From 7c1d26386c003f1df850fa67ad2ab73288564e29 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sat, 17 Sep 2022 13:17:47 -0600 Subject: [PATCH 001/467] WIP --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 7b84d9807..d9f530d0c 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -36,6 +36,7 @@ import Unison.LSP.Orphans () import Unison.LSP.Types import qualified Unison.LSP.Types as LSP import qualified Unison.LSP.VFS as VFS +import Unison.LabeledDependency (LabeledDependency) import qualified Unison.NamesWithHistory as NamesWithHistory import Unison.Parser.Ann (Ann) import qualified Unison.Pattern as Pattern @@ -51,6 +52,8 @@ import Unison.Symbol (Symbol) import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter +import Unison.Term (Term) +import qualified Unison.Term as Term import qualified Unison.Typechecker.Context as Context import qualified Unison.Typechecker.TypeError as TypeError import qualified Unison.UnisonFile as UF @@ -282,3 +285,13 @@ ppeForFile fileUri = do let filePPE = PPE.fromSuffixNames hl (NamesWithHistory.fromCurrentNames fileNames) pure (filePPE `PPE.addFallback` ppe) _ -> pure ppe + +annotatedSubTerms :: UF.UnisonFile v a -> [(a, Term v a)] +annotatedSubTerms (UF.UnisonFileId {terms}) = + terms ^.. folded . _2 . subTerms . to (\trm -> (ABT.annotation trm, trm)) + +subTerms :: Fold (Term v a) (Term v a) +subTerms = + cosmosOf (to ABT.out . folded) + +-- refs :: Fold (Term v a) (LabeledDependency) From 062eee195651bb288746c34bf499c0c69ddbc4b7 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 19 Sep 2022 10:01:43 -0600 Subject: [PATCH 002/467] WIP --- unison-cli/src/Unison/LSP/Conversions.hs | 6 +- unison-cli/src/Unison/LSP/FileAnalysis.hs | 25 ++++---- unison-cli/src/Unison/LSP/Hover.hs | 73 ++++++++++++++++++++++- unison-cli/src/Unison/LSP/Types.hs | 2 + 4 files changed, 92 insertions(+), 14 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Conversions.hs b/unison-cli/src/Unison/LSP/Conversions.hs index 5538d28e3..b9f62ec66 100644 --- a/unison-cli/src/Unison/LSP/Conversions.hs +++ b/unison-cli/src/Unison/LSP/Conversions.hs @@ -3,9 +3,10 @@ module Unison.LSP.Conversions where import qualified Data.IntervalMap.Interval as Interval import Language.LSP.Types import Unison.LSP.Orphans () -import qualified Unison.Syntax.Lexer as Lex import Unison.Parser.Ann (Ann) import qualified Unison.Parser.Ann as Ann +import Unison.Prelude +import qualified Unison.Syntax.Lexer as Lex import qualified Unison.Util.Range as Range rangeToInterval :: Range -> Interval.Interval Position @@ -16,6 +17,9 @@ rangeToInterval (Range start end) -- intended (E.g. intersecting). | otherwise = Interval.IntervalCO start end +annToInterval :: Ann -> Maybe (Interval.Interval Position) +annToInterval ann = annToRange ann <&> rangeToInterval + uToLspPos :: Lex.Pos -> Position uToLspPos uPos = Position diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index d9f530d0c..25cf92579 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -24,6 +24,7 @@ import qualified Unison.ABT as ABT import qualified Unison.Codebase as Codebase import Unison.Codebase.Editor.HandleInput (typecheckHelper) import qualified Unison.Codebase.Path as Path +import Unison.ConstructorReference (ConstructorReference) import qualified Unison.DataDeclaration as DD import qualified Unison.Debug as Debug import qualified Unison.HashQualified' as HQ' @@ -36,7 +37,6 @@ import Unison.LSP.Orphans () import Unison.LSP.Types import qualified Unison.LSP.Types as LSP import qualified Unison.LSP.VFS as VFS -import Unison.LabeledDependency (LabeledDependency) import qualified Unison.NamesWithHistory as NamesWithHistory import Unison.Parser.Ann (Ann) import qualified Unison.Pattern as Pattern @@ -46,6 +46,7 @@ import qualified Unison.PrettyPrintEnv as PPE import qualified Unison.PrettyPrintEnv.Names as PPE import qualified Unison.PrettyPrintEnvDecl as PPE import qualified Unison.PrintError as PrintError +import Unison.Reference (Reference) import Unison.Result (Note) import qualified Unison.Result as Result import Unison.Symbol (Symbol) @@ -70,7 +71,7 @@ checkFile doc = runMaybeT $ do (fileVersion, contents) <- MaybeT (VFS.getFileContents doc) parseNames <- lift getParseNames let sourceName = getUri $ doc ^. uri - let lexedSource@(srcText, _) = (contents, L.lexer (Text.unpack sourceName) (Text.unpack contents)) + let lexedSource@(srcText, tokens) = (contents, L.lexer (Text.unpack sourceName) (Text.unpack contents)) let ambientAbilities = [] cb <- asks codebase let generateUniqueName = Parser.uniqueBase32Namegen <$> Random.getSystemDRG @@ -89,6 +90,7 @@ checkFile doc = runMaybeT $ do codeActions & foldMap (\(RangedCodeAction {_codeActionRanges, _codeAction}) -> (,_codeAction) <$> _codeActionRanges) & toRangeMap + let tokenMap = getTokenMap tokens let fileAnalysis = FileAnalysis {diagnostics = diagnosticRanges, codeActions = codeActionRanges, ..} pure $ fileAnalysis @@ -118,6 +120,15 @@ analyseFile fileUri srcText notes = do ppe <- LSP.globalPPE analyseNotes fileUri (PPE.suffixifiedPPE ppe) (Text.unpack srcText) notes +getTokenMap :: [L.Token L.Lexeme] -> IM.IntervalMap Position L.Lexeme +getTokenMap tokens = + tokens + & mapMaybe + ( \token -> + IM.singleton <$> (annToInterval $ Parser.ann token) <*> pure (L.payload token) + ) + & fold + analyseNotes :: Foldable f => Uri -> PrettyPrintEnv -> String -> f (Note Symbol Ann) -> Lsp ([Diagnostic], [RangedCodeAction]) analyseNotes fileUri ppe src notes = do currentPath <- getCurrentPath @@ -285,13 +296,3 @@ ppeForFile fileUri = do let filePPE = PPE.fromSuffixNames hl (NamesWithHistory.fromCurrentNames fileNames) pure (filePPE `PPE.addFallback` ppe) _ -> pure ppe - -annotatedSubTerms :: UF.UnisonFile v a -> [(a, Term v a)] -annotatedSubTerms (UF.UnisonFileId {terms}) = - terms ^.. folded . _2 . subTerms . to (\trm -> (ABT.annotation trm, trm)) - -subTerms :: Fold (Term v a) (Term v a) -subTerms = - cosmosOf (to ABT.out . folded) - --- refs :: Fold (Term v a) (LabeledDependency) diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 24f8bf44a..84991b255 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -5,17 +5,31 @@ module Unison.LSP.Hover where import Control.Lens hiding (List) import Control.Monad.Reader +import qualified Data.IntervalMap.Lazy as IM import qualified Data.Text as Text import Language.LSP.Types -import Language.LSP.Types.Lens +import Language.LSP.Types.Lens hiding (to) +import qualified Unison.ABT as ABT +import qualified Unison.Codebase as Codebase import qualified Unison.Codebase.Path as Path +import Unison.ConstructorReference (ConstructorReference) import qualified Unison.HashQualified as HQ +import Unison.LSP.Conversions (annToInterval) +import Unison.LSP.FileAnalysis (getFileAnalysis) import Unison.LSP.Types import Unison.LSP.VFS import Unison.Prelude +import qualified Unison.PrettyPrintEnvDecl as PPED +import Unison.Reference (Reference) +import Unison.Referent (Referent) import qualified Unison.Server.Backend as Backend import qualified Unison.Server.Syntax as Server import qualified Unison.Server.Types as Backend +import qualified Unison.Syntax.Parser as Parser +import qualified Unison.Syntax.TypePrinter as TypePrinter +import qualified Unison.Term as Term +import qualified Unison.UnisonFile as UF +import Unison.Util.List (safeHead) -- | Rudimentary hover handler -- @@ -44,3 +58,60 @@ hoverHandler m respond = formatTypeDefinition :: Backend.TypeDefinition -> Text formatTypeDefinition (Backend.TypeDefinition {bestTypeName}) = bestTypeName + +hoverInfo :: Uri -> Position -> MaybeT Lsp Text +hoverInfo uri p = do + FileAnalysis {tokenMap, parsedFile} <- MaybeT $ getFileAnalysis uri + subTermMap <- subTermMap <$> MaybeT (pure parsedFile) + matchingHoverInfo <- MaybeT . pure . safeHead . IM.elems $ IM.containing subTermMap p + matchingToken <- MaybeT . pure . safeHead . IM.elems $ IM.containing tokenMap p + case matchingHoverInfo of + SimpleHint txt -> pure txt + Ref ref -> do + Env {codebase} <- ask + typ <- MaybeT . liftIO $ Codebase.getTypeOfReferent codebase ref + ppe <- lift $ globalPPE + pure . Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ + +subTermMap :: Parser.Annotated a => UF.UnisonFile v a -> IM.IntervalMap Position HoverInfo +subTermMap (UF.UnisonFileId {terms}) = + terms ^@.. (folded . _2 . subTerms . (reindexed ABT.annotation selfIndex) <. termHoverInfo) + & mapMaybe (\(a, trm) -> IM.singleton <$> annToInterval (Parser.ann a) <*> pure trm) + & fold + +subTerms :: Fold (Term.Term v a) (Term.Term v a) +subTerms = + cosmosOf (to ABT.out . folded) + +data HoverInfo + = SimpleHint Text + | Ref Referent + +termHoverInfo :: Fold (Term.Term v a) HoverInfo +termHoverInfo = folding \term -> + case ABT.out term of + ABT.Tm f -> case f of + Term.Int {} -> Just (SimpleHint "Int") + Term.Nat {} -> Just (SimpleHint "Nat") + Term.Float {} -> Just (SimpleHint "Float") + Term.Boolean {} -> Just (SimpleHint "Boolean") + Term.Text {} -> Just (SimpleHint "Text") + Term.Char {} -> Just (SimpleHint "Char") + Term.Blank {} -> Nothing + Term.Ref ref -> Just (Ref ref) + Term.Constructor cRef -> Just (ConstructorRef cRef) + Term.Request cRef -> Just (ConstructorRef cRef) + Term.Handle {} -> Nothing + Term.App {} -> Nothing + Term.Ann {} -> Nothing + Term.List {} -> Nothing + Term.If {} -> Nothing + Term.And {} -> Nothing + Term.Or {} -> Nothing + Term.Lam {} -> Nothing + Term.LetRec {} -> Nothing + Term.Let {} -> Nothing + Term.Match {} -> Nothing + Term.TermLink {} -> Nothing + Term.TypeLink {} -> Nothing + _ -> Nothing diff --git a/unison-cli/src/Unison/LSP/Types.hs b/unison-cli/src/Unison/LSP/Types.hs index 345582a93..571bf870d 100644 --- a/unison-cli/src/Unison/LSP/Types.hs +++ b/unison-cli/src/Unison/LSP/Types.hs @@ -11,6 +11,7 @@ import Control.Monad.Except import Control.Monad.Reader import qualified Data.HashMap.Strict as HM import Data.IntervalMap.Lazy (IntervalMap) +import qualified Data.IntervalMap.Lazy as IM import qualified Ki import qualified Language.LSP.Logging as LSP import Language.LSP.Server @@ -77,6 +78,7 @@ data FileAnalysis = FileAnalysis { fileUri :: Uri, fileVersion :: FileVersion, lexedSource :: LexedSource, + tokenMap :: IM.IntervalMap Position Lexer.Lexeme, parsedFile :: Maybe (UF.UnisonFile Symbol Ann), typecheckedFile :: Maybe (UF.TypecheckedUnisonFile Symbol Ann), notes :: Seq (Note Symbol Ann), From 39b54fd10100953da5d57c582f5a4bd5008c5c80 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Fri, 30 Sep 2022 17:00:11 -0600 Subject: [PATCH 003/467] Working 'smart' hover --- unison-cli/src/Unison/LSP/Conversions.hs | 14 ++- unison-cli/src/Unison/LSP/FileAnalysis.hs | 4 - unison-cli/src/Unison/LSP/Hover.hs | 132 +++++++++++++--------- 3 files changed, 88 insertions(+), 62 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Conversions.hs b/unison-cli/src/Unison/LSP/Conversions.hs index b9f62ec66..e4f083eaf 100644 --- a/unison-cli/src/Unison/LSP/Conversions.hs +++ b/unison-cli/src/Unison/LSP/Conversions.hs @@ -10,12 +10,14 @@ import qualified Unison.Syntax.Lexer as Lex import qualified Unison.Util.Range as Range rangeToInterval :: Range -> Interval.Interval Position -rangeToInterval (Range start end) - -- Selections are are open on the right-side - | start == end = Interval.ClosedInterval start end - -- Ranges of a single 'point' need to be closed for some interval map operations to work as - -- intended (E.g. intersecting). - | otherwise = Interval.IntervalCO start end +rangeToInterval (Range start end) = + Interval.ClosedInterval start end + +-- -- Selections are are open on the right-side +-- start == end = Interval.ClosedInterval start end +-- -- Ranges of a single 'point' need to be closed for some interval map operations to work as +-- -- intended (E.g. intersecting). +-- otherwise = Interval.ClosedInterval start end annToInterval :: Ann -> Maybe (Interval.Interval Position) annToInterval ann = annToRange ann <&> rangeToInterval diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 20c956aa3..ce9de82ea 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -24,7 +24,6 @@ import qualified Unison.ABT as ABT import Unison.Cli.TypeCheck (typecheckHelper) import qualified Unison.Codebase as Codebase import qualified Unison.Codebase.Path as Path -import Unison.ConstructorReference (ConstructorReference) import qualified Unison.DataDeclaration as DD import qualified Unison.Debug as Debug import qualified Unison.HashQualified' as HQ' @@ -46,15 +45,12 @@ import qualified Unison.PrettyPrintEnv as PPE import qualified Unison.PrettyPrintEnv.Names as PPE import qualified Unison.PrettyPrintEnvDecl as PPE import qualified Unison.PrintError as PrintError -import Unison.Reference (Reference) import Unison.Result (Note) import qualified Unison.Result as Result import Unison.Symbol (Symbol) import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter -import Unison.Term (Term) -import qualified Unison.Term as Term import qualified Unison.Typechecker.Context as Context import qualified Unison.Typechecker.TypeError as TypeError import qualified Unison.UnisonFile as UF diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 84991b255..f55002847 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -11,96 +11,122 @@ import Language.LSP.Types import Language.LSP.Types.Lens hiding (to) import qualified Unison.ABT as ABT import qualified Unison.Codebase as Codebase -import qualified Unison.Codebase.Path as Path -import Unison.ConstructorReference (ConstructorReference) -import qualified Unison.HashQualified as HQ +import qualified Unison.ConstructorType as CT +import qualified Unison.Debug as Debug import Unison.LSP.Conversions (annToInterval) import Unison.LSP.FileAnalysis (getFileAnalysis) import Unison.LSP.Types -import Unison.LSP.VFS import Unison.Prelude import qualified Unison.PrettyPrintEnvDecl as PPED -import Unison.Reference (Reference) import Unison.Referent (Referent) -import qualified Unison.Server.Backend as Backend -import qualified Unison.Server.Syntax as Server -import qualified Unison.Server.Types as Backend +import qualified Unison.Referent as Referent +import Unison.Symbol (Symbol) +import qualified Unison.Syntax.Lexer as Lex import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter import qualified Unison.Term as Term import qualified Unison.UnisonFile as UF import Unison.Util.List (safeHead) +import qualified Unison.Var as Var --- | Rudimentary hover handler +-- | Hover help handler -- --- TODO: Add docs, use FileAnalysis to select hover target. +-- TODO: Add docs hoverHandler :: RequestMessage 'TextDocumentHover -> (Either ResponseError (ResponseResult 'TextDocumentHover) -> Lsp ()) -> Lsp () hoverHandler m respond = respond . Right =<< runMaybeT do - let p = (m ^. params) - txtIdentifier <- MaybeT $ identifierAtPosition p - hqIdentifier <- MaybeT . pure $ HQ.fromText txtIdentifier - cb <- asks codebase - rt <- asks runtime - results <- MaybeT . fmap eitherToMaybe $ (lspBackend $ Backend.prettyDefinitionsForHQName Path.empty Nothing Nothing (Backend.Suffixify True) rt cb hqIdentifier) - let termResults = formatTermDefinition <$> toList (Backend.termDefinitions results) - let typeResults = formatTypeDefinition <$> toList (Backend.typeDefinitions results) - let markup = Text.intercalate "\n\n---\n\n" $ termResults <> typeResults + let pos = (m ^. params . position) + -- let p = (m ^. params) + -- txtIdentifier <- MaybeT $ identifierAtPosition p + -- hqIdentifier <- MaybeT . pure $ HQ.fromText txtIdentifier + -- cb <- asks codebase + -- rt <- asks runtime + + hoverTxt <- hoverInfo (m ^. params . textDocument . uri) pos + -- results <- MaybeT . fmap eitherToMaybe $ (lspBackend $ Backend.prettyDefinitionsForHQName Path.empty Nothing Nothing (Backend.Suffixify True) rt cb hqIdentifier) + -- let termResults = formatTermDefinition <$> toList (Backend.termDefinitions results) + -- let typeResults = formatTypeDefinition <$> toList (Backend.typeDefinitions results) + -- let markup = Text.intercalate "\n\n---\n\n" $ termResults <> typeResults pure $ Hover - { _contents = HoverContents (MarkupContent MkPlainText markup), + { _contents = HoverContents (MarkupContent MkPlainText hoverTxt), _range = Nothing -- TODO add range info } where - formatTermDefinition :: Backend.TermDefinition -> Text - formatTermDefinition (Backend.TermDefinition {bestTermName, signature}) = - bestTermName <> " : " <> Text.pack (Server.toPlain signature) - formatTypeDefinition :: Backend.TypeDefinition -> Text - formatTypeDefinition (Backend.TypeDefinition {bestTypeName}) = bestTypeName +-- formatTermDefinition :: Backend.TermDefinition -> Text +-- formatTermDefinition (Backend.TermDefinition {bestTermName, signature}) = +-- bestTermName <> " : " <> Text.pack (Server.toPlain signature) + +-- formatTypeDefinition :: Backend.TypeDefinition -> Text +-- formatTypeDefinition (Backend.TypeDefinition {bestTypeName}) = bestTypeName hoverInfo :: Uri -> Position -> MaybeT Lsp Text hoverInfo uri p = do - FileAnalysis {tokenMap, parsedFile} <- MaybeT $ getFileAnalysis uri - subTermMap <- subTermMap <$> MaybeT (pure parsedFile) - matchingHoverInfo <- MaybeT . pure . safeHead . IM.elems $ IM.containing subTermMap p - matchingToken <- MaybeT . pure . safeHead . IM.elems $ IM.containing tokenMap p - case matchingHoverInfo of - SimpleHint txt -> pure txt - Ref ref -> do - Env {codebase} <- ask - typ <- MaybeT . liftIO $ Codebase.getTypeOfReferent codebase ref - ppe <- lift $ globalPPE - pure . Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ + Debug.debugM Debug.LSP "POINT" p + FileAnalysis {tokenMap, typecheckedFile} <- getFileAnalysis uri + Debug.debugM Debug.LSP "TYPECHECKED" typecheckedFile + subTermMap <- mkSubTermMap <$> MaybeT (pure typecheckedFile) + Debug.debugM Debug.LSP "SubTerms" subTermMap + let matchingHoverInfos = concat . IM.elems $ IM.containing subTermMap p + let matchingLexeme = IM.elems $ IM.containing tokenMap p + Debug.debugM Debug.LSP "Matching" matchingHoverInfos + renderedTypes <- for matchingHoverInfos \info -> do + case info of + BuiltinType txt -> pure txt + LocalVar _v -> pure $ "" + Ref ref -> do + Env {codebase} <- ask + typ <- MaybeT . liftIO $ Codebase.getTypeOfReferent codebase ref + ppe <- lift $ globalPPE + pure . Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ + Debug.debugM Debug.LSP "Rendered" renderedTypes + -- Due to the way hover info is computed, there should be at most one. + typ <- hoistMaybe $ safeHead renderedTypes + hoistMaybe $ case listToMaybe matchingLexeme of + Just (Lex.WordyId n _) -> Just $ Text.pack n <> " : " <> typ + Just (Lex.SymbolyId n _) -> Just $ Text.pack n <> " : " <> typ + Just (Lex.Textual _) -> Just $ " : " <> typ + Just (Lex.Character _) -> Just $ " : " <> typ + Just (Lex.Numeric _) -> Just $ " : " <> typ + Just (Lex.Bytes _) -> Just $ " : " <> typ + -- TODO: add other lexemes + _ -> Nothing -subTermMap :: Parser.Annotated a => UF.UnisonFile v a -> IM.IntervalMap Position HoverInfo -subTermMap (UF.UnisonFileId {terms}) = - terms ^@.. (folded . _2 . subTerms . (reindexed ABT.annotation selfIndex) <. termHoverInfo) - & mapMaybe (\(a, trm) -> IM.singleton <$> annToInterval (Parser.ann a) <*> pure trm) - & fold +mkSubTermMap :: (Parser.Annotated a, Show a) => UF.TypecheckedUnisonFile Symbol a -> IM.IntervalMap Position [HoverInfo] +mkSubTermMap (UF.TypecheckedUnisonFileId {hashTermsId}) = + hashTermsId ^@.. (folded . _3 . subTerms . (reindexed ABT.annotation selfIndex) <. termHoverInfo) + & Debug.debug Debug.LSP "Cosmos'd" + & map (\(a, info) -> IM.singleton <$> annToInterval (Parser.ann a) <*> pure [info]) + & Debug.debug Debug.LSP "Converted1" + & mapMaybe Prelude.id + & Debug.debug Debug.LSP "Converted2" + & IM.unionsWith (<>) subTerms :: Fold (Term.Term v a) (Term.Term v a) subTerms = cosmosOf (to ABT.out . folded) data HoverInfo - = SimpleHint Text + = BuiltinType Text + | LocalVar Text | Ref Referent + deriving stock (Show, Eq, Ord) -termHoverInfo :: Fold (Term.Term v a) HoverInfo +termHoverInfo :: Fold (Term.Term Symbol a) HoverInfo termHoverInfo = folding \term -> case ABT.out term of ABT.Tm f -> case f of - Term.Int {} -> Just (SimpleHint "Int") - Term.Nat {} -> Just (SimpleHint "Nat") - Term.Float {} -> Just (SimpleHint "Float") - Term.Boolean {} -> Just (SimpleHint "Boolean") - Term.Text {} -> Just (SimpleHint "Text") - Term.Char {} -> Just (SimpleHint "Char") + Term.Int {} -> Just (BuiltinType "Int") + Term.Nat {} -> Just (BuiltinType "Nat") + Term.Float {} -> Just (BuiltinType "Float") + Term.Boolean {} -> Just (BuiltinType "Boolean") + Term.Text {} -> Just (BuiltinType "Text") + Term.Char {} -> Just (BuiltinType "Char") Term.Blank {} -> Nothing - Term.Ref ref -> Just (Ref ref) - Term.Constructor cRef -> Just (ConstructorRef cRef) - Term.Request cRef -> Just (ConstructorRef cRef) + Term.Ref ref -> Just (Ref $ Referent.Ref ref) + Term.Constructor cRef -> Just (Ref $ Referent.Con cRef CT.Data) + Term.Request cRef -> Just (Ref $ Referent.Con cRef CT.Effect) Term.Handle {} -> Nothing Term.App {} -> Nothing Term.Ann {} -> Nothing @@ -114,4 +140,6 @@ termHoverInfo = folding \term -> Term.Match {} -> Nothing Term.TermLink {} -> Nothing Term.TypeLink {} -> Nothing + -- ABT.Abs v r -> case f of + ABT.Var v -> Just (LocalVar $ Var.name v) _ -> Nothing From 29b47cfdec2b827fee4ee0c879af1a3c85f05277 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sat, 1 Oct 2022 15:14:53 -0600 Subject: [PATCH 004/467] Add summary type --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 52 ++++++++++++++++++++++- unison-cli/src/Unison/LSP/Hover.hs | 8 ++-- unison-cli/src/Unison/LSP/Types.hs | 22 +++++++++- 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index ce9de82ea..a850baba9 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -86,10 +86,34 @@ checkFile doc = runMaybeT $ do codeActions & foldMap (\(RangedCodeAction {_codeActionRanges, _codeAction}) -> (,_codeAction) <$> _codeActionRanges) & toRangeMap + let fileSummary = mkFileSummary parsedFile typecheckedFile let tokenMap = getTokenMap tokens - let fileAnalysis = FileAnalysis {diagnostics = diagnosticRanges, codeActions = codeActionRanges, ..} + let fileAnalysis = FileAnalysis {diagnostics = diagnosticRanges, codeActions = codeActionRanges, fileSummary, ..} pure $ fileAnalysis +mkFileSummary :: Maybe (UF.UnisonFile Symbol Ann) -> Maybe (UF.TypecheckedUnisonFile Symbol Ann) -> Maybe FileSummary +mkFileSummary parsed typechecked = case (parsed, typechecked) of + (Nothing, Nothing) -> Nothing + (_, Just (UF.TypecheckedUnisonFileId {})) -> error "mkFileSummary" + (Just UF.UnisonFileId {}, _) -> error "mkFileSummary" + +getFileDefLocations :: Uri -> MaybeT Lsp (Map Symbol Ann) +getFileDefLocations uri = do + fileDefLocations <$> getFileSummary uri + +fileDefLocations :: FileSummary -> Map Symbol Ann +fileDefLocations FileSummary {dataDeclSummary, effectDeclSummary, testWatchSummary, exprWatchSummary, termSummary} = + fold + [ dataDeclSummary <&> (DD.annotation . snd), + effectDeclSummary <&> (DD.annotation . DD.toDataDecl . snd), + (testWatchSummary <> exprWatchSummary) + & foldMap \(maySym, _id, trm, _typ) -> + case maySym of + Nothing -> mempty + Just sym -> Map.singleton sym (ABT.annotation trm), + termSummary <&> \(_refId, trm, _typ) -> ABT.annotation trm + ] + fileAnalysisWorker :: Lsp () fileAnalysisWorker = forever do dirtyFilesV <- asks dirtyFilesVar @@ -281,6 +305,11 @@ getFileAnalysis uri = do checkedFiles <- readTVarIO checkedFilesV pure $ Map.lookup uri checkedFiles +getFileSummary :: Uri -> MaybeT Lsp FileSummary +getFileSummary uri = do + FileAnalysis {fileSummary} <- MaybeT $ getFileAnalysis uri + MaybeT . pure $ fileSummary + -- TODO memoize per file ppeForFile :: Uri -> Lsp PrettyPrintEnv ppeForFile fileUri = do @@ -292,3 +321,24 @@ ppeForFile fileUri = do let filePPE = PPE.fromSuffixNames hl (NamesWithHistory.fromCurrentNames fileNames) pure (filePPE `PPE.addFallback` ppe) _ -> pure ppe + +-- | Information about a symbol defined within the file. +-- data FileDefInfo ann +-- = FileDataDecl Reference.Id ann +-- | FileAbilityDecl Reference.Id ann +-- | FileTerm (Maybe Reference.Id) ann +-- | FileWatch WatchKind (Maybe Reference.Id) ann + +-- getFileSymbols :: Uri -> MaybeT Lsp (Map Symbol (FileDefInfo Ann)) +-- getFileSymbols uri = do +-- FileAnalysis {parsedFile} <- MaybeT $ getFileAnalysis uri +-- UF.UnisonFileId {dataDeclarationsId, effectDeclarationsId, terms, watches} <- MaybeT (pure parsedFile) + +-- pure $ +-- do +-- dataDeclarationsId & ifoldMap \v (ref, dd) -> Map.singleton v . FileDataDecl ref $ DD.annotation dd +-- <> (effectDeclarationsId & ifoldMap \v (ref, dd) -> Map.singleton v . FileAbilityDecl ref . DD.annotation . DD.toDataDecl $ dd) +-- <> (terms & foldMap \(v, ref, dd) -> Map.singleton v . FileAbilityDecl ref . DD.annotation . DD.toDataDecl $ dd) + +-- effectDeclarationsId & ifoldMap \v ed -> [Map.singleton v . FileEffectDecl $ DD.annotation ed] +-- terms & foldMap \(v, trm) -> [Map.singleton v $ FileEffectDecl ann] diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index f55002847..647aa1dad 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -64,7 +64,7 @@ hoverHandler m respond = hoverInfo :: Uri -> Position -> MaybeT Lsp Text hoverInfo uri p = do Debug.debugM Debug.LSP "POINT" p - FileAnalysis {tokenMap, typecheckedFile} <- getFileAnalysis uri + FileAnalysis {tokenMap, typecheckedFile} <- MaybeT $ getFileAnalysis uri Debug.debugM Debug.LSP "TYPECHECKED" typecheckedFile subTermMap <- mkSubTermMap <$> MaybeT (pure typecheckedFile) Debug.debugM Debug.LSP "SubTerms" subTermMap @@ -74,7 +74,7 @@ hoverInfo uri p = do renderedTypes <- for matchingHoverInfos \info -> do case info of BuiltinType txt -> pure txt - LocalVar _v -> pure $ "" + LocalVar _v -> pure $ "" Ref ref -> do Env {codebase} <- ask typ <- MaybeT . liftIO $ Codebase.getTypeOfReferent codebase ref @@ -82,8 +82,8 @@ hoverInfo uri p = do pure . Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ Debug.debugM Debug.LSP "Rendered" renderedTypes -- Due to the way hover info is computed, there should be at most one. - typ <- hoistMaybe $ safeHead renderedTypes - hoistMaybe $ case listToMaybe matchingLexeme of + typ <- MaybeT . pure $ safeHead renderedTypes + MaybeT . pure $ case listToMaybe matchingLexeme of Just (Lex.WordyId n _) -> Just $ Text.pack n <> " : " <> typ Just (Lex.SymbolyId n _) -> Just $ Text.pack n <> " : " <> typ Just (Lex.Textual _) -> Just $ " : " <> typ diff --git a/unison-cli/src/Unison/LSP/Types.hs b/unison-cli/src/Unison/LSP/Types.hs index 571bf870d..10254622b 100644 --- a/unison-cli/src/Unison/LSP/Types.hs +++ b/unison-cli/src/Unison/LSP/Types.hs @@ -21,15 +21,19 @@ import Language.LSP.VFS import Unison.Codebase import qualified Unison.Codebase.Path as Path import Unison.Codebase.Runtime (Runtime) +import qualified Unison.DataDeclaration as DD import Unison.LSP.Orphans () import Unison.NamesWithHistory (NamesWithHistory) import Unison.Parser.Ann import Unison.Prelude import Unison.PrettyPrintEnvDecl (PrettyPrintEnvDecl) +import qualified Unison.Reference as Reference import Unison.Result (Note) import qualified Unison.Server.Backend as Backend import Unison.Symbol import qualified Unison.Syntax.Lexer as Lexer +import Unison.Term (Term) +import Unison.Type (Type) import qualified Unison.UnisonFile as UF import UnliftIO @@ -83,10 +87,26 @@ data FileAnalysis = FileAnalysis typecheckedFile :: Maybe (UF.TypecheckedUnisonFile Symbol Ann), notes :: Seq (Note Symbol Ann), diagnostics :: IntervalMap Position [Diagnostic], - codeActions :: IntervalMap Position [CodeAction] + codeActions :: IntervalMap Position [CodeAction], + fileSummary :: Maybe FileSummary } deriving (Show) +-- | A file that parses might not always type-check, but often we just want to get as much +-- information as we have available. This provides a type where we can summarize the +-- information available in a Unison file. +-- +-- If the file typechecked then all the Ref Ids and types will be filled in, otherwise +-- they will be Nothing. +data FileSummary = FileSummary + { dataDeclSummary :: Map Symbol (Reference.Id, DD.DataDeclaration Symbol Ann), + effectDeclSummary :: Map Symbol (Reference.Id, DD.EffectDeclaration Symbol Ann), + termSummary :: Map Symbol (Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann)), + testWatchSummary :: [(Maybe Symbol, Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann))], + exprWatchSummary :: [(Maybe Symbol, Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann))] + } + deriving stock (Show) + getCurrentPath :: Lsp Path.Absolute getCurrentPath = asks currentPathCache >>= liftIO From 9449f793299502e074ba1c140fe748cf681a3616 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sun, 2 Oct 2022 12:42:07 -0600 Subject: [PATCH 005/467] Render hover as markdown --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 42 ++++++++++++++++++++-- unison-cli/src/Unison/LSP/Hover.hs | 44 +++++++++++++++-------- 2 files changed, 69 insertions(+), 17 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index a850baba9..c35e02f7a 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -48,6 +48,7 @@ import qualified Unison.PrintError as PrintError import Unison.Result (Note) import qualified Unison.Result as Result import Unison.Symbol (Symbol) +import qualified Unison.Symbol as Symbol import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter @@ -58,6 +59,7 @@ import qualified Unison.UnisonFile.Names as UF import Unison.Util.Monoid (foldMapM) import qualified Unison.Util.Pretty as Pretty import qualified Unison.Var as Var +import Unison.WatchKind (pattern TestWatch) import UnliftIO (atomically, modifyTVar', readTVar, readTVarIO, writeTVar) -- | Lex, parse, and typecheck a file. @@ -91,11 +93,47 @@ checkFile doc = runMaybeT $ do let fileAnalysis = FileAnalysis {diagnostics = diagnosticRanges, codeActions = codeActionRanges, fileSummary, ..} pure $ fileAnalysis +assertUserSym :: Symbol -> Maybe Symbol +assertUserSym sym = case sym of + Symbol.Symbol _ (Var.User {}) -> Just sym + _ -> Nothing + mkFileSummary :: Maybe (UF.UnisonFile Symbol Ann) -> Maybe (UF.TypecheckedUnisonFile Symbol Ann) -> Maybe FileSummary mkFileSummary parsed typechecked = case (parsed, typechecked) of (Nothing, Nothing) -> Nothing - (_, Just (UF.TypecheckedUnisonFileId {})) -> error "mkFileSummary" - (Just UF.UnisonFileId {}, _) -> error "mkFileSummary" + (_, Just (UF.TypecheckedUnisonFileId {dataDeclarationsId', effectDeclarationsId', hashTermsId})) -> + let (trms, testWatches, exprWatches) = + hashTermsId & ifoldMap \sym (ref, wk, trm, typ) -> + case wk of + Nothing -> (Map.singleton sym (Just ref, trm, Just typ), mempty, mempty) + Just TestWatch -> (mempty, [(assertUserSym sym, Just ref, trm, Just typ)], mempty) + Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, Just typ)]) + in Just $ + FileSummary + { dataDeclSummary = dataDeclarationsId', + effectDeclSummary = effectDeclarationsId', + termSummary = trms, + testWatchSummary = testWatches, + exprWatchSummary = exprWatches + } + (Just UF.UnisonFileId {dataDeclarationsId, effectDeclarationsId, terms, watches}, _) -> + let trms = + terms & foldMap \(sym, trm) -> + (Map.singleton sym (Nothing, trm, Nothing)) + (testWatches, exprWatches) = + watches & ifoldMap \wk tms -> + tms & foldMap \(v, trm) -> + case wk of + TestWatch -> ([(assertUserSym v, Nothing, trm, Nothing)], mempty) + _ -> (mempty, [(assertUserSym v, Nothing, trm, Nothing)]) + in Just $ + FileSummary + { dataDeclSummary = dataDeclarationsId, + effectDeclSummary = effectDeclarationsId, + termSummary = trms, + testWatchSummary = testWatches, + exprWatchSummary = exprWatches + } getFileDefLocations :: Uri -> MaybeT Lsp (Map Symbol Ann) getFileDefLocations uri = do diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 647aa1dad..d35c2404a 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -6,15 +6,16 @@ module Unison.LSP.Hover where import Control.Lens hiding (List) import Control.Monad.Reader import qualified Data.IntervalMap.Lazy as IM +import qualified Data.Map as Map import qualified Data.Text as Text import Language.LSP.Types -import Language.LSP.Types.Lens hiding (to) +import Language.LSP.Types.Lens hiding (only, to) import qualified Unison.ABT as ABT import qualified Unison.Codebase as Codebase import qualified Unison.ConstructorType as CT import qualified Unison.Debug as Debug import Unison.LSP.Conversions (annToInterval) -import Unison.LSP.FileAnalysis (getFileAnalysis) +import Unison.LSP.FileAnalysis (getFileAnalysis, getFileDefLocations, getFileSummary) import Unison.LSP.Types import Unison.Prelude import qualified Unison.PrettyPrintEnvDecl as PPED @@ -27,7 +28,6 @@ import qualified Unison.Syntax.TypePrinter as TypePrinter import qualified Unison.Term as Term import qualified Unison.UnisonFile as UF import Unison.Util.List (safeHead) -import qualified Unison.Var as Var -- | Hover help handler -- @@ -49,7 +49,7 @@ hoverHandler m respond = -- let markup = Text.intercalate "\n\n---\n\n" $ termResults <> typeResults pure $ Hover - { _contents = HoverContents (MarkupContent MkPlainText hoverTxt), + { _contents = HoverContents (MarkupContent MkMarkdown hoverTxt), _range = Nothing -- TODO add range info } where @@ -65,25 +65,34 @@ hoverInfo :: Uri -> Position -> MaybeT Lsp Text hoverInfo uri p = do Debug.debugM Debug.LSP "POINT" p FileAnalysis {tokenMap, typecheckedFile} <- MaybeT $ getFileAnalysis uri + FileSummary {termSummary, testWatchSummary, exprWatchSummary} <- getFileSummary uri + fileDefLocations <- getFileDefLocations uri Debug.debugM Debug.LSP "TYPECHECKED" typecheckedFile - subTermMap <- mkSubTermMap <$> MaybeT (pure typecheckedFile) + subTermMap <- mkSubTermMap fileDefLocations <$> MaybeT (pure typecheckedFile) Debug.debugM Debug.LSP "SubTerms" subTermMap let matchingHoverInfos = concat . IM.elems $ IM.containing subTermMap p let matchingLexeme = IM.elems $ IM.containing tokenMap p + Debug.debugM Debug.LSP "Matching" matchingHoverInfos + ppe <- lift $ globalPPE + let renderType typ = Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ renderedTypes <- for matchingHoverInfos \info -> do case info of BuiltinType txt -> pure txt LocalVar _v -> pure $ "" + FileDef v -> + pure . maybe "" renderType $ + termSummary ^? ix v . _3 . _Just + <|> testWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just + <|> exprWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just Ref ref -> do Env {codebase} <- ask typ <- MaybeT . liftIO $ Codebase.getTypeOfReferent codebase ref - ppe <- lift $ globalPPE - pure . Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ + pure $ renderType typ Debug.debugM Debug.LSP "Rendered" renderedTypes -- Due to the way hover info is computed, there should be at most one. typ <- MaybeT . pure $ safeHead renderedTypes - MaybeT . pure $ case listToMaybe matchingLexeme of + typeSig <- MaybeT . pure $ case listToMaybe matchingLexeme of Just (Lex.WordyId n _) -> Just $ Text.pack n <> " : " <> typ Just (Lex.SymbolyId n _) -> Just $ Text.pack n <> " : " <> typ Just (Lex.Textual _) -> Just $ " : " <> typ @@ -92,10 +101,11 @@ hoverInfo uri p = do Just (Lex.Bytes _) -> Just $ " : " <> typ -- TODO: add other lexemes _ -> Nothing + pure $ Text.unlines ["```unison", typeSig, "```"] -mkSubTermMap :: (Parser.Annotated a, Show a) => UF.TypecheckedUnisonFile Symbol a -> IM.IntervalMap Position [HoverInfo] -mkSubTermMap (UF.TypecheckedUnisonFileId {hashTermsId}) = - hashTermsId ^@.. (folded . _3 . subTerms . (reindexed ABT.annotation selfIndex) <. termHoverInfo) +mkSubTermMap :: (Parser.Annotated a, Show a) => Map Symbol a -> UF.TypecheckedUnisonFile Symbol a -> IM.IntervalMap Position [HoverInfo] +mkSubTermMap fileDefs (UF.TypecheckedUnisonFileId {hashTermsId}) = + hashTermsId ^@.. (folded . _3 . subTerms . (reindexed ABT.annotation selfIndex) <. termHoverInfo fileDefs) & Debug.debug Debug.LSP "Cosmos'd" & map (\(a, info) -> IM.singleton <$> annToInterval (Parser.ann a) <*> pure [info]) & Debug.debug Debug.LSP "Converted1" @@ -109,12 +119,13 @@ subTerms = data HoverInfo = BuiltinType Text - | LocalVar Text + | LocalVar Symbol + | FileDef Symbol | Ref Referent deriving stock (Show, Eq, Ord) -termHoverInfo :: Fold (Term.Term Symbol a) HoverInfo -termHoverInfo = folding \term -> +termHoverInfo :: (Map Symbol a) -> Fold (Term.Term Symbol a) HoverInfo +termHoverInfo fileDefs = folding \term -> case ABT.out term of ABT.Tm f -> case f of Term.Int {} -> Just (BuiltinType "Int") @@ -141,5 +152,8 @@ termHoverInfo = folding \term -> Term.TermLink {} -> Nothing Term.TypeLink {} -> Nothing -- ABT.Abs v r -> case f of - ABT.Var v -> Just (LocalVar $ Var.name v) + ABT.Var v -> + case Map.lookup v fileDefs of + Nothing -> Just (LocalVar v) + Just _ -> Just (FileDef v) _ -> Nothing From 419d001158d3d3305388af9f4eacb94756325e48 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 21 Nov 2022 17:58:00 -0600 Subject: [PATCH 006/467] Add some shared file/codebase queries --- lib/unison-prelude/src/Unison/Prelude.hs | 4 ++ .../src/Unison/Util/Relation4.hs | 9 +++ unison-cli/src/Unison/LSP/FileAnalysis.hs | 46 +++++++++---- unison-cli/src/Unison/LSP/Hover.hs | 49 +++++++------ unison-cli/src/Unison/LSP/Queries.hs | 69 +++++++++++++++++++ unison-cli/src/Unison/LSP/Types.hs | 8 ++- unison-cli/unison-cli.cabal | 1 + unison-core/src/Unison/DataDeclaration.hs | 4 +- unison-core/src/Unison/Term.hs | 4 +- 9 files changed, 150 insertions(+), 44 deletions(-) create mode 100644 unison-cli/src/Unison/LSP/Queries.hs diff --git a/lib/unison-prelude/src/Unison/Prelude.hs b/lib/unison-prelude/src/Unison/Prelude.hs index d89bd9cb0..291b35748 100644 --- a/lib/unison-prelude/src/Unison/Prelude.hs +++ b/lib/unison-prelude/src/Unison/Prelude.hs @@ -18,6 +18,7 @@ module Unison.Prelude whenJustM, eitherToMaybe, maybeToEither, + altSum, -- * @Either@ control flow onLeft, @@ -74,6 +75,9 @@ import UnliftIO as X (MonadUnliftIO (..), askRunInIO, askUnliftIO, try, withUnli import qualified UnliftIO import Witherable as X (filterA, forMaybe, mapMaybe, wither, witherMap) +altSum :: (Alternative f, Foldable t) => t (f a) -> f a +altSum = foldl' (<|>) empty + -- | E.g. -- -- @@ diff --git a/lib/unison-util-relation/src/Unison/Util/Relation4.hs b/lib/unison-util-relation/src/Unison/Util/Relation4.hs index 9e5251fa0..758e344f0 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation4.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation4.hs @@ -93,12 +93,21 @@ keys :: Relation4 a b c d -> (Set a, Set b, Set c, Set d) keys Relation4 {d1, d2, d3, d4} = (Map.keysSet d1, Map.keysSet d2, Map.keysSet d3, Map.keysSet d4) +lookupD1 :: (Ord a, Ord b, Ord c, Ord d) => a -> Relation4 a b c d -> Relation3 b c d +lookupD1 a = fromMaybe mempty . Map.lookup a . d1 + +lookupD2 :: (Ord a, Ord b, Ord c, Ord d) => b -> Relation4 a b c d -> Relation3 a c d +lookupD2 b = fromMaybe mempty . Map.lookup b . d2 + d1set :: Ord a => Relation4 a b c d -> Set a d1set = Map.keysSet . d1 d12 :: (Ord a, Ord b) => Relation4 a b c d -> Relation a b d12 = R.fromMultimap . fmap (Map.keysSet . R3.d1) . d1 +d13 :: (Ord a, Ord c) => Relation4 a b c d -> Relation a c +d13 = R.fromMultimap . fmap (Map.keysSet . R3.d2) . d1 + d34 :: (Ord c, Ord d) => Relation4 a b c d -> Relation c d d34 = R.fromMultimap . fmap (Map.keysSet . R3.d3) . d3 diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 767bf7ae6..8a5aaf12e 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -10,6 +10,7 @@ import Data.Foldable import Data.IntervalMap.Lazy (IntervalMap) import qualified Data.IntervalMap.Lazy as IM import qualified Data.Map as Map +import qualified Data.Set as Set import qualified Data.Text as Text import Language.LSP.Types ( Diagnostic, @@ -45,6 +46,7 @@ import qualified Unison.PrettyPrintEnv as PPE import qualified Unison.PrettyPrintEnv.Names as PPE import qualified Unison.PrettyPrintEnvDecl as PPE import qualified Unison.PrintError as PrintError +import qualified Unison.Reference as Reference import Unison.Result (Note) import qualified Unison.Result as Result import Unison.Symbol (Symbol) @@ -52,12 +54,19 @@ import qualified Unison.Symbol as Symbol import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter +import Unison.Term (Term) +import Unison.Type (Type) import qualified Unison.Typechecker.Context as Context import qualified Unison.Typechecker.TypeError as TypeError import qualified Unison.UnisonFile as UF import qualified Unison.UnisonFile.Names as UF import Unison.Util.Monoid (foldMapM) import qualified Unison.Util.Pretty as Pretty +import qualified Unison.Util.Relation as R +import Unison.Util.Relation3 (Relation3) +import qualified Unison.Util.Relation3 as R3 +import Unison.Util.Relation4 (Relation4) +import qualified Unison.Util.Relation4 as R4 import qualified Unison.Var as Var import Unison.WatchKind (pattern TestWatch) import UnliftIO (atomically, modifyTVar', readTVar, readTVarIO, writeTVar) @@ -110,9 +119,9 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, Just typ)]) in Just $ FileSummary - { dataDeclSummary = dataDeclarationsId', - effectDeclSummary = effectDeclarationsId', - termSummary = trms, + { dataDeclSummary = map2ToR3 dataDeclarationsId', + effectDeclSummary = map2ToR3 effectDeclarationsId', + termSummary = termRelation trms, testWatchSummary = testWatches, exprWatchSummary = exprWatches } @@ -128,28 +137,41 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of _ -> (mempty, [(assertUserSym v, Nothing, trm, Nothing)]) in Just $ FileSummary - { dataDeclSummary = dataDeclarationsId, - effectDeclSummary = effectDeclarationsId, - termSummary = trms, + { dataDeclSummary = map2ToR3 dataDeclarationsId, + effectDeclSummary = map2ToR3 effectDeclarationsId, + termSummary = termRelation trms, testWatchSummary = testWatches, exprWatchSummary = exprWatches } + where + termRelation :: Map Symbol (Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann)) -> Relation4 Symbol (Maybe Reference.Id) (Term Symbol Ann) (Maybe (Type Symbol Ann)) + termRelation m = + m + & Map.toList + & fmap (\(sym, (ref, trm, typ)) -> (sym, ref, trm, typ)) + & R4.fromList + map2ToR3 :: (Ord k, Ord a, Ord b) => Map k (a, b) -> Relation3 k a b + map2ToR3 m = + m + & Map.toList + & fmap (\(k, (a, b)) -> (k, a, b)) + & R3.fromList -getFileDefLocations :: Uri -> MaybeT Lsp (Map Symbol Ann) +getFileDefLocations :: Uri -> MaybeT Lsp (Map Symbol (Set Ann)) getFileDefLocations uri = do fileDefLocations <$> getFileSummary uri -fileDefLocations :: FileSummary -> Map Symbol Ann +fileDefLocations :: FileSummary -> Map Symbol (Set Ann) fileDefLocations FileSummary {dataDeclSummary, effectDeclSummary, testWatchSummary, exprWatchSummary, termSummary} = fold - [ dataDeclSummary <&> (DD.annotation . snd), - effectDeclSummary <&> (DD.annotation . DD.toDataDecl . snd), + [ fmap (Set.map DD.annotation) . R.domain . R3.d13 $ dataDeclSummary, + fmap (Set.map (DD.annotation . DD.toDataDecl)) . R.domain . R3.d13 $ effectDeclSummary, (testWatchSummary <> exprWatchSummary) & foldMap \(maySym, _id, trm, _typ) -> case maySym of Nothing -> mempty - Just sym -> Map.singleton sym (ABT.annotation trm), - termSummary <&> \(_refId, trm, _typ) -> ABT.annotation trm + Just sym -> Map.singleton sym (Set.singleton $ ABT.annotation trm), + fmap (Set.map ABT.annotation) . R.domain . R4.d13 $ termSummary ] fileAnalysisWorker :: Lsp () diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 53333288b..62cd0e07f 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -11,11 +11,11 @@ import qualified Data.Text as Text import Language.LSP.Types import Language.LSP.Types.Lens hiding (only, to) import qualified Unison.ABT as ABT -import qualified Unison.Codebase as Codebase import qualified Unison.ConstructorType as CT import qualified Unison.Debug as Debug import Unison.LSP.Conversions (annToInterval) import Unison.LSP.FileAnalysis (getFileAnalysis, getFileDefLocations, getFileSummary) +import qualified Unison.LSP.Queries as LSPQ import Unison.LSP.Types import Unison.Prelude import qualified Unison.PrettyPrintEnvDecl as PPED @@ -27,7 +27,8 @@ import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter import qualified Unison.Term as Term import qualified Unison.UnisonFile as UF -import Unison.Util.List (safeHead) +import qualified Unison.Util.Relation3 as Relation3 +import qualified Unison.Util.Relation4 as Relation4 -- | Hover help handler -- @@ -60,30 +61,28 @@ hoverInfo uri p = do Debug.debugM Debug.LSP "Matching" matchingHoverInfos ppe <- lift $ globalPPE let renderType typ = Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ - renderedTypes <- for matchingHoverInfos \info -> do - case info of - BuiltinType txt -> pure txt - LocalVar _v -> pure $ "" - FileDef v -> - pure . maybe "" renderType $ - termSummary ^? ix v . _3 . _Just - <|> testWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just - <|> exprWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just - Ref ref -> do - Env {codebase} <- ask - typ <- MaybeT . liftIO $ Codebase.getTypeOfReferent codebase ref - pure $ renderType typ - Debug.debugM Debug.LSP "Rendered" renderedTypes - -- Due to the way hover info is computed, there should be at most one. - typ <- MaybeT . pure $ safeHead renderedTypes + renderedType <- + altSum $ + matchingHoverInfos <&> \info -> do + case info of + BuiltinType txt -> pure txt + LocalVar _v -> pure $ "" + FileDef v -> + pure . maybe "" renderType $ + Relation4.d1 termSummary ^? ix v . folding Relation3.d3s . _Just + <|> testWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just + <|> exprWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just + Ref ref -> do + typ <- LSPQ.getTypeOfReferent uri ref + pure $ renderType typ let typeSig = case listToMaybe matchingLexeme of - Just (Lex.WordyId n _) -> Text.pack n <> " : " <> typ - Just (Lex.SymbolyId n _) -> Text.pack n <> " : " <> typ + Just (Lex.WordyId n _) -> Text.pack n <> " : " <> renderedType + Just (Lex.SymbolyId n _) -> Text.pack n <> " : " <> renderedType -- TODO: add other lexemes - _ -> ": " <> typ + _ -> ": " <> renderedType pure $ Text.unlines ["```unison", typeSig, "```"] -mkSubTermMap :: (Parser.Annotated a, Show a) => Map Symbol a -> UF.TypecheckedUnisonFile Symbol a -> IM.IntervalMap Position [HoverInfo] +mkSubTermMap :: (Parser.Annotated a, Show a) => Map Symbol (Set a) -> UF.TypecheckedUnisonFile Symbol a -> IM.IntervalMap Position [HoverInfo] mkSubTermMap fileDefs (UF.TypecheckedUnisonFileId {hashTermsId}) = hashTermsId ^@.. (folded . _3 . subTerms . (reindexed ABT.annotation selfIndex) <. termHoverInfo fileDefs) & Debug.debug Debug.LSP "Cosmos'd" @@ -104,7 +103,7 @@ data HoverInfo | Ref Referent deriving stock (Show, Eq, Ord) -termHoverInfo :: (Map Symbol a) -> Fold (Term.Term Symbol a) HoverInfo +termHoverInfo :: (Map Symbol (Set a)) -> Fold (Term.Term Symbol a) HoverInfo termHoverInfo fileDefs = folding \term -> case ABT.out term of ABT.Tm f -> case f of @@ -133,6 +132,6 @@ termHoverInfo fileDefs = folding \term -> Term.TypeLink {} -> Nothing ABT.Var v -> case Map.lookup v fileDefs of - Nothing -> Just (LocalVar v) - Just _ -> Just (FileDef v) + Just xs | not . null $ xs -> Just (FileDef v) + _ -> Just (LocalVar v) _ -> Nothing diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs new file mode 100644 index 000000000..5a3d9db79 --- /dev/null +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -0,0 +1,69 @@ +-- | Rewrites of some codebase queries, but which check the scratch file for info first. +module Unison.LSP.Queries + ( getTypeOfReferent, + getTypeDeclaration, + ) +where + +import Control.Monad.Reader +import qualified Data.Set as Set +import Language.LSP.Types +import qualified Unison.Codebase as Codebase +import Unison.ConstructorReference (GConstructorReference (..)) +import Unison.DataDeclaration (Decl) +import qualified Unison.DataDeclaration as DD +import Unison.LSP.FileAnalysis (getFileSummary) +import Unison.LSP.Types +import Unison.Parser.Ann (Ann) +import Unison.Prelude +import qualified Unison.Reference as Reference +import Unison.Referent (Referent) +import qualified Unison.Referent as Referent +import Unison.Symbol (Symbol) +import Unison.Type (Type) +import qualified Unison.Util.Relation as R +import qualified Unison.Util.Relation3 as R3 +import qualified Unison.Util.Relation4 as R4 + +-- | Gets the type of a reference from either the parsed file or the codebase. +getTypeOfReferent :: Uri -> Referent -> MaybeT Lsp (Type Symbol Ann) +getTypeOfReferent fileUri ref = do + getFromFile <|> getFromCodebase + where + getFromFile = do + FileSummary {termSummary} <- getFileSummary fileUri + case ref of + Referent.Ref (Reference.Builtin {}) -> empty + Referent.Ref (Reference.DerivedId termRefId) -> + do + termSummary + & R4.lookupD2 (Just termRefId) + & R3.d3s + & Set.toList + & fmap (MaybeT . pure) + & altSum + Referent.Con (ConstructorReference r0 cid) _type -> do + case r0 of + Reference.DerivedId r -> do + decl <- getTypeDeclaration fileUri r + MaybeT . pure $ DD.typeOfConstructor (either DD.toDataDecl id decl) cid + Reference.Builtin _ -> empty + getFromCodebase = do + Env {codebase} <- ask + MaybeT . liftIO $ Codebase.runTransaction codebase $ Codebase.getTypeOfReferent codebase ref + +-- | Gets a decl from either the parsed file or the codebase. +getTypeDeclaration :: Uri -> Reference.Id -> MaybeT Lsp (Decl Symbol Ann) +getTypeDeclaration fileUri refId = do + getFromFile <|> getFromCodebase + where + getFromFile :: MaybeT Lsp (Decl Symbol Ann) + getFromFile = do + FileSummary {dataDeclSummary, effectDeclSummary} <- getFileSummary fileUri + let datas = Set.toList . R.ran $ R3.lookupD2 refId dataDeclSummary + let effects = Set.toList . R.ran $ R3.lookupD2 refId effectDeclSummary + MaybeT . pure . listToMaybe $ fmap Right datas <> fmap Left effects + + getFromCodebase = do + Env {codebase} <- ask + MaybeT . liftIO $ Codebase.runTransaction codebase $ Codebase.getTypeDeclaration codebase refId diff --git a/unison-cli/src/Unison/LSP/Types.hs b/unison-cli/src/Unison/LSP/Types.hs index 05a1c317e..7a4487609 100644 --- a/unison-cli/src/Unison/LSP/Types.hs +++ b/unison-cli/src/Unison/LSP/Types.hs @@ -47,6 +47,8 @@ import qualified Unison.Syntax.Lexer as Lexer import Unison.Term (Term) import Unison.Type (Type) import qualified Unison.UnisonFile as UF +import Unison.Util.Relation3 (Relation3) +import Unison.Util.Relation4 (Relation4) import UnliftIO -- | A custom LSP monad wrapper so we can provide our own environment. @@ -127,9 +129,9 @@ data FileAnalysis = FileAnalysis -- If the file typechecked then all the Ref Ids and types will be filled in, otherwise -- they will be Nothing. data FileSummary = FileSummary - { dataDeclSummary :: Map Symbol (Reference.Id, DD.DataDeclaration Symbol Ann), - effectDeclSummary :: Map Symbol (Reference.Id, DD.EffectDeclaration Symbol Ann), - termSummary :: Map Symbol (Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann)), + { dataDeclSummary :: Relation3 Symbol Reference.Id (DD.DataDeclaration Symbol Ann), + effectDeclSummary :: Relation3 Symbol Reference.Id (DD.EffectDeclaration Symbol Ann), + termSummary :: Relation4 Symbol (Maybe Reference.Id) (Term Symbol Ann) (Maybe (Type Symbol Ann)), testWatchSummary :: [(Maybe Symbol, Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann))], exprWatchSummary :: [(Maybe Symbol, Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann))] } diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 401f275de..db91b8666 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -82,6 +82,7 @@ library Unison.LSP.Hover Unison.LSP.NotificationHandlers Unison.LSP.Orphans + Unison.LSP.Queries Unison.LSP.Types Unison.LSP.UCMWorker Unison.LSP.VFS diff --git a/unison-core/src/Unison/DataDeclaration.hs b/unison-core/src/Unison/DataDeclaration.hs index ba581fbde..bc6584a9f 100644 --- a/unison-core/src/Unison/DataDeclaration.hs +++ b/unison-core/src/Unison/DataDeclaration.hs @@ -91,7 +91,7 @@ data DataDeclaration v a = DataDeclaration bound :: [v], constructors' :: [(a, v, Type v a)] } - deriving (Eq, Show, Functor) + deriving (Eq, Ord, Show, Functor) constructors_ :: Lens' (DataDeclaration v a) [(a, v, Type v a)] constructors_ = lens getter setter @@ -102,7 +102,7 @@ constructors_ = lens getter setter newtype EffectDeclaration v a = EffectDeclaration { toDataDecl :: DataDeclaration v a } - deriving (Eq, Show, Functor) + deriving (Eq, Ord, Show, Functor) asDataDecl_ :: Iso' (EffectDeclaration v a) (DataDeclaration v a) asDataDecl_ = iso toDataDecl EffectDeclaration diff --git a/unison-core/src/Unison/Term.hs b/unison-core/src/Unison/Term.hs index fc49f246a..5e0d4c891 100644 --- a/unison-core/src/Unison/Term.hs +++ b/unison-core/src/Unison/Term.hs @@ -55,7 +55,7 @@ data MatchCase loc a = MatchCase matchGuard :: Maybe a, matchBody :: a } - deriving (Show, Eq, Foldable, Functor, Generic, Generic1, Traversable) + deriving (Show, Eq, Ord, Foldable, Functor, Generic, Generic1, Traversable) matchPattern_ :: Lens' (MatchCase loc a) (Pattern loc) matchPattern_ = lens matchPattern setter @@ -102,7 +102,7 @@ data F typeVar typeAnn patternAnn a Match a [MatchCase patternAnn a] | TermLink Referent | TypeLink Reference - deriving (Foldable, Functor, Generic, Generic1, Traversable) + deriving (Ord, Foldable, Functor, Generic, Generic1, Traversable) _Ref :: Prism' (F tv ta pa a) Reference _Ref = _Ctor @"Ref" From 339073b4b644f8b609e35377ecbd97e100d6e8ea Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 23 Nov 2022 14:16:45 -0600 Subject: [PATCH 007/467] Add a bunch of ref-finding helpers for LSP --- lib/unison-prelude/src/Unison/Prelude.hs | 4 + .../src/Unison/Util/Relation4.hs | 3 + unison-cli/src/Unison/LSP/Conversions.hs | 6 + unison-cli/src/Unison/LSP/Queries.hs | 144 ++++++++++++++++++ unison-syntax/src/Unison/Parser/Ann.hs | 19 +++ 5 files changed, 176 insertions(+) diff --git a/lib/unison-prelude/src/Unison/Prelude.hs b/lib/unison-prelude/src/Unison/Prelude.hs index 291b35748..8fd4a4b3f 100644 --- a/lib/unison-prelude/src/Unison/Prelude.hs +++ b/lib/unison-prelude/src/Unison/Prelude.hs @@ -19,6 +19,7 @@ module Unison.Prelude eitherToMaybe, maybeToEither, altSum, + altMap, -- * @Either@ control flow onLeft, @@ -78,6 +79,9 @@ import Witherable as X (filterA, forMaybe, mapMaybe, wither, witherMap) altSum :: (Alternative f, Foldable t) => t (f a) -> f a altSum = foldl' (<|>) empty +altMap :: (Alternative f, Foldable t) => (a -> f b) -> t a -> f b +altMap f = altSum . fmap f . toList + -- | E.g. -- -- @@ diff --git a/lib/unison-util-relation/src/Unison/Util/Relation4.hs b/lib/unison-util-relation/src/Unison/Util/Relation4.hs index 758e344f0..1777f8a3c 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation4.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation4.hs @@ -133,6 +133,9 @@ d234 Relation4 {d2, d3, d4} = d12s :: (Ord a, Ord b) => Relation4 a b c d -> [(a, b)] d12s = nubOrd . fmap (\(a, (b, _)) -> (a, b)) . toNestedList +d3s :: Relation4 a b c d -> Set c +d3s = Map.keysSet . d3 + -- e.g. Map.toList (d1 r) >>= \(a, r3) -> (a,) <$> Map.keys (R3.d1 r3) insert, diff --git a/unison-cli/src/Unison/LSP/Conversions.hs b/unison-cli/src/Unison/LSP/Conversions.hs index f1a804eb5..fb1a1a7c5 100644 --- a/unison-cli/src/Unison/LSP/Conversions.hs +++ b/unison-cli/src/Unison/LSP/Conversions.hs @@ -23,6 +23,12 @@ uToLspPos uPos = _character = fromIntegral $ Lex.column uPos - 1 } +lspToUPos :: Position -> Lex.Pos +lspToUPos lspPos = + Lex.Pos + (fromIntegral $ _line lspPos + 1) -- 1 indexed vs 0 indexed + (fromIntegral $ _character lspPos + 1) + uToLspRange :: Range.Range -> Range uToLspRange (Range.Range start end) = Range (uToLspPos start) (uToLspPos end) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 5a3d9db79..3ad871ddb 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -2,25 +2,38 @@ module Unison.LSP.Queries ( getTypeOfReferent, getTypeDeclaration, + refAtPosition, ) where +import Control.Lens import Control.Monad.Reader import qualified Data.Set as Set import Language.LSP.Types +import qualified Unison.ABT as ABT import qualified Unison.Codebase as Codebase import Unison.ConstructorReference (GConstructorReference (..)) +import qualified Unison.ConstructorType as CT import Unison.DataDeclaration (Decl) import qualified Unison.DataDeclaration as DD +import Unison.LSP.Conversions (lspToUPos) import Unison.LSP.FileAnalysis (getFileSummary) +import Unison.LSP.Orphans () import Unison.LSP.Types +import Unison.LabeledDependency +import qualified Unison.LabeledDependency as LD +import Unison.Lexer.Pos (Pos (..)) import Unison.Parser.Ann (Ann) +import qualified Unison.Parser.Ann as Ann import Unison.Prelude import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Referent as Referent import Unison.Symbol (Symbol) +import Unison.Term (MatchCase (MatchCase), Term) +import qualified Unison.Term as Term import Unison.Type (Type) +import qualified Unison.Type as Type import qualified Unison.Util.Relation as R import qualified Unison.Util.Relation3 as R3 import qualified Unison.Util.Relation4 as R4 @@ -67,3 +80,134 @@ getTypeDeclaration fileUri refId = do getFromCodebase = do Env {codebase} <- ask MaybeT . liftIO $ Codebase.runTransaction codebase $ Codebase.getTypeDeclaration codebase refId + +-- | Returns a reference to whatever the symbol at the given position refers to. +refAtPosition :: Uri -> Position -> MaybeT Lsp LabeledDependency +refAtPosition uri (lspToUPos -> pos) = do + FileSummary {dataDeclSummary, effectDeclSummary, termSummary, testWatchSummary, exprWatchSummary} <- getFileSummary uri + ( altMap (hoistMaybe . refInDecl pos . Right) (R3.d3s dataDeclSummary) + <|> altMap (hoistMaybe . refInDecl pos . Left) (R3.d3s effectDeclSummary) + <|> altMap findRefInTerm (R4.d3s termSummary) + <|> altMap findRefInTerm (testWatchSummary ^.. folded . _3) + <|> altMap findRefInTerm (exprWatchSummary ^.. folded . _3) + ) + where + hoistMaybe :: Maybe a -> MaybeT Lsp a + hoistMaybe = MaybeT . pure + findRefInTerm :: Term Symbol Ann -> MaybeT Lsp LabeledDependency + findRefInTerm term = do + hoistMaybe (findSmallestEnclosingNode pos term) >>= \case + Left term -> hoistMaybe $ refInTerm term + Right typ -> hoistMaybe $ refInType typ + +refInTerm :: (Term v a -> Maybe LabeledDependency) +refInTerm term = + case ABT.out term of + ABT.Tm f -> case f of + Term.Int {} -> Nothing + Term.Nat {} -> Nothing + Term.Float {} -> Nothing + Term.Boolean {} -> Nothing + Term.Text {} -> Nothing + Term.Char {} -> Nothing + Term.Blank {} -> Nothing + Term.Ref ref -> Just (LD.TermReference ref) + Term.Constructor conRef -> Just (LD.ConReference conRef CT.Data) + Term.Request conRef -> Just (LD.ConReference conRef CT.Effect) + Term.Handle _a _b -> Nothing + Term.App _a _b -> Nothing + Term.Ann _a _typ -> Nothing + Term.List _xs -> Nothing + Term.If _cond _a _b -> Nothing + Term.And _l _r -> Nothing + Term.Or _l _r -> Nothing + Term.Lam _a -> Nothing + Term.LetRec _isTop _xs _y -> Nothing + Term.Let _isTop _a _b -> Nothing + Term.Match _a _cases -> Nothing + Term.TermLink ref -> Just (LD.TermReferent ref) + Term.TypeLink ref -> Just (LD.TypeReference ref) + ABT.Var _v -> Nothing + ABT.Cycle _r -> Nothing + ABT.Abs _v _r -> Nothing + +refInType :: Type v a -> Maybe LabeledDependency +refInType typ = case ABT.out typ of + ABT.Tm f -> case f of + Type.Ref ref -> Just (LD.TypeReference ref) + Type.Arrow _a _b -> Nothing + Type.Effect _a _b -> Nothing + Type.App _a _b -> Nothing + Type.Forall _r -> Nothing + Type.Ann _a _kind -> Nothing + Type.Effects _es -> Nothing + Type.IntroOuter _a -> Nothing + ABT.Var _v -> Nothing + ABT.Cycle _r -> Nothing + ABT.Abs _v _r -> Nothing + +-- | Find the the node in a term which contains the specified position, but none of its +-- children contain that position. +findSmallestEnclosingNode :: Pos -> Term v Ann -> Maybe (Either (Term v Ann) (Type v Ann)) +findSmallestEnclosingNode pos term + | not (ABT.annotation term `Ann.contains` pos) = Nothing + | otherwise = (<|> Just (Left term)) $ do + case ABT.out term of + ABT.Tm f -> case f of + Term.Int {} -> Just (Left term) + Term.Nat {} -> Just (Left term) + Term.Float {} -> Just (Left term) + Term.Boolean {} -> Just (Left term) + Term.Text {} -> Just (Left term) + Term.Char {} -> Just (Left term) + Term.Blank {} -> Just (Left term) + Term.Ref {} -> Just (Left term) + Term.Constructor {} -> Just (Left term) + Term.Request {} -> Just (Left term) + Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.App a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (Right <$> findSmallestEnclosingType pos typ) + Term.List xs -> altSum (findSmallestEnclosingNode pos <$> xs) + Term.If cond a b -> findSmallestEnclosingNode pos cond <|> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.And l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r + Term.Or l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r + Term.Lam a -> findSmallestEnclosingNode pos a + Term.LetRec _isTop xs y -> altSum (findSmallestEnclosingNode pos <$> xs) <|> findSmallestEnclosingNode pos y + Term.Let _isTop a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.Match a cases -> + findSmallestEnclosingNode pos a + <|> altSum (cases <&> \(MatchCase _pat grd body) -> altSum (findSmallestEnclosingNode pos <$> grd) <|> findSmallestEnclosingNode pos body) + Term.TermLink {} -> Just (Left term) + Term.TypeLink {} -> Just (Left term) + ABT.Var _v -> Just (Left term) + ABT.Cycle r -> findSmallestEnclosingNode pos r + ABT.Abs _v r -> findSmallestEnclosingNode pos r + +findSmallestEnclosingType :: Pos -> Type v Ann -> Maybe (Type v Ann) +findSmallestEnclosingType pos typ + | not (ABT.annotation typ `Ann.contains` pos) = Nothing + | otherwise = (<|> Just typ) $ do + case ABT.out typ of + ABT.Tm f -> case f of + Type.Ref {} -> Just typ + Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Forall r -> findSmallestEnclosingType pos r + Type.Ann a _kind -> findSmallestEnclosingType pos a + Type.Effects es -> altSum (findSmallestEnclosingType pos <$> es) + Type.IntroOuter a -> findSmallestEnclosingType pos a + ABT.Var _v -> Just typ + ABT.Cycle r -> findSmallestEnclosingType pos r + ABT.Abs _v r -> findSmallestEnclosingType pos r + +refInDecl :: Pos -> DD.Decl v Ann -> Maybe LabeledDependency +refInDecl p (DD.asDataDecl -> dd) + | not (DD.annotation dd `Ann.contains` p) = + Nothing + | otherwise = + DD.constructors' dd + & altMap \(ann, _v, typ) -> do + guard (ann `Ann.contains` p) + typeNode <- findSmallestEnclosingType p typ + refInType typeNode diff --git a/unison-syntax/src/Unison/Parser/Ann.hs b/unison-syntax/src/Unison/Parser/Ann.hs index 6ae13dad7..812680fb8 100644 --- a/unison-syntax/src/Unison/Parser/Ann.hs +++ b/unison-syntax/src/Unison/Parser/Ann.hs @@ -26,3 +26,22 @@ instance Semigroup Ann where a <> External = a Intrinsic <> a = a a <> Intrinsic = a + +-- | Checks whether an annotation contains a given position +-- i.e. pos ∈ [start, end) +-- +-- >>> Intrinsic `contains` L.Pos 1 1 +-- False +-- +-- >>> External `contains` L.Pos 1 1 +-- False +-- +-- >>> Ann (L.Pos 0 0) (L.Pos 0 10) `contains` L.Pos 0 5 +-- True +-- +-- >>> Ann (L.Pos 0 0) (L.Pos 0 10) `contains` L.Pos 0 10 +-- False +contains :: Ann -> L.Pos -> Bool +contains Intrinsic _ = False +contains External _ = False +contains (Ann start end) p = start <= p && p < end From 8a30019f7b236bfb6ffed98c3ff1dbb8bd4fabf2 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sat, 26 Nov 2022 12:19:35 -0600 Subject: [PATCH 008/467] Hover working much better --- unison-cli/src/Unison/LSP/Completion.hs | 4 +- unison-cli/src/Unison/LSP/FileAnalysis.hs | 2 +- unison-cli/src/Unison/LSP/Hover.hs | 66 ++++++++++------------- unison-cli/src/Unison/LSP/Queries.hs | 2 +- unison-cli/src/Unison/LSP/VFS.hs | 40 +++++++------- 5 files changed, 52 insertions(+), 62 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Completion.hs b/unison-cli/src/Unison/LSP/Completion.hs index a06ba1187..3eb772621 100644 --- a/unison-cli/src/Unison/LSP/Completion.hs +++ b/unison-cli/src/Unison/LSP/Completion.hs @@ -37,7 +37,9 @@ import qualified Unison.Util.Relation as Relation completionHandler :: RequestMessage 'TextDocumentCompletion -> (Either ResponseError (ResponseResult 'TextDocumentCompletion) -> Lsp ()) -> Lsp () completionHandler m respond = respond . maybe (Right $ InL mempty) (Right . InR) =<< runMaybeT do - (range, prefix) <- MaybeT $ VFS.completionPrefix (m ^. params) + let fileUri = m ^. params . textDocument . uri + let pos = (m ^. params . position) + (range, prefix) <- VFS.completionPrefix fileUri pos ppe <- PPED.suffixifiedPPE <$> lift globalPPE completions <- lift getCompletions Config {maxCompletions} <- lift getConfig diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 8a5aaf12e..d94f884b7 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -75,7 +75,7 @@ import UnliftIO (atomically, modifyTVar', readTVar, readTVarIO, writeTVar) checkFile :: HasUri d Uri => d -> Lsp (Maybe FileAnalysis) checkFile doc = runMaybeT $ do let fileUri = doc ^. uri - (fileVersion, contents) <- MaybeT (VFS.getFileContents doc) + (fileVersion, contents) <- VFS.getFileContents fileUri parseNames <- lift getParseNames let sourceName = getUri $ doc ^. uri let lexedSource@(srcText, tokens) = (contents, L.lexer (Text.unpack sourceName) (Text.unpack contents)) diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 62cd0e07f..1ed1d8bf5 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -9,26 +9,29 @@ import qualified Data.IntervalMap.Lazy as IM import qualified Data.Map as Map import qualified Data.Text as Text import Language.LSP.Types -import Language.LSP.Types.Lens hiding (only, to) +import Language.LSP.Types.Lens hiding (id, only, to) import qualified Unison.ABT as ABT import qualified Unison.ConstructorType as CT import qualified Unison.Debug as Debug +import qualified Unison.HashQualified as HQ import Unison.LSP.Conversions (annToInterval) -import Unison.LSP.FileAnalysis (getFileAnalysis, getFileDefLocations, getFileSummary) import qualified Unison.LSP.Queries as LSPQ import Unison.LSP.Types +import qualified Unison.LSP.VFS as VFS +import qualified Unison.LabeledDependency as LD +import qualified Unison.Name as Name import Unison.Prelude import qualified Unison.PrettyPrintEnvDecl as PPED +import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Referent as Referent import Unison.Symbol (Symbol) -import qualified Unison.Syntax.Lexer as Lex +import qualified Unison.Syntax.DeclPrinter as DeclPrinter import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter import qualified Unison.Term as Term import qualified Unison.UnisonFile as UF -import qualified Unison.Util.Relation3 as Relation3 -import qualified Unison.Util.Relation4 as Relation4 +import qualified Unison.Util.Pretty as Pretty -- | Hover help handler -- @@ -47,40 +50,25 @@ hoverHandler m respond = } hoverInfo :: Uri -> Position -> MaybeT Lsp Text -hoverInfo uri p = do - Debug.debugM Debug.LSP "POINT" p - FileAnalysis {tokenMap, typecheckedFile} <- MaybeT $ getFileAnalysis uri - FileSummary {termSummary, testWatchSummary, exprWatchSummary} <- getFileSummary uri - fileDefLocations <- getFileDefLocations uri - Debug.debugM Debug.LSP "TYPECHECKED" typecheckedFile - subTermMap <- mkSubTermMap fileDefLocations <$> MaybeT (pure typecheckedFile) - Debug.debugM Debug.LSP "SubTerms" subTermMap - let matchingHoverInfos = concat . IM.elems $ IM.containing subTermMap p - let matchingLexeme = IM.elems $ IM.containing tokenMap p - - Debug.debugM Debug.LSP "Matching" matchingHoverInfos - ppe <- lift $ globalPPE - let renderType typ = Text.pack $ TypePrinter.prettyStr (Just 40) (PPED.suffixifiedPPE ppe) typ - renderedType <- - altSum $ - matchingHoverInfos <&> \info -> do - case info of - BuiltinType txt -> pure txt - LocalVar _v -> pure $ "" - FileDef v -> - pure . maybe "" renderType $ - Relation4.d1 termSummary ^? ix v . folding Relation3.d3s . _Just - <|> testWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just - <|> exprWatchSummary ^? folded . filteredBy (_1 . _Just . only v) . _4 . _Just - Ref ref -> do - typ <- LSPQ.getTypeOfReferent uri ref - pure $ renderType typ - let typeSig = case listToMaybe matchingLexeme of - Just (Lex.WordyId n _) -> Text.pack n <> " : " <> renderedType - Just (Lex.SymbolyId n _) -> Text.pack n <> " : " <> renderedType - -- TODO: add other lexemes - _ -> ": " <> renderedType - pure $ Text.unlines ["```unison", typeSig, "```"] +hoverInfo uri pos = + markdownify <$> do + symAtCursor <- VFS.identifierAtPosition uri pos + ref <- LSPQ.refAtPosition uri pos + ppe <- lift $ globalPPE + case ref of + LD.TypeReference (Reference.Builtin {}) -> pure (symAtCursor <> " : ") + LD.TypeReference ref@(Reference.DerivedId refId) -> do + nameAtCursor <- MaybeT . pure $ Name.fromText symAtCursor + decl <- LSPQ.getTypeDeclaration uri refId + let typ = Text.pack . Pretty.toPlain prettyWidth . Pretty.syntaxToColor $ DeclPrinter.prettyDecl ppe ref (HQ.NameOnly nameAtCursor) decl + pure typ + LD.TermReferent ref -> do + typ <- LSPQ.getTypeOfReferent uri ref + let renderedType = Text.pack $ TypePrinter.prettyStr (Just prettyWidth) (PPED.suffixifiedPPE ppe) typ + pure (symAtCursor <> " : " <> renderedType) + where + markdownify rendered = Text.unlines ["```unison", rendered, "```"] + prettyWidth = 40 mkSubTermMap :: (Parser.Annotated a, Show a) => Map Symbol (Set a) -> UF.TypecheckedUnisonFile Symbol a -> IM.IntervalMap Position [HoverInfo] mkSubTermMap fileDefs (UF.TypecheckedUnisonFileId {hashTermsId}) = diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 3ad871ddb..add48c275 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -84,7 +84,7 @@ getTypeDeclaration fileUri refId = do -- | Returns a reference to whatever the symbol at the given position refers to. refAtPosition :: Uri -> Position -> MaybeT Lsp LabeledDependency refAtPosition uri (lspToUPos -> pos) = do - FileSummary {dataDeclSummary, effectDeclSummary, termSummary, testWatchSummary, exprWatchSummary} <- getFileSummary uri + (FileSummary {dataDeclSummary, effectDeclSummary, termSummary, testWatchSummary, exprWatchSummary}) <- getFileSummary uri ( altMap (hoistMaybe . refInDecl pos . Right) (R3.d3s dataDeclSummary) <|> altMap (hoistMaybe . refInDecl pos . Left) (R3.d3s effectDeclSummary) <|> altMap findRefInTerm (R4.d3s termSummary) diff --git a/unison-cli/src/Unison/LSP/VFS.hs b/unison-cli/src/Unison/LSP/VFS.hs index f1e28f3ac..583bd4d45 100644 --- a/unison-cli/src/Unison/LSP/VFS.hs +++ b/unison-cli/src/Unison/LSP/VFS.hs @@ -18,7 +18,7 @@ import qualified Data.Text.Utf16.Rope as Rope import Data.Tuple (swap) import qualified Language.LSP.Logging as LSP import Language.LSP.Types -import Language.LSP.Types.Lens (HasCharacter (character), HasParams (params), HasPosition (position), HasTextDocument (textDocument), HasUri (uri)) +import Language.LSP.Types.Lens (HasCharacter (character), HasParams (params), HasTextDocument (textDocument), HasUri (uri)) import qualified Language.LSP.Types.Lens as LSP import Language.LSP.VFS as VFS hiding (character) import Unison.LSP.Orphans () @@ -33,14 +33,14 @@ usingVFS m = do vfsVar' <- asks vfsVar modifyMVar vfsVar' $ \vfs -> swap <$> runStateT m vfs -getVirtualFile :: (HasUri doc Uri) => doc -> Lsp (Maybe VirtualFile) -getVirtualFile p = do +getVirtualFile :: Uri -> Lsp (Maybe VirtualFile) +getVirtualFile uri = do vfs <- asks vfsVar >>= readMVar - pure $ vfs ^. vfsMap . at (toNormalizedUri $ p ^. uri) + pure $ vfs ^. vfsMap . at (toNormalizedUri $ uri) -getFileContents :: (HasUri doc Uri) => doc -> Lsp (Maybe (FileVersion, Text)) -getFileContents p = runMaybeT $ do - vf <- MaybeT $ getVirtualFile p +getFileContents :: Uri -> MaybeT Lsp (FileVersion, Text) +getFileContents uri = do + vf <- MaybeT $ getVirtualFile uri pure (vf ^. lsp_version, Rope.toText $ vf ^. file_text) vfsLogger :: Colog.LogAction (StateT VFS Lsp) (Colog.WithSeverity VfsLog) @@ -62,17 +62,17 @@ markAllFilesDirty = do markFilesDirty $ Map.keys (vfs ^. vfsMap) -- | Returns the name or symbol which the provided position is contained in. -identifierAtPosition :: (HasPosition p Position, HasTextDocument p TextDocumentIdentifier) => p -> Lsp (Maybe Text) -identifierAtPosition p = do - identifierSplitAtPosition p <&> fmap \(before, after) -> (before <> after) +identifierAtPosition :: Uri -> Position -> MaybeT Lsp Text +identifierAtPosition uri pos = do + identifierSplitAtPosition uri pos <&> \(before, after) -> (before <> after) -- | Returns the prefix and suffix of the symbol which the provided position is contained in. -identifierSplitAtPosition :: (HasPosition p Position, HasTextDocument p docId, HasUri docId Uri) => p -> Lsp (Maybe (Text, Text)) -identifierSplitAtPosition p = runMaybeT $ do - vf <- MaybeT (getVirtualFile (p ^. textDocument)) - PosPrefixInfo {fullLine, cursorPos} <- MaybeT (VFS.getCompletionPrefix (p ^. position) vf) +identifierSplitAtPosition :: Uri -> Position -> MaybeT Lsp (Text, Text) +identifierSplitAtPosition uri pos = do + vf <- MaybeT (getVirtualFile uri) + PosPrefixInfo {fullLine, cursorPos} <- MaybeT (VFS.getCompletionPrefix pos vf) let (before, after) = Text.splitAt (cursorPos ^. character . to fromIntegral) fullLine - pure $ (Text.takeWhileEnd isIdentifierChar before, Text.takeWhile isIdentifierChar after) + pure (Text.takeWhileEnd isIdentifierChar before, Text.takeWhile isIdentifierChar after) where -- TODO: Should probably use something from the Lexer here isIdentifierChar = \case @@ -83,11 +83,11 @@ identifierSplitAtPosition p = runMaybeT $ do -- | Returns the prefix of the symbol at the provided location, and the range that prefix -- spans. -completionPrefix :: (HasPosition p Position, HasTextDocument p docId, HasUri docId Uri) => p -> Lsp (Maybe (Range, Text)) -completionPrefix p = runMaybeT $ do - (before, _) <- MaybeT $ identifierSplitAtPosition p - let posLine = p ^. position . LSP.line - let posChar = (p ^. position . LSP.character) +completionPrefix :: Uri -> Position -> MaybeT Lsp (Range, Text) +completionPrefix uri pos = do + (before, _) <- identifierSplitAtPosition uri pos + let posLine = pos ^. LSP.line + let posChar = pos ^. LSP.character let range = mkRange posLine (posChar - fromIntegral (Text.length before)) posLine posChar pure (range, before) From 7f8adfdd2e355f1ea005a58cd4432a58da927acb Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sat, 26 Nov 2022 12:27:58 -0600 Subject: [PATCH 009/467] Add file symbols to pretty printer for hover --- .../src/Unison/PrettyPrintEnvDecl.hs | 5 +++ unison-cli/src/Unison/LSP/FileAnalysis.hs | 36 +++++-------------- unison-cli/src/Unison/LSP/Hover.hs | 7 ++-- 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/parser-typechecker/src/Unison/PrettyPrintEnvDecl.hs b/parser-typechecker/src/Unison/PrettyPrintEnvDecl.hs index 5adf2336a..937763ebe 100644 --- a/parser-typechecker/src/Unison/PrettyPrintEnvDecl.hs +++ b/parser-typechecker/src/Unison/PrettyPrintEnvDecl.hs @@ -4,6 +4,7 @@ module Unison.PrettyPrintEnvDecl ( PrettyPrintEnvDecl (..), biasTo, empty, + addFallback, ) where @@ -35,3 +36,7 @@ biasTo targets PrettyPrintEnvDecl {unsuffixifiedPPE, suffixifiedPPE} = empty :: PrettyPrintEnvDecl empty = PrettyPrintEnvDecl PPE.empty PPE.empty + +addFallback :: PrettyPrintEnvDecl -> PrettyPrintEnvDecl -> PrettyPrintEnvDecl +addFallback (PrettyPrintEnvDecl unA suffA) (PrettyPrintEnvDecl unB suffB) = + PrettyPrintEnvDecl (unA `PPE.addFallback` unB) (suffA `PPE.addFallback` suffB) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index d94f884b7..158f4a65c 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -43,8 +43,9 @@ import qualified Unison.Pattern as Pattern import Unison.Prelude import Unison.PrettyPrintEnv (PrettyPrintEnv) import qualified Unison.PrettyPrintEnv as PPE -import qualified Unison.PrettyPrintEnv.Names as PPE import qualified Unison.PrettyPrintEnvDecl as PPE +import qualified Unison.PrettyPrintEnvDecl as PPED +import qualified Unison.PrettyPrintEnvDecl.Names as PPED import qualified Unison.PrintError as PrintError import qualified Unison.Reference as Reference import Unison.Result (Note) @@ -371,34 +372,13 @@ getFileSummary uri = do MaybeT . pure $ fileSummary -- TODO memoize per file -ppeForFile :: Uri -> Lsp PrettyPrintEnv -ppeForFile fileUri = do - ppe <- PPE.suffixifiedPPE <$> globalPPE +ppedForFile :: Uri -> Lsp PPE.PrettyPrintEnvDecl +ppedForFile fileUri = do + pped <- globalPPE getFileAnalysis fileUri >>= \case Just (FileAnalysis {typecheckedFile = Just tf}) -> do hl <- asks codebase >>= \codebase -> liftIO (Codebase.runTransaction codebase Codebase.hashLength) let fileNames = UF.typecheckedToNames tf - let filePPE = PPE.fromSuffixNames hl (NamesWithHistory.fromCurrentNames fileNames) - pure (filePPE `PPE.addFallback` ppe) - _ -> pure ppe - --- | Information about a symbol defined within the file. --- data FileDefInfo ann --- = FileDataDecl Reference.Id ann --- | FileAbilityDecl Reference.Id ann --- | FileTerm (Maybe Reference.Id) ann --- | FileWatch WatchKind (Maybe Reference.Id) ann - --- getFileSymbols :: Uri -> MaybeT Lsp (Map Symbol (FileDefInfo Ann)) --- getFileSymbols uri = do --- FileAnalysis {parsedFile} <- MaybeT $ getFileAnalysis uri --- UF.UnisonFileId {dataDeclarationsId, effectDeclarationsId, terms, watches} <- MaybeT (pure parsedFile) - --- pure $ --- do --- dataDeclarationsId & ifoldMap \v (ref, dd) -> Map.singleton v . FileDataDecl ref $ DD.annotation dd --- <> (effectDeclarationsId & ifoldMap \v (ref, dd) -> Map.singleton v . FileAbilityDecl ref . DD.annotation . DD.toDataDecl $ dd) --- <> (terms & foldMap \(v, ref, dd) -> Map.singleton v . FileAbilityDecl ref . DD.annotation . DD.toDataDecl $ dd) - --- effectDeclarationsId & ifoldMap \v ed -> [Map.singleton v . FileEffectDecl $ DD.annotation ed] --- terms & foldMap \(v, trm) -> [Map.singleton v $ FileEffectDecl ann] + let filePPED = PPED.fromNamesDecl hl (NamesWithHistory.fromCurrentNames fileNames) + pure (filePPED `PPED.addFallback` pped) + _ -> pure pped diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 1ed1d8bf5..17ba873c9 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -15,6 +15,7 @@ import qualified Unison.ConstructorType as CT import qualified Unison.Debug as Debug import qualified Unison.HashQualified as HQ import Unison.LSP.Conversions (annToInterval) +import Unison.LSP.FileAnalysis (ppedForFile) import qualified Unison.LSP.Queries as LSPQ import Unison.LSP.Types import qualified Unison.LSP.VFS as VFS @@ -54,17 +55,17 @@ hoverInfo uri pos = markdownify <$> do symAtCursor <- VFS.identifierAtPosition uri pos ref <- LSPQ.refAtPosition uri pos - ppe <- lift $ globalPPE + pped <- lift $ ppedForFile uri case ref of LD.TypeReference (Reference.Builtin {}) -> pure (symAtCursor <> " : ") LD.TypeReference ref@(Reference.DerivedId refId) -> do nameAtCursor <- MaybeT . pure $ Name.fromText symAtCursor decl <- LSPQ.getTypeDeclaration uri refId - let typ = Text.pack . Pretty.toPlain prettyWidth . Pretty.syntaxToColor $ DeclPrinter.prettyDecl ppe ref (HQ.NameOnly nameAtCursor) decl + let typ = Text.pack . Pretty.toPlain prettyWidth . Pretty.syntaxToColor $ DeclPrinter.prettyDecl pped ref (HQ.NameOnly nameAtCursor) decl pure typ LD.TermReferent ref -> do typ <- LSPQ.getTypeOfReferent uri ref - let renderedType = Text.pack $ TypePrinter.prettyStr (Just prettyWidth) (PPED.suffixifiedPPE ppe) typ + let renderedType = Text.pack $ TypePrinter.prettyStr (Just prettyWidth) (PPED.suffixifiedPPE pped) typ pure (symAtCursor <> " : " <> renderedType) where markdownify rendered = Text.unlines ["```unison", rendered, "```"] From 46a360dacfc7270889b2c1a9f29b2c94f0e66a9e Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sat, 26 Nov 2022 12:52:44 -0600 Subject: [PATCH 010/467] Show types for literals --- .../src/Unison/Util/Relation4.hs | 3 + unison-cli/src/Unison/LSP/Hover.hs | 104 ++++++++---------- unison-cli/src/Unison/LSP/Queries.hs | 42 ++++--- 3 files changed, 76 insertions(+), 73 deletions(-) diff --git a/lib/unison-util-relation/src/Unison/Util/Relation4.hs b/lib/unison-util-relation/src/Unison/Util/Relation4.hs index 1777f8a3c..f7fc2175e 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation4.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation4.hs @@ -136,6 +136,9 @@ d12s = nubOrd . fmap (\(a, (b, _)) -> (a, b)) . toNestedList d3s :: Relation4 a b c d -> Set c d3s = Map.keysSet . d3 +d4s :: Relation4 a b c d -> Set d +d4s = Map.keysSet . d4 + -- e.g. Map.toList (d1 r) >>= \(a, r3) -> (a,) <$> Map.keys (R3.d1 r3) insert, diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 17ba873c9..e6c11397c 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -5,33 +5,25 @@ module Unison.LSP.Hover where import Control.Lens hiding (List) import Control.Monad.Reader -import qualified Data.IntervalMap.Lazy as IM -import qualified Data.Map as Map import qualified Data.Text as Text import Language.LSP.Types import Language.LSP.Types.Lens hiding (id, only, to) import qualified Unison.ABT as ABT -import qualified Unison.ConstructorType as CT -import qualified Unison.Debug as Debug import qualified Unison.HashQualified as HQ -import Unison.LSP.Conversions (annToInterval) import Unison.LSP.FileAnalysis (ppedForFile) import qualified Unison.LSP.Queries as LSPQ import Unison.LSP.Types import qualified Unison.LSP.VFS as VFS import qualified Unison.LabeledDependency as LD import qualified Unison.Name as Name +import Unison.Parser.Ann (Ann) import Unison.Prelude import qualified Unison.PrettyPrintEnvDecl as PPED import qualified Unison.Reference as Reference -import Unison.Referent (Referent) -import qualified Unison.Referent as Referent import Unison.Symbol (Symbol) import qualified Unison.Syntax.DeclPrinter as DeclPrinter -import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter import qualified Unison.Term as Term -import qualified Unison.UnisonFile as UF import qualified Unison.Util.Pretty as Pretty -- | Hover help handler @@ -52,60 +44,54 @@ hoverHandler m respond = hoverInfo :: Uri -> Position -> MaybeT Lsp Text hoverInfo uri pos = - markdownify <$> do - symAtCursor <- VFS.identifierAtPosition uri pos - ref <- LSPQ.refAtPosition uri pos - pped <- lift $ ppedForFile uri - case ref of - LD.TypeReference (Reference.Builtin {}) -> pure (symAtCursor <> " : ") - LD.TypeReference ref@(Reference.DerivedId refId) -> do - nameAtCursor <- MaybeT . pure $ Name.fromText symAtCursor - decl <- LSPQ.getTypeDeclaration uri refId - let typ = Text.pack . Pretty.toPlain prettyWidth . Pretty.syntaxToColor $ DeclPrinter.prettyDecl pped ref (HQ.NameOnly nameAtCursor) decl - pure typ - LD.TermReferent ref -> do - typ <- LSPQ.getTypeOfReferent uri ref - let renderedType = Text.pack $ TypePrinter.prettyStr (Just prettyWidth) (PPED.suffixifiedPPE pped) typ - pure (symAtCursor <> " : " <> renderedType) + markdownify <$> (hoverInfoForRef <|> hoverInfoForLiteral) where + markdownify :: Text -> Text markdownify rendered = Text.unlines ["```unison", rendered, "```"] + prettyWidth :: Pretty.Width prettyWidth = 40 + hoverInfoForRef :: MaybeT Lsp Text + hoverInfoForRef = do + symAtCursor <- VFS.identifierAtPosition uri pos + ref <- LSPQ.refAtPosition uri pos + pped <- lift $ ppedForFile uri + case ref of + LD.TypeReference (Reference.Builtin {}) -> pure (symAtCursor <> " : ") + LD.TypeReference ref@(Reference.DerivedId refId) -> do + nameAtCursor <- MaybeT . pure $ Name.fromText symAtCursor + decl <- LSPQ.getTypeDeclaration uri refId + let typ = Text.pack . Pretty.toPlain prettyWidth . Pretty.syntaxToColor $ DeclPrinter.prettyDecl pped ref (HQ.NameOnly nameAtCursor) decl + pure typ + LD.TermReferent ref -> do + typ <- LSPQ.getTypeOfReferent uri ref + let renderedType = Text.pack $ TypePrinter.prettyStr (Just prettyWidth) (PPED.suffixifiedPPE pped) typ + pure (symAtCursor <> " : " <> renderedType) + hoverInfoForLiteral :: MaybeT Lsp Text + hoverInfoForLiteral = do + LSPQ.nodeAtPosition uri pos >>= \case + Left term -> do + typ <- hoistMaybe $ builtinTypeForLiterals term + pure (": " <> typ) + Right {} -> empty -mkSubTermMap :: (Parser.Annotated a, Show a) => Map Symbol (Set a) -> UF.TypecheckedUnisonFile Symbol a -> IM.IntervalMap Position [HoverInfo] -mkSubTermMap fileDefs (UF.TypecheckedUnisonFileId {hashTermsId}) = - hashTermsId ^@.. (folded . _3 . subTerms . (reindexed ABT.annotation selfIndex) <. termHoverInfo fileDefs) - & Debug.debug Debug.LSP "Cosmos'd" - & map (\(a, info) -> IM.singleton <$> annToInterval (Parser.ann a) <*> pure [info]) - & Debug.debug Debug.LSP "Converted1" - & mapMaybe Prelude.id - & Debug.debug Debug.LSP "Converted2" - & IM.unionsWith (<>) + hoistMaybe :: Maybe a -> MaybeT Lsp a + hoistMaybe = MaybeT . pure -subTerms :: Fold (Term.Term v a) (Term.Term v a) -subTerms = - cosmosOf (to ABT.out . folded) - -data HoverInfo - = BuiltinType Text - | LocalVar Symbol - | FileDef Symbol - | Ref Referent - deriving stock (Show, Eq, Ord) - -termHoverInfo :: (Map Symbol (Set a)) -> Fold (Term.Term Symbol a) HoverInfo -termHoverInfo fileDefs = folding \term -> +-- | Get the type for term literals. +builtinTypeForLiterals :: Term.Term Symbol Ann -> Maybe Text +builtinTypeForLiterals term = case ABT.out term of ABT.Tm f -> case f of - Term.Int {} -> Just (BuiltinType "Int") - Term.Nat {} -> Just (BuiltinType "Nat") - Term.Float {} -> Just (BuiltinType "Float") - Term.Boolean {} -> Just (BuiltinType "Boolean") - Term.Text {} -> Just (BuiltinType "Text") - Term.Char {} -> Just (BuiltinType "Char") + Term.Int {} -> Just "Int" + Term.Nat {} -> Just "Nat" + Term.Float {} -> Just "Float" + Term.Boolean {} -> Just "Boolean" + Term.Text {} -> Just "Text" + Term.Char {} -> Just "Char" Term.Blank {} -> Nothing - Term.Ref ref -> Just (Ref $ Referent.Ref ref) - Term.Constructor cRef -> Just (Ref $ Referent.Con cRef CT.Data) - Term.Request cRef -> Just (Ref $ Referent.Con cRef CT.Effect) + Term.Ref {} -> Nothing + Term.Constructor {} -> Nothing + Term.Request {} -> Nothing Term.Handle {} -> Nothing Term.App {} -> Nothing Term.Ann {} -> Nothing @@ -119,8 +105,6 @@ termHoverInfo fileDefs = folding \term -> Term.Match {} -> Nothing Term.TermLink {} -> Nothing Term.TypeLink {} -> Nothing - ABT.Var v -> - case Map.lookup v fileDefs of - Just xs | not . null $ xs -> Just (FileDef v) - _ -> Just (LocalVar v) - _ -> Nothing + ABT.Var {} -> Nothing + ABT.Cycle {} -> Nothing + ABT.Abs {} -> Nothing diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index add48c275..d9f7f74ed 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -3,6 +3,7 @@ module Unison.LSP.Queries ( getTypeOfReferent, getTypeDeclaration, refAtPosition, + nodeAtPosition, ) where @@ -83,22 +84,23 @@ getTypeDeclaration fileUri refId = do -- | Returns a reference to whatever the symbol at the given position refers to. refAtPosition :: Uri -> Position -> MaybeT Lsp LabeledDependency -refAtPosition uri (lspToUPos -> pos) = do - (FileSummary {dataDeclSummary, effectDeclSummary, termSummary, testWatchSummary, exprWatchSummary}) <- getFileSummary uri - ( altMap (hoistMaybe . refInDecl pos . Right) (R3.d3s dataDeclSummary) - <|> altMap (hoistMaybe . refInDecl pos . Left) (R3.d3s effectDeclSummary) - <|> altMap findRefInTerm (R4.d3s termSummary) - <|> altMap findRefInTerm (testWatchSummary ^.. folded . _3) - <|> altMap findRefInTerm (exprWatchSummary ^.. folded . _3) - ) +refAtPosition uri pos = do + findInTermOrType <|> findInDecl where - hoistMaybe :: Maybe a -> MaybeT Lsp a - hoistMaybe = MaybeT . pure - findRefInTerm :: Term Symbol Ann -> MaybeT Lsp LabeledDependency - findRefInTerm term = do - hoistMaybe (findSmallestEnclosingNode pos term) >>= \case + findInTermOrType :: MaybeT Lsp LabeledDependency + findInTermOrType = + nodeAtPosition uri pos >>= \case Left term -> hoistMaybe $ refInTerm term Right typ -> hoistMaybe $ refInType typ + findInDecl :: MaybeT Lsp LabeledDependency + findInDecl = do + let uPos = lspToUPos pos + (FileSummary {dataDeclSummary, effectDeclSummary}) <- getFileSummary uri + ( altMap (hoistMaybe . refInDecl uPos . Right) (R3.d3s dataDeclSummary) + <|> altMap (hoistMaybe . refInDecl uPos . Left) (R3.d3s effectDeclSummary) + ) + hoistMaybe :: Maybe a -> MaybeT Lsp a + hoistMaybe = MaybeT . pure refInTerm :: (Term v a -> Maybe LabeledDependency) refInTerm term = @@ -211,3 +213,17 @@ refInDecl p (DD.asDataDecl -> dd) guard (ann `Ann.contains` p) typeNode <- findSmallestEnclosingType p typ refInType typeNode + +-- | Returns the ABT node at the provided position. +-- Does not return Decl nodes. +nodeAtPosition :: Uri -> Position -> MaybeT Lsp (Either (Term Symbol Ann) (Type Symbol Ann)) +nodeAtPosition uri (lspToUPos -> pos) = do + (FileSummary {termSummary, testWatchSummary, exprWatchSummary}) <- getFileSummary uri + ( altMap (hoistMaybe . findSmallestEnclosingNode pos) (R4.d3s termSummary) + <|> altMap (fmap Right . hoistMaybe . findSmallestEnclosingType pos) (catMaybes . Set.toList $ R4.d4s termSummary) + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) (testWatchSummary ^.. folded . _3) + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) (exprWatchSummary ^.. folded . _3) + ) + where + hoistMaybe :: Maybe a -> MaybeT Lsp a + hoistMaybe = MaybeT . pure From 77e9b8fa58c036156c8f9e4d9f5de4e33369be5c Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sat, 26 Nov 2022 13:55:30 -0600 Subject: [PATCH 011/467] Fix monoid for annotations to improve ann for type arrows --- unison-cli/src/Unison/LSP/Queries.hs | 19 +++++++++---------- unison-syntax/src/Unison/Parser/Ann.hs | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index d9f7f74ed..2572a559c 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -17,6 +17,7 @@ import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.DataDeclaration (Decl) import qualified Unison.DataDeclaration as DD +import qualified Unison.Debug as Debug import Unison.LSP.Conversions (lspToUPos) import Unison.LSP.FileAnalysis (getFileSummary) import Unison.LSP.Orphans () @@ -96,6 +97,7 @@ refAtPosition uri pos = do findInDecl = do let uPos = lspToUPos pos (FileSummary {dataDeclSummary, effectDeclSummary}) <- getFileSummary uri + Debug.debugLogM Debug.LSP "finding in decl" ( altMap (hoistMaybe . refInDecl uPos . Right) (R3.d3s dataDeclSummary) <|> altMap (hoistMaybe . refInDecl uPos . Left) (R3.d3s effectDeclSummary) ) @@ -203,16 +205,13 @@ findSmallestEnclosingType pos typ ABT.Cycle r -> findSmallestEnclosingType pos r ABT.Abs _v r -> findSmallestEnclosingType pos r -refInDecl :: Pos -> DD.Decl v Ann -> Maybe LabeledDependency -refInDecl p (DD.asDataDecl -> dd) - | not (DD.annotation dd `Ann.contains` p) = - Nothing - | otherwise = - DD.constructors' dd - & altMap \(ann, _v, typ) -> do - guard (ann `Ann.contains` p) - typeNode <- findSmallestEnclosingType p typ - refInType typeNode +refInDecl :: Pos -> DD.Decl Symbol Ann -> Maybe LabeledDependency +refInDecl p (DD.asDataDecl -> dd) = + DD.constructors' dd + & altMap \(_conNameAnn, _v, typ) -> do + typeNode <- findSmallestEnclosingType p typ + ref <- refInType typeNode + pure ref -- | Returns the ABT node at the provided position. -- Does not return Decl nodes. diff --git a/unison-syntax/src/Unison/Parser/Ann.hs b/unison-syntax/src/Unison/Parser/Ann.hs index 812680fb8..7b721b02e 100644 --- a/unison-syntax/src/Unison/Parser/Ann.hs +++ b/unison-syntax/src/Unison/Parser/Ann.hs @@ -20,7 +20,7 @@ instance Monoid Ann where mempty = External instance Semigroup Ann where - Ann s1 _ <> Ann _ e2 = Ann s1 e2 + Ann s1 e1 <> Ann s2 e2 = Ann (min s1 s2) (max e1 e2) -- If we have a concrete location from a file, use it External <> a = a a <> External = a From e8c7969430a0af2de4e68cac1b3629a1c62e2130 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Sat, 26 Nov 2022 14:26:37 -0600 Subject: [PATCH 012/467] Add docs --- lib/unison-prelude/src/Unison/Prelude.hs | 2 ++ unison-cli/src/Unison/LSP/FileAnalysis.hs | 5 ++++ unison-cli/src/Unison/LSP/Queries.hs | 34 +++++++++++++++-------- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lib/unison-prelude/src/Unison/Prelude.hs b/lib/unison-prelude/src/Unison/Prelude.hs index 8fd4a4b3f..6ed914f63 100644 --- a/lib/unison-prelude/src/Unison/Prelude.hs +++ b/lib/unison-prelude/src/Unison/Prelude.hs @@ -76,9 +76,11 @@ import UnliftIO as X (MonadUnliftIO (..), askRunInIO, askUnliftIO, try, withUnli import qualified UnliftIO import Witherable as X (filterA, forMaybe, mapMaybe, wither, witherMap) +-- | Like 'fold' but for Alternative. altSum :: (Alternative f, Foldable t) => t (f a) -> f a altSum = foldl' (<|>) empty +-- | Like 'foldMap' but for Alternative. altMap :: (Alternative f, Foldable t) => (a -> f b) -> t a -> f b altMap f = altSum . fmap f . toList diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 158f4a65c..51c6c8630 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -103,11 +103,14 @@ checkFile doc = runMaybeT $ do let fileAnalysis = FileAnalysis {diagnostics = diagnosticRanges, codeActions = codeActionRanges, fileSummary, ..} pure $ fileAnalysis +-- | If a symbol is a 'User' symbol, return (Just sym), otherwise return Nothing. assertUserSym :: Symbol -> Maybe Symbol assertUserSym sym = case sym of Symbol.Symbol _ (Var.User {}) -> Just sym _ -> Nothing +-- | Summarize the information available to us from the current state of the file. +-- See 'FileSummary' for more information. mkFileSummary :: Maybe (UF.UnisonFile Symbol Ann) -> Maybe (UF.TypecheckedUnisonFile Symbol Ann) -> Maybe FileSummary mkFileSummary parsed typechecked = case (parsed, typechecked) of (Nothing, Nothing) -> Nothing @@ -158,10 +161,12 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of & fmap (\(k, (a, b)) -> (k, a, b)) & R3.fromList +-- | Get the location of user defined definitions within the file getFileDefLocations :: Uri -> MaybeT Lsp (Map Symbol (Set Ann)) getFileDefLocations uri = do fileDefLocations <$> getFileSummary uri +-- | Compute the location of user defined definitions within the file fileDefLocations :: FileSummary -> Map Symbol (Set Ann) fileDefLocations FileSummary {dataDeclSummary, effectDeclSummary, testWatchSummary, exprWatchSummary, termSummary} = fold diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 2572a559c..a1e6c836f 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -28,6 +28,7 @@ import Unison.Lexer.Pos (Pos (..)) import Unison.Parser.Ann (Ann) import qualified Unison.Parser.Ann as Ann import Unison.Prelude +import Unison.Reference (TypeReference) import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Referent as Referent @@ -92,18 +93,20 @@ refAtPosition uri pos = do findInTermOrType = nodeAtPosition uri pos >>= \case Left term -> hoistMaybe $ refInTerm term - Right typ -> hoistMaybe $ refInType typ + Right typ -> hoistMaybe $ fmap TypeReference (refInType typ) findInDecl :: MaybeT Lsp LabeledDependency - findInDecl = do - let uPos = lspToUPos pos - (FileSummary {dataDeclSummary, effectDeclSummary}) <- getFileSummary uri - Debug.debugLogM Debug.LSP "finding in decl" - ( altMap (hoistMaybe . refInDecl uPos . Right) (R3.d3s dataDeclSummary) - <|> altMap (hoistMaybe . refInDecl uPos . Left) (R3.d3s effectDeclSummary) - ) + findInDecl = + LD.TypeReference <$> do + let uPos = lspToUPos pos + (FileSummary {dataDeclSummary, effectDeclSummary}) <- getFileSummary uri + Debug.debugLogM Debug.LSP "finding in decl" + ( altMap (hoistMaybe . refInDecl uPos . Right) (R3.d3s dataDeclSummary) + <|> altMap (hoistMaybe . refInDecl uPos . Left) (R3.d3s effectDeclSummary) + ) hoistMaybe :: Maybe a -> MaybeT Lsp a hoistMaybe = MaybeT . pure +-- | Returns the reference a given term node refers to, if any. refInTerm :: (Term v a -> Maybe LabeledDependency) refInTerm term = case ABT.out term of @@ -135,10 +138,11 @@ refInTerm term = ABT.Cycle _r -> Nothing ABT.Abs _v _r -> Nothing -refInType :: Type v a -> Maybe LabeledDependency +-- Returns the reference a given type node refers to, if any. +refInType :: Type v a -> Maybe TypeReference refInType typ = case ABT.out typ of ABT.Tm f -> case f of - Type.Ref ref -> Just (LD.TypeReference ref) + Type.Ref ref -> Just ref Type.Arrow _a _b -> Nothing Type.Effect _a _b -> Nothing Type.App _a _b -> Nothing @@ -187,6 +191,10 @@ findSmallestEnclosingNode pos term ABT.Cycle r -> findSmallestEnclosingNode pos r ABT.Abs _v r -> findSmallestEnclosingNode pos r +-- | Find the the node in a type which contains the specified position, but none of its +-- children contain that position. +-- This is helpful for finding the specific type reference of a given argument within a type arrow +-- that a position references. findSmallestEnclosingType :: Pos -> Type v Ann -> Maybe (Type v Ann) findSmallestEnclosingType pos typ | not (ABT.annotation typ `Ann.contains` pos) = Nothing @@ -205,7 +213,11 @@ findSmallestEnclosingType pos typ ABT.Cycle r -> findSmallestEnclosingType pos r ABT.Abs _v r -> findSmallestEnclosingType pos r -refInDecl :: Pos -> DD.Decl Symbol Ann -> Maybe LabeledDependency +-- | Returns the type reference the given position applies to within a Decl, if any. +-- +-- I.e. if the cursor is over a type reference within a constructor signature or ability +-- request signature, that type reference will be returned. +refInDecl :: Pos -> DD.Decl Symbol Ann -> Maybe TypeReference refInDecl p (DD.asDataDecl -> dd) = DD.constructors' dd & altMap \(_conNameAnn, _v, typ) -> do From 9ac0b47ee2d5b81e14c79ce5d3ea09ecbb9ea07d Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 28 Nov 2022 12:09:18 -0600 Subject: [PATCH 013/467] Remove debugging --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 15 ++++++++++++--- unison-cli/src/Unison/LSP/Queries.hs | 10 ++++------ unison-core/src/Unison/Term.hs | 5 +++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 51c6c8630..b1de71db0 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -56,6 +56,7 @@ import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Parser as Parser import qualified Unison.Syntax.TypePrinter as TypePrinter import Unison.Term (Term) +import qualified Unison.Term as Term import Unison.Type (Type) import qualified Unison.Typechecker.Context as Context import qualified Unison.Typechecker.TypeError as TypeError @@ -118,9 +119,9 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of let (trms, testWatches, exprWatches) = hashTermsId & ifoldMap \sym (ref, wk, trm, typ) -> case wk of - Nothing -> (Map.singleton sym (Just ref, trm, Just typ), mempty, mempty) - Just TestWatch -> (mempty, [(assertUserSym sym, Just ref, trm, Just typ)], mempty) - Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, Just typ)]) + Nothing -> (Map.singleton sym (Just ref, trm, getUserTypeAnnotation sym <|> Just typ), mempty, mempty) + Just TestWatch -> (mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)], mempty) + Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)]) in Just $ FileSummary { dataDeclSummary = map2ToR3 dataDeclarationsId', @@ -148,6 +149,14 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of exprWatchSummary = exprWatches } where + -- Gets the user provided type annotation for a term if there is one. + -- This type sig will have Ann's within the file if it exists. + getUserTypeAnnotation :: Symbol -> Maybe (Type Symbol Ann) + getUserTypeAnnotation v = do + UF.UnisonFileId {terms, watches} <- parsed + trm <- Prelude.lookup v (terms <> fold watches) + typ <- Term.getTypeAnnotation trm + pure typ termRelation :: Map Symbol (Maybe Reference.Id, Term Symbol Ann, Maybe (Type Symbol Ann)) -> Relation4 Symbol (Maybe Reference.Id) (Term Symbol Ann) (Maybe (Type Symbol Ann)) termRelation m = m diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index a1e6c836f..4062ced16 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -17,7 +17,6 @@ import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.DataDeclaration (Decl) import qualified Unison.DataDeclaration as DD -import qualified Unison.Debug as Debug import Unison.LSP.Conversions (lspToUPos) import Unison.LSP.FileAnalysis (getFileSummary) import Unison.LSP.Orphans () @@ -99,7 +98,6 @@ refAtPosition uri pos = do LD.TypeReference <$> do let uPos = lspToUPos pos (FileSummary {dataDeclSummary, effectDeclSummary}) <- getFileSummary uri - Debug.debugLogM Debug.LSP "finding in decl" ( altMap (hoistMaybe . refInDecl uPos . Right) (R3.d3s dataDeclSummary) <|> altMap (hoistMaybe . refInDecl uPos . Left) (R3.d3s effectDeclSummary) ) @@ -156,7 +154,7 @@ refInType typ = case ABT.out typ of -- | Find the the node in a term which contains the specified position, but none of its -- children contain that position. -findSmallestEnclosingNode :: Pos -> Term v Ann -> Maybe (Either (Term v Ann) (Type v Ann)) +findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (Either (Term Symbol Ann) (Type Symbol Ann)) findSmallestEnclosingNode pos term | not (ABT.annotation term `Ann.contains` pos) = Nothing | otherwise = (<|> Just (Left term)) $ do @@ -195,7 +193,7 @@ findSmallestEnclosingNode pos term -- children contain that position. -- This is helpful for finding the specific type reference of a given argument within a type arrow -- that a position references. -findSmallestEnclosingType :: Pos -> Type v Ann -> Maybe (Type v Ann) +findSmallestEnclosingType :: Pos -> Type Symbol Ann -> Maybe (Type Symbol Ann) findSmallestEnclosingType pos typ | not (ABT.annotation typ `Ann.contains` pos) = Nothing | otherwise = (<|> Just typ) $ do @@ -230,8 +228,8 @@ refInDecl p (DD.asDataDecl -> dd) = nodeAtPosition :: Uri -> Position -> MaybeT Lsp (Either (Term Symbol Ann) (Type Symbol Ann)) nodeAtPosition uri (lspToUPos -> pos) = do (FileSummary {termSummary, testWatchSummary, exprWatchSummary}) <- getFileSummary uri - ( altMap (hoistMaybe . findSmallestEnclosingNode pos) (R4.d3s termSummary) - <|> altMap (fmap Right . hoistMaybe . findSmallestEnclosingType pos) (catMaybes . Set.toList $ R4.d4s termSummary) + ( altMap (fmap Right . hoistMaybe . findSmallestEnclosingType pos) (catMaybes . Set.toList $ R4.d4s termSummary) + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) (R4.d3s termSummary) <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) (testWatchSummary ^.. folded . _3) <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) (exprWatchSummary ^.. folded . _3) ) diff --git a/unison-core/src/Unison/Term.hs b/unison-core/src/Unison/Term.hs index fbc15b0e5..b23160a4b 100644 --- a/unison-core/src/Unison/Term.hs +++ b/unison-core/src/Unison/Term.hs @@ -124,6 +124,11 @@ _TermLink = _Ctor @"TermLink" _TypeLink :: Prism' (F tv ta pa a) Reference _TypeLink = _Ctor @"TypeLink" +-- | Returns the top-level type annotation for a term if it has one. +getTypeAnnotation :: Term v a -> Maybe (Type v a) +getTypeAnnotation (ABT.Tm' (Ann _ t)) = Just t +getTypeAnnotation _ = Nothing + type IsTop = Bool -- | Like `Term v`, but with an annotation of type `a` at every level in the tree From b71625b93741879f2f5e9dcf791f6b97a2a9c233 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 28 Nov 2022 16:38:38 -0600 Subject: [PATCH 014/467] Only use parsed file --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index b1de71db0..37dc7aa25 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -115,21 +115,6 @@ assertUserSym sym = case sym of mkFileSummary :: Maybe (UF.UnisonFile Symbol Ann) -> Maybe (UF.TypecheckedUnisonFile Symbol Ann) -> Maybe FileSummary mkFileSummary parsed typechecked = case (parsed, typechecked) of (Nothing, Nothing) -> Nothing - (_, Just (UF.TypecheckedUnisonFileId {dataDeclarationsId', effectDeclarationsId', hashTermsId})) -> - let (trms, testWatches, exprWatches) = - hashTermsId & ifoldMap \sym (ref, wk, trm, typ) -> - case wk of - Nothing -> (Map.singleton sym (Just ref, trm, getUserTypeAnnotation sym <|> Just typ), mempty, mempty) - Just TestWatch -> (mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)], mempty) - Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)]) - in Just $ - FileSummary - { dataDeclSummary = map2ToR3 dataDeclarationsId', - effectDeclSummary = map2ToR3 effectDeclarationsId', - termSummary = termRelation trms, - testWatchSummary = testWatches, - exprWatchSummary = exprWatches - } (Just UF.UnisonFileId {dataDeclarationsId, effectDeclarationsId, terms, watches}, _) -> let trms = terms & foldMap \(sym, trm) -> @@ -148,6 +133,21 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of testWatchSummary = testWatches, exprWatchSummary = exprWatches } + (_, Just (UF.TypecheckedUnisonFileId {dataDeclarationsId', effectDeclarationsId', hashTermsId})) -> + let (trms, testWatches, exprWatches) = + hashTermsId & ifoldMap \sym (ref, wk, trm, typ) -> + case wk of + Nothing -> (Map.singleton sym (Just ref, trm, getUserTypeAnnotation sym <|> Just typ), mempty, mempty) + Just TestWatch -> (mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)], mempty) + Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)]) + in Just $ + FileSummary + { dataDeclSummary = map2ToR3 dataDeclarationsId', + effectDeclSummary = map2ToR3 effectDeclarationsId', + termSummary = termRelation trms, + testWatchSummary = testWatches, + exprWatchSummary = exprWatches + } where -- Gets the user provided type annotation for a term if there is one. -- This type sig will have Ann's within the file if it exists. From 3124e8a320499df372b4c7779b17316832a26a8f Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 28 Nov 2022 16:38:46 -0600 Subject: [PATCH 015/467] Revert "Only use parsed file" This reverts commit b71625b93741879f2f5e9dcf791f6b97a2a9c233. --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 37dc7aa25..b1de71db0 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -115,6 +115,21 @@ assertUserSym sym = case sym of mkFileSummary :: Maybe (UF.UnisonFile Symbol Ann) -> Maybe (UF.TypecheckedUnisonFile Symbol Ann) -> Maybe FileSummary mkFileSummary parsed typechecked = case (parsed, typechecked) of (Nothing, Nothing) -> Nothing + (_, Just (UF.TypecheckedUnisonFileId {dataDeclarationsId', effectDeclarationsId', hashTermsId})) -> + let (trms, testWatches, exprWatches) = + hashTermsId & ifoldMap \sym (ref, wk, trm, typ) -> + case wk of + Nothing -> (Map.singleton sym (Just ref, trm, getUserTypeAnnotation sym <|> Just typ), mempty, mempty) + Just TestWatch -> (mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)], mempty) + Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)]) + in Just $ + FileSummary + { dataDeclSummary = map2ToR3 dataDeclarationsId', + effectDeclSummary = map2ToR3 effectDeclarationsId', + termSummary = termRelation trms, + testWatchSummary = testWatches, + exprWatchSummary = exprWatches + } (Just UF.UnisonFileId {dataDeclarationsId, effectDeclarationsId, terms, watches}, _) -> let trms = terms & foldMap \(sym, trm) -> @@ -133,21 +148,6 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of testWatchSummary = testWatches, exprWatchSummary = exprWatches } - (_, Just (UF.TypecheckedUnisonFileId {dataDeclarationsId', effectDeclarationsId', hashTermsId})) -> - let (trms, testWatches, exprWatches) = - hashTermsId & ifoldMap \sym (ref, wk, trm, typ) -> - case wk of - Nothing -> (Map.singleton sym (Just ref, trm, getUserTypeAnnotation sym <|> Just typ), mempty, mempty) - Just TestWatch -> (mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)], mempty) - Just _ -> (mempty, mempty, [(assertUserSym sym, Just ref, trm, getUserTypeAnnotation sym <|> Just typ)]) - in Just $ - FileSummary - { dataDeclSummary = map2ToR3 dataDeclarationsId', - effectDeclSummary = map2ToR3 effectDeclarationsId', - termSummary = termRelation trms, - testWatchSummary = testWatches, - exprWatchSummary = exprWatches - } where -- Gets the user provided type annotation for a term if there is one. -- This type sig will have Ann's within the file if it exists. From 877aa7f9012aa0973993da51e4777ba80dfd5714 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Tue, 6 Dec 2022 15:34:52 -0500 Subject: [PATCH 016/467] use Cli monad in sync http functions --- .../src/Unison/Codebase/Editor/HandleInput.hs | 66 +- .../src/Unison/CommandLine/OutputMessages.hs | 4 +- unison-cli/src/Unison/Share/Sync.hs | 618 +++++++++++------- unison-cli/src/Unison/Share/Sync/Types.hs | 18 +- 4 files changed, 406 insertions(+), 300 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index be148c1bc..df462b89b 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1866,50 +1866,46 @@ handlePushToUnisonShare remote@WriteShareRemotePath {server, repo, path = remote let sharePath = Share.Path (repo Nel.:| pathToSegments remotePath) ensureAuthenticatedWithCodeserver codeserver - Cli.Env {authHTTPClient, codebase} <- ask - -- doesn't handle the case where a non-existent path is supplied localCausalHash <- Cli.runTransaction (Ops.loadCausalHashAtPath (pathToSegments (Path.unabsolute localPath))) & onNothingM do Cli.returnEarly (EmptyPush . Path.absoluteToPath' $ localPath) - let checkAndSetPush :: Maybe Hash32 -> IO (Either (Share.SyncError Share.CheckAndSetPushError) ()) + let checkAndSetPush :: Maybe Hash32 -> Cli () checkAndSetPush remoteHash = - withEntitiesUploadedProgressCallback \uploadedCallback -> - if Just (Hash32.fromHash (unCausalHash localCausalHash)) == remoteHash - then pure (Right ()) - else - Share.checkAndSetPush - authHTTPClient - baseURL - (Codebase.withConnectionIO codebase) - sharePath - remoteHash - localCausalHash - uploadedCallback + when (Just (Hash32.fromHash (unCausalHash localCausalHash)) /= remoteHash) do + Cli.with withEntitiesUploadedProgressCallback \uploadedCallback -> do + let push = + Share.checkAndSetPush + baseURL + sharePath + remoteHash + localCausalHash + uploadedCallback + push & onLeftM (pushError ShareErrorCheckAndSetPush) case behavior of PushBehavior.ForcePush -> do maybeHashJwt <- - Cli.ioE (Share.getCausalHashByPath authHTTPClient baseURL sharePath) \err -> - Cli.returnEarly (Output.ShareError (ShareErrorGetCausalHashByPath err)) - Cli.ioE (checkAndSetPush (Share.hashJWTHash <$> maybeHashJwt)) (pushError ShareErrorCheckAndSetPush) + Share.getCausalHashByPath baseURL sharePath & onLeftM \err0 -> + (Cli.returnEarly . Output.ShareError) case err0 of + Share.SyncError err -> ShareErrorGetCausalHashByPath err + Share.TransportError err -> ShareErrorTransport err + checkAndSetPush (Share.hashJWTHash <$> maybeHashJwt) Cli.respond (ViewOnShare remote) PushBehavior.RequireEmpty -> do - Cli.ioE (checkAndSetPush Nothing) (pushError ShareErrorCheckAndSetPush) + checkAndSetPush Nothing Cli.respond (ViewOnShare remote) PushBehavior.RequireNonEmpty -> do - let push :: IO (Either (Share.SyncError Share.FastForwardPushError) ()) - push = do - withEntitiesUploadedProgressCallback \uploadedCallback -> + let push :: Cli (Either (Share.SyncError Share.FastForwardPushError) ()) + push = + Cli.with withEntitiesUploadedProgressCallback \uploadedCallback -> Share.fastForwardPush - authHTTPClient baseURL - (Codebase.withConnectionIO codebase) sharePath localCausalHash uploadedCallback - Cli.ioE push (pushError ShareErrorFastForwardPush) + push & onLeftM (pushError ShareErrorFastForwardPush) Cli.respond (ViewOnShare remote) where pathToSegments :: Path -> [Text] @@ -2155,21 +2151,13 @@ importRemoteShareBranch rrn@(ReadShareRemoteNamespace {server, repo, path}) = do -- Auto-login to share if pulling from a non-public path when (not $ RemoteRepo.isPublic rrn) $ ensureAuthenticatedWithCodeserver codeserver let shareFlavoredPath = Share.Path (repo Nel.:| coerce @[NameSegment] @[Text] (Path.toList path)) - Cli.Env {authHTTPClient, codebase} <- ask - let pull :: IO (Either (Share.SyncError Share.PullError) CausalHash) - pull = - withEntitiesDownloadedProgressCallback \downloadedCallback -> - Share.pull - authHTTPClient - baseURL - (Codebase.withConnectionIO codebase) - shareFlavoredPath - downloadedCallback + Cli.Env {codebase} <- ask causalHash <- - Cli.ioE pull \err0 -> - (Cli.returnEarly . Output.ShareError) case err0 of - Share.SyncError err -> Output.ShareErrorPull err - Share.TransportError err -> Output.ShareErrorTransport err + Cli.with withEntitiesDownloadedProgressCallback \downloadedCallback -> + Share.pull baseURL shareFlavoredPath downloadedCallback & onLeftM \err0 -> + (Cli.returnEarly . Output.ShareError) case err0 of + Share.SyncError err -> Output.ShareErrorPull err + Share.TransportError err -> Output.ShareErrorTransport err liftIO (Codebase.getBranchForHash codebase (Cv.causalHash2to1 causalHash)) & onNothingM do error $ reportBug "E412939" "`pull` \"succeeded\", but I can't find the result in the codebase. (This is a bug.)" where diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index cd0a2a7ca..0c5fa3452 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -1724,9 +1724,9 @@ notifyUser dir o = case o of (Share.FastForwardPushErrorNoWritePermission sharePath) -> noWritePermission sharePath (Share.FastForwardPushErrorServerMissingDependencies hashes) -> missingDependencies hashes ShareErrorPull e -> case e of - (Share.PullErrorGetCausalHashByPath err) -> handleGetCausalHashByPathError err - (Share.PullErrorNoHistoryAtPath sharePath) -> + Share.PullErrorNoHistoryAtPath sharePath -> P.wrap $ P.text "The server didn't find anything at" <> prettySharePath sharePath + Share.PullErrorNoReadPermission sharePath -> noReadPermission sharePath ShareErrorGetCausalHashByPath err -> handleGetCausalHashByPathError err ShareErrorTransport te -> case te of DecodeFailure msg resp -> diff --git a/unison-cli/src/Unison/Share/Sync.hs b/unison-cli/src/Unison/Share/Sync.hs index 14b00ed31..306253cf6 100644 --- a/unison-cli/src/Unison/Share/Sync.hs +++ b/unison-cli/src/Unison/Share/Sync.hs @@ -2,9 +2,7 @@ {-# LANGUAGE TypeOperators #-} module Unison.Share.Sync - ( -- * High-level API - - -- ** Get causal hash by path + ( -- ** Get causal hash by path getCausalHashByPath, GetCausalHashByPathError (..), @@ -22,6 +20,7 @@ where import Control.Concurrent.STM import Control.Monad.Except +import Control.Monad.Reader (ask) import Control.Monad.Trans.Reader (ReaderT, runReaderT) import qualified Control.Monad.Trans.Reader as Reader import qualified Data.Foldable as Foldable (find) @@ -52,6 +51,9 @@ import U.Codebase.Sqlite.V2.HashHandle (v2HashHandle) import U.Util.Hash32 (Hash32) import Unison.Auth.HTTPClient (AuthenticatedHttpClient) import qualified Unison.Auth.HTTPClient as Auth +import Unison.Cli.Monad (Cli) +import qualified Unison.Cli.Monad as Cli +import qualified Unison.Codebase as Codebase import qualified Unison.Debug as Debug import Unison.Prelude import Unison.Share.Sync.Types @@ -60,8 +62,6 @@ import qualified Unison.Sync.API as Share (API) import Unison.Sync.Common (causalHashToHash32, entityToTempEntity, expectEntity, hash32ToCausalHash) import qualified Unison.Sync.Types as Share import Unison.Util.Monoid (foldMapM) -import qualified UnliftIO -import UnliftIO.Exception (throwIO) ------------------------------------------------------------------------------------------------------------------------ -- Pile of constants @@ -83,12 +83,8 @@ maxSimultaneousPushWorkers = 5 -- This flavor of push takes the expected state of the server, and the desired state we want to set; if our expectation -- is off, we won't proceed with the push. checkAndSetPush :: - -- | The HTTP client to use for Unison Share requests. - AuthenticatedHttpClient -> -- | The Unison Share URL. BaseUrl -> - -- | SQLite-connection-making function, for writing entities we pull. - (forall a. (Sqlite.Connection -> IO a) -> IO a) -> -- | The repo+path to push to. Share.Path -> -- | The hash that we expect this repo+path to be at on Unison Share. If not, we'll get back a hash mismatch error. @@ -98,42 +94,54 @@ checkAndSetPush :: CausalHash -> -- | Callback that's given a number of entities we just uploaded. (Int -> IO ()) -> - IO (Either (SyncError CheckAndSetPushError) ()) -checkAndSetPush httpClient unisonShareUrl connect path expectedHash causalHash uploadedCallback = catchSyncErrors do - -- Maybe the server already has this causal; try just setting its remote path. Commonly, it will respond that it needs - -- this causal (UpdatePathMissingDependencies). - updatePath >>= \case - Share.UpdatePathSuccess -> pure (Right ()) - Share.UpdatePathHashMismatch mismatch -> pure (Left (CheckAndSetPushErrorHashMismatch mismatch)) - Share.UpdatePathMissingDependencies (Share.NeedDependencies dependencies) -> do - -- Upload the causal and all of its dependencies. - uploadEntities httpClient unisonShareUrl connect (Share.pathRepoName path) dependencies uploadedCallback >>= \case - False -> pure (Left (CheckAndSetPushErrorNoWritePermission path)) - True -> - -- After uploading the causal and all of its dependencies, try setting the remote path again. - updatePath <&> \case - Share.UpdatePathSuccess -> Right () - -- Between the initial updatePath attempt and this one, someone else managed to update the path. That's ok; - -- we still managed to upload our causal, but the push has indeed failed overall. - Share.UpdatePathHashMismatch mismatch -> Left (CheckAndSetPushErrorHashMismatch mismatch) - -- Unexpected, but possible: we thought we uploaded all we needed to, yet the server still won't accept our - -- causal. Bug in the client because we didn't upload enough? Bug in the server because we weren't told to - -- upload some dependency? Who knows. - Share.UpdatePathMissingDependencies (Share.NeedDependencies dependencies) -> - Left (CheckAndSetPushErrorServerMissingDependencies dependencies) - Share.UpdatePathNoWritePermission _ -> Left (CheckAndSetPushErrorNoWritePermission path) - Share.UpdatePathNoWritePermission _ -> pure (Left (CheckAndSetPushErrorNoWritePermission path)) - where - updatePath :: IO Share.UpdatePathResponse - updatePath = - httpUpdatePath - httpClient - unisonShareUrl - Share.UpdatePathRequest - { path, - expectedHash, - newHash = causalHashToHash32 causalHash - } + Cli (Either (SyncError CheckAndSetPushError) ()) +checkAndSetPush unisonShareUrl path expectedHash causalHash uploadedCallback = do + Cli.Env {authHTTPClient} <- ask + + Cli.label \done -> do + let failed :: SyncError CheckAndSetPushError -> Cli void + failed = done . Left + + let updatePath :: Cli Share.UpdatePathResponse + updatePath = do + liftIO request & onLeftM \err -> failed (TransportError err) + where + request :: IO (Either CodeserverTransportError Share.UpdatePathResponse) + request = + httpUpdatePath + authHTTPClient + unisonShareUrl + Share.UpdatePathRequest + { path, + expectedHash, + newHash = causalHashToHash32 causalHash + } + + -- Maybe the server already has this causal; try just setting its remote path. Commonly, it will respond that it + -- needs this causal (UpdatePathMissingDependencies). + updatePath >>= \case + Share.UpdatePathSuccess -> pure (Right ()) + Share.UpdatePathHashMismatch mismatch -> pure (Left (SyncError (CheckAndSetPushErrorHashMismatch mismatch))) + Share.UpdatePathMissingDependencies (Share.NeedDependencies dependencies) -> do + -- Upload the causal and all of its dependencies. + uploadEntities unisonShareUrl (Share.pathRepoName path) dependencies uploadedCallback & onLeftM \err -> + failed $ + err <&> \case + UploadEntitiesNoWritePermission -> CheckAndSetPushErrorNoWritePermission path + + -- After uploading the causal and all of its dependencies, try setting the remote path again. + updatePath >>= \case + Share.UpdatePathSuccess -> pure (Right ()) + -- Between the initial updatePath attempt and this one, someone else managed to update the path. That's ok; + -- we still managed to upload our causal, but the push has indeed failed overall. + Share.UpdatePathHashMismatch mismatch -> failed (SyncError (CheckAndSetPushErrorHashMismatch mismatch)) + -- Unexpected, but possible: we thought we uploaded all we needed to, yet the server still won't accept our + -- causal. Bug in the client because we didn't upload enough? Bug in the server because we weren't told to + -- upload some dependency? Who knows. + Share.UpdatePathMissingDependencies (Share.NeedDependencies dependencies) -> + failed (SyncError (CheckAndSetPushErrorServerMissingDependencies dependencies)) + Share.UpdatePathNoWritePermission _ -> failed (SyncError (CheckAndSetPushErrorNoWritePermission path)) + Share.UpdatePathNoWritePermission _ -> failed (SyncError (CheckAndSetPushErrorNoWritePermission path)) -- | Perform a fast-forward push (initially of just a causal hash, but ultimately all of its dependencies that the -- server is missing, too) to Unison Share. @@ -141,86 +149,105 @@ checkAndSetPush httpClient unisonShareUrl connect path expectedHash causalHash u -- This flavor of push provides the server with a chain of causal hashes leading from its current state to our desired -- state. fastForwardPush :: - -- | The HTTP client to use for Unison Share requests. - AuthenticatedHttpClient -> -- | The Unison Share URL. BaseUrl -> - -- | SQLite-connection-making function, for writing entities we pull. - (forall a. (Sqlite.Connection -> IO a) -> IO a) -> -- | The repo+path to push to. Share.Path -> -- | The hash of our local causal to push. CausalHash -> -- | Callback that's given a number of entities we just uploaded. (Int -> IO ()) -> - IO (Either (SyncError FastForwardPushError) ()) -fastForwardPush httpClient unisonShareUrl connect path localHeadHash uploadedCallback = catchSyncErrors do - getCausalHashByPath httpClient unisonShareUrl path >>= \case - Left (GetCausalHashByPathErrorNoReadPermission _) -> pure (Left (FastForwardPushErrorNoReadPermission path)) - Right Nothing -> pure (Left (FastForwardPushErrorNoHistory path)) - Right (Just (Share.hashJWTHash -> remoteHeadHash)) -> do - let doLoadCausalSpineBetween = do - -- (Temporary?) optimization - perform the "is ancestor?" check within sqlite before reconstructing the - -- actual path. - let isBefore :: Sqlite.Transaction Bool - isBefore = do - maybeHashIds <- - runMaybeT $ - (,) - <$> MaybeT (Q.loadCausalHashIdByCausalHash (hash32ToCausalHash remoteHeadHash)) - <*> MaybeT (Q.loadCausalHashIdByCausalHash localHeadHash) - case maybeHashIds of - Nothing -> pure False - Just (remoteHeadHashId, localHeadHashId) -> Q.before remoteHeadHashId localHeadHashId - isBefore >>= \case - False -> pure Nothing - True -> loadCausalSpineBetween remoteHeadHash (causalHashToHash32 localHeadHash) - (connect \conn -> Sqlite.runTransaction conn doLoadCausalSpineBetween) >>= \case + Cli (Either (SyncError FastForwardPushError) ()) +fastForwardPush unisonShareUrl path localHeadHash uploadedCallback = do + Cli.label \done -> do + let succeeded :: Cli void + succeeded = + done (Right ()) + + let failed :: SyncError FastForwardPushError -> Cli void + failed = done . Left + + remoteHeadHash <- + getCausalHashByPath unisonShareUrl path >>= \case + Left (TransportError err) -> failed (TransportError err) + Left (SyncError (GetCausalHashByPathErrorNoReadPermission _)) -> + failed (SyncError (FastForwardPushErrorNoReadPermission path)) + Right Nothing -> failed (SyncError (FastForwardPushErrorNoHistory path)) + Right (Just remoteHeadHash) -> pure (Share.hashJWTHash remoteHeadHash) + + let doLoadCausalSpineBetween = do + -- (Temporary?) optimization - perform the "is ancestor?" check within sqlite before reconstructing the + -- actual path. + let isBefore :: Sqlite.Transaction Bool + isBefore = do + maybeHashIds <- + runMaybeT $ + (,) + <$> MaybeT (Q.loadCausalHashIdByCausalHash (hash32ToCausalHash remoteHeadHash)) + <*> MaybeT (Q.loadCausalHashIdByCausalHash localHeadHash) + case maybeHashIds of + Nothing -> pure False + Just (remoteHeadHashId, localHeadHashId) -> Q.before remoteHeadHashId localHeadHashId + isBefore >>= \case + False -> pure Nothing + True -> loadCausalSpineBetween remoteHeadHash (causalHashToHash32 localHeadHash) + + let doUpload :: List.NonEmpty CausalHash -> Cli () + -- Maybe we could save round trips here by including the tail (or the head *and* the tail) as "extra hashes", + -- but we don't have that API yet. So, we only upload the head causal entity (which we don't even know for sure + -- the server doesn't have yet), and will (eventually) end up uploading the casuals in the tail that the server + -- needs. + doUpload (headHash :| _tailHashes) = do + request & onLeftM \err -> + failed $ + err <&> \case + UploadEntitiesNoWritePermission -> (FastForwardPushErrorNoWritePermission path) + where + request = + uploadEntities + unisonShareUrl + (Share.pathRepoName path) + (NESet.singleton (causalHashToHash32 headHash)) + uploadedCallback + + localInnerHashes <- + Cli.runTransaction doLoadCausalSpineBetween >>= \case -- After getting the remote causal hash, we can tell from a local computation that this wouldn't be a -- fast-forward push, so we don't bother trying - just report the error now. - Nothing -> pure (Left (FastForwardPushErrorNotFastForward path)) + Nothing -> failed (SyncError (FastForwardPushErrorNotFastForward path)) -- The path from remote-to-local, excluding local, was empty. So, remote == local; there's nothing to push. - Just [] -> pure (Right ()) - Just (_ : localInnerHashes0) -> do - -- drop remote hash - let localInnerHashes = map hash32ToCausalHash localInnerHashes0 - doUpload (localHeadHash :| localInnerHashes) >>= \case - False -> pure (Left (FastForwardPushErrorNoWritePermission path)) - True -> do - let doFastForwardPath = - httpFastForwardPath - httpClient - unisonShareUrl - Share.FastForwardPathRequest - { expectedHash = remoteHeadHash, - hashes = - causalHashToHash32 <$> List.NonEmpty.fromList (localInnerHashes ++ [localHeadHash]), - path - } - doFastForwardPath <&> \case - Share.FastForwardPathSuccess -> Right () - Share.FastForwardPathMissingDependencies (Share.NeedDependencies dependencies) -> - Left (FastForwardPushErrorServerMissingDependencies dependencies) - -- Weird: someone must have force-pushed no history here, or something. We observed a history at - -- this path but moments ago! - Share.FastForwardPathNoHistory -> Left (FastForwardPushErrorNoHistory path) - Share.FastForwardPathNoWritePermission _ -> Left (FastForwardPushErrorNoWritePermission path) - Share.FastForwardPathNotFastForward _ -> Left (FastForwardPushErrorNotFastForward path) - Share.FastForwardPathInvalidParentage (Share.InvalidParentage parent child) -> - Left (FastForwardPushInvalidParentage parent child) - where - doUpload :: List.NonEmpty CausalHash -> IO Bool - -- Maybe we could save round trips here by including the tail (or the head *and* the tail) as "extra hashes", but we - -- don't have that API yet. So, we only upload the head causal entity (which we don't even know for sure the server - -- doesn't have yet), and will (eventually) end up uploading the casuals in the tail that the server needs. - doUpload (headHash :| _tailHashes) = - uploadEntities - httpClient - unisonShareUrl - connect - (Share.pathRepoName path) - (NESet.singleton (causalHashToHash32 headHash)) - uploadedCallback + Just [] -> succeeded + -- drop remote hash + Just (_ : localInnerHashes) -> pure (map hash32ToCausalHash localInnerHashes) + + doUpload (localHeadHash :| localInnerHashes) + + let doFastForwardPath :: Cli Share.FastForwardPathResponse + doFastForwardPath = do + Cli.Env {authHTTPClient} <- ask + let request = + httpFastForwardPath + authHTTPClient + unisonShareUrl + Share.FastForwardPathRequest + { expectedHash = remoteHeadHash, + hashes = + causalHashToHash32 <$> List.NonEmpty.fromList (localInnerHashes ++ [localHeadHash]), + path + } + liftIO request & onLeftM \err -> failed (TransportError err) + + doFastForwardPath >>= \case + Share.FastForwardPathSuccess -> succeeded + Share.FastForwardPathMissingDependencies (Share.NeedDependencies dependencies) -> + failed (SyncError (FastForwardPushErrorServerMissingDependencies dependencies)) + -- Weird: someone must have force-pushed no history here, or something. We observed a history at + -- this path but moments ago! + Share.FastForwardPathNoHistory -> failed (SyncError (FastForwardPushErrorNoHistory path)) + Share.FastForwardPathNoWritePermission _ -> failed (SyncError (FastForwardPushErrorNoWritePermission path)) + Share.FastForwardPathNotFastForward _ -> failed (SyncError (FastForwardPushErrorNotFastForward path)) + Share.FastForwardPathInvalidParentage (Share.InvalidParentage parent child) -> + failed (SyncError (FastForwardPushInvalidParentage parent child)) -- Return a list (in oldest-to-newest order) of hashes along the causal spine that connects the given arguments, -- excluding the newest hash (second argument). @@ -356,55 +383,82 @@ dagbfs goal children = ------------------------------------------------------------------------------------------------------------------------ -- Pull +data DownloadEntitiesError + = DownloadEntitiesNoReadPermission + pull :: - -- | The HTTP client to use for Unison Share requests. - AuthenticatedHttpClient -> -- | The Unison Share URL. BaseUrl -> - -- | SQLite-connection-making function, for writing entities we pull. - (forall a. (Sqlite.Connection -> IO a) -> IO a) -> -- | The repo+path to pull from. Share.Path -> -- | Callback that's given a number of entities we just downloaded. (Int -> IO ()) -> - IO (Either (SyncError PullError) CausalHash) -pull httpClient unisonShareUrl connect repoPath downloadedCallback = catchSyncErrors do - getCausalHashByPath httpClient unisonShareUrl repoPath >>= \case - Left err -> pure (Left (PullErrorGetCausalHashByPath err)) - -- There's nothing at the remote path, so there's no causal to pull. - Right Nothing -> pure (Left (PullErrorNoHistoryAtPath repoPath)) - Right (Just hashJwt) -> do - let hash = Share.hashJWTHash hashJwt - maybeTempEntities <- - connect \conn -> - Sqlite.runTransaction conn (Q.entityLocation hash) >>= \case - Just Q.EntityInMainStorage -> pure Nothing - Just Q.EntityInTempStorage -> pure (Just (NESet.singleton hash)) - Nothing -> do - Share.DownloadEntitiesSuccess entities <- + Cli (Either (SyncError PullError) CausalHash) +pull unisonShareUrl repoPath downloadedCallback = do + Cli.Env {authHTTPClient, codebase} <- ask + + Cli.label \done -> do + let failed :: SyncError PullError -> Cli void + failed = done . Left + + hashJwt <- + getCausalHashByPath unisonShareUrl repoPath >>= \case + Left err -> failed (getCausalHashByPathErrorToPullError <$> err) + -- There's nothing at the remote path, so there's no causal to pull. + Right Nothing -> failed (SyncError (PullErrorNoHistoryAtPath repoPath)) + Right (Just hashJwt) -> pure hashJwt + + let hash = Share.hashJWTHash hashJwt + + maybeTempEntities <- + Cli.runTransaction (Q.entityLocation hash) >>= \case + Just Q.EntityInMainStorage -> pure Nothing + Just Q.EntityInTempStorage -> pure (Just (NESet.singleton hash)) + Nothing -> do + let request = httpDownloadEntities - httpClient + authHTTPClient unisonShareUrl Share.DownloadEntitiesRequest {repoName, hashes = NESet.singleton hashJwt} - tempEntities <- insertEntities conn entities - downloadedCallback 1 - pure (NESet.nonEmptySet tempEntities) - whenJust maybeTempEntities \tempEntities -> - completeTempEntities - httpClient - unisonShareUrl - connect - repoName - downloadedCallback - tempEntities - -- Since we may have just inserted and then deleted many temp entities, we attempt to recover some disk space by - -- vacuuming after each pull. If the vacuum fails due to another open transaction on this connection, that's ok, - -- we'll try vacuuming again next pull. - _success <- connect Sqlite.vacuum - pure (Right (hash32ToCausalHash hash)) + entities <- + liftIO request >>= \case + Left err -> failed (TransportError err) + Right (Share.DownloadEntitiesNoReadPermission _) -> + failed (SyncError (PullErrorNoReadPermission repoPath)) + Right (Share.DownloadEntitiesSuccess entities) -> pure entities + tempEntities <- Cli.runTransaction (insertEntities entities) + liftIO (downloadedCallback 1) + pure (NESet.nonEmptySet tempEntities) + + whenJust maybeTempEntities \tempEntities -> do + let doCompleteTempEntities = + completeTempEntities + authHTTPClient + unisonShareUrl + ( \action -> + Codebase.withConnection codebase \conn -> + action (Sqlite.runTransaction conn) + ) + repoName + downloadedCallback + tempEntities + liftIO doCompleteTempEntities & onLeftM \err -> + failed $ + err <&> \case + DownloadEntitiesNoReadPermission -> PullErrorNoReadPermission repoPath + + -- Since we may have just inserted and then deleted many temp entities, we attempt to recover some disk space by + -- vacuuming after each pull. If the vacuum fails due to another open transaction on this connection, that's ok, + -- we'll try vacuuming again next pull. + _success <- liftIO (Codebase.withConnection codebase Sqlite.vacuum) + pure (Right (hash32ToCausalHash hash)) where repoName = Share.pathRepoName repoPath +getCausalHashByPathErrorToPullError :: GetCausalHashByPathError -> PullError +getCausalHashByPathErrorToPullError = \case + GetCausalHashByPathErrorNoReadPermission path -> PullErrorNoReadPermission path + type WorkerCount = TVar Int @@ -423,20 +477,21 @@ recordNotWorking sem = -- What the dispatcher is to do data DispatcherJob = DispatcherForkWorker (NESet Share.HashJWT) + | DispatcherReturnEarlyBecauseDownloaderFailed (SyncError DownloadEntitiesError) | DispatcherDone --- | Finish downloading entities from Unison Share. Returns the total number of entities downloaded. +-- | Finish downloading entities from Unison Share (or return the first failure to download something). -- -- Precondition: the entities were *already* downloaded at some point in the past, and are now sitting in the -- `temp_entity` table, waiting for their dependencies to arrive so they can be flushed to main storage. completeTempEntities :: AuthenticatedHttpClient -> BaseUrl -> - (forall a. (Sqlite.Connection -> IO a) -> IO a) -> + (forall a. ((forall x. Sqlite.Transaction x -> IO x) -> IO a) -> IO a) -> Share.RepoName -> (Int -> IO ()) -> NESet Hash32 -> - IO () + IO (Either (SyncError DownloadEntitiesError) ()) completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallback initialNewTempEntities = do -- The set of hashes we still need to download hashesVar <- newTVarIO Set.empty @@ -453,34 +508,43 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba -- How many workers (downloader / inserter / elaborator) are currently doing stuff. workerCount <- newWorkerCount + -- The first download error seen by a downloader, if any. + downloaderFailedVar <- newEmptyTMVarIO + -- Kick off the cycle of inserter->elaborator->dispatcher->downloader by giving the elaborator something to do atomically (writeTQueue newTempEntitiesQueue (Set.empty, Just initialNewTempEntities)) Ki.scoped \scope -> do Ki.fork_ scope (inserter entitiesQueue newTempEntitiesQueue workerCount) Ki.fork_ scope (elaborator hashesVar uninsertedHashesVar newTempEntitiesQueue workerCount) - dispatcher hashesVar uninsertedHashesVar entitiesQueue newTempEntitiesQueue workerCount + dispatcher hashesVar uninsertedHashesVar entitiesQueue newTempEntitiesQueue workerCount downloaderFailedVar where -- Dispatcher thread: "dequeue" from `hashesVar`, fork one-shot downloaders. -- - -- We stop when all of the following are true: + -- We stop when either all of the following are true: -- -- - There are no outstanding workers (downloaders, inserter, elaboraror) -- - The inserter thread doesn't have any outstanding work enqueued (in `entitiesQueue`) -- - The elaborator thread doesn't have any outstanding work enqueued (in `newTempEntitiesQueue`) + -- + -- Or: + -- + -- - Some downloader failed to download something dispatcher :: TVar (Set Share.HashJWT) -> TVar (Set Share.HashJWT) -> TQueue (NESet Share.HashJWT, NEMap Hash32 (Share.Entity Text Hash32 Share.HashJWT)) -> TQueue (Set Share.HashJWT, Maybe (NESet Hash32)) -> WorkerCount -> - IO () - dispatcher hashesVar uninsertedHashesVar entitiesQueue newTempEntitiesQueue workerCount = + TMVar (SyncError DownloadEntitiesError) -> + IO (Either (SyncError DownloadEntitiesError) ()) + dispatcher hashesVar uninsertedHashesVar entitiesQueue newTempEntitiesQueue workerCount downloaderFailedVar = Ki.scoped \scope -> - let loop :: IO () + let loop :: IO (Either (SyncError DownloadEntitiesError) ()) loop = - atomically (dispatchWorkMode <|> checkIfDoneMode) >>= \case - DispatcherDone -> pure () + atomically (checkIfDownloaderFailedMode <|> dispatchWorkMode <|> checkIfDoneMode) >>= \case + DispatcherDone -> pure (Right ()) + DispatcherReturnEarlyBecauseDownloaderFailed err -> pure (Left err) DispatcherForkWorker hashes -> do atomically do -- Limit number of simultaneous downloaders (plus 2, for inserter and elaborator) @@ -491,10 +555,17 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba -- nothing more for the dispatcher to do, when in fact a downloader thread just hasn't made it as -- far as recording its own existence recordWorking workerCount - _ <- Ki.fork @() scope (downloader entitiesQueue workerCount hashes) + _ <- + Ki.fork @() scope do + downloader entitiesQueue workerCount hashes & onLeftM \err -> + void (atomically (tryPutTMVar downloaderFailedVar err)) loop in loop where + checkIfDownloaderFailedMode :: STM DispatcherJob + checkIfDownloaderFailedMode = + DispatcherReturnEarlyBecauseDownloaderFailed <$> readTMVar downloaderFailedVar + dispatchWorkMode :: STM DispatcherJob dispatchWorkMode = do hashes <- readTVar hashesVar @@ -513,22 +584,26 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba isEmptyTQueue newTempEntitiesQueue >>= check pure DispatcherDone - -- Downloader thread: download entities, enqueue to `entitiesQueue` + -- Downloader thread: download entities, (if successful) enqueue to `entitiesQueue` downloader :: TQueue (NESet Share.HashJWT, NEMap Hash32 (Share.Entity Text Hash32 Share.HashJWT)) -> WorkerCount -> NESet Share.HashJWT -> - IO () + IO (Either (SyncError DownloadEntitiesError) ()) downloader entitiesQueue workerCount hashes = do - Share.DownloadEntitiesSuccess entities <- - httpDownloadEntities - httpClient - unisonShareUrl - Share.DownloadEntitiesRequest {repoName, hashes} - downloadedCallback (NESet.size hashes) - atomically do - writeTQueue entitiesQueue (hashes, entities) - recordNotWorking workerCount + httpDownloadEntities httpClient unisonShareUrl Share.DownloadEntitiesRequest {repoName, hashes} >>= \case + Left err -> do + atomically (recordNotWorking workerCount) + pure (Left (TransportError err)) + Right (Share.DownloadEntitiesNoReadPermission _) -> do + atomically (recordNotWorking workerCount) + pure (Left (SyncError DownloadEntitiesNoReadPermission)) + Right (Share.DownloadEntitiesSuccess entities) -> do + downloadedCallback (NESet.size hashes) + atomically do + writeTQueue entitiesQueue (hashes, entities) + recordNotWorking workerCount + pure (Right ()) -- Inserter thread: dequeue from `entitiesQueue`, insert entities, enqueue to `newTempEntitiesQueue` inserter :: @@ -537,7 +612,7 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba WorkerCount -> IO Void inserter entitiesQueue newTempEntitiesQueue workerCount = - connect \conn -> + connect \runTransaction -> forever do (hashJwts, entities) <- atomically do @@ -545,7 +620,7 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba recordWorking workerCount pure entities newTempEntities0 <- - Sqlite.runTransaction conn do + runTransaction do NEMap.toList entities & foldMapM \(hash, entity) -> upsertEntitySomewhere hash entity <&> \case Q.EntityInMainStorage -> Set.empty @@ -562,7 +637,7 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba WorkerCount -> IO Void elaborator hashesVar uninsertedHashesVar newTempEntitiesQueue workerCount = - connect \conn -> + connect \runTransaction -> forever do maybeNewTempEntities <- atomically do @@ -580,7 +655,7 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba recordWorking workerCount pure (Just newTempEntities) whenJust maybeNewTempEntities \newTempEntities -> do - newElaboratedHashes <- Sqlite.runTransaction conn (elaborateHashes newTempEntities) + newElaboratedHashes <- runTransaction (elaborateHashes newTempEntities) atomically do uninsertedHashes <- readTVar uninsertedHashesVar hashes0 <- readTVar hashesVar @@ -589,85 +664,99 @@ completeTempEntities httpClient unisonShareUrl connect repoName downloadedCallba -- | Insert entities into the database, and return the subset that went into temp storage (`temp_entitiy`) rather than -- of main storage (`object` / `causal`) due to missing dependencies. -insertEntities :: Sqlite.Connection -> NEMap Hash32 (Share.Entity Text Hash32 Share.HashJWT) -> IO (Set Hash32) -insertEntities conn entities = - Sqlite.runTransaction conn do - NEMap.toList entities & foldMapM \(hash, entity) -> - upsertEntitySomewhere hash entity <&> \case - Q.EntityInMainStorage -> Set.empty - Q.EntityInTempStorage -> Set.singleton hash +insertEntities :: NEMap Hash32 (Share.Entity Text Hash32 Share.HashJWT) -> Sqlite.Transaction (Set Hash32) +insertEntities entities = + NEMap.toList entities & foldMapM \(hash, entity) -> + upsertEntitySomewhere hash entity <&> \case + Q.EntityInMainStorage -> Set.empty + Q.EntityInTempStorage -> Set.singleton hash ------------------------------------------------------------------------------------------------------------------------ -- Get causal hash by path -- | Get the causal hash of a path hosted on Unison Share. getCausalHashByPath :: - -- | The HTTP client to use for Unison Share requests. - AuthenticatedHttpClient -> -- | The Unison Share URL. BaseUrl -> Share.Path -> - IO (Either GetCausalHashByPathError (Maybe Share.HashJWT)) -getCausalHashByPath httpClient unisonShareUrl repoPath = - httpGetCausalHashByPath httpClient unisonShareUrl (Share.GetCausalHashByPathRequest repoPath) <&> \case - Share.GetCausalHashByPathSuccess maybeHashJwt -> Right maybeHashJwt - Share.GetCausalHashByPathNoReadPermission _ -> Left (GetCausalHashByPathErrorNoReadPermission repoPath) + Cli (Either (SyncError GetCausalHashByPathError) (Maybe Share.HashJWT)) +getCausalHashByPath unisonShareUrl repoPath = do + Cli.Env {authHTTPClient} <- ask + liftIO (httpGetCausalHashByPath authHTTPClient unisonShareUrl (Share.GetCausalHashByPathRequest repoPath)) <&> \case + Left err -> Left (TransportError err) + Right (Share.GetCausalHashByPathSuccess maybeHashJwt) -> Right maybeHashJwt + Right (Share.GetCausalHashByPathNoReadPermission _) -> + Left (SyncError (GetCausalHashByPathErrorNoReadPermission repoPath)) ------------------------------------------------------------------------------------------------------------------------ -- Upload entities data UploadDispatcherJob - = UploadDispatcherReturnFailure + = UploadDispatcherReturnFailure (SyncError UploadEntitiesError) | UploadDispatcherForkWorkerWhenAvailable (NESet Hash32) | UploadDispatcherForkWorker (NESet Hash32) | UploadDispatcherDone +data UploadEntitiesError + = UploadEntitiesNoWritePermission + -- | Upload a set of entities to Unison Share. If the server responds that it cannot yet store any hash(es) due to -- missing dependencies, send those dependencies too, and on and on, until the server stops responding that it's missing -- anything. -- -- Returns true on success, false on failure (because the user does not have write permission). uploadEntities :: - AuthenticatedHttpClient -> BaseUrl -> - (forall a. (Sqlite.Connection -> IO a) -> IO a) -> Share.RepoName -> NESet Hash32 -> (Int -> IO ()) -> - IO Bool -uploadEntities httpClient unisonShareUrl connect repoName hashes0 uploadedCallback = do - hashesVar <- newTVarIO (NESet.toSet hashes0) - -- Semantically, this is the set of hashes we've uploaded so far, but we do delete from it when it's safe to, so it - -- doesn't grow unbounded. It's used to filter out hashes that would be duplicate uploads: the server, when responding - -- to any particular upload request, may declare that it still needs some hashes that we're in the process of - -- uploading from another thread. - dedupeVar <- newTVarIO Set.empty - nextWorkerIdVar <- newTVarIO 0 - workersVar <- newTVarIO Set.empty - workerFailedVar <- newEmptyTMVarIO + Cli (Either (SyncError UploadEntitiesError) ()) +uploadEntities unisonShareUrl repoName hashes0 uploadedCallback = do + Cli.Env {authHTTPClient, codebase} <- ask - Ki.scoped \scope -> - dispatcher scope hashesVar dedupeVar nextWorkerIdVar workersVar workerFailedVar + liftIO do + hashesVar <- newTVarIO (NESet.toSet hashes0) + -- Semantically, this is the set of hashes we've uploaded so far, but we do delete from it when it's safe to, so it + -- doesn't grow unbounded. It's used to filter out hashes that would be duplicate uploads: the server, when + -- responding to any particular upload request, may declare that it still needs some hashes that we're in the + -- process of uploading from another thread. + dedupeVar <- newTVarIO Set.empty + nextWorkerIdVar <- newTVarIO 0 + workersVar <- newTVarIO Set.empty + workerFailedVar <- newEmptyTMVarIO + + Ki.scoped \scope -> + dispatcher + scope + authHTTPClient + (Codebase.runTransaction codebase) + hashesVar + dedupeVar + nextWorkerIdVar + workersVar + workerFailedVar where dispatcher :: Ki.Scope -> + AuthenticatedHttpClient -> + (forall a. Sqlite.Transaction a -> IO a) -> TVar (Set Hash32) -> TVar (Set Hash32) -> TVar Int -> TVar (Set Int) -> - TMVar () -> - IO Bool - dispatcher scope hashesVar dedupeVar nextWorkerIdVar workersVar workerFailedVar = do + TMVar (SyncError UploadEntitiesError) -> + IO (Either (SyncError UploadEntitiesError) ()) + dispatcher scope httpClient runTransaction hashesVar dedupeVar nextWorkerIdVar workersVar workerFailedVar = do loop where - loop :: IO Bool + loop :: IO (Either (SyncError UploadEntitiesError) ()) loop = doJob [checkForFailureMode, dispatchWorkMode, checkIfDoneMode] - doJob :: [STM UploadDispatcherJob] -> IO Bool + doJob :: [STM UploadDispatcherJob] -> IO (Either (SyncError UploadEntitiesError) ()) doJob jobs = atomically (asum jobs) >>= \case - UploadDispatcherReturnFailure -> pure False + UploadDispatcherReturnFailure err -> pure (Left err) UploadDispatcherForkWorkerWhenAvailable hashes -> doJob [forkWorkerMode hashes, checkForFailureMode] UploadDispatcherForkWorker hashes -> do workerId <- @@ -678,14 +767,14 @@ uploadEntities httpClient unisonShareUrl connect repoName hashes0 uploadedCallba pure workerId _ <- Ki.fork @() scope do - worker hashesVar dedupeVar workersVar workerFailedVar workerId hashes + worker httpClient runTransaction hashesVar dedupeVar workersVar workerFailedVar workerId hashes loop - UploadDispatcherDone -> pure True + UploadDispatcherDone -> pure (Right ()) checkForFailureMode :: STM UploadDispatcherJob checkForFailureMode = do - () <- readTMVar workerFailedVar - pure UploadDispatcherReturnFailure + err <- readTMVar workerFailedVar + pure (UploadDispatcherReturnFailure err) dispatchWorkMode :: STM UploadDispatcherJob dispatchWorkMode = do @@ -708,25 +797,35 @@ uploadEntities httpClient unisonShareUrl connect repoName hashes0 uploadedCallba when (not (Set.null workers)) retry pure UploadDispatcherDone - worker :: TVar (Set Hash32) -> TVar (Set Hash32) -> TVar (Set Int) -> TMVar () -> Int -> NESet Hash32 -> IO () - worker hashesVar dedupeVar workersVar workerFailedVar workerId hashes = do + worker :: + AuthenticatedHttpClient -> + (forall a. Sqlite.Transaction a -> IO a) -> + TVar (Set Hash32) -> + TVar (Set Hash32) -> + TVar (Set Int) -> + TMVar (SyncError UploadEntitiesError) -> + Int -> + NESet Hash32 -> + IO () + worker httpClient runTransaction hashesVar dedupeVar workersVar workerFailedVar workerId hashes = do entities <- fmap NEMap.fromAscList do - connect \conn -> - Sqlite.runTransaction conn do - for (NESet.toAscList hashes) \hash -> do - entity <- expectEntity hash - pure (hash, entity) + runTransaction do + for (NESet.toAscList hashes) \hash -> do + entity <- expectEntity hash + pure (hash, entity) result <- httpUploadEntities httpClient unisonShareUrl Share.UploadEntitiesRequest {entities, repoName} <&> \case - Share.UploadEntitiesNeedDependencies (Share.NeedDependencies moreHashes) -> Right (NESet.toSet moreHashes) - Share.UploadEntitiesNoWritePermission _ -> Left () - Share.UploadEntitiesHashMismatchForEntity _ -> error "hash mismatch; fixme" - Share.UploadEntitiesSuccess -> Right Set.empty + Left err -> Left (TransportError err) + Right (Share.UploadEntitiesNeedDependencies (Share.NeedDependencies moreHashes)) -> + Right (NESet.toSet moreHashes) + Right (Share.UploadEntitiesNoWritePermission _) -> Left (SyncError UploadEntitiesNoWritePermission) + Right (Share.UploadEntitiesHashMismatchForEntity _) -> error "hash mismatch; fixme" + Right Share.UploadEntitiesSuccess -> Right Set.empty case result of - Left () -> void (atomically (tryPutTMVar workerFailedVar ())) + Left err -> void (atomically (tryPutTMVar workerFailedVar err)) Right moreHashes -> do uploadedCallback (NESet.size hashes) maybeYoungestWorkerThatWasAlive <- @@ -815,11 +914,31 @@ upsertEntitySomewhere hash entity = ------------------------------------------------------------------------------------------------------------------------ -- HTTP calls -httpGetCausalHashByPath :: Auth.AuthenticatedHttpClient -> BaseUrl -> Share.GetCausalHashByPathRequest -> IO Share.GetCausalHashByPathResponse -httpFastForwardPath :: Auth.AuthenticatedHttpClient -> BaseUrl -> Share.FastForwardPathRequest -> IO Share.FastForwardPathResponse -httpUpdatePath :: Auth.AuthenticatedHttpClient -> BaseUrl -> Share.UpdatePathRequest -> IO Share.UpdatePathResponse -httpDownloadEntities :: Auth.AuthenticatedHttpClient -> BaseUrl -> Share.DownloadEntitiesRequest -> IO Share.DownloadEntitiesResponse -httpUploadEntities :: Auth.AuthenticatedHttpClient -> BaseUrl -> Share.UploadEntitiesRequest -> IO Share.UploadEntitiesResponse +httpGetCausalHashByPath :: + Auth.AuthenticatedHttpClient -> + BaseUrl -> + Share.GetCausalHashByPathRequest -> + IO (Either CodeserverTransportError Share.GetCausalHashByPathResponse) +httpFastForwardPath :: + Auth.AuthenticatedHttpClient -> + BaseUrl -> + Share.FastForwardPathRequest -> + IO (Either CodeserverTransportError Share.FastForwardPathResponse) +httpUpdatePath :: + Auth.AuthenticatedHttpClient -> + BaseUrl -> + Share.UpdatePathRequest -> + IO (Either CodeserverTransportError Share.UpdatePathResponse) +httpDownloadEntities :: + Auth.AuthenticatedHttpClient -> + BaseUrl -> + Share.DownloadEntitiesRequest -> + IO (Either CodeserverTransportError Share.DownloadEntitiesResponse) +httpUploadEntities :: + Auth.AuthenticatedHttpClient -> + BaseUrl -> + Share.UploadEntitiesRequest -> + IO (Either CodeserverTransportError Share.UploadEntitiesResponse) ( httpGetCausalHashByPath, httpFastForwardPath, httpUpdatePath, @@ -843,14 +962,14 @@ httpUploadEntities :: Auth.AuthenticatedHttpClient -> BaseUrl -> Share.UploadEnt go httpUploadEntities ) where - hoist :: Servant.ClientM a -> ReaderT Servant.ClientEnv IO a + hoist :: Servant.ClientM a -> ReaderT Servant.ClientEnv (ExceptT CodeserverTransportError IO) a hoist m = do clientEnv <- Reader.ask liftIO (Servant.runClientM m clientEnv) >>= \case Right a -> pure a Left err -> do Debug.debugLogM Debug.Sync (show err) - throwIO case err of + throwError case err of Servant.FailureResponse _req resp -> case HTTP.statusCode $ Servant.responseStatusCode resp of 401 -> Unauthenticated (Servant.baseUrl clientEnv) @@ -867,25 +986,18 @@ httpUploadEntities :: Auth.AuthenticatedHttpClient -> BaseUrl -> Share.UploadEnt Servant.ConnectionError _ -> UnreachableCodeserver (Servant.baseUrl clientEnv) go :: - (req -> ReaderT Servant.ClientEnv IO resp) -> + (req -> ReaderT Servant.ClientEnv (ExceptT CodeserverTransportError IO) resp) -> Auth.AuthenticatedHttpClient -> BaseUrl -> req -> - IO resp + IO (Either CodeserverTransportError resp) go f (Auth.AuthenticatedHttpClient httpClient) unisonShareUrl req = - runReaderT - (f req) - (Servant.mkClientEnv httpClient unisonShareUrl) - { Servant.makeClientRequest = \url request -> - -- Disable client-side timeouts - (Servant.defaultMakeClientRequest url request) - { Http.Client.responseTimeout = Http.Client.responseTimeoutNone - } - } - -catchSyncErrors :: IO (Either e a) -> IO (Either (SyncError e) a) -catchSyncErrors action = - UnliftIO.try @_ @CodeserverTransportError action >>= \case - Left te -> pure (Left . TransportError $ te) - Right (Left e) -> pure . Left . SyncError $ e - Right (Right a) -> pure $ Right a + (Servant.mkClientEnv httpClient unisonShareUrl) + { Servant.makeClientRequest = \url request -> + -- Disable client-side timeouts + (Servant.defaultMakeClientRequest url request) + { Http.Client.responseTimeout = Http.Client.responseTimeoutNone + } + } + & runReaderT (f req) + & runExceptT diff --git a/unison-cli/src/Unison/Share/Sync/Types.hs b/unison-cli/src/Unison/Share/Sync/Types.hs index 3d9903457..29de8d08b 100644 --- a/unison-cli/src/Unison/Share/Sync/Types.hs +++ b/unison-cli/src/Unison/Share/Sync/Types.hs @@ -1,7 +1,13 @@ -{-# LANGUAGE DeriveAnyClass #-} - -- | Types used by the UCM client during sync. -module Unison.Share.Sync.Types where +module Unison.Share.Sync.Types + ( CheckAndSetPushError (..), + CodeserverTransportError (..), + FastForwardPushError (..), + GetCausalHashByPathError (..), + PullError (..), + SyncError (..), + ) +where import Data.Set.NonEmpty (NESet) import qualified Servant.Client as Servant @@ -29,9 +35,8 @@ data FastForwardPushError -- | An error occurred while pulling code from Unison Share. data PullError - = -- | An error occurred while resolving a repo+path to a causal hash. - PullErrorGetCausalHashByPath GetCausalHashByPathError - | PullErrorNoHistoryAtPath Share.Path + = PullErrorNoHistoryAtPath Share.Path + | PullErrorNoReadPermission Share.Path deriving (Show) -- | An error occurred when getting causal hash by path. @@ -57,3 +62,4 @@ data CodeserverTransportError data SyncError e = TransportError CodeserverTransportError | SyncError e + deriving stock (Functor) From 5277920b5a69b12caa4ebb8b353472dfd97e9414 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 13 Dec 2022 14:43:16 -0500 Subject: [PATCH 017/467] Implement some additional primops - These were missing pieces of a NatMap insert/lookup test. --- chez-libs/unison/primops.ss | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chez-libs/unison/primops.ss b/chez-libs/unison/primops.ss index 9b7965ff3..9b54a3231 100644 --- a/chez-libs/unison/primops.ss +++ b/chez-libs/unison/primops.ss @@ -37,6 +37,7 @@ unison-FOp-Text.toUtf8 ; unison-FOp-Value.serialize unison-FOp-IO.stdHandle + unison-FOp-IO.getArgs.impl.v1 unison-FOp-ImmutableByteArray.copyTo! unison-FOp-ImmutableByteArray.read8 @@ -69,6 +70,7 @@ unison-POp-ITOT unison-POp-LEQN ; unison-POp-LKUP + unison-POp-LZRO unison-POp-MULN unison-POp-NTOT unison-POp-PAKT @@ -83,7 +85,9 @@ unison-POp-TAKS unison-POp-TAKT unison-POp-TRCE + unison-POp-TTON unison-POp-UPKT + unison-POp-XORN unison-POp-VALU unison-POp-VWLS @@ -119,6 +123,7 @@ (define (unison-POp-IORN m n) (fxlogior m n)) (define (unison-POp-ITOT i) (signed-number->istring i)) (define (unison-POp-LEQN m n) (if (fx< m n) 1 0)) + (define (unison-POp-LZRO m) (- 64 (fxlength m))) (define (unison-POp-MULN m n) (* m n)) (define (unison-POp-NTOT m) (number->istring m)) (define (unison-POp-PAKB l) (u8-list->ibytevector l)) @@ -134,11 +139,15 @@ (define (unison-POp-TAKS n s) (list-head s n)) (define (unison-POp-TAKT n t) (istring-take n t)) (define (unison-POp-TRCE x) (display (describe-value x))) + (define (unison-POp-TTON s) + (let ([mn (string->number s)]) + (if mn (list 1 mn) (list 0)))) (define (unison-POp-UPKT t) (string->list t)) (define (unison-POp-VWLS l) (if (null? l) (list 0) (list 1 (car l) (cdr l)))) + (define (unison-POp-XORN m n) (fxxor m n)) (define (unison-POp-VALU c) (decode-value c)) (define (unison-FOp-IO.putBytes.impl.v3 p bs) @@ -159,6 +168,9 @@ [(1) stdout] [(2) stderr])) + (define (unison-FOp-IO.getArgs.impl.v1) + (list 1 (cdr (command-line)))) + (define (unison-FOp-Text.toUtf8 s) (string->bytevector s utf-8-transcoder)) From f39f24eaa97ec3e581782c22ea20170337b3db70 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 13 Dec 2022 18:06:17 -0500 Subject: [PATCH 018/467] Fix some bad primop implementations - Universal compare and equality weren't returning appropriate things, and comparison was just doing equality. - Decrement was incrementing - The error instruction wasn't doing anything to display the value it was called with. - These were discovered via benchmarking the Map type --- chez-libs/unison/core.ss | 13 ++++++++++++- chez-libs/unison/primops.ss | 13 +++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/chez-libs/unison/core.ss b/chez-libs/unison/core.ss index 474b37cc6..0a8d83c7c 100644 --- a/chez-libs/unison/core.ss +++ b/chez-libs/unison/core.ss @@ -3,7 +3,9 @@ identity describe-value - decode-value) + decode-value + + universal-compare) (import (chezscheme)) @@ -40,4 +42,13 @@ (reify-args (- j 1) (cons (reify (i 'ref j)) args))))]))) + + ; 0 = LT + ; 1 = EQ + ; 2 = GT + (define (universal-compare l r) + (cond + [(equal? l r) 1] + [(and (number? l) (number? r)) (if (< l r) 0 2)] + [else (raise "universal-compare: unimplemented")])) ) diff --git a/chez-libs/unison/primops.ss b/chez-libs/unison/primops.ss index 9b54a3231..bd54c585c 100644 --- a/chez-libs/unison/primops.ss +++ b/chez-libs/unison/primops.ss @@ -104,10 +104,10 @@ (define unison-POp-BLDS list) (define (unison-POp-CATS l r) (append l r)) (define (unison-POp-CATT l r) (istring-append l r)) - (define (unison-POp-CMPU l r) (equal? l r)) + (define (unison-POp-CMPU l r) (universal-compare l r)) (define (unison-POp-COMN n) (fxlognot n)) (define (unison-POp-CONS x xs) (cons x xs)) - (define (unison-POp-DECI n) (+ n 1)) + (define (unison-POp-DECI n) (fx1- n)) (define (unison-POp-DIVN m n) (fxdiv m n)) (define (unison-POp-DRPB n bs) (ibytevector-drop n bs)) (define (unison-POp-DRPS n l) @@ -115,8 +115,13 @@ (define (unison-POp-DRPT n t) (istring-drop n t)) (define (unison-POp-EQLN m n) (if (fx= m n) 1 0)) (define (unison-POp-EQLT s t) (if (string=? s t) 1 0)) - (define (unison-POp-EQLU x y) (equal? x y)) - (define (unison-POp-EROR fnm x) (raise fnm)) + (define (unison-POp-EQLU x y) (if (equal? x y) 1 0)) + (define (unison-POp-EROR fnm x) + (let-values ([(p g) (open-string-output-port)]) + (put-string p fnm) + (put-string p ": ") + (display x p) + (raise (g)))) (define (unison-POp-FTOT f) (number->istring f)) (define (unison-POp-IDXB n bs) (bytevector-u8-ref bs n)) (define (unison-POp-IDXS n l) (list-ref l n)) From ce2397693440256b17d6839cabc8ab0831777f0d Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 18:20:06 -0500 Subject: [PATCH 019/467] Move hashing-v2 name segment into its own module --- .../Migrations/MigrateSchema1To2/DbHelpers.hs | 14 ++++++------- .../src/Unison/Hashing/V2/Convert.hs | 13 ++++++------ .../src/Unison/Hashing/V2/Branch.hs | 20 +++++++------------ .../src/Unison/Hashing/V2/NameSegment.hs | 15 ++++++++++++++ unison-hashing-v2/unison-hashing-v2.cabal | 1 + 5 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 unison-hashing-v2/src/Unison/Hashing/V2/NameSegment.hs diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs index a9d8e6838..bdc7b6017 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs @@ -26,9 +26,9 @@ import qualified U.Codebase.Sqlite.Queries as Q import qualified U.Codebase.Sqlite.Reference as S import qualified U.Codebase.Sqlite.Referent as S import Unison.Hash (Hash) -import Unison.Hashing.V2.Branch (NameSegment (..)) import qualified Unison.Hashing.V2.Branch as Hashing.Branch import qualified Unison.Hashing.V2.Causal as Hashing.Causal +import qualified Unison.Hashing.V2.NameSegment as Hashing (NameSegment (..)) import qualified Unison.Hashing.V2.Patch as Hashing (Patch (..)) import qualified Unison.Hashing.V2.Patch as Hashing.Patch import qualified Unison.Hashing.V2.Reference as Hashing (Reference) @@ -62,7 +62,7 @@ dbBranchHash (S.Branch.Full.Branch tms tps patches children) = where doTerms :: Map Db.TextId (Map S.Referent S.DbMetadataSet) -> - Transaction (Map NameSegment (Map Hashing.Referent Hashing.Branch.MdValues)) + Transaction (Map Hashing.NameSegment (Map Hashing.Referent Hashing.Branch.MdValues)) doTerms = Map.bitraverse s2hNameSegment @@ -70,17 +70,17 @@ dbBranchHash (S.Branch.Full.Branch tms tps patches children) = doTypes :: Map Db.TextId (Map S.Reference S.DbMetadataSet) -> - Transaction (Map NameSegment (Map Hashing.Reference Hashing.Branch.MdValues)) + Transaction (Map Hashing.NameSegment (Map Hashing.Reference Hashing.Branch.MdValues)) doTypes = Map.bitraverse s2hNameSegment (Map.bitraverse s2hReference s2hMetadataSet) - doPatches :: Map Db.TextId Db.PatchObjectId -> Transaction (Map NameSegment Hash) + doPatches :: Map Db.TextId Db.PatchObjectId -> Transaction (Map Hashing.NameSegment Hash) doPatches = Map.bitraverse s2hNameSegment (Q.expectPrimaryHashByObjectId . Db.unPatchObjectId) - doChildren :: Map Db.TextId (Db.BranchObjectId, Db.CausalHashId) -> Transaction (Map NameSegment Hash) + doChildren :: Map Db.TextId (Db.BranchObjectId, Db.CausalHashId) -> Transaction (Map Hashing.NameSegment Hash) doChildren = Map.bitraverse s2hNameSegment \(_boId, chId) -> Q.expectHash (Db.unCausalHashId chId) @@ -103,9 +103,9 @@ s2hMetadataSet :: DbMetadataSet -> Transaction Hashing.Branch.MdValues s2hMetadataSet = \case S.MetadataSet.Inline rs -> Hashing.Branch.MdValues <$> Set.traverse s2hReference rs -s2hNameSegment :: Db.TextId -> Transaction NameSegment +s2hNameSegment :: Db.TextId -> Transaction Hashing.NameSegment s2hNameSegment = - fmap NameSegment . Q.expectText + fmap Hashing.NameSegment . Q.expectText s2hReferent :: S.Referent -> Transaction Hashing.Referent s2hReferent = \case diff --git a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs index 693837154..8be2750d2 100644 --- a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs +++ b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs @@ -45,6 +45,7 @@ import qualified Unison.Hashing.V2.DataDeclaration as Hashing.DD import Unison.Hashing.V2.Hashable (HashFor (HashFor), Hashable) import qualified Unison.Hashing.V2.Hashable as Hashable import qualified Unison.Hashing.V2.Kind as Hashing.Kind +import qualified Unison.Hashing.V2.NameSegment as Hashing (NameSegment (..)) import qualified Unison.Hashing.V2.Patch as Hashing.Patch import qualified Unison.Hashing.V2.Pattern as Hashing.Pattern import qualified Unison.Hashing.V2.Reference as Hashing.Reference @@ -379,7 +380,7 @@ m2hBranch0 b = -- is there a more readable way to structure these that's also linear? doTerms :: Memory.Branch.Star Memory.Referent.Referent Memory.NameSegment.NameSegment -> - Map Hashing.Branch.NameSegment (Map Hashing.Referent.Referent Hashing.Branch.MdValues) + Map Hashing.NameSegment (Map Hashing.Referent.Referent Hashing.Branch.MdValues) doTerms s = Map.fromList [ (m2hNameSegment ns, m2) @@ -395,7 +396,7 @@ m2hBranch0 b = doTypes :: Memory.Branch.Star Memory.Reference.Reference Memory.NameSegment.NameSegment -> - Map Hashing.Branch.NameSegment (Map Hashing.Reference.Reference Hashing.Branch.MdValues) + Map Hashing.NameSegment (Map Hashing.Reference.Reference Hashing.Branch.MdValues) doTypes s = Map.fromList [ (m2hNameSegment ns, m2) @@ -412,13 +413,13 @@ m2hBranch0 b = doPatches :: Map Memory.NameSegment.NameSegment (Memory.Branch.EditHash, m Memory.Patch.Patch) -> - Map Hashing.Branch.NameSegment Hash + Map Hashing.NameSegment Hash doPatches = Map.bimap m2hNameSegment fst doChildren :: Map Memory.NameSegment.NameSegment (Memory.Branch.Branch m) -> - Map Hashing.Branch.NameSegment Hash + Map Hashing.NameSegment Hash doChildren = Map.bimap m2hNameSegment (Memory.Causal.unCausalHash . Memory.Branch.headHash) -m2hNameSegment :: Memory.NameSegment.NameSegment -> Hashing.Branch.NameSegment -m2hNameSegment (Memory.NameSegment.NameSegment s) = Hashing.Branch.NameSegment s +m2hNameSegment :: Memory.NameSegment.NameSegment -> Hashing.NameSegment +m2hNameSegment (Memory.NameSegment.NameSegment s) = Hashing.NameSegment s diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs index 725d2faea..8b621b0a7 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs @@ -1,13 +1,12 @@ -{-# LANGUAGE DerivingVia #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE ViewPatterns #-} - -module Unison.Hashing.V2.Branch (NameSegment (..), Raw (..), MdValues (..), hashBranch) where +module Unison.Hashing.V2.Branch + ( Raw (..), + MdValues (..), + hashBranch, + ) +where import Unison.Hash (Hash) +import Unison.Hashing.V2.NameSegment (NameSegment) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Referent (Referent) import Unison.Hashing.V2.Tokenizable (Tokenizable) @@ -20,8 +19,6 @@ newtype MdValues = MdValues (Set MetadataValue) deriving (Eq, Ord, Show) deriving (Tokenizable) via Set MetadataValue -newtype NameSegment = NameSegment Text deriving (Eq, Ord, Show) - hashBranch :: Raw -> Hash hashBranch = H.hashTokenizable @@ -39,6 +36,3 @@ instance Tokenizable Raw where H.accumulateToken (children b), H.accumulateToken (patches b) ] - -instance H.Tokenizable NameSegment where - tokens (NameSegment t) = [H.Text t] diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/NameSegment.hs b/unison-hashing-v2/src/Unison/Hashing/V2/NameSegment.hs new file mode 100644 index 000000000..22bb34cf2 --- /dev/null +++ b/unison-hashing-v2/src/Unison/Hashing/V2/NameSegment.hs @@ -0,0 +1,15 @@ +module Unison.Hashing.V2.NameSegment + ( NameSegment (..), + ) +where + +import qualified Unison.Hashing.V2.Tokenizable as H +import Unison.Prelude + +-- | A name segment. +newtype NameSegment + = NameSegment Text + deriving stock (Eq, Ord, Show) + +instance H.Tokenizable NameSegment where + tokens (NameSegment t) = [H.Text t] diff --git a/unison-hashing-v2/unison-hashing-v2.cabal b/unison-hashing-v2/unison-hashing-v2.cabal index c56228b3a..1b939e26b 100644 --- a/unison-hashing-v2/unison-hashing-v2.cabal +++ b/unison-hashing-v2/unison-hashing-v2.cabal @@ -23,6 +23,7 @@ library Unison.Hashing.V2.DataDeclaration Unison.Hashing.V2.Hashable Unison.Hashing.V2.Kind + Unison.Hashing.V2.NameSegment Unison.Hashing.V2.Patch Unison.Hashing.V2.Pattern Unison.Hashing.V2.Reference From 3e48cabaad793e3fd70876c18cdb89a4a03d98e2 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 18:37:51 -0500 Subject: [PATCH 020/467] Add Unison.ContentAddressable class --- codebase2/core/Unison/ContentAddressable.hs | 12 ++++++++++++ codebase2/core/package.yaml | 1 + codebase2/core/unison-core.cabal | 2 ++ 3 files changed, 15 insertions(+) create mode 100644 codebase2/core/Unison/ContentAddressable.hs diff --git a/codebase2/core/Unison/ContentAddressable.hs b/codebase2/core/Unison/ContentAddressable.hs new file mode 100644 index 000000000..ffdec0609 --- /dev/null +++ b/codebase2/core/Unison/ContentAddressable.hs @@ -0,0 +1,12 @@ +module Unison.ContentAddressable + ( ContentAddressable (..), + ) +where + +import U.Util.Hash (Hash) + +-- | A type class that is inhabited by types that can compute a hash of their content. +-- +-- Instances of this class should only live in dedicated "hashing packages" such as @unison-hashing-v2@. +class ContentAddressable a where + hash :: a -> Hash diff --git a/codebase2/core/package.yaml b/codebase2/core/package.yaml index 35b511ae9..9a2d7db15 100644 --- a/codebase2/core/package.yaml +++ b/codebase2/core/package.yaml @@ -12,6 +12,7 @@ dependencies: - containers - vector - unison-util + - unison-util-base32hex default-extensions: - ApplicativeDo diff --git a/codebase2/core/unison-core.cabal b/codebase2/core/unison-core.cabal index f9f6be7fd..63ed44299 100644 --- a/codebase2/core/unison-core.cabal +++ b/codebase2/core/unison-core.cabal @@ -18,6 +18,7 @@ library exposed-modules: U.Core.ABT U.Core.ABT.Var + Unison.ContentAddressable hs-source-dirs: ./ default-extensions: @@ -50,5 +51,6 @@ library base , containers , unison-util + , unison-util-base32hex , vector default-language: Haskell2010 From bbc17e01a6f590201ed1e90ec3c3c2ad7e46a7e6 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 18:50:23 -0500 Subject: [PATCH 021/467] move Unison.Hash and friends to new unison-hash package --- .../codebase-sqlite-hashing-v2/package.yaml | 1 + .../unison-codebase-sqlite-hashing-v2.cabal | 1 + codebase2/codebase-sqlite/package.yaml | 3 +- .../unison-codebase-sqlite.cabal | 3 +- codebase2/codebase/package.yaml | 1 + codebase2/codebase/unison-codebase.cabal | 1 + codebase2/core/unison-core.cabal | 1 - hie.yaml | 15 +++-- .../package.yaml | 5 +- .../src/U/Util/Hash32/Orphans/Aeson.hs | 0 .../unison-hash-orphans-aeson.cabal} | 3 +- .../package.yaml | 5 +- .../src/U/Util/Hash32/Orphans/Sqlite.hs | 0 .../unison-hash-orphans-sqlite.cabal} | 3 +- lib/unison-hash/package.yaml | 46 ++++++++++++++ .../src/U/Util/Hash.hs | 0 .../src/U/Util/Hash32.hs | 0 .../src}/Unison/ContentAddressable.hs | 0 .../unison-hash}/src/Unison/Hash.hs | 0 lib/unison-hash/unison-hash.cabal | 60 +++++++++++++++++++ .../unison-util-base32hex.cabal | 2 - parser-typechecker/package.yaml | 1 + .../unison-parser-typechecker.cabal | 2 + stack.yaml | 5 +- unison-cli/package.yaml | 2 +- unison-cli/unison-cli.cabal | 5 ++ unison-core/package.yaml | 1 + unison-core/unison-core1.cabal | 2 +- unison-hashing-v2/package.yaml | 1 + unison-hashing-v2/unison-hashing-v2.cabal | 1 + unison-share-api/package.yaml | 3 +- unison-share-api/unison-share-api.cabal | 3 +- unison-syntax/package.yaml | 1 + unison-syntax/unison-syntax.cabal | 2 + 34 files changed, 156 insertions(+), 23 deletions(-) rename lib/{unison-util-base32hex-orphans-aeson => unison-hash-orphans-aeson}/package.yaml (87%) rename lib/{unison-util-base32hex-orphans-aeson => unison-hash-orphans-aeson}/src/U/Util/Hash32/Orphans/Aeson.hs (100%) rename lib/{unison-util-base32hex-orphans-aeson/unison-util-base32hex-orphans-aeson.cabal => unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal} (95%) rename lib/{unison-util-base32hex-orphans-sqlite => unison-hash-orphans-sqlite}/package.yaml (87%) rename lib/{unison-util-base32hex-orphans-sqlite => unison-hash-orphans-sqlite}/src/U/Util/Hash32/Orphans/Sqlite.hs (100%) rename lib/{unison-util-base32hex-orphans-sqlite/unison-util-base32hex-orphans-sqlite.cabal => unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal} (95%) create mode 100644 lib/unison-hash/package.yaml rename lib/{unison-util-base32hex => unison-hash}/src/U/Util/Hash.hs (100%) rename lib/{unison-util-base32hex => unison-hash}/src/U/Util/Hash32.hs (100%) rename {codebase2/core => lib/unison-hash/src}/Unison/ContentAddressable.hs (100%) rename {unison-core => lib/unison-hash}/src/Unison/Hash.hs (100%) create mode 100644 lib/unison-hash/unison-hash.cabal diff --git a/codebase2/codebase-sqlite-hashing-v2/package.yaml b/codebase2/codebase-sqlite-hashing-v2/package.yaml index f205c201a..d270edffd 100644 --- a/codebase2/codebase-sqlite-hashing-v2/package.yaml +++ b/codebase2/codebase-sqlite-hashing-v2/package.yaml @@ -15,6 +15,7 @@ dependencies: - unison-codebase-sqlite - unison-core - unison-core1 + - unison-hash - unison-hashing-v2 - unison-prelude - unison-sqlite diff --git a/codebase2/codebase-sqlite-hashing-v2/unison-codebase-sqlite-hashing-v2.cabal b/codebase2/codebase-sqlite-hashing-v2/unison-codebase-sqlite-hashing-v2.cabal index 6d0e6fd72..c18980ccb 100644 --- a/codebase2/codebase-sqlite-hashing-v2/unison-codebase-sqlite-hashing-v2.cabal +++ b/codebase2/codebase-sqlite-hashing-v2/unison-codebase-sqlite-hashing-v2.cabal @@ -61,6 +61,7 @@ library , unison-codebase-sqlite , unison-core , unison-core1 + , unison-hash , unison-hashing-v2 , unison-prelude , unison-sqlite diff --git a/codebase2/codebase-sqlite/package.yaml b/codebase2/codebase-sqlite/package.yaml index f0331c219..8b68851ee 100644 --- a/codebase2/codebase-sqlite/package.yaml +++ b/codebase2/codebase-sqlite/package.yaml @@ -29,11 +29,12 @@ dependencies: - unison-codebase - unison-codebase-sync - unison-core + - unison-hash + - unison-hash-orphans-sqlite - unison-prelude - unison-sqlite - unison-util - unison-util-base32hex - - unison-util-base32hex-orphans-sqlite - unison-util-serialization - unison-util-term - unliftio diff --git a/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal b/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal index 31e44ed6e..e5fac6df3 100644 --- a/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal +++ b/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal @@ -106,11 +106,12 @@ library , unison-codebase , unison-codebase-sync , unison-core + , unison-hash + , unison-hash-orphans-sqlite , unison-prelude , unison-sqlite , unison-util , unison-util-base32hex - , unison-util-base32hex-orphans-sqlite , unison-util-serialization , unison-util-term , unliftio diff --git a/codebase2/codebase/package.yaml b/codebase2/codebase/package.yaml index 56c41f95b..ee3761867 100644 --- a/codebase2/codebase/package.yaml +++ b/codebase2/codebase/package.yaml @@ -32,6 +32,7 @@ dependencies: - mtl - text - unison-core + - unison-hash - unison-util - unison-util-base32hex - unison-prelude diff --git a/codebase2/codebase/unison-codebase.cabal b/codebase2/codebase/unison-codebase.cabal index 3342c5844..56e2ca466 100644 --- a/codebase2/codebase/unison-codebase.cabal +++ b/codebase2/codebase/unison-codebase.cabal @@ -57,6 +57,7 @@ library , text , time , unison-core + , unison-hash , unison-prelude , unison-util , unison-util-base32hex diff --git a/codebase2/core/unison-core.cabal b/codebase2/core/unison-core.cabal index 63ed44299..9e162cd1e 100644 --- a/codebase2/core/unison-core.cabal +++ b/codebase2/core/unison-core.cabal @@ -18,7 +18,6 @@ library exposed-modules: U.Core.ABT U.Core.ABT.Var - Unison.ContentAddressable hs-source-dirs: ./ default-extensions: diff --git a/hie.yaml b/hie.yaml index f1f0a9baf..814ecee6b 100644 --- a/hie.yaml +++ b/hie.yaml @@ -27,6 +27,15 @@ cradle: - path: "codebase2/util-term/./" component: "unison-util-term:lib" + - path: "lib/unison-hash/src" + component: "unison-hash:lib" + + - path: "lib/unison-hash-orphans-aeson/src" + component: "unison-hash-orphans-aeson:lib" + + - path: "lib/unison-hash-orphans-sqlite/src" + component: "unison-hash-orphans-sqlite:lib" + - path: "lib/unison-prelude/src" component: "unison-prelude:lib" @@ -45,12 +54,6 @@ cradle: - path: "lib/unison-util-base32hex/src" component: "unison-util-base32hex:lib" - - path: "lib/unison-util-base32hex-orphans-aeson/src" - component: "unison-util-base32hex-orphans-aeson:lib" - - - path: "lib/unison-util-base32hex-orphans-sqlite/src" - component: "unison-util-base32hex-orphans-sqlite:lib" - - path: "lib/unison-util-bytes/src" component: "unison-util-bytes:lib" diff --git a/lib/unison-util-base32hex-orphans-aeson/package.yaml b/lib/unison-hash-orphans-aeson/package.yaml similarity index 87% rename from lib/unison-util-base32hex-orphans-aeson/package.yaml rename to lib/unison-hash-orphans-aeson/package.yaml index da2b27afc..1bdba2625 100644 --- a/lib/unison-util-base32hex-orphans-aeson/package.yaml +++ b/lib/unison-hash-orphans-aeson/package.yaml @@ -1,17 +1,18 @@ -name: unison-util-base32hex-orphans-aeson +name: unison-hash-orphans-aeson github: unisonweb/unison copyright: Copyright (C) 2013-2021 Unison Computing, PBC and contributors library: when: - condition: false - other-modules: Paths_unison_util_base32hex_orphans_aeson + other-modules: Paths_unison_hash_orphans_aeson source-dirs: src dependencies: - aeson - base - text + - unison-hash - unison-util-base32hex ghc-options: diff --git a/lib/unison-util-base32hex-orphans-aeson/src/U/Util/Hash32/Orphans/Aeson.hs b/lib/unison-hash-orphans-aeson/src/U/Util/Hash32/Orphans/Aeson.hs similarity index 100% rename from lib/unison-util-base32hex-orphans-aeson/src/U/Util/Hash32/Orphans/Aeson.hs rename to lib/unison-hash-orphans-aeson/src/U/Util/Hash32/Orphans/Aeson.hs diff --git a/lib/unison-util-base32hex-orphans-aeson/unison-util-base32hex-orphans-aeson.cabal b/lib/unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal similarity index 95% rename from lib/unison-util-base32hex-orphans-aeson/unison-util-base32hex-orphans-aeson.cabal rename to lib/unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal index b77f6d5be..deb05ca6c 100644 --- a/lib/unison-util-base32hex-orphans-aeson/unison-util-base32hex-orphans-aeson.cabal +++ b/lib/unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -name: unison-util-base32hex-orphans-aeson +name: unison-hash-orphans-aeson version: 0.0.0 homepage: https://github.com/unisonweb/unison#readme bug-reports: https://github.com/unisonweb/unison/issues @@ -49,5 +49,6 @@ library aeson , base , text + , unison-hash , unison-util-base32hex default-language: Haskell2010 diff --git a/lib/unison-util-base32hex-orphans-sqlite/package.yaml b/lib/unison-hash-orphans-sqlite/package.yaml similarity index 87% rename from lib/unison-util-base32hex-orphans-sqlite/package.yaml rename to lib/unison-hash-orphans-sqlite/package.yaml index 7ed1fbaa8..c5e577660 100644 --- a/lib/unison-util-base32hex-orphans-sqlite/package.yaml +++ b/lib/unison-hash-orphans-sqlite/package.yaml @@ -1,17 +1,18 @@ -name: unison-util-base32hex-orphans-sqlite +name: unison-hash-orphans-sqlite github: unisonweb/unison copyright: Copyright (C) 2013-2021 Unison Computing, PBC and contributors library: when: - condition: false - other-modules: Paths_unison_util_base32hex_orphans_sqlite + other-modules: Paths_unison_hash_orphans_sqlite source-dirs: src dependencies: - base - sqlite-simple - text + - unison-hash - unison-util-base32hex ghc-options: diff --git a/lib/unison-util-base32hex-orphans-sqlite/src/U/Util/Hash32/Orphans/Sqlite.hs b/lib/unison-hash-orphans-sqlite/src/U/Util/Hash32/Orphans/Sqlite.hs similarity index 100% rename from lib/unison-util-base32hex-orphans-sqlite/src/U/Util/Hash32/Orphans/Sqlite.hs rename to lib/unison-hash-orphans-sqlite/src/U/Util/Hash32/Orphans/Sqlite.hs diff --git a/lib/unison-util-base32hex-orphans-sqlite/unison-util-base32hex-orphans-sqlite.cabal b/lib/unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal similarity index 95% rename from lib/unison-util-base32hex-orphans-sqlite/unison-util-base32hex-orphans-sqlite.cabal rename to lib/unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal index f78c9eca9..8e0378321 100644 --- a/lib/unison-util-base32hex-orphans-sqlite/unison-util-base32hex-orphans-sqlite.cabal +++ b/lib/unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -name: unison-util-base32hex-orphans-sqlite +name: unison-hash-orphans-sqlite version: 0.0.0 homepage: https://github.com/unisonweb/unison#readme bug-reports: https://github.com/unisonweb/unison/issues @@ -49,5 +49,6 @@ library base , sqlite-simple , text + , unison-hash , unison-util-base32hex default-language: Haskell2010 diff --git a/lib/unison-hash/package.yaml b/lib/unison-hash/package.yaml new file mode 100644 index 000000000..5731e2269 --- /dev/null +++ b/lib/unison-hash/package.yaml @@ -0,0 +1,46 @@ +name: unison-hash +github: unisonweb/unison +copyright: Copyright (C) 2013-2021 Unison Computing, PBC and contributors + +ghc-options: -Wall -O0 -fno-warn-name-shadowing -fno-warn-missing-pattern-synonym-signatures + +dependencies: + - base + - bytestring + - text + - unison-prelude + - unison-util-base32hex + +library: + source-dirs: src + when: + - condition: false + other-modules: Paths_unison_hash + +default-extensions: + - ApplicativeDo + - BangPatterns + - BlockArguments + - DeriveAnyClass + - DeriveFunctor + - DeriveGeneric + - DeriveTraversable + - DerivingStrategies + - DerivingVia + - DoAndIfThenElse + - DuplicateRecordFields + - FlexibleContexts + - FlexibleInstances + - GeneralizedNewtypeDeriving + - LambdaCase + - MultiParamTypeClasses + - NamedFieldPuns + - OverloadedStrings + - PatternSynonyms + - RankNTypes + - ScopedTypeVariables + - StandaloneDeriving + - TupleSections + - TypeApplications + - TypeFamilies + - ViewPatterns diff --git a/lib/unison-util-base32hex/src/U/Util/Hash.hs b/lib/unison-hash/src/U/Util/Hash.hs similarity index 100% rename from lib/unison-util-base32hex/src/U/Util/Hash.hs rename to lib/unison-hash/src/U/Util/Hash.hs diff --git a/lib/unison-util-base32hex/src/U/Util/Hash32.hs b/lib/unison-hash/src/U/Util/Hash32.hs similarity index 100% rename from lib/unison-util-base32hex/src/U/Util/Hash32.hs rename to lib/unison-hash/src/U/Util/Hash32.hs diff --git a/codebase2/core/Unison/ContentAddressable.hs b/lib/unison-hash/src/Unison/ContentAddressable.hs similarity index 100% rename from codebase2/core/Unison/ContentAddressable.hs rename to lib/unison-hash/src/Unison/ContentAddressable.hs diff --git a/unison-core/src/Unison/Hash.hs b/lib/unison-hash/src/Unison/Hash.hs similarity index 100% rename from unison-core/src/Unison/Hash.hs rename to lib/unison-hash/src/Unison/Hash.hs diff --git a/lib/unison-hash/unison-hash.cabal b/lib/unison-hash/unison-hash.cabal new file mode 100644 index 000000000..7fec13121 --- /dev/null +++ b/lib/unison-hash/unison-hash.cabal @@ -0,0 +1,60 @@ +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.34.4. +-- +-- see: https://github.com/sol/hpack + +name: unison-hash +version: 0.0.0 +homepage: https://github.com/unisonweb/unison#readme +bug-reports: https://github.com/unisonweb/unison/issues +copyright: Copyright (C) 2013-2021 Unison Computing, PBC and contributors +build-type: Simple + +source-repository head + type: git + location: https://github.com/unisonweb/unison + +library + exposed-modules: + U.Util.Hash + U.Util.Hash32 + Unison.ContentAddressable + Unison.Hash + hs-source-dirs: + src + default-extensions: + ApplicativeDo + BangPatterns + BlockArguments + DeriveAnyClass + DeriveFunctor + DeriveGeneric + DeriveTraversable + DerivingStrategies + DerivingVia + DoAndIfThenElse + DuplicateRecordFields + FlexibleContexts + FlexibleInstances + GeneralizedNewtypeDeriving + LambdaCase + MultiParamTypeClasses + NamedFieldPuns + OverloadedStrings + PatternSynonyms + RankNTypes + ScopedTypeVariables + StandaloneDeriving + TupleSections + TypeApplications + TypeFamilies + ViewPatterns + ghc-options: -Wall -O0 -fno-warn-name-shadowing -fno-warn-missing-pattern-synonym-signatures + build-depends: + base + , bytestring + , text + , unison-prelude + , unison-util-base32hex + default-language: Haskell2010 diff --git a/lib/unison-util-base32hex/unison-util-base32hex.cabal b/lib/unison-util-base32hex/unison-util-base32hex.cabal index 57b7d69cb..d4364532a 100644 --- a/lib/unison-util-base32hex/unison-util-base32hex.cabal +++ b/lib/unison-util-base32hex/unison-util-base32hex.cabal @@ -18,8 +18,6 @@ source-repository head library exposed-modules: U.Util.Base32Hex - U.Util.Hash - U.Util.Hash32 hs-source-dirs: src default-extensions: diff --git a/parser-typechecker/package.yaml b/parser-typechecker/package.yaml index 29c04a619..d0deac5b0 100644 --- a/parser-typechecker/package.yaml +++ b/parser-typechecker/package.yaml @@ -108,6 +108,7 @@ dependencies: - unison-codebase-sync - unison-core - unison-core1 + - unison-hash - unison-hashing-v2 - unison-prelude - unison-pretty-printer diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index a6ff9e4fe..085e867e4 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -276,6 +276,7 @@ library , unison-codebase-sync , unison-core , unison-core1 + , unison-hash , unison-hashing-v2 , unison-prelude , unison-pretty-printer @@ -463,6 +464,7 @@ test-suite parser-typechecker-tests , unison-codebase-sync , unison-core , unison-core1 + , unison-hash , unison-hashing-v2 , unison-parser-typechecker , unison-prelude diff --git a/stack.yaml b/stack.yaml index d72c82019..f92bcad39 100644 --- a/stack.yaml +++ b/stack.yaml @@ -25,11 +25,12 @@ packages: - codebase2/util - codebase2/util-serialization - codebase2/util-term +- lib/unison-hash +- lib/unison-hash-orphans-aeson +- lib/unison-hash-orphans-sqlite - lib/unison-prelude - lib/unison-sqlite - lib/unison-util-base32hex -- lib/unison-util-base32hex-orphans-aeson -- lib/unison-util-base32hex-orphans-sqlite - lib/unison-util-bytes - lib/unison-util-relation - lib/unison-util-rope diff --git a/unison-cli/package.yaml b/unison-cli/package.yaml index d22400376..9fab1b81f 100644 --- a/unison-cli/package.yaml +++ b/unison-cli/package.yaml @@ -70,8 +70,8 @@ dependencies: - unison-codebase - unison-codebase-sqlite - unison-codebase-sqlite-hashing-v2 - - unison-sqlite - unison-core1 + - unison-hash - unison-parser-typechecker - unison-prelude - unison-pretty-printer diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index f32b51fd1..bdf572be0 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -185,6 +185,7 @@ library , unison-codebase-sqlite , unison-codebase-sqlite-hashing-v2 , unison-core1 + , unison-hash , unison-parser-typechecker , unison-prelude , unison-pretty-printer @@ -311,6 +312,7 @@ executable cli-integration-tests , unison-codebase-sqlite , unison-codebase-sqlite-hashing-v2 , unison-core1 + , unison-hash , unison-parser-typechecker , unison-prelude , unison-pretty-printer @@ -431,6 +433,7 @@ executable transcripts , unison-codebase-sqlite , unison-codebase-sqlite-hashing-v2 , unison-core1 + , unison-hash , unison-parser-typechecker , unison-prelude , unison-pretty-printer @@ -558,6 +561,7 @@ executable unison , unison-codebase-sqlite , unison-codebase-sqlite-hashing-v2 , unison-core1 + , unison-hash , unison-parser-typechecker , unison-prelude , unison-pretty-printer @@ -688,6 +692,7 @@ test-suite cli-tests , unison-codebase-sqlite , unison-codebase-sqlite-hashing-v2 , unison-core1 + , unison-hash , unison-parser-typechecker , unison-prelude , unison-pretty-printer diff --git a/unison-core/package.yaml b/unison-core/package.yaml index d4dc85b67..1ccee6a33 100644 --- a/unison-core/package.yaml +++ b/unison-core/package.yaml @@ -26,6 +26,7 @@ library: - text - transformers - unison-core + - unison-hash - unison-prelude - unison-util - unison-util-base32hex diff --git a/unison-core/unison-core1.cabal b/unison-core/unison-core1.cabal index 02a07748f..c76aa0b44 100644 --- a/unison-core/unison-core1.cabal +++ b/unison-core/unison-core1.cabal @@ -31,7 +31,6 @@ library Unison.DataDeclaration Unison.DataDeclaration.ConstructorId Unison.DataDeclaration.Names - Unison.Hash Unison.Hashable Unison.HashQualified Unison.HashQualified' @@ -104,6 +103,7 @@ library , text , transformers , unison-core + , unison-hash , unison-prelude , unison-util , unison-util-base32hex diff --git a/unison-hashing-v2/package.yaml b/unison-hashing-v2/package.yaml index f761b800e..516599ae7 100644 --- a/unison-hashing-v2/package.yaml +++ b/unison-hashing-v2/package.yaml @@ -14,6 +14,7 @@ dependencies: - semialign - text - unison-core1 + - unison-hash - unison-prelude - unison-util - unison-util-base32hex diff --git a/unison-hashing-v2/unison-hashing-v2.cabal b/unison-hashing-v2/unison-hashing-v2.cabal index 1b939e26b..59a100730 100644 --- a/unison-hashing-v2/unison-hashing-v2.cabal +++ b/unison-hashing-v2/unison-hashing-v2.cabal @@ -71,6 +71,7 @@ library , semialign , text , unison-core1 + , unison-hash , unison-prelude , unison-util , unison-util-base32hex diff --git a/unison-share-api/package.yaml b/unison-share-api/package.yaml index c8d33bcdd..5e5e2db52 100644 --- a/unison-share-api/package.yaml +++ b/unison-share-api/package.yaml @@ -43,12 +43,13 @@ dependencies: - unison-codebase - unison-codebase-sqlite - unison-core1 + - unison-hash + - unison-hash-orphans-aeson - unison-parser-typechecker - unison-prelude - unison-pretty-printer - unison-util - unison-util-base32hex - - unison-util-base32hex-orphans-aeson - unison-util-relation - unison-sqlite - unison-syntax diff --git a/unison-share-api/unison-share-api.cabal b/unison-share-api/unison-share-api.cabal index 79472c6e8..1e913c8a8 100644 --- a/unison-share-api/unison-share-api.cabal +++ b/unison-share-api/unison-share-api.cabal @@ -102,6 +102,8 @@ library , unison-codebase , unison-codebase-sqlite , unison-core1 + , unison-hash + , unison-hash-orphans-aeson , unison-parser-typechecker , unison-prelude , unison-pretty-printer @@ -109,7 +111,6 @@ library , unison-syntax , unison-util , unison-util-base32hex - , unison-util-base32hex-orphans-aeson , unison-util-relation , unliftio , unordered-containers diff --git a/unison-syntax/package.yaml b/unison-syntax/package.yaml index ee5aae4f2..7fa062248 100644 --- a/unison-syntax/package.yaml +++ b/unison-syntax/package.yaml @@ -14,6 +14,7 @@ dependencies: - mtl - text - unison-core1 + - unison-hash - unison-prelude - unison-util-base32hex - unison-util-bytes diff --git a/unison-syntax/unison-syntax.cabal b/unison-syntax/unison-syntax.cabal index dd5eb4c43..9c7b6b655 100644 --- a/unison-syntax/unison-syntax.cabal +++ b/unison-syntax/unison-syntax.cabal @@ -67,6 +67,7 @@ library , mtl , text , unison-core1 + , unison-hash , unison-prelude , unison-util-base32hex , unison-util-bytes @@ -119,6 +120,7 @@ test-suite syntax-tests , mtl , text , unison-core1 + , unison-hash , unison-prelude , unison-syntax , unison-util-base32hex From 72c5f1db5eea257532126a071532339c928175dc Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 19:26:19 -0500 Subject: [PATCH 022/467] add instance ContentAddressable for hashing branch --- lib/unison-hash/src/Unison/ContentAddressable.hs | 2 +- .../Migrations/MigrateSchema1To2/DbHelpers.hs | 3 ++- .../src/Unison/Hashing/V2/Convert.hs | 3 ++- unison-hashing-v2/package.yaml | 1 + unison-hashing-v2/src/Unison/Hashing/V2.hs | 16 ++++++++++++++++ .../src/Unison/Hashing/V2/Branch.hs | 7 +++---- unison-hashing-v2/unison-hashing-v2.cabal | 2 ++ 7 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 unison-hashing-v2/src/Unison/Hashing/V2.hs diff --git a/lib/unison-hash/src/Unison/ContentAddressable.hs b/lib/unison-hash/src/Unison/ContentAddressable.hs index ffdec0609..87b13db97 100644 --- a/lib/unison-hash/src/Unison/ContentAddressable.hs +++ b/lib/unison-hash/src/Unison/ContentAddressable.hs @@ -9,4 +9,4 @@ import U.Util.Hash (Hash) -- -- Instances of this class should only live in dedicated "hashing packages" such as @unison-hashing-v2@. class ContentAddressable a where - hash :: a -> Hash + contentHash :: a -> Hash diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs index bdc7b6017..27944ac79 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs @@ -25,6 +25,7 @@ import qualified U.Codebase.Sqlite.Patch.TypeEdit as S.TypeEdit import qualified U.Codebase.Sqlite.Queries as Q import qualified U.Codebase.Sqlite.Reference as S import qualified U.Codebase.Sqlite.Referent as S +import Unison.ContentAddressable (contentHash) import Unison.Hash (Hash) import qualified Unison.Hashing.V2.Branch as Hashing.Branch import qualified Unison.Hashing.V2.Causal as Hashing.Causal @@ -53,7 +54,7 @@ syncCausalHash S.SyncCausalFormat {valueHash = valueHashId, parents = parentChId dbBranchHash :: S.DbBranch -> Transaction BranchHash dbBranchHash (S.Branch.Full.Branch tms tps patches children) = - fmap (BranchHash . Hashing.Branch.hashBranch) $ + fmap (BranchHash . contentHash) $ Hashing.Branch.Raw <$> doTerms tms <*> doTypes tps diff --git a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs index 8be2750d2..7d276957e 100644 --- a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs +++ b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs @@ -37,6 +37,7 @@ import qualified Unison.Codebase.TypeEdit as Memory.TypeEdit import qualified Unison.ConstructorReference as Memory.ConstructorReference import qualified Unison.ConstructorType as CT import qualified Unison.ConstructorType as Memory.ConstructorType +import Unison.ContentAddressable (contentHash) import qualified Unison.DataDeclaration as Memory.DD import Unison.Hash (Hash) import qualified Unison.Hashing.V2.Branch as Hashing.Branch @@ -359,7 +360,7 @@ hashPatch :: Memory.Patch.Patch -> Hash hashPatch = Hashing.Patch.hashPatch . m2hPatch hashBranch0 :: Memory.Branch.Branch0 m -> Hash -hashBranch0 = Hashing.Branch.hashBranch . m2hBranch0 +hashBranch0 = contentHash . m2hBranch0 hashCausal :: Hashable e => e -> Set Memory.Causal.CausalHash -> (Memory.Causal.CausalHash, HashFor e) hashCausal e tails = diff --git a/unison-hashing-v2/package.yaml b/unison-hashing-v2/package.yaml index 516599ae7..7152bce56 100644 --- a/unison-hashing-v2/package.yaml +++ b/unison-hashing-v2/package.yaml @@ -40,6 +40,7 @@ default-extensions: - FlexibleContexts - FlexibleInstances - GeneralizedNewtypeDeriving + - InstanceSigs - LambdaCase - MultiParamTypeClasses - NamedFieldPuns diff --git a/unison-hashing-v2/src/Unison/Hashing/V2.hs b/unison-hashing-v2/src/Unison/Hashing/V2.hs new file mode 100644 index 000000000..dbcb43ffe --- /dev/null +++ b/unison-hashing-v2/src/Unison/Hashing/V2.hs @@ -0,0 +1,16 @@ +module Unison.Hashing.V2 + ( V2 (..), + ) +where + +import Unison.ContentAddressable (ContentAddressable (..)) +import Unison.Hash (Hash) +import Unison.Hashing.V2.Tokenizable (Tokenizable, hashTokenizable) + +newtype V2 a + = V2 a + +-- FIXME get version in here +instance Tokenizable a => ContentAddressable (V2 a) where + contentHash :: V2 a -> Hash + contentHash (V2 x) = hashTokenizable x diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs index 8b621b0a7..939cbbcdc 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs @@ -1,11 +1,12 @@ module Unison.Hashing.V2.Branch ( Raw (..), MdValues (..), - hashBranch, ) where +import Unison.ContentAddressable (ContentAddressable) import Unison.Hash (Hash) +import Unison.Hashing.V2 (V2 (..)) import Unison.Hashing.V2.NameSegment (NameSegment) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Referent (Referent) @@ -19,15 +20,13 @@ newtype MdValues = MdValues (Set MetadataValue) deriving (Eq, Ord, Show) deriving (Tokenizable) via Set MetadataValue -hashBranch :: Raw -> Hash -hashBranch = H.hashTokenizable - data Raw = Raw { terms :: Map NameSegment (Map Referent MdValues), types :: Map NameSegment (Map Reference MdValues), patches :: Map NameSegment Hash, children :: Map NameSegment Hash -- the Causal Hash } + deriving (ContentAddressable) via (V2 Raw) instance Tokenizable Raw where tokens b = diff --git a/unison-hashing-v2/unison-hashing-v2.cabal b/unison-hashing-v2/unison-hashing-v2.cabal index 59a100730..a44882f71 100644 --- a/unison-hashing-v2/unison-hashing-v2.cabal +++ b/unison-hashing-v2/unison-hashing-v2.cabal @@ -17,6 +17,7 @@ source-repository head library exposed-modules: + Unison.Hashing.V2 Unison.Hashing.V2.ABT Unison.Hashing.V2.Branch Unison.Hashing.V2.Causal @@ -50,6 +51,7 @@ library FlexibleContexts FlexibleInstances GeneralizedNewtypeDeriving + InstanceSigs LambdaCase MultiParamTypeClasses NamedFieldPuns From 4d7c09a7bd1eeeb85bd7ae4ebf47d1e4bd5f0680 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 19:36:02 -0500 Subject: [PATCH 023/467] monomorphize Token and delete Accumulate class --- lib/unison-hash/src/Unison/Hash.hs | 1 + .../src/Unison/Hashing/V2/ABT.hs | 45 +++++++------- .../src/Unison/Hashing/V2/Term.hs | 9 +-- .../src/Unison/Hashing/V2/Tokenizable.hs | 58 ++++++++----------- 4 files changed, 53 insertions(+), 60 deletions(-) diff --git a/lib/unison-hash/src/Unison/Hash.hs b/lib/unison-hash/src/Unison/Hash.hs index 04c2e65cb..b94558c43 100644 --- a/lib/unison-hash/src/Unison/Hash.hs +++ b/lib/unison-hash/src/Unison/Hash.hs @@ -6,6 +6,7 @@ module Unison.Hash HashFor (..), base32Hex, fromBase32Hex, + Hash.fromByteString, Hash.toByteString, validBase32HexChars, ) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs b/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs index 9950b92bf..4d93cbde3 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs @@ -14,17 +14,18 @@ import qualified Data.List as List (sort) import qualified Data.Map as Map import qualified Data.Set as Set import Unison.ABT -import Unison.Hashing.V2.Tokenizable (Accumulate, Hashable1, hash1) +import Unison.Hash (Hash) +import Unison.Hashing.V2.Tokenizable (Hashable1, hash1) import qualified Unison.Hashing.V2.Tokenizable as Hashable import Unison.Prelude import Prelude hiding (abs, cycle) -- Hash a strongly connected component and sort its definitions into a canonical order. hashComponent :: - forall a f h v. - (Functor f, Hashable1 f, Foldable f, Eq v, Show v, Ord v, Ord h, Accumulate h) => + forall a f v. + (Functor f, Hashable1 f, Foldable f, Eq v, Show v, Ord v) => Map.Map v (Term f v a) -> - (h, [(v, Term f v a)]) + (Hash, [(v, Term f v a)]) hashComponent byName = let ts = Map.toList byName -- First, compute a canonical hash ordering of the component, as well as an environment in which we can hash @@ -32,11 +33,11 @@ hashComponent byName = (hashes, env) = doHashCycle [] ts -- Construct a list of tokens that is shared by all members of the component. They are disambiguated only by their -- name that gets tumbled into the hash. - commonTokens :: [Hashable.Token h] + commonTokens :: [Hashable.Token] commonTokens = Hashable.Tag 1 : map Hashable.Hashed hashes -- Use a helper function that hashes a single term given its name, now that we have an environment in which we can -- look the name up, as well as the common tokens. - hashName :: v -> h + hashName :: v -> Hash hashName v = Hashable.accumulate (commonTokens ++ [Hashable.Hashed (hash' env (var v :: Term f v ()))]) (hashes', permutedTerms) = ts @@ -53,10 +54,10 @@ hashComponent byName = -- components (using the `termFromHash` function). Requires that the -- overall component has no free variables. hashComponents :: - (Functor f, Hashable1 f, Foldable f, Eq v, Show v, Var v, Ord h, Accumulate h) => - (h -> Word64 -> Term f v ()) -> + (Functor f, Hashable1 f, Foldable f, Eq v, Show v, Var v) => + (Hash -> Word64 -> Term f v ()) -> Map.Map v (Term f v a) -> - [(h, [(v, Term f v a)])] + [(Hash, [(v, Term f v a)])] hashComponents termFromHash termsByName = let bound = Set.fromList (Map.keys termsByName) escapedVars = Set.unions (freeVars <$> Map.elems termsByName) `Set.difference` bound @@ -82,25 +83,25 @@ hashComponents termFromHash termsByName = -- | We ignore annotations in the `Term`, as these should never affect the -- meaning of the term. hash :: - forall f v a h. - (Functor f, Hashable1 f, Eq v, Show v, Ord h, Accumulate h) => + forall f v a. + (Functor f, Hashable1 f, Eq v, Show v) => Term f v a -> - h -hash = hash' [] where + Hash +hash = hash' [] hash' :: - forall f v a h. - (Functor f, Hashable1 f, Eq v, Show v, Ord h, Accumulate h) => + forall f v a. + (Functor f, Hashable1 f, Eq v, Show v) => [Either [v] v] -> Term f v a -> - h + Hash hash' env = \case Var' v -> maybe die hashInt ind where lookup (Left cycle) = v `elem` cycle lookup (Right v') = v == v' ind = findIndex lookup env - hashInt :: Int -> h + hashInt :: Int -> Hash hashInt i = Hashable.accumulate [Hashable.Nat $ fromIntegral i] die = error $ @@ -111,7 +112,7 @@ hash' env = \case Abs'' v t -> hash' (Right v : env) t Tm' t -> hash1 (\ts -> (List.sort (map (hash' env) ts), hash' env)) (hash' env) t where - hashCycle :: [v] -> [Either [v] v] -> [Term f v a] -> ([h], Term f v a -> h) + hashCycle :: [v] -> [Either [v] v] -> [Term f v a] -> ([Hash], Term f v a -> Hash) hashCycle cycle env ts = let (ts', env') = doHashCycle env (zip cycle ts) in (ts', hash' env') @@ -119,11 +120,11 @@ hash' env = \case -- | @doHashCycle env terms@ hashes cycle @terms@ in environment @env@, and returns the canonical ordering of the hashes -- of those terms, as well as an updated environment with each of the terms' bindings in the canonical ordering. doHashCycle :: - forall a f h v. - (Accumulate h, Eq v, Functor f, Hashable1 f, Ord h, Show v) => + forall a f v. + (Eq v, Functor f, Hashable1 f, Show v) => [Either [v] v] -> [(v, Term f v a)] -> - ([h], [Either [v] v]) + ([Hash], [Either [v] v]) doHashCycle env namedTerms = (map (hash' newEnv) permutedTerms, newEnv) where @@ -132,7 +133,7 @@ doHashCycle env namedTerms = permutationEnv = Left names : env (permutedNames, permutedTerms) = namedTerms - & sortOn @h (hash' permutationEnv . snd) + & sortOn (hash' permutationEnv . snd) & unzip -- The new environment, which includes the names of all of the terms in the cycle, now that we have computed their -- canonical ordering diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs index b2427f1e7..6e296b4aa 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs @@ -25,6 +25,7 @@ import qualified Data.Zip as Zip import qualified Unison.ABT as ABT import qualified Unison.Blank as B import Unison.DataDeclaration.ConstructorId (ConstructorId) +import Unison.Hash (Hash) import qualified Unison.Hash as Hash import qualified Unison.Hashing.V2.ABT as ABT import Unison.Hashing.V2.Pattern (Pattern) @@ -134,9 +135,9 @@ hashClosedTerm :: Var v => Term v a -> Reference.Id hashClosedTerm tm = Reference.Id (ABT.hash tm) 0 instance Var v => Hashable1 (F v a p) where - hash1 :: forall h x. (Ord h, Hashable.Accumulate h) => ([x] -> ([h], x -> h)) -> (x -> h) -> (F v a p) x -> h + hash1 :: forall x. ([x] -> ([Hash], x -> Hash)) -> (x -> Hash) -> (F v a p) x -> Hash hash1 hashCycle hash e = - let varint :: Integral i => i -> Hashable.Token h + let varint :: Integral i => i -> Hashable.Token varint = Hashable.Nat . fromIntegral tag = Hashable.Tag hashed = Hashable.Hashed @@ -146,11 +147,11 @@ instance Var v => Hashable1 (F v a p) where -- are 'transparent' wrt hash and hashing is unaffected by whether -- expressions are linked. So for example `x = 1 + 1` and `y = x` hash -- the same. - Ref (Reference.Derived h 0) -> Hashable.fromBytes (Hash.toByteString h) + Ref (Reference.Derived h 0) -> Hash.fromByteString (Hash.toByteString h) Ref (Reference.Derived h i) -> Hashable.accumulate [ tag 1, - hashed $ Hashable.fromBytes (Hash.toByteString h), + hashed $ Hash.fromByteString (Hash.toByteString h), Hashable.Nat i ] -- Note: start each layer with leading `1` byte, to avoid collisions diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs index 54339a51f..d828c9916 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs @@ -1,9 +1,9 @@ module Unison.Hashing.V2.Tokenizable ( Tokenizable (..), - Accumulate (..), Hashable1 (..), Token (..), hashTokenizable, + accumulate, accumulateToken, ) where @@ -34,28 +34,23 @@ import qualified Unison.Util.Relation4 as Relation4 -- simple types (like an Int for example) to keep the same hashes, which would lead to -- collisions in the `hash` table, since each hash has a different hash version but the same -- base32 representation. -hashingVersion :: Token h +hashingVersion :: Token hashingVersion = Tag 2 -data Token h +data Token = Tag !Word8 | Bytes !ByteString | Int !Int64 | Text !Text | Double !Double - | Hashed !h + | Hashed !Hash | Nat !Word64 -class Accumulate h where - accumulate :: [Token h] -> h - fromBytes :: ByteString -> h - toBytes :: h -> ByteString - -accumulateToken :: (Accumulate h, Tokenizable t) => t -> Token h +accumulateToken :: Tokenizable t => t -> Token accumulateToken = Hashed . hashTokenizable -- | Tokenize then accumulate a type into a Hash. -hashTokenizable :: (Tokenizable t, Accumulate h) => t -> h +hashTokenizable :: Tokenizable t => t -> Hash hashTokenizable = accumulate . tokens -- | Tokenizable converts a value into a set of hashing tokens which will later be accumulated @@ -74,7 +69,7 @@ hashTokenizable = accumulate . tokens -- hash (TaggedBranch _ b) = hash b -- @@ class Tokenizable t where - tokens :: Accumulate h => t -> [Token h] + tokens :: t -> [Token] instance Tokenizable a => Tokenizable [a] where tokens = map accumulateToken @@ -124,27 +119,22 @@ instance Tokenizable Bool where instance Tokenizable Hash where tokens h = [Bytes (Hash.toByteString h)] --- | A class for all types which can accumulate tokens into a hash. --- If you want to provide an instance for hashing a Unison value, see 'Tokenizable' --- and 'Hashable' instead. -instance Accumulate Hash where - accumulate = fromBytes . BA.convert . CH.hashFinalize . go CH.hashInit - where - go :: CH.Context CH.SHA3_512 -> [Token Hash] -> CH.Context CH.SHA3_512 - go acc tokens = CH.hashUpdates acc (hashingVersion : tokens >>= toBS) - toBS (Tag b) = [B.singleton b] - toBS (Bytes bs) = [encodeLength $ B.length bs, bs] - toBS (Int i) = [BL.toStrict . toLazyByteString . int64BE $ i] - toBS (Nat i) = [BL.toStrict . toLazyByteString . word64BE $ i] - toBS (Double d) = [BL.toStrict . toLazyByteString . doubleBE $ d] - toBS (Text txt) = - let tbytes = encodeUtf8 txt - in [encodeLength (B.length tbytes), tbytes] - toBS (Hashed h) = [Hash.toByteString h] - encodeLength :: Integral n => n -> B.ByteString - encodeLength = BL.toStrict . toLazyByteString . word64BE . fromIntegral - fromBytes = Hash.fromByteString - toBytes = Hash.toByteString +accumulate :: [Token] -> Hash +accumulate = Hash.fromByteString . BA.convert . CH.hashFinalize . go CH.hashInit + where + go :: CH.Context CH.SHA3_512 -> [Token] -> CH.Context CH.SHA3_512 + go acc tokens = CH.hashUpdates acc (hashingVersion : tokens >>= toBS) + toBS (Tag b) = [B.singleton b] + toBS (Bytes bs) = [encodeLength $ B.length bs, bs] + toBS (Int i) = [BL.toStrict . toLazyByteString . int64BE $ i] + toBS (Nat i) = [BL.toStrict . toLazyByteString . word64BE $ i] + toBS (Double d) = [BL.toStrict . toLazyByteString . doubleBE $ d] + toBS (Text txt) = + let tbytes = encodeUtf8 txt + in [encodeLength (B.length tbytes), tbytes] + toBS (Hashed h) = [Hash.toByteString h] + encodeLength :: Integral n => n -> B.ByteString + encodeLength = BL.toStrict . toLazyByteString . word64BE . fromIntegral class Hashable1 f where -- | Produce a hash for an `f a`, given a hashing function for `a`. @@ -173,4 +163,4 @@ class Hashable1 f where -- hash1 hashUnordered _ (U unordered uno dos) = -- let (hs, hash) = hashUnordered unordered -- in accumulate $ map Hashed hs ++ [Hashed (hash uno), Hashed (hash dos)] - hash1 :: (Ord h, Accumulate h) => ([a] -> ([h], a -> h)) -> (a -> h) -> f a -> h + hash1 :: ([a] -> ([Hash], a -> Hash)) -> (a -> Hash) -> f a -> Hash From 87ff4adac0bd2d68f09b94c8585dd23a2d7ad1a4 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 19:41:22 -0500 Subject: [PATCH 024/467] delete V2 newtype for deriving ContentAddressable --- unison-hashing-v2/src/Unison/Hashing/V2.hs | 16 ---------------- .../src/Unison/Hashing/V2/Branch.hs | 7 ++++--- unison-hashing-v2/unison-hashing-v2.cabal | 1 - 3 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 unison-hashing-v2/src/Unison/Hashing/V2.hs diff --git a/unison-hashing-v2/src/Unison/Hashing/V2.hs b/unison-hashing-v2/src/Unison/Hashing/V2.hs deleted file mode 100644 index dbcb43ffe..000000000 --- a/unison-hashing-v2/src/Unison/Hashing/V2.hs +++ /dev/null @@ -1,16 +0,0 @@ -module Unison.Hashing.V2 - ( V2 (..), - ) -where - -import Unison.ContentAddressable (ContentAddressable (..)) -import Unison.Hash (Hash) -import Unison.Hashing.V2.Tokenizable (Tokenizable, hashTokenizable) - -newtype V2 a - = V2 a - --- FIXME get version in here -instance Tokenizable a => ContentAddressable (V2 a) where - contentHash :: V2 a -> Hash - contentHash (V2 x) = hashTokenizable x diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs index 939cbbcdc..7719d02eb 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs @@ -4,9 +4,8 @@ module Unison.Hashing.V2.Branch ) where -import Unison.ContentAddressable (ContentAddressable) +import Unison.ContentAddressable (ContentAddressable (..)) import Unison.Hash (Hash) -import Unison.Hashing.V2 (V2 (..)) import Unison.Hashing.V2.NameSegment (NameSegment) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Referent (Referent) @@ -26,7 +25,9 @@ data Raw = Raw patches :: Map NameSegment Hash, children :: Map NameSegment Hash -- the Causal Hash } - deriving (ContentAddressable) via (V2 Raw) + +instance ContentAddressable Raw where + contentHash = H.hashTokenizable instance Tokenizable Raw where tokens b = diff --git a/unison-hashing-v2/unison-hashing-v2.cabal b/unison-hashing-v2/unison-hashing-v2.cabal index a44882f71..5c2e7b690 100644 --- a/unison-hashing-v2/unison-hashing-v2.cabal +++ b/unison-hashing-v2/unison-hashing-v2.cabal @@ -17,7 +17,6 @@ source-repository head library exposed-modules: - Unison.Hashing.V2 Unison.Hashing.V2.ABT Unison.Hashing.V2.Branch Unison.Hashing.V2.Causal From 9b423774a64bb1ec2f106f7c4eb7c9f31ce0e4ac Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 20:59:46 -0500 Subject: [PATCH 025/467] hide v2 hashing behind an interface --- .../src/U/Codebase/Sqlite/V2/HashHandle.hs | 10 +- .../src/Unison/Hashing/V2/Convert2.hs | 149 ++++---- .../src/Unison/ContentAddressable.hs | 29 +- .../src/Unison/Codebase/Branch.hs | 6 +- .../src/Unison/Codebase/Causal.hs | 27 +- .../Migrations/MigrateSchema1To2.hs | 20 +- .../Migrations/MigrateSchema1To2/DbHelpers.hs | 54 +-- .../src/Unison/Hashing/V2/Convert.hs | 359 +++++++++--------- .../Unison/DataDeclaration/ConstructorId.hs | 8 - unison-hashing-v2/package.yaml | 2 + unison-hashing-v2/src/Unison/Hashing/V2.hs | 50 +++ .../src/Unison/Hashing/V2/Causal.hs | 15 +- .../src/Unison/Hashing/V2/ConstructorId.hs | 8 + .../src/Unison/Hashing/V2/DataDeclaration.hs | 17 +- .../src/Unison/Hashing/V2/Hashable.hs | 30 -- .../src/Unison/Hashing/V2/Kind.hs | 16 +- .../src/Unison/Hashing/V2/Patch.hs | 20 +- .../src/Unison/Hashing/V2/Pattern.hs | 181 +++------ .../src/Unison/Hashing/V2/Reference.hs | 58 +-- .../src/Unison/Hashing/V2/Reference/Util.hs | 12 +- .../src/Unison/Hashing/V2/Referent.hs | 20 +- .../src/Unison/Hashing/V2/Term.hs | 154 ++++---- .../src/Unison/Hashing/V2/TermEdit.hs | 8 +- .../src/Unison/Hashing/V2/Type.hs | 89 +++-- .../src/Unison/Hashing/V2/TypeEdit.hs | 8 +- unison-hashing-v2/unison-hashing-v2.cabal | 4 +- 26 files changed, 625 insertions(+), 729 deletions(-) create mode 100644 unison-hashing-v2/src/Unison/Hashing/V2.hs create mode 100644 unison-hashing-v2/src/Unison/Hashing/V2/ConstructorId.hs delete mode 100644 unison-hashing-v2/src/Unison/Hashing/V2/Hashable.hs diff --git a/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs b/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs index b2a74ddc8..ebce136d7 100644 --- a/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs +++ b/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs @@ -7,13 +7,13 @@ import qualified Data.Set as Set import U.Codebase.Sqlite.HashHandle import U.Util.Type (removeAllEffectVars) import Unison.Hashing.V2.Convert2 (h2ToV2Reference, v2ToH2Type, v2ToH2TypeD) -import qualified Unison.Hashing.V2.Type as H2 +import qualified Unison.Hashing.V2 as H2 v2HashHandle :: HashHandle v2HashHandle = HashHandle - { toReference = h2ToV2Reference . H2.toReference . v2ToH2Type . removeAllEffectVars, - toReferenceMentions = Set.map h2ToV2Reference . H2.toReferenceMentions . v2ToH2Type . removeAllEffectVars, - toReferenceDecl = \h -> h2ToV2Reference . H2.toReference . v2ToH2TypeD h . removeAllEffectVars, - toReferenceDeclMentions = \h -> Set.map h2ToV2Reference . H2.toReferenceMentions . v2ToH2TypeD h . removeAllEffectVars + { toReference = h2ToV2Reference . H2.typeToReference . v2ToH2Type . removeAllEffectVars, + toReferenceMentions = Set.map h2ToV2Reference . H2.typeToReferenceMentions . v2ToH2Type . removeAllEffectVars, + toReferenceDecl = \h -> h2ToV2Reference . H2.typeToReference . v2ToH2TypeD h . removeAllEffectVars, + toReferenceDeclMentions = \h -> Set.map h2ToV2Reference . H2.typeToReferenceMentions . v2ToH2TypeD h . removeAllEffectVars } diff --git a/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs b/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs index e32c0217e..96890f1aa 100644 --- a/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs +++ b/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs @@ -13,117 +13,112 @@ import qualified U.Codebase.Referent as V2.Referent import qualified U.Codebase.Term as V2 (F, F' (..), MatchCase (..), Pattern (..), SeqOp (..), TermRef, TypeRef) import qualified U.Codebase.Type as V2.Type import qualified U.Core.ABT as ABT -import qualified U.Util.Hash as V2 (Hash) -import qualified Unison.Hashing.V2.Kind as H2 -import qualified Unison.Hashing.V2.Pattern as H2.Pattern -import qualified Unison.Hashing.V2.Reference as H2 -import qualified Unison.Hashing.V2.Referent as H2.Referent -import qualified Unison.Hashing.V2.Term as H2 -import qualified Unison.Hashing.V2.Type as H2.Type +import Unison.Hash (Hash) +import qualified Unison.Hashing.V2 as H2 import Unison.Prelude -v2ToH2Term :: forall v. Ord v => V2.Hash -> ABT.Term (V2.F v) v () -> H2.Term v () +v2ToH2Term :: forall v. Ord v => Hash -> ABT.Term (V2.F v) v () -> H2.Term v () v2ToH2Term thisTermComponentHash = ABT.transform convertF where - convertF :: forall x. V2.F v x -> H2.F v () () x + convertF :: forall x. V2.F v x -> H2.TermF v () () x convertF = \case - V2.Int x -> H2.Int x - V2.Nat x -> H2.Nat x - V2.Float x -> H2.Float x - V2.Boolean x -> H2.Boolean x - V2.Text x -> H2.Text x - V2.Char x -> H2.Char x - V2.Ref x -> H2.Ref (convertTermRef thisTermComponentHash x) - V2.Constructor a b -> H2.Constructor (convertReference a) b - V2.Request a b -> H2.Request (convertReference a) b - V2.Handle a b -> H2.Handle a b - V2.App a b -> H2.App a b - V2.Ann a b -> H2.Ann a (v2ToH2Type b) - V2.List a -> H2.List a - V2.If a b c -> H2.If a b c - V2.And a b -> H2.And a b - V2.Or a b -> H2.Or a b - V2.Lam a -> H2.Lam a - V2.LetRec a b -> H2.LetRec a b - V2.Let a b -> H2.Let a b - V2.Match a b -> H2.Match a (map convertMatchCase b) - V2.TermLink a -> H2.TermLink (convertReferent thisTermComponentHash a) - V2.TypeLink a -> H2.TypeLink (convertReference a) + V2.Int x -> H2.TermInt x + V2.Nat x -> H2.TermNat x + V2.Float x -> H2.TermFloat x + V2.Boolean x -> H2.TermBoolean x + V2.Text x -> H2.TermText x + V2.Char x -> H2.TermChar x + V2.Ref x -> H2.TermRef (convertTermRef thisTermComponentHash x) + V2.Constructor a b -> H2.TermConstructor (convertReference a) b + V2.Request a b -> H2.TermRequest (convertReference a) b + V2.Handle a b -> H2.TermHandle a b + V2.App a b -> H2.TermApp a b + V2.Ann a b -> H2.TermAnn a (v2ToH2Type b) + V2.List a -> H2.TermList a + V2.If a b c -> H2.TermIf a b c + V2.And a b -> H2.TermAnd a b + V2.Or a b -> H2.TermOr a b + V2.Lam a -> H2.TermLam a + V2.LetRec a b -> H2.TermLetRec a b + V2.Let a b -> H2.TermLet a b + V2.Match a b -> H2.TermMatch a (map convertMatchCase b) + V2.TermLink a -> H2.TermTermLink (convertReferent thisTermComponentHash a) + V2.TypeLink a -> H2.TermTypeLink (convertReference a) convertMatchCase :: V2.MatchCase Text V2.TypeRef x -> H2.MatchCase () x convertMatchCase (V2.MatchCase pat a b) = H2.MatchCase (convertPattern pat) a b -convertPattern :: V2.Pattern Text V2.TypeRef -> H2.Pattern.Pattern () +convertPattern :: V2.Pattern Text V2.TypeRef -> H2.Pattern () convertPattern = \case - V2.PUnbound -> H2.Pattern.Unbound () - V2.PVar -> H2.Pattern.Var () - V2.PBoolean a -> H2.Pattern.Boolean () a - V2.PInt a -> H2.Pattern.Int () a - V2.PNat a -> H2.Pattern.Nat () a - V2.PFloat a -> H2.Pattern.Float () a - V2.PText a -> H2.Pattern.Text () a - V2.PChar a -> H2.Pattern.Char () a - V2.PConstructor a b c -> H2.Pattern.Constructor () (convertReference a) b (map convertPattern c) - V2.PAs a -> H2.Pattern.As () (convertPattern a) - V2.PEffectPure a -> H2.Pattern.EffectPure () (convertPattern a) - V2.PEffectBind a b c d -> H2.Pattern.EffectBind () (convertReference a) b (map convertPattern c) (convertPattern d) - V2.PSequenceLiteral a -> H2.Pattern.SequenceLiteral () (map convertPattern a) - V2.PSequenceOp a b c -> H2.Pattern.SequenceOp () (convertPattern a) (convertSeqOp b) (convertPattern c) + V2.PUnbound -> H2.PatternUnbound () + V2.PVar -> H2.PatternVar () + V2.PBoolean a -> H2.PatternBoolean () a + V2.PInt a -> H2.PatternInt () a + V2.PNat a -> H2.PatternNat () a + V2.PFloat a -> H2.PatternFloat () a + V2.PText a -> H2.PatternText () a + V2.PChar a -> H2.PatternChar () a + V2.PConstructor a b c -> H2.PatternConstructor () (convertReference a) b (map convertPattern c) + V2.PAs a -> H2.PatternAs () (convertPattern a) + V2.PEffectPure a -> H2.PatternEffectPure () (convertPattern a) + V2.PEffectBind a b c d -> H2.PatternEffectBind () (convertReference a) b (map convertPattern c) (convertPattern d) + V2.PSequenceLiteral a -> H2.PatternSequenceLiteral () (map convertPattern a) + V2.PSequenceOp a b c -> H2.PatternSequenceOp () (convertPattern a) (convertSeqOp b) (convertPattern c) where convertSeqOp = \case - V2.PCons -> H2.Pattern.Cons - V2.PSnoc -> H2.Pattern.Snoc - V2.PConcat -> H2.Pattern.Concat + V2.PCons -> H2.Cons + V2.PSnoc -> H2.Snoc + V2.PConcat -> H2.Concat convertReferent :: - V2.Hash -> - V2.Referent.Referent' (V2.Reference' Text (Maybe V2.Hash)) (V2.Reference' Text V2.Hash) -> - H2.Referent.Referent + Hash -> + V2.Referent.Referent' (V2.Reference' Text (Maybe Hash)) (V2.Reference' Text Hash) -> + H2.Referent convertReferent defaultHash = \case - V2.Referent.Ref x -> H2.Referent.Ref (convertTermRef defaultHash x) - V2.Referent.Con x cid -> H2.Referent.Con (convertReference x) cid + V2.Referent.Ref x -> H2.ReferentRef (convertTermRef defaultHash x) + V2.Referent.Con x cid -> H2.ReferentCon (convertReference x) cid -convertId :: V2.Hash -> V2.Id' (Maybe V2.Hash) -> H2.Id +convertId :: Hash -> V2.Id' (Maybe Hash) -> H2.ReferenceId convertId defaultHash = \case - V2.Id m p -> H2.Id (fromMaybe defaultHash m) p + V2.Id m p -> H2.ReferenceId (fromMaybe defaultHash m) p convertReference :: V2.Reference -> H2.Reference -convertReference = convertReference' (\(V2.Id a b) -> H2.Id a b) +convertReference = convertReference' (\(V2.Id a b) -> H2.ReferenceId a b) -convertTermRef :: V2.Hash -> V2.TermRef -> H2.Reference +convertTermRef :: Hash -> V2.TermRef -> H2.Reference convertTermRef = convertReference' . convertId -convertReference' :: (V2.Id' hash -> H2.Id) -> V2.Reference' Text hash -> H2.Reference +convertReference' :: (V2.Id' hash -> H2.ReferenceId) -> V2.Reference' Text hash -> H2.Reference convertReference' idConv = \case - V2.ReferenceBuiltin x -> H2.Builtin x - V2.ReferenceDerived x -> H2.DerivedId (idConv x) + V2.ReferenceBuiltin x -> H2.ReferenceBuiltin x + V2.ReferenceDerived x -> H2.ReferenceDerivedId (idConv x) -v2ToH2Type :: forall v. Ord v => V2.Type.TypeR V2.TypeRef v -> H2.Type.Type v () +v2ToH2Type :: forall v. Ord v => V2.Type.TypeR V2.TypeRef v -> H2.Type v () v2ToH2Type = v2ToH2Type' convertReference -v2ToH2TypeD :: forall v. Ord v => V2.Hash -> V2.Type.TypeD v -> H2.Type.Type v () +v2ToH2TypeD :: forall v. Ord v => Hash -> V2.Type.TypeD v -> H2.Type v () v2ToH2TypeD defaultHash = v2ToH2Type' (convertReference' (convertId defaultHash)) -v2ToH2Type' :: forall r v. Ord v => (r -> H2.Reference) -> V2.Type.TypeR r v -> H2.Type.Type v () +v2ToH2Type' :: forall r v. Ord v => (r -> H2.Reference) -> V2.Type.TypeR r v -> H2.Type v () v2ToH2Type' mkReference = ABT.transform convertF where - convertF :: forall a. V2.Type.F' r a -> H2.Type.F a + convertF :: forall a. V2.Type.F' r a -> H2.TypeF a convertF = \case - V2.Type.Ref x -> H2.Type.Ref (mkReference x) - V2.Type.Arrow a b -> H2.Type.Arrow a b - V2.Type.Ann a k -> H2.Type.Ann a (convertKind k) - V2.Type.App a b -> H2.Type.App a b - V2.Type.Effect a b -> H2.Type.Effect a b - V2.Type.Effects a -> H2.Type.Effects a - V2.Type.Forall a -> H2.Type.Forall a - V2.Type.IntroOuter a -> H2.Type.IntroOuter a + V2.Type.Ref x -> H2.TypeRef (mkReference x) + V2.Type.Arrow a b -> H2.TypeArrow a b + V2.Type.Ann a k -> H2.TypeAnn a (convertKind k) + V2.Type.App a b -> H2.TypeApp a b + V2.Type.Effect a b -> H2.TypeEffect a b + V2.Type.Effects a -> H2.TypeEffects a + V2.Type.Forall a -> H2.TypeForall a + V2.Type.IntroOuter a -> H2.TypeIntroOuter a convertKind :: V2.Kind -> H2.Kind convertKind = \case - V2.Star -> H2.Star - V2.Arrow a b -> H2.Arrow (convertKind a) (convertKind b) + V2.Star -> H2.KindStar + V2.Arrow a b -> H2.KindArrow (convertKind a) (convertKind b) h2ToV2Reference :: H2.Reference -> V2.Reference h2ToV2Reference = \case - H2.Builtin txt -> V2.ReferenceBuiltin txt - H2.DerivedId (H2.Id x y) -> V2.ReferenceDerived (V2.Id x y) + H2.ReferenceBuiltin txt -> V2.ReferenceBuiltin txt + H2.ReferenceDerivedId (H2.ReferenceId x y) -> V2.ReferenceDerived (V2.Id x y) diff --git a/lib/unison-hash/src/Unison/ContentAddressable.hs b/lib/unison-hash/src/Unison/ContentAddressable.hs index 87b13db97..7f6d6fcb6 100644 --- a/lib/unison-hash/src/Unison/ContentAddressable.hs +++ b/lib/unison-hash/src/Unison/ContentAddressable.hs @@ -7,6 +7,33 @@ import U.Util.Hash (Hash) -- | A type class that is inhabited by types that can compute a hash of their content. -- --- Instances of this class should only live in dedicated "hashing packages" such as @unison-hashing-v2@. +-- The base instances of this class should only live in dedicated "hashing packages" such as @unison-hashing-v2@, whose +-- types and implementations should never change. +-- +-- Trivial wrapper instances can be written around these, but note these pipelines from +-- @MyType ==> SomeHashingType ==> Hash@ must take care not to change the @MyType ==> SomeHashingType@ conversion, once +-- written. +-- +-- For example, we might have a representation of some namespace in memory +-- +-- @ +-- data Namespace = Namespace Terms Types OtherStuff CachesAndWhatnot +-- @ +-- +-- with a somewhat equivalent "hashing" type in some "hashing package", with a ContentAddressable instance +-- +-- @ +-- data HashingNamespace = Namespace Terms Types +-- @ +-- +-- We can of course make our own convenience instance +-- +-- @ +-- instance ContentAddressable Namespace where +-- contentHash = contentHash . namespaceToHashingNamespace +-- @ +-- +-- But we must make sure that the implementation of @namespaceToHashingNamespace@ never changes the fields in the +-- corresponding @HashingNamespace@, even as features are added to or removed from @Namespace@. class ContentAddressable a where contentHash :: a -> Hash diff --git a/parser-typechecker/src/Unison/Codebase/Branch.hs b/parser-typechecker/src/Unison/Codebase/Branch.hs index b586985e9..e0369a9c6 100644 --- a/parser-typechecker/src/Unison/Codebase/Branch.hs +++ b/parser-typechecker/src/Unison/Codebase/Branch.hs @@ -116,8 +116,8 @@ import Unison.Codebase.Patch (Patch) import qualified Unison.Codebase.Patch as Patch import Unison.Codebase.Path (Path (..)) import qualified Unison.Codebase.Path as Path +import Unison.ContentAddressable (ContentAddressable (contentHash)) import qualified Unison.Hashing.V2.Convert as H -import qualified Unison.Hashing.V2.Hashable as H import Unison.Name (Name) import qualified Unison.Name as Name import Unison.NameSegment (NameSegment) @@ -139,8 +139,8 @@ instance AsEmpty (Branch m) where | b0 == empty = Just () | otherwise = Nothing -instance H.Hashable (Branch0 m) where - hash = H.hashBranch0 +instance ContentAddressable (Branch0 m) where + contentHash = H.hashBranch0 deepReferents :: Branch0 m -> Set Referent deepReferents = R.dom . deepTerms diff --git a/parser-typechecker/src/Unison/Codebase/Causal.hs b/parser-typechecker/src/Unison/Codebase/Causal.hs index 8d3c51ddc..9bf0c095e 100644 --- a/parser-typechecker/src/Unison/Codebase/Causal.hs +++ b/parser-typechecker/src/Unison/Codebase/Causal.hs @@ -52,13 +52,14 @@ import Unison.Codebase.Causal.Type pattern Merge, pattern One, ) +import Unison.ContentAddressable (ContentAddressable) +import Unison.Hash (HashFor (HashFor)) import qualified Unison.Hashing.V2.Convert as Hashing -import Unison.Hashing.V2.Hashable (HashFor (HashFor), Hashable) import Unison.Prelude import Prelude hiding (head, read, tail) -- | Focus the current head, keeping the hash up to date. -head_ :: Hashable e => Lens.Lens' (Causal m e) e +head_ :: ContentAddressable e => Lens.Lens' (Causal m e) e head_ = Lens.lens getter setter where getter = head @@ -74,7 +75,7 @@ head_ = Lens.lens getter setter -- (or is equal to `c2` if `c1` changes nothing). squashMerge' :: forall m e. - (Monad m, Hashable e, Eq e) => + (Monad m, ContentAddressable e, Eq e) => (Causal m e -> Causal m e -> m (Maybe (Causal m e))) -> (e -> m e) -> (Maybe e -> e -> e -> m e) -> @@ -93,7 +94,7 @@ squashMerge' lca discardHistory combine c1 c2 = do threeWayMerge :: forall m e. - (Monad m, Hashable e) => + (Monad m, ContentAddressable e) => (Maybe e -> e -> e -> m e) -> Causal m e -> Causal m e -> @@ -102,7 +103,7 @@ threeWayMerge = threeWayMerge' lca threeWayMerge' :: forall m e. - (Monad m, Hashable e) => + (Monad m, ContentAddressable e) => (Causal m e -> Causal m e -> m (Maybe (Causal m e))) -> (Maybe e -> e -> e -> m e) -> Causal m e -> @@ -138,11 +139,11 @@ beforeHash maxDepth h c = State.modify' (<> Set.fromList cs) Monad.anyM (Reader.local (1 +) . go) unseens -stepDistinct :: (Applicative m, Eq e, Hashable e) => (e -> e) -> Causal m e -> Causal m e +stepDistinct :: (Applicative m, Eq e, ContentAddressable e) => (e -> e) -> Causal m e -> Causal m e stepDistinct f c = f (head c) `consDistinct` c stepDistinctM :: - (Applicative m, Functor n, Eq e, Hashable e) => + (Applicative m, Functor n, Eq e, ContentAddressable e) => (e -> n e) -> Causal m e -> n (Causal m e) @@ -150,12 +151,12 @@ stepDistinctM f c = (`consDistinct` c) <$> f (head c) -- | Causal construction should go through here for uniformity; -- with an exception for `one`, which avoids an Applicative constraint. -fromList :: (Applicative m, Hashable e) => e -> [Causal m e] -> Causal m e +fromList :: (Applicative m, ContentAddressable e) => e -> [Causal m e] -> Causal m e fromList e cs = fromListM e (map (\c -> (currentHash c, pure c)) cs) -- | Construct a causal from a list of predecessors. The predecessors may be given in any order. -fromListM :: Hashable e => e -> [(CausalHash, m (Causal m e))] -> Causal m e +fromListM :: ContentAddressable e => e -> [(CausalHash, m (Causal m e))] -> Causal m e fromListM e ts = case ts of [] -> UnsafeOne ch eh e @@ -165,21 +166,21 @@ fromListM e ts = (ch, eh) = (Hashing.hashCausal e (Set.fromList (map fst ts))) -- | An optimized variant of 'fromListM' for when it is known we have 2+ predecessors (merge node). -mergeNode :: Hashable e => e -> Map (CausalHash) (m (Causal m e)) -> Causal m e +mergeNode :: ContentAddressable e => e -> Map (CausalHash) (m (Causal m e)) -> Causal m e mergeNode newHead predecessors = let (ch, eh) = Hashing.hashCausal newHead (Map.keysSet predecessors) in UnsafeMerge ch eh newHead predecessors -- duplicated logic here instead of delegating to `fromList` to avoid `Applicative m` constraint. -one :: Hashable e => e -> Causal m e +one :: ContentAddressable e => e -> Causal m e one e = UnsafeOne ch eh e where (ch, eh) = Hashing.hashCausal e mempty -cons :: (Applicative m, Hashable e) => e -> Causal m e -> Causal m e +cons :: (Applicative m, ContentAddressable e) => e -> Causal m e -> Causal m e cons e tail = fromList e [tail] -consDistinct :: (Applicative m, Eq e, Hashable e) => e -> Causal m e -> Causal m e +consDistinct :: (Applicative m, Eq e, ContentAddressable e) => e -> Causal m e -> Causal m e consDistinct e tl = if head tl == e then tl diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs index 52ff8c9f7..c2e4ed9aa 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs @@ -1,9 +1,6 @@ {-# LANGUAGE ApplicativeDo #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ViewPatterns #-} module Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema1To2 ( migrateSchema1To2, @@ -63,11 +60,12 @@ import qualified Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema1To2.DbH import qualified Unison.Codebase.SqliteCodebase.Operations as CodebaseOps import qualified Unison.ConstructorReference as ConstructorReference import qualified Unison.ConstructorType as CT +import Unison.ContentAddressable (contentHash) import qualified Unison.DataDeclaration as DD import Unison.DataDeclaration.ConstructorId (ConstructorId) import Unison.Hash (Hash) import qualified Unison.Hash as Unison -import qualified Unison.Hashing.V2.Causal as Hashing +import qualified Unison.Hashing.V2 as Hashing import qualified Unison.Hashing.V2.Convert as Convert import Unison.Parser.Ann (Ann) import Unison.Pattern (Pattern) @@ -236,20 +234,18 @@ migrateCausal oldCausalHashId = fmap (either id id) . runExceptT $ do let (newParentHashes, newParentHashIds) = oldCausalParentHashIds - & fmap - (\oldParentHashId -> migratedCausals ^?! ix oldParentHashId) + & fmap (\oldParentHashId -> migratedCausals ^?! ix oldParentHashId) & unzip & bimap (Set.fromList . map unCausalHash) Set.fromList let newCausalHash :: CausalHash newCausalHash = CausalHash $ - Hashing.hashCausal - ( Hashing.Causal - { branchHash = unBranchHash newBranchHash, - parents = newParentHashes - } - ) + contentHash + Hashing.Causal + { branchHash = unBranchHash newBranchHash, + parents = newParentHashes + } newCausalHashId <- lift . lift $ Q.saveCausalHash newCausalHash let newCausal = DbCausal diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs index 27944ac79..232875575 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs @@ -27,19 +27,7 @@ import qualified U.Codebase.Sqlite.Reference as S import qualified U.Codebase.Sqlite.Referent as S import Unison.ContentAddressable (contentHash) import Unison.Hash (Hash) -import qualified Unison.Hashing.V2.Branch as Hashing.Branch -import qualified Unison.Hashing.V2.Causal as Hashing.Causal -import qualified Unison.Hashing.V2.NameSegment as Hashing (NameSegment (..)) -import qualified Unison.Hashing.V2.Patch as Hashing (Patch (..)) -import qualified Unison.Hashing.V2.Patch as Hashing.Patch -import qualified Unison.Hashing.V2.Reference as Hashing (Reference) -import qualified Unison.Hashing.V2.Reference as Hashing.Reference -import qualified Unison.Hashing.V2.Referent as Hashing (Referent) -import qualified Unison.Hashing.V2.Referent as Hashing.Referent -import qualified Unison.Hashing.V2.TermEdit as Hashing (TermEdit) -import qualified Unison.Hashing.V2.TermEdit as Hashing.TermEdit -import qualified Unison.Hashing.V2.TypeEdit as Hashing (TypeEdit) -import qualified Unison.Hashing.V2.TypeEdit as Hashing.TypeEdit +import qualified Unison.Hashing.V2 as Hashing import Unison.Prelude import Unison.Sqlite (Transaction) import qualified Unison.Util.Map as Map @@ -47,15 +35,15 @@ import qualified Unison.Util.Set as Set syncCausalHash :: S.SyncCausalFormat -> Transaction CausalHash syncCausalHash S.SyncCausalFormat {valueHash = valueHashId, parents = parentChIds} = do - fmap (CausalHash . Hashing.Causal.hashCausal) $ - Hashing.Causal.Causal + fmap (CausalHash . contentHash) $ + Hashing.Causal <$> coerce @(Transaction BranchHash) @(Transaction Hash) (Q.expectBranchHash valueHashId) <*> fmap (Set.fromList . coerce @[CausalHash] @[Hash] . Vector.toList) (traverse Q.expectCausalHash parentChIds) dbBranchHash :: S.DbBranch -> Transaction BranchHash dbBranchHash (S.Branch.Full.Branch tms tps patches children) = fmap (BranchHash . contentHash) $ - Hashing.Branch.Raw + Hashing.Raw <$> doTerms tms <*> doTypes tps <*> doPatches patches @@ -63,7 +51,7 @@ dbBranchHash (S.Branch.Full.Branch tms tps patches children) = where doTerms :: Map Db.TextId (Map S.Referent S.DbMetadataSet) -> - Transaction (Map Hashing.NameSegment (Map Hashing.Referent Hashing.Branch.MdValues)) + Transaction (Map Hashing.NameSegment (Map Hashing.Referent Hashing.MdValues)) doTerms = Map.bitraverse s2hNameSegment @@ -71,7 +59,7 @@ dbBranchHash (S.Branch.Full.Branch tms tps patches children) = doTypes :: Map Db.TextId (Map S.Reference S.DbMetadataSet) -> - Transaction (Map Hashing.NameSegment (Map Hashing.Reference Hashing.Branch.MdValues)) + Transaction (Map Hashing.NameSegment (Map Hashing.Reference Hashing.MdValues)) doTypes = Map.bitraverse s2hNameSegment @@ -87,7 +75,7 @@ dbBranchHash (S.Branch.Full.Branch tms tps patches children) = dbPatchHash :: S.Patch -> Transaction PatchHash dbPatchHash S.Patch {S.termEdits, S.typeEdits} = - fmap (PatchHash . Hashing.Patch.hashPatch) $ + fmap (PatchHash . contentHash) $ Hashing.Patch <$> doTermEdits termEdits <*> doTypeEdits typeEdits @@ -100,9 +88,9 @@ dbPatchHash S.Patch {S.termEdits, S.typeEdits} = doTypeEdits = Map.bitraverse s2hReferenceH (Set.traverse s2hTypeEdit) -s2hMetadataSet :: DbMetadataSet -> Transaction Hashing.Branch.MdValues +s2hMetadataSet :: DbMetadataSet -> Transaction Hashing.MdValues s2hMetadataSet = \case - S.MetadataSet.Inline rs -> Hashing.Branch.MdValues <$> Set.traverse s2hReference rs + S.MetadataSet.Inline rs -> Hashing.MdValues <$> Set.traverse s2hReference rs s2hNameSegment :: Db.TextId -> Transaction Hashing.NameSegment s2hNameSegment = @@ -110,30 +98,30 @@ s2hNameSegment = s2hReferent :: S.Referent -> Transaction Hashing.Referent s2hReferent = \case - S.Referent.Ref r -> Hashing.Referent.Ref <$> s2hReference r - S.Referent.Con r cid -> Hashing.Referent.Con <$> s2hReference r <*> pure (fromIntegral cid) + S.Referent.Ref r -> Hashing.ReferentRef <$> s2hReference r + S.Referent.Con r cid -> Hashing.ReferentCon <$> s2hReference r <*> pure (fromIntegral cid) s2hReferentH :: S.ReferentH -> Transaction Hashing.Referent s2hReferentH = \case - S.Referent.Ref r -> Hashing.Referent.Ref <$> s2hReferenceH r - S.Referent.Con r cid -> Hashing.Referent.Con <$> s2hReferenceH r <*> pure (fromIntegral cid) + S.Referent.Ref r -> Hashing.ReferentRef <$> s2hReferenceH r + S.Referent.Con r cid -> Hashing.ReferentCon <$> s2hReferenceH r <*> pure (fromIntegral cid) s2hReference :: S.Reference -> Transaction Hashing.Reference s2hReference = \case - S.ReferenceBuiltin t -> Hashing.Reference.Builtin <$> Q.expectText t - S.Reference.Derived h i -> Hashing.Reference.Derived <$> Q.expectPrimaryHashByObjectId h <*> pure i + S.ReferenceBuiltin t -> Hashing.ReferenceBuiltin <$> Q.expectText t + S.Reference.Derived h i -> Hashing.ReferenceDerived <$> Q.expectPrimaryHashByObjectId h <*> pure i s2hReferenceH :: S.ReferenceH -> Transaction Hashing.Reference s2hReferenceH = \case - S.ReferenceBuiltin t -> Hashing.Reference.Builtin <$> Q.expectText t - S.Reference.Derived h i -> Hashing.Reference.Derived <$> Q.expectHash h <*> pure i + S.ReferenceBuiltin t -> Hashing.ReferenceBuiltin <$> Q.expectText t + S.Reference.Derived h i -> Hashing.ReferenceDerived <$> Q.expectHash h <*> pure i s2hTermEdit :: S.TermEdit -> Transaction Hashing.TermEdit s2hTermEdit = \case - S.TermEdit.Replace r _typing -> Hashing.TermEdit.Replace <$> s2hReferent r - S.TermEdit.Deprecate -> pure Hashing.TermEdit.Deprecate + S.TermEdit.Replace r _typing -> Hashing.TermEditReplace <$> s2hReferent r + S.TermEdit.Deprecate -> pure Hashing.TermEditDeprecate s2hTypeEdit :: S.TypeEdit -> Transaction Hashing.TypeEdit s2hTypeEdit = \case - S.TypeEdit.Replace r -> Hashing.TypeEdit.Replace <$> s2hReference r - S.TypeEdit.Deprecate -> pure Hashing.TypeEdit.Deprecate + S.TypeEdit.Replace r -> Hashing.TypeEditReplace <$> s2hReference r + S.TypeEdit.Deprecate -> pure Hashing.TypeEditDeprecate diff --git a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs index 7d276957e..1c635d93e 100644 --- a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs +++ b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs @@ -37,24 +37,10 @@ import qualified Unison.Codebase.TypeEdit as Memory.TypeEdit import qualified Unison.ConstructorReference as Memory.ConstructorReference import qualified Unison.ConstructorType as CT import qualified Unison.ConstructorType as Memory.ConstructorType -import Unison.ContentAddressable (contentHash) +import Unison.ContentAddressable (ContentAddressable (contentHash)) import qualified Unison.DataDeclaration as Memory.DD -import Unison.Hash (Hash) -import qualified Unison.Hashing.V2.Branch as Hashing.Branch -import qualified Unison.Hashing.V2.Causal as Hashing.Causal -import qualified Unison.Hashing.V2.DataDeclaration as Hashing.DD -import Unison.Hashing.V2.Hashable (HashFor (HashFor), Hashable) -import qualified Unison.Hashing.V2.Hashable as Hashable -import qualified Unison.Hashing.V2.Kind as Hashing.Kind -import qualified Unison.Hashing.V2.NameSegment as Hashing (NameSegment (..)) -import qualified Unison.Hashing.V2.Patch as Hashing.Patch -import qualified Unison.Hashing.V2.Pattern as Hashing.Pattern -import qualified Unison.Hashing.V2.Reference as Hashing.Reference -import qualified Unison.Hashing.V2.Referent as Hashing.Referent -import qualified Unison.Hashing.V2.Term as Hashing.Term -import qualified Unison.Hashing.V2.TermEdit as Hashing.TermEdit -import qualified Unison.Hashing.V2.Type as Hashing.Type -import qualified Unison.Hashing.V2.TypeEdit as Hashing.TypeEdit +import Unison.Hash (Hash, HashFor (HashFor)) +import qualified Unison.Hashing.V2 as Hashing import qualified Unison.Kind as Memory.Kind import qualified Unison.NameSegment as Memory.NameSegment import Unison.Names.ResolutionResult (ResolutionResult) @@ -70,10 +56,11 @@ import qualified Unison.Util.Star3 as Memory.Star3 import Unison.Var (Var) typeToReference :: Var v => Memory.Type.Type v a -> Memory.Reference.Reference -typeToReference = h2mReference . Hashing.Type.toReference . m2hType . Memory.Type.removeAllEffectVars +typeToReference = h2mReference . Hashing.typeToReference . m2hType . Memory.Type.removeAllEffectVars typeToReferenceMentions :: Var v => Memory.Type.Type v a -> Set Memory.Reference.Reference -typeToReferenceMentions = Set.map h2mReference . Hashing.Type.toReferenceMentions . m2hType . Memory.Type.removeAllEffectVars +typeToReferenceMentions = + Set.map h2mReference . Hashing.typeToReferenceMentions . m2hType . Memory.Type.removeAllEffectVars -- TODO: remove non-prime version -- include type in hash @@ -84,14 +71,14 @@ hashTermComponents :: Map v (Memory.Reference.Id, Memory.Term.Term v a, Memory.Type.Type v a) hashTermComponents mTerms = case Writer.runWriter (traverse (bitraverse m2hTerm (pure . m2hType)) mTerms) of - (hTerms, constructorTypes) -> h2mTermResult (constructorTypes Map.!) <$> Hashing.Term.hashComponents hTerms + (hTerms, constructorTypes) -> h2mTermResult (constructorTypes Map.!) <$> Hashing.hashTermComponents hTerms where h2mTermResult :: Ord v => ( Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType ) -> - (Hashing.Reference.Id, Hashing.Term.Term v a, Hashing.Type.Type v a) -> + (Hashing.ReferenceId, Hashing.Term v a, Hashing.Type v a) -> (Memory.Reference.Id, Memory.Term.Term v a, Memory.Type.Type v a) h2mTermResult getCtorType (id, tm, typ) = (h2mReferenceId id, h2mTerm getCtorType tm, h2mType typ) @@ -105,133 +92,133 @@ hashTermComponentsWithoutTypes :: Map v (Memory.Reference.Id, Memory.Term.Term v a) hashTermComponentsWithoutTypes mTerms = case Writer.runWriter (traverse m2hTerm mTerms) of - (hTerms, constructorTypes) -> h2mTermResult (constructorTypes Map.!) <$> Hashing.Term.hashComponentsWithoutTypes hTerms + (hTerms, constructorTypes) -> h2mTermResult (constructorTypes Map.!) <$> Hashing.hashTermComponentsWithoutTypes hTerms where - h2mTermResult :: Ord v => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> (Hashing.Reference.Id, Hashing.Term.Term v a) -> (Memory.Reference.Id, Memory.Term.Term v a) + h2mTermResult :: Ord v => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> (Hashing.ReferenceId, Hashing.Term v a) -> (Memory.Reference.Id, Memory.Term.Term v a) h2mTermResult getCtorType (id, tm) = (h2mReferenceId id, h2mTerm getCtorType tm) hashClosedTerm :: Var v => Memory.Term.Term v a -> Memory.Reference.Id -hashClosedTerm = h2mReferenceId . Hashing.Term.hashClosedTerm . fst . Writer.runWriter . m2hTerm +hashClosedTerm = h2mReferenceId . Hashing.hashClosedTerm . fst . Writer.runWriter . m2hTerm -m2hTerm :: Ord v => Memory.Term.Term v a -> Writer (Map Memory.Reference.Reference Memory.ConstructorType.ConstructorType) (Hashing.Term.Term v a) +m2hTerm :: Ord v => Memory.Term.Term v a -> Writer (Map Memory.Reference.Reference Memory.ConstructorType.ConstructorType) (Hashing.Term v a) m2hTerm = ABT.transformM \case - Memory.Term.Int i -> pure (Hashing.Term.Int i) - Memory.Term.Nat n -> pure (Hashing.Term.Nat n) - Memory.Term.Float d -> pure (Hashing.Term.Float d) - Memory.Term.Boolean b -> pure (Hashing.Term.Boolean b) - Memory.Term.Text t -> pure (Hashing.Term.Text t) - Memory.Term.Char c -> pure (Hashing.Term.Char c) - Memory.Term.Blank b -> pure (Hashing.Term.Blank b) - Memory.Term.Ref r -> pure (Hashing.Term.Ref (m2hReference r)) - Memory.Term.Constructor (Memory.ConstructorReference.ConstructorReference r i) -> pure (Hashing.Term.Constructor (m2hReference r) i) - Memory.Term.Request (Memory.ConstructorReference.ConstructorReference r i) -> pure (Hashing.Term.Request (m2hReference r) i) - Memory.Term.Handle x y -> pure (Hashing.Term.Handle x y) - Memory.Term.App f x -> pure (Hashing.Term.App f x) - Memory.Term.Ann e t -> pure (Hashing.Term.Ann e (m2hType t)) - Memory.Term.List as -> pure (Hashing.Term.List as) - Memory.Term.And p q -> pure (Hashing.Term.And p q) - Memory.Term.If c t f -> pure (Hashing.Term.If c t f) - Memory.Term.Or p q -> pure (Hashing.Term.Or p q) - Memory.Term.Lam a -> pure (Hashing.Term.Lam a) - Memory.Term.LetRec _isTop bs body -> pure (Hashing.Term.LetRec bs body) - Memory.Term.Let _isTop b body -> pure (Hashing.Term.Let b body) - Memory.Term.Match scr cases -> pure (Hashing.Term.Match scr (fmap m2hMatchCase cases)) - Memory.Term.TermLink r -> Hashing.Term.TermLink <$> m2hReferent r - Memory.Term.TypeLink r -> pure (Hashing.Term.TypeLink (m2hReference r)) + Memory.Term.Int i -> pure (Hashing.TermInt i) + Memory.Term.Nat n -> pure (Hashing.TermNat n) + Memory.Term.Float d -> pure (Hashing.TermFloat d) + Memory.Term.Boolean b -> pure (Hashing.TermBoolean b) + Memory.Term.Text t -> pure (Hashing.TermText t) + Memory.Term.Char c -> pure (Hashing.TermChar c) + Memory.Term.Blank b -> pure (Hashing.TermBlank b) + Memory.Term.Ref r -> pure (Hashing.TermRef (m2hReference r)) + Memory.Term.Constructor (Memory.ConstructorReference.ConstructorReference r i) -> pure (Hashing.TermConstructor (m2hReference r) i) + Memory.Term.Request (Memory.ConstructorReference.ConstructorReference r i) -> pure (Hashing.TermRequest (m2hReference r) i) + Memory.Term.Handle x y -> pure (Hashing.TermHandle x y) + Memory.Term.App f x -> pure (Hashing.TermApp f x) + Memory.Term.Ann e t -> pure (Hashing.TermAnn e (m2hType t)) + Memory.Term.List as -> pure (Hashing.TermList as) + Memory.Term.And p q -> pure (Hashing.TermAnd p q) + Memory.Term.If c t f -> pure (Hashing.TermIf c t f) + Memory.Term.Or p q -> pure (Hashing.TermOr p q) + Memory.Term.Lam a -> pure (Hashing.TermLam a) + Memory.Term.LetRec _isTop bs body -> pure (Hashing.TermLetRec bs body) + Memory.Term.Let _isTop b body -> pure (Hashing.TermLet b body) + Memory.Term.Match scr cases -> pure (Hashing.TermMatch scr (fmap m2hMatchCase cases)) + Memory.Term.TermLink r -> Hashing.TermTermLink <$> m2hReferent r + Memory.Term.TypeLink r -> pure (Hashing.TermTypeLink (m2hReference r)) -m2hMatchCase :: Memory.Term.MatchCase a a1 -> Hashing.Term.MatchCase a a1 -m2hMatchCase (Memory.Term.MatchCase pat m_a1 a1) = Hashing.Term.MatchCase (m2hPattern pat) m_a1 a1 +m2hMatchCase :: Memory.Term.MatchCase a a1 -> Hashing.MatchCase a a1 +m2hMatchCase (Memory.Term.MatchCase pat m_a1 a1) = Hashing.MatchCase (m2hPattern pat) m_a1 a1 -m2hPattern :: Memory.Pattern.Pattern a -> Hashing.Pattern.Pattern a +m2hPattern :: Memory.Pattern.Pattern a -> Hashing.Pattern a m2hPattern = \case - Memory.Pattern.Unbound loc -> Hashing.Pattern.Unbound loc - Memory.Pattern.Var loc -> Hashing.Pattern.Var loc - Memory.Pattern.Boolean loc b -> Hashing.Pattern.Boolean loc b - Memory.Pattern.Int loc i -> Hashing.Pattern.Int loc i - Memory.Pattern.Nat loc n -> Hashing.Pattern.Nat loc n - Memory.Pattern.Float loc f -> Hashing.Pattern.Float loc f - Memory.Pattern.Text loc t -> Hashing.Pattern.Text loc t - Memory.Pattern.Char loc c -> Hashing.Pattern.Char loc c + Memory.Pattern.Unbound loc -> Hashing.PatternUnbound loc + Memory.Pattern.Var loc -> Hashing.PatternVar loc + Memory.Pattern.Boolean loc b -> Hashing.PatternBoolean loc b + Memory.Pattern.Int loc i -> Hashing.PatternInt loc i + Memory.Pattern.Nat loc n -> Hashing.PatternNat loc n + Memory.Pattern.Float loc f -> Hashing.PatternFloat loc f + Memory.Pattern.Text loc t -> Hashing.PatternText loc t + Memory.Pattern.Char loc c -> Hashing.PatternChar loc c Memory.Pattern.Constructor loc (Memory.ConstructorReference.ConstructorReference r i) ps -> - Hashing.Pattern.Constructor loc (m2hReference r) i (fmap m2hPattern ps) - Memory.Pattern.As loc p -> Hashing.Pattern.As loc (m2hPattern p) - Memory.Pattern.EffectPure loc p -> Hashing.Pattern.EffectPure loc (m2hPattern p) + Hashing.PatternConstructor loc (m2hReference r) i (fmap m2hPattern ps) + Memory.Pattern.As loc p -> Hashing.PatternAs loc (m2hPattern p) + Memory.Pattern.EffectPure loc p -> Hashing.PatternEffectPure loc (m2hPattern p) Memory.Pattern.EffectBind loc (Memory.ConstructorReference.ConstructorReference r i) ps k -> - Hashing.Pattern.EffectBind loc (m2hReference r) i (fmap m2hPattern ps) (m2hPattern k) - Memory.Pattern.SequenceLiteral loc ps -> Hashing.Pattern.SequenceLiteral loc (fmap m2hPattern ps) - Memory.Pattern.SequenceOp loc l op r -> Hashing.Pattern.SequenceOp loc (m2hPattern l) (m2hSequenceOp op) (m2hPattern r) + Hashing.PatternEffectBind loc (m2hReference r) i (fmap m2hPattern ps) (m2hPattern k) + Memory.Pattern.SequenceLiteral loc ps -> Hashing.PatternSequenceLiteral loc (fmap m2hPattern ps) + Memory.Pattern.SequenceOp loc l op r -> Hashing.PatternSequenceOp loc (m2hPattern l) (m2hSequenceOp op) (m2hPattern r) -m2hSequenceOp :: Memory.Pattern.SeqOp -> Hashing.Pattern.SeqOp +m2hSequenceOp :: Memory.Pattern.SeqOp -> Hashing.SeqOp m2hSequenceOp = \case - Memory.Pattern.Cons -> Hashing.Pattern.Cons - Memory.Pattern.Snoc -> Hashing.Pattern.Snoc - Memory.Pattern.Concat -> Hashing.Pattern.Concat + Memory.Pattern.Cons -> Hashing.Cons + Memory.Pattern.Snoc -> Hashing.Snoc + Memory.Pattern.Concat -> Hashing.Concat -m2hReferent :: Memory.Referent.Referent -> Writer (Map Memory.Reference.Reference Memory.ConstructorType.ConstructorType) Hashing.Referent.Referent +m2hReferent :: Memory.Referent.Referent -> Writer (Map Memory.Reference.Reference Memory.ConstructorType.ConstructorType) Hashing.Referent m2hReferent = \case - Memory.Referent.Ref ref -> pure (Hashing.Referent.Ref (m2hReference ref)) + Memory.Referent.Ref ref -> pure (Hashing.ReferentRef (m2hReference ref)) Memory.Referent.Con (Memory.ConstructorReference.ConstructorReference ref n) ct -> do Writer.tell (Map.singleton ref ct) - pure (Hashing.Referent.Con (m2hReference ref) n) + pure (Hashing.ReferentCon (m2hReference ref) n) -h2mTerm :: Ord v => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> Hashing.Term.Term v a -> Memory.Term.Term v a +h2mTerm :: Ord v => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> Hashing.Term v a -> Memory.Term.Term v a h2mTerm getCT = ABT.transform \case - Hashing.Term.Int i -> Memory.Term.Int i - Hashing.Term.Nat n -> Memory.Term.Nat n - Hashing.Term.Float d -> Memory.Term.Float d - Hashing.Term.Boolean b -> Memory.Term.Boolean b - Hashing.Term.Text t -> Memory.Term.Text t - Hashing.Term.Char c -> Memory.Term.Char c - Hashing.Term.Blank b -> Memory.Term.Blank b - Hashing.Term.Ref r -> Memory.Term.Ref (h2mReference r) - Hashing.Term.Constructor r i -> Memory.Term.Constructor (Memory.ConstructorReference.ConstructorReference (h2mReference r) i) - Hashing.Term.Request r i -> Memory.Term.Request (Memory.ConstructorReference.ConstructorReference (h2mReference r) i) - Hashing.Term.Handle x y -> Memory.Term.Handle x y - Hashing.Term.App f x -> Memory.Term.App f x - Hashing.Term.Ann e t -> Memory.Term.Ann e (h2mType t) - Hashing.Term.List as -> Memory.Term.List as - Hashing.Term.If c t f -> Memory.Term.If c t f - Hashing.Term.And p q -> Memory.Term.And p q - Hashing.Term.Or p q -> Memory.Term.Or p q - Hashing.Term.Lam a -> Memory.Term.Lam a - Hashing.Term.LetRec bs body -> Memory.Term.LetRec False bs body - Hashing.Term.Let b body -> Memory.Term.Let False b body - Hashing.Term.Match scr cases -> Memory.Term.Match scr (h2mMatchCase <$> cases) - Hashing.Term.TermLink r -> Memory.Term.TermLink (h2mReferent getCT r) - Hashing.Term.TypeLink r -> Memory.Term.TypeLink (h2mReference r) + Hashing.TermInt i -> Memory.Term.Int i + Hashing.TermNat n -> Memory.Term.Nat n + Hashing.TermFloat d -> Memory.Term.Float d + Hashing.TermBoolean b -> Memory.Term.Boolean b + Hashing.TermText t -> Memory.Term.Text t + Hashing.TermChar c -> Memory.Term.Char c + Hashing.TermBlank b -> Memory.Term.Blank b + Hashing.TermRef r -> Memory.Term.Ref (h2mReference r) + Hashing.TermConstructor r i -> Memory.Term.Constructor (Memory.ConstructorReference.ConstructorReference (h2mReference r) i) + Hashing.TermRequest r i -> Memory.Term.Request (Memory.ConstructorReference.ConstructorReference (h2mReference r) i) + Hashing.TermHandle x y -> Memory.Term.Handle x y + Hashing.TermApp f x -> Memory.Term.App f x + Hashing.TermAnn e t -> Memory.Term.Ann e (h2mType t) + Hashing.TermList as -> Memory.Term.List as + Hashing.TermIf c t f -> Memory.Term.If c t f + Hashing.TermAnd p q -> Memory.Term.And p q + Hashing.TermOr p q -> Memory.Term.Or p q + Hashing.TermLam a -> Memory.Term.Lam a + Hashing.TermLetRec bs body -> Memory.Term.LetRec False bs body + Hashing.TermLet b body -> Memory.Term.Let False b body + Hashing.TermMatch scr cases -> Memory.Term.Match scr (h2mMatchCase <$> cases) + Hashing.TermTermLink r -> Memory.Term.TermLink (h2mReferent getCT r) + Hashing.TermTypeLink r -> Memory.Term.TypeLink (h2mReference r) -h2mMatchCase :: Hashing.Term.MatchCase a b -> Memory.Term.MatchCase a b -h2mMatchCase (Hashing.Term.MatchCase pat m_b b) = Memory.Term.MatchCase (h2mPattern pat) m_b b +h2mMatchCase :: Hashing.MatchCase a b -> Memory.Term.MatchCase a b +h2mMatchCase (Hashing.MatchCase pat m_b b) = Memory.Term.MatchCase (h2mPattern pat) m_b b -h2mPattern :: Hashing.Pattern.Pattern a -> Memory.Pattern.Pattern a +h2mPattern :: Hashing.Pattern a -> Memory.Pattern.Pattern a h2mPattern = \case - Hashing.Pattern.Unbound loc -> Memory.Pattern.Unbound loc - Hashing.Pattern.Var loc -> Memory.Pattern.Var loc - Hashing.Pattern.Boolean loc b -> Memory.Pattern.Boolean loc b - Hashing.Pattern.Int loc i -> Memory.Pattern.Int loc i - Hashing.Pattern.Nat loc n -> Memory.Pattern.Nat loc n - Hashing.Pattern.Float loc f -> Memory.Pattern.Float loc f - Hashing.Pattern.Text loc t -> Memory.Pattern.Text loc t - Hashing.Pattern.Char loc c -> Memory.Pattern.Char loc c - Hashing.Pattern.Constructor loc r i ps -> + Hashing.PatternUnbound loc -> Memory.Pattern.Unbound loc + Hashing.PatternVar loc -> Memory.Pattern.Var loc + Hashing.PatternBoolean loc b -> Memory.Pattern.Boolean loc b + Hashing.PatternInt loc i -> Memory.Pattern.Int loc i + Hashing.PatternNat loc n -> Memory.Pattern.Nat loc n + Hashing.PatternFloat loc f -> Memory.Pattern.Float loc f + Hashing.PatternText loc t -> Memory.Pattern.Text loc t + Hashing.PatternChar loc c -> Memory.Pattern.Char loc c + Hashing.PatternConstructor loc r i ps -> Memory.Pattern.Constructor loc (Memory.ConstructorReference.ConstructorReference (h2mReference r) i) (h2mPattern <$> ps) - Hashing.Pattern.As loc p -> Memory.Pattern.As loc (h2mPattern p) - Hashing.Pattern.EffectPure loc p -> Memory.Pattern.EffectPure loc (h2mPattern p) - Hashing.Pattern.EffectBind loc r i ps k -> + Hashing.PatternAs loc p -> Memory.Pattern.As loc (h2mPattern p) + Hashing.PatternEffectPure loc p -> Memory.Pattern.EffectPure loc (h2mPattern p) + Hashing.PatternEffectBind loc r i ps k -> Memory.Pattern.EffectBind loc (Memory.ConstructorReference.ConstructorReference (h2mReference r) i) (h2mPattern <$> ps) (h2mPattern k) - Hashing.Pattern.SequenceLiteral loc ps -> Memory.Pattern.SequenceLiteral loc (h2mPattern <$> ps) - Hashing.Pattern.SequenceOp loc l op r -> Memory.Pattern.SequenceOp loc (h2mPattern l) (h2mSequenceOp op) (h2mPattern r) + Hashing.PatternSequenceLiteral loc ps -> Memory.Pattern.SequenceLiteral loc (h2mPattern <$> ps) + Hashing.PatternSequenceOp loc l op r -> Memory.Pattern.SequenceOp loc (h2mPattern l) (h2mSequenceOp op) (h2mPattern r) -h2mSequenceOp :: Hashing.Pattern.SeqOp -> Memory.Pattern.SeqOp +h2mSequenceOp :: Hashing.SeqOp -> Memory.Pattern.SeqOp h2mSequenceOp = \case - Hashing.Pattern.Cons -> Memory.Pattern.Cons - Hashing.Pattern.Snoc -> Memory.Pattern.Snoc - Hashing.Pattern.Concat -> Memory.Pattern.Concat + Hashing.Cons -> Memory.Pattern.Cons + Hashing.Snoc -> Memory.Pattern.Snoc + Hashing.Concat -> Memory.Pattern.Concat -h2mReferent :: (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> Hashing.Referent.Referent -> Memory.Referent.Referent +h2mReferent :: (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> Hashing.Referent -> Memory.Referent.Referent h2mReferent getCT = \case - Hashing.Referent.Ref ref -> Memory.Referent.Ref (h2mReference ref) - Hashing.Referent.Con ref n -> + Hashing.ReferentRef ref -> Memory.Referent.Ref (h2mReference ref) + Hashing.ReferentCon ref n -> let mRef = h2mReference ref in Memory.Referent.Con (Memory.ConstructorReference.ConstructorReference mRef n) (getCT mRef) @@ -241,10 +228,10 @@ hashDataDecls :: ResolutionResult v a [(v, Memory.Reference.Id, Memory.DD.DataDeclaration v a)] hashDataDecls memDecls = do let hashingDecls = fmap m2hDecl memDecls - hashingResult <- Hashing.DD.hashDecls Name.unsafeFromVar hashingDecls + hashingResult <- Hashing.hashDecls Name.unsafeFromVar hashingDecls pure $ map h2mDeclResult hashingResult where - h2mDeclResult :: Ord v => (v, Hashing.Reference.Id, Hashing.DD.DataDeclaration v a) -> (v, Memory.Reference.Id, Memory.DD.DataDeclaration v a) + h2mDeclResult :: Ord v => (v, Hashing.ReferenceId, Hashing.DataDeclaration v a) -> (v, Memory.Reference.Id, Memory.DD.DataDeclaration v a) h2mDeclResult (v, id, dd) = (v, h2mReferenceId id, h2mDecl dd) hashDecls :: @@ -269,75 +256,75 @@ hashDecls memDecls = do retag CT.Effect = Left . Memory.DD.EffectDeclaration retag CT.Data = Right -m2hDecl :: Ord v => Memory.DD.DataDeclaration v a -> Hashing.DD.DataDeclaration v a +m2hDecl :: Ord v => Memory.DD.DataDeclaration v a -> Hashing.DataDeclaration v a m2hDecl (Memory.DD.DataDeclaration mod ann bound ctors) = - Hashing.DD.DataDeclaration (m2hModifier mod) ann bound $ fmap (Lens.over _3 m2hType) ctors + Hashing.DataDeclaration (m2hModifier mod) ann bound $ fmap (Lens.over _3 m2hType) ctors -m2hType :: Ord v => Memory.Type.Type v a -> Hashing.Type.Type v a +m2hType :: Ord v => Memory.Type.Type v a -> Hashing.Type v a m2hType = ABT.transform \case - Memory.Type.Ref ref -> Hashing.Type.Ref (m2hReference ref) - Memory.Type.Arrow a1 a1' -> Hashing.Type.Arrow a1 a1' - Memory.Type.Ann a1 ki -> Hashing.Type.Ann a1 (m2hKind ki) - Memory.Type.App a1 a1' -> Hashing.Type.App a1 a1' - Memory.Type.Effect a1 a1' -> Hashing.Type.Effect a1 a1' - Memory.Type.Effects a1s -> Hashing.Type.Effects a1s - Memory.Type.Forall a1 -> Hashing.Type.Forall a1 - Memory.Type.IntroOuter a1 -> Hashing.Type.IntroOuter a1 + Memory.Type.Ref ref -> Hashing.TypeRef (m2hReference ref) + Memory.Type.Arrow a1 a1' -> Hashing.TypeArrow a1 a1' + Memory.Type.Ann a1 ki -> Hashing.TypeAnn a1 (m2hKind ki) + Memory.Type.App a1 a1' -> Hashing.TypeApp a1 a1' + Memory.Type.Effect a1 a1' -> Hashing.TypeEffect a1 a1' + Memory.Type.Effects a1s -> Hashing.TypeEffects a1s + Memory.Type.Forall a1 -> Hashing.TypeForall a1 + Memory.Type.IntroOuter a1 -> Hashing.TypeIntroOuter a1 -m2hKind :: Memory.Kind.Kind -> Hashing.Kind.Kind +m2hKind :: Memory.Kind.Kind -> Hashing.Kind m2hKind = \case - Memory.Kind.Star -> Hashing.Kind.Star - Memory.Kind.Arrow k1 k2 -> Hashing.Kind.Arrow (m2hKind k1) (m2hKind k2) + Memory.Kind.Star -> Hashing.KindStar + Memory.Kind.Arrow k1 k2 -> Hashing.KindArrow (m2hKind k1) (m2hKind k2) -m2hReference :: Memory.Reference.Reference -> Hashing.Reference.Reference +m2hReference :: Memory.Reference.Reference -> Hashing.Reference m2hReference = \case - Memory.Reference.Builtin t -> Hashing.Reference.Builtin t - Memory.Reference.DerivedId d -> Hashing.Reference.DerivedId (m2hReferenceId d) + Memory.Reference.Builtin t -> Hashing.ReferenceBuiltin t + Memory.Reference.DerivedId d -> Hashing.ReferenceDerivedId (m2hReferenceId d) -m2hReferenceId :: Memory.Reference.Id -> Hashing.Reference.Id -m2hReferenceId (Memory.Reference.Id h i) = Hashing.Reference.Id h i +m2hReferenceId :: Memory.Reference.Id -> Hashing.ReferenceId +m2hReferenceId (Memory.Reference.Id h i) = Hashing.ReferenceId h i -h2mModifier :: Hashing.DD.Modifier -> Memory.DD.Modifier +h2mModifier :: Hashing.Modifier -> Memory.DD.Modifier h2mModifier = \case - Hashing.DD.Structural -> Memory.DD.Structural - Hashing.DD.Unique text -> Memory.DD.Unique text + Hashing.Structural -> Memory.DD.Structural + Hashing.Unique text -> Memory.DD.Unique text -m2hModifier :: Memory.DD.Modifier -> Hashing.DD.Modifier +m2hModifier :: Memory.DD.Modifier -> Hashing.Modifier m2hModifier = \case - Memory.DD.Structural -> Hashing.DD.Structural - Memory.DD.Unique text -> Hashing.DD.Unique text + Memory.DD.Structural -> Hashing.Structural + Memory.DD.Unique text -> Hashing.Unique text -h2mDecl :: Ord v => Hashing.DD.DataDeclaration v a -> Memory.DD.DataDeclaration v a -h2mDecl (Hashing.DD.DataDeclaration mod ann bound ctors) = +h2mDecl :: Ord v => Hashing.DataDeclaration v a -> Memory.DD.DataDeclaration v a +h2mDecl (Hashing.DataDeclaration mod ann bound ctors) = Memory.DD.DataDeclaration (h2mModifier mod) ann bound (over _3 h2mType <$> ctors) -h2mType :: Ord v => Hashing.Type.Type v a -> Memory.Type.Type v a +h2mType :: Ord v => Hashing.Type v a -> Memory.Type.Type v a h2mType = ABT.transform \case - Hashing.Type.Ref ref -> Memory.Type.Ref (h2mReference ref) - Hashing.Type.Arrow a1 a1' -> Memory.Type.Arrow a1 a1' - Hashing.Type.Ann a1 ki -> Memory.Type.Ann a1 (h2mKind ki) - Hashing.Type.App a1 a1' -> Memory.Type.App a1 a1' - Hashing.Type.Effect a1 a1' -> Memory.Type.Effect a1 a1' - Hashing.Type.Effects a1s -> Memory.Type.Effects a1s - Hashing.Type.Forall a1 -> Memory.Type.Forall a1 - Hashing.Type.IntroOuter a1 -> Memory.Type.IntroOuter a1 + Hashing.TypeRef ref -> Memory.Type.Ref (h2mReference ref) + Hashing.TypeArrow a1 a1' -> Memory.Type.Arrow a1 a1' + Hashing.TypeAnn a1 ki -> Memory.Type.Ann a1 (h2mKind ki) + Hashing.TypeApp a1 a1' -> Memory.Type.App a1 a1' + Hashing.TypeEffect a1 a1' -> Memory.Type.Effect a1 a1' + Hashing.TypeEffects a1s -> Memory.Type.Effects a1s + Hashing.TypeForall a1 -> Memory.Type.Forall a1 + Hashing.TypeIntroOuter a1 -> Memory.Type.IntroOuter a1 -h2mKind :: Hashing.Kind.Kind -> Memory.Kind.Kind +h2mKind :: Hashing.Kind -> Memory.Kind.Kind h2mKind = \case - Hashing.Kind.Star -> Memory.Kind.Star - Hashing.Kind.Arrow k1 k2 -> Memory.Kind.Arrow (h2mKind k1) (h2mKind k2) + Hashing.KindStar -> Memory.Kind.Star + Hashing.KindArrow k1 k2 -> Memory.Kind.Arrow (h2mKind k1) (h2mKind k2) -h2mReference :: Hashing.Reference.Reference -> Memory.Reference.Reference +h2mReference :: Hashing.Reference -> Memory.Reference.Reference h2mReference = \case - Hashing.Reference.Builtin t -> Memory.Reference.Builtin t - Hashing.Reference.DerivedId d -> Memory.Reference.DerivedId (h2mReferenceId d) + Hashing.ReferenceBuiltin t -> Memory.Reference.Builtin t + Hashing.ReferenceDerivedId d -> Memory.Reference.DerivedId (h2mReferenceId d) -h2mReferenceId :: Hashing.Reference.Id -> Memory.Reference.Id -h2mReferenceId (Hashing.Reference.Id h i) = Memory.Reference.Id h i +h2mReferenceId :: Hashing.ReferenceId -> Memory.Reference.Id +h2mReferenceId (Hashing.ReferenceId h i) = Memory.Reference.Id h i -m2hPatch :: Memory.Patch.Patch -> Hashing.Patch.Patch +m2hPatch :: Memory.Patch.Patch -> Hashing.Patch m2hPatch (Memory.Patch.Patch termEdits typeEdits) = - Hashing.Patch.Patch termEdits' typeEdits' + Hashing.Patch termEdits' typeEdits' where typeEdits' = Map.fromList @@ -346,33 +333,33 @@ m2hPatch (Memory.Patch.Patch termEdits typeEdits) = $ Relation.toMultimap typeEdits termEdits' = Map.fromList - . map (bimap (Hashing.Referent.Ref . m2hReference) (Set.map m2hTermEdit)) + . map (bimap (Hashing.ReferentRef . m2hReference) (Set.map m2hTermEdit)) . Map.toList $ Relation.toMultimap termEdits m2hTermEdit = \case - Memory.TermEdit.Replace r _ -> Hashing.TermEdit.Replace (Hashing.Referent.Ref $ m2hReference r) - Memory.TermEdit.Deprecate -> Hashing.TermEdit.Deprecate + Memory.TermEdit.Replace r _ -> Hashing.TermEditReplace (Hashing.ReferentRef $ m2hReference r) + Memory.TermEdit.Deprecate -> Hashing.TermEditDeprecate m2hTypeEdit = \case - Memory.TypeEdit.Replace r -> Hashing.TypeEdit.Replace (m2hReference r) - Memory.TypeEdit.Deprecate -> Hashing.TypeEdit.Deprecate + Memory.TypeEdit.Replace r -> Hashing.TypeEditReplace (m2hReference r) + Memory.TypeEdit.Deprecate -> Hashing.TypeEditDeprecate hashPatch :: Memory.Patch.Patch -> Hash -hashPatch = Hashing.Patch.hashPatch . m2hPatch +hashPatch = contentHash . m2hPatch hashBranch0 :: Memory.Branch.Branch0 m -> Hash hashBranch0 = contentHash . m2hBranch0 -hashCausal :: Hashable e => e -> Set Memory.Causal.CausalHash -> (Memory.Causal.CausalHash, HashFor e) +hashCausal :: ContentAddressable e => e -> Set Memory.Causal.CausalHash -> (Memory.Causal.CausalHash, HashFor e) hashCausal e tails = - let valueHash@(HashFor vh) = (Hashable.hashFor e) + let valueHash = contentHash e causalHash = - Memory.Causal.CausalHash . Hashing.Causal.hashCausal $ - Hashing.Causal.Causal vh (Set.map Memory.Causal.unCausalHash tails) - in (causalHash, valueHash) + Memory.Causal.CausalHash . contentHash $ + Hashing.Causal valueHash (Set.map Memory.Causal.unCausalHash tails) + in (causalHash, HashFor valueHash) -m2hBranch0 :: Memory.Branch.Branch0 m -> Hashing.Branch.Raw +m2hBranch0 :: Memory.Branch.Branch0 m -> Hashing.Raw m2hBranch0 b = - Hashing.Branch.Raw + Hashing.Raw (doTerms (Memory.Branch._terms b)) (doTypes (Memory.Branch._types b)) (doPatches (Memory.Branch._edits b)) @@ -381,7 +368,7 @@ m2hBranch0 b = -- is there a more readable way to structure these that's also linear? doTerms :: Memory.Branch.Star Memory.Referent.Referent Memory.NameSegment.NameSegment -> - Map Hashing.NameSegment (Map Hashing.Referent.Referent Hashing.Branch.MdValues) + Map Hashing.NameSegment (Map Hashing.Referent Hashing.MdValues) doTerms s = Map.fromList [ (m2hNameSegment ns, m2) @@ -391,13 +378,13 @@ m2hBranch0 b = [ (fst (Writer.runWriter (m2hReferent r)), md) | r <- toList . Relation.lookupRan ns $ Memory.Star3.d1 s, let mdrefs1to2 (_typeR1, valR1) = m2hReference valR1 - md = Hashing.Branch.MdValues . Set.map mdrefs1to2 . Relation.lookupDom r $ Memory.Star3.d3 s + md = Hashing.MdValues . Set.map mdrefs1to2 . Relation.lookupDom r $ Memory.Star3.d3 s ] ] doTypes :: Memory.Branch.Star Memory.Reference.Reference Memory.NameSegment.NameSegment -> - Map Hashing.NameSegment (Map Hashing.Reference.Reference Hashing.Branch.MdValues) + Map Hashing.NameSegment (Map Hashing.Reference Hashing.MdValues) doTypes s = Map.fromList [ (m2hNameSegment ns, m2) @@ -407,8 +394,8 @@ m2hBranch0 b = [ (m2hReference r, md) | r <- toList . Relation.lookupRan ns $ Memory.Star3.d1 s, let mdrefs1to2 (_typeR1, valR1) = m2hReference valR1 - md :: Hashing.Branch.MdValues - md = Hashing.Branch.MdValues . Set.map mdrefs1to2 . Relation.lookupDom r $ Memory.Star3.d3 s + md :: Hashing.MdValues + md = Hashing.MdValues . Set.map mdrefs1to2 . Relation.lookupDom r $ Memory.Star3.d3 s ] ] diff --git a/unison-core/src/Unison/DataDeclaration/ConstructorId.hs b/unison-core/src/Unison/DataDeclaration/ConstructorId.hs index 1461f66ff..011effb5e 100644 --- a/unison-core/src/Unison/DataDeclaration/ConstructorId.hs +++ b/unison-core/src/Unison/DataDeclaration/ConstructorId.hs @@ -1,11 +1,3 @@ -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ViewPatterns #-} - module Unison.DataDeclaration.ConstructorId (ConstructorId) where import Data.Word (Word64) diff --git a/unison-hashing-v2/package.yaml b/unison-hashing-v2/package.yaml index 7152bce56..46fbfb6e4 100644 --- a/unison-hashing-v2/package.yaml +++ b/unison-hashing-v2/package.yaml @@ -21,6 +21,8 @@ dependencies: - unison-util-relation library: + exposed-modules: + Unison.Hashing.V2 source-dirs: src when: - condition: false diff --git a/unison-hashing-v2/src/Unison/Hashing/V2.hs b/unison-hashing-v2/src/Unison/Hashing/V2.hs new file mode 100644 index 000000000..b91e9dbf4 --- /dev/null +++ b/unison-hashing-v2/src/Unison/Hashing/V2.hs @@ -0,0 +1,50 @@ +-- | Description: This module exports: +-- +-- * Data types with 'ContentAddressable' instances that correspond to v2 of the Unison hash function. +-- * Miscellaneous helper functions related to hashing. +module Unison.Hashing.V2 + ( Causal (..), + DataDeclaration (..), + Decl, + EffectDeclaration (..), + Kind (..), + MatchCase (..), + MdValues (..), + Modifier (..), + NameSegment (..), + Patch (..), + Pattern (..), + Raw (..), + Reference (..), + pattern ReferenceDerived, + ReferenceId (..), + Referent (..), + SeqOp (..), + Term, + TermEdit (..), + TermF (..), + Type, + TypeEdit (..), + TypeF (..), + hashClosedTerm, + hashDecls, + hashTermComponents, + hashTermComponentsWithoutTypes, + typeToReference, + typeToReferenceMentions, + ) +where + +import Unison.Hashing.V2.Branch (MdValues (..), Raw (..)) +import Unison.Hashing.V2.Causal (Causal (..)) +import Unison.Hashing.V2.DataDeclaration (DataDeclaration (..), Decl, EffectDeclaration (..), Modifier (..), hashDecls) +import Unison.Hashing.V2.Kind (Kind (..)) +import Unison.Hashing.V2.NameSegment (NameSegment (..)) +import Unison.Hashing.V2.Patch (Patch (..)) +import Unison.Hashing.V2.Pattern (Pattern (..), SeqOp (..)) +import Unison.Hashing.V2.Reference (Reference (..), ReferenceId (..), pattern ReferenceDerived) +import Unison.Hashing.V2.Referent (Referent (..)) +import Unison.Hashing.V2.Term (MatchCase (..), Term, TermF (..), hashClosedTerm, hashTermComponents, hashTermComponentsWithoutTypes) +import Unison.Hashing.V2.TermEdit (TermEdit (..)) +import Unison.Hashing.V2.Type (Type, TypeF (..), typeToReference, typeToReferenceMentions) +import Unison.Hashing.V2.TypeEdit (TypeEdit (..)) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs index 8c74fdd46..475fe89cd 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs @@ -1,23 +1,18 @@ -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} - module Unison.Hashing.V2.Causal ( Causal (..), - hashCausal, ) where -import Data.Set (Set) import qualified Data.Set as Set +import Unison.ContentAddressable (ContentAddressable (..)) import Unison.Hash (Hash) import qualified Unison.Hashing.V2.Tokenizable as H -import qualified Unison.Hashing.V2.Tokenizable as Tokenizable - -hashCausal :: Causal -> Hash -hashCausal = Tokenizable.hashTokenizable +import Unison.Prelude data Causal = Causal {branchHash :: Hash, parents :: Set Hash} +instance ContentAddressable Causal where + contentHash = H.hashTokenizable + instance H.Tokenizable Causal where tokens c = H.tokens $ branchHash c : Set.toList (parents c) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/ConstructorId.hs b/unison-hashing-v2/src/Unison/Hashing/V2/ConstructorId.hs new file mode 100644 index 000000000..f64b67534 --- /dev/null +++ b/unison-hashing-v2/src/Unison/Hashing/V2/ConstructorId.hs @@ -0,0 +1,8 @@ +module Unison.Hashing.V2.ConstructorId + ( ConstructorId, + ) +where + +import Data.Word (Word64) + +type ConstructorId = Word64 diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs b/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs index 46d4b67d5..0fed39823 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE RecordWildCards #-} - module Unison.Hashing.V2.DataDeclaration ( DataDeclaration (..), EffectDeclaration (..), @@ -15,12 +13,11 @@ import qualified Data.Map as Map import qualified Unison.ABT as ABT import Unison.Hash (Hash) import qualified Unison.Hashing.V2.ABT as ABT -import Unison.Hashing.V2.Reference (Reference) -import qualified Unison.Hashing.V2.Reference as Reference +import Unison.Hashing.V2.Reference (Reference (..), ReferenceId) import qualified Unison.Hashing.V2.Reference.Util as Reference.Util import Unison.Hashing.V2.Tokenizable (Hashable1) import qualified Unison.Hashing.V2.Tokenizable as Hashable -import Unison.Hashing.V2.Type (Type) +import Unison.Hashing.V2.Type (Type, TypeF) import qualified Unison.Hashing.V2.Type as Type import qualified Unison.Name as Name import qualified Unison.Names.ResolutionResult as Names @@ -58,10 +55,10 @@ toABT dd = ABT.tm $ Modified (modifier dd) dd' dd' = ABT.absChain (bound dd) (ABT.tm (Constructors (ABT.transform Type <$> constructorTypes dd))) -- Implementation detail of `hashDecls`, works with unannotated data decls -hashDecls0 :: (Eq v, ABT.Var v, Show v) => Map v (DataDeclaration v ()) -> [(v, Reference.Id)] +hashDecls0 :: (Eq v, ABT.Var v, Show v) => Map v (DataDeclaration v ()) -> [(v, ReferenceId)] hashDecls0 decls = let abts = toABT <$> decls - ref r = ABT.tm (Type (Type.Ref (Reference.DerivedId r))) + ref r = ABT.tm (Type (Type.TypeRef (ReferenceDerivedId r))) cs = Reference.Util.hashComponents ref abts in [(v, r) | (v, (r, _)) <- Map.toList cs] @@ -80,11 +77,11 @@ hashDecls :: (Eq v, Var v, Show v) => (v -> Name.Name) -> Map v (DataDeclaration v a) -> - Names.ResolutionResult v a [(v, Reference.Id, DataDeclaration v a)] + Names.ResolutionResult v a [(v, ReferenceId, DataDeclaration v a)] hashDecls unsafeVarToName decls = do -- todo: make sure all other external references are resolved before calling this let varToRef = hashDecls0 (void <$> decls) - varToRef' = second Reference.DerivedId <$> varToRef + varToRef' = second ReferenceDerivedId <$> varToRef decls' = bindTypes <$> decls bindTypes dd = dd {constructors' = over _3 (Type.bindExternal varToRef') <$> constructors' dd} typeReferences = Map.fromList (first unsafeVarToName <$> varToRef') @@ -107,7 +104,7 @@ bindReferences unsafeVarToName keepFree names (DataDeclaration m a bound constru pure $ DataDeclaration m a bound constructors data F a - = Type (Type.F a) + = Type (TypeF a) | LetRec [a] a | Constructors [a] | Modified Modifier a diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Hashable.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Hashable.hs deleted file mode 100644 index f6ed2ece7..000000000 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Hashable.hs +++ /dev/null @@ -1,30 +0,0 @@ -module Unison.Hashing.V2.Hashable - ( Hashable (..), - hashFor, - HashFor (..), - ) -where - -import Data.Int (Int64) -import Data.Set (Set) -import Unison.Hash (Hash (..), HashFor (..)) -import qualified Unison.Hashing.V2.Tokenizable as Tokenizable - --- | This typeclass provides a mechanism for obtaining a content-based hash for Unison types & --- terms. --- Be wary that Unison requires that these hashes be deterministic, any change to a Hashable --- instance requires a full codebase migration and should not be taken lightly. -class Hashable t where - hash :: t -> Hash - -instance Tokenizable.Tokenizable a => Hashable [a] where - hash = Tokenizable.hashTokenizable - -instance Tokenizable.Tokenizable a => Hashable (Set a) where - hash = Tokenizable.hashTokenizable - -instance Hashable Int64 where - hash = Tokenizable.hashTokenizable - -hashFor :: Hashable t => t -> HashFor t -hashFor = HashFor . hash diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Kind.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Kind.hs index 98d6791a6..9cc130b0d 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Kind.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Kind.hs @@ -1,14 +1,18 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Unison.Hashing.V2.Kind where +module Unison.Hashing.V2.Kind + ( Kind (..), + ) +where import Unison.Hashing.V2.Tokenizable (Tokenizable) import qualified Unison.Hashing.V2.Tokenizable as Hashable import Unison.Prelude -data Kind = Star | Arrow Kind Kind deriving (Eq, Ord, Read, Show, Generic) +data Kind + = KindStar + | KindArrow Kind Kind + deriving (Eq, Ord, Read, Show, Generic) instance Tokenizable Kind where tokens k = case k of - Star -> [Hashable.Tag 0] - Arrow k1 k2 -> (Hashable.Tag 1 : Hashable.tokens k1) ++ Hashable.tokens k2 + KindStar -> [Hashable.Tag 0] + KindArrow k1 k2 -> (Hashable.Tag 1 : Hashable.tokens k1) ++ Hashable.tokens k2 diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs index 017f68d54..67e3f59a7 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs @@ -1,27 +1,25 @@ -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TemplateHaskell #-} +module Unison.Hashing.V2.Patch + ( Patch (..), + ) +where -module Unison.Hashing.V2.Patch (Patch (..), hashPatch) where - -import Data.Map (Map) -import Data.Set (Set) -import Unison.Hash (Hash) +import Unison.ContentAddressable (ContentAddressable (contentHash)) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Referent (Referent) import Unison.Hashing.V2.TermEdit (TermEdit) import Unison.Hashing.V2.Tokenizable (Tokenizable) import qualified Unison.Hashing.V2.Tokenizable as H import Unison.Hashing.V2.TypeEdit (TypeEdit) - -hashPatch :: Patch -> Hash -hashPatch = H.hashTokenizable +import Unison.Prelude data Patch = Patch { termEdits :: Map Referent (Set TermEdit), typeEdits :: Map Reference (Set TypeEdit) } +instance ContentAddressable Patch where + contentHash = H.hashTokenizable + instance Tokenizable Patch where tokens p = [ H.accumulateToken (termEdits p), diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Pattern.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Pattern.hs index 1cfe22542..433370b29 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Pattern.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Pattern.hs @@ -1,35 +1,30 @@ -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} +module Unison.Hashing.V2.Pattern + ( Pattern (..), + SeqOp (..), + ) +where -module Unison.Hashing.V2.Pattern where - -import Data.Foldable as Foldable hiding (foldMap') -import Data.List (intercalate) -import qualified Data.Set as Set import Unison.DataDeclaration.ConstructorId (ConstructorId) import Unison.Hashing.V2.Reference (Reference) import qualified Unison.Hashing.V2.Tokenizable as H -import qualified Unison.Hashing.V2.Type as Type import Unison.Prelude data Pattern loc - = Unbound loc - | Var loc - | Boolean loc !Bool - | Int loc !Int64 - | Nat loc !Word64 - | Float loc !Double - | Text loc !Text - | Char loc !Char - | Constructor loc !Reference !ConstructorId [Pattern loc] - | As loc (Pattern loc) - | EffectPure loc (Pattern loc) - | EffectBind loc !Reference !ConstructorId [Pattern loc] (Pattern loc) - | SequenceLiteral loc [Pattern loc] - | SequenceOp loc (Pattern loc) !SeqOp (Pattern loc) - deriving (Ord, Generic, Functor, Foldable, Traversable) + = PatternUnbound loc + | PatternVar loc + | PatternBoolean loc !Bool + | PatternInt loc !Int64 + | PatternNat loc !Word64 + | PatternFloat loc !Double + | PatternText loc !Text + | PatternChar loc !Char + | PatternConstructor loc !Reference !ConstructorId [Pattern loc] + | PatternAs loc (Pattern loc) + | PatternEffectPure loc (Pattern loc) + | PatternEffectBind loc !Reference !ConstructorId [Pattern loc] (Pattern loc) + | PatternSequenceLiteral loc [Pattern loc] + | PatternSequenceOp loc (Pattern loc) !SeqOp (Pattern loc) + deriving stock (Foldable, Functor, Generic, Ord, Show, Traversable) data SeqOp = Cons @@ -42,118 +37,36 @@ instance H.Tokenizable SeqOp where tokens Snoc = [H.Tag 1] tokens Concat = [H.Tag 2] -instance Show (Pattern loc) where - show (Unbound _) = "Unbound" - show (Var _) = "Var" - show (Boolean _ x) = "Boolean " <> show x - show (Int _ x) = "Int " <> show x - show (Nat _ x) = "Nat " <> show x - show (Float _ x) = "Float " <> show x - show (Text _ t) = "Text " <> show t - show (Char _ c) = "Char " <> show c - show (Constructor _ r i ps) = - "Constructor " <> unwords [show r, show i, show ps] - show (As _ p) = "As " <> show p - show (EffectPure _ k) = "EffectPure " <> show k - show (EffectBind _ r i ps k) = - "EffectBind " <> unwords [show r, show i, show ps, show k] - show (SequenceLiteral _ ps) = "Sequence " <> intercalate ", " (fmap show ps) - show (SequenceOp _ ph op pt) = "Sequence " <> show ph <> " " <> show op <> " " <> show pt - -application :: Pattern loc -> Bool -application (Constructor _ _ _ (_ : _)) = True -application _ = False - -loc :: Pattern loc -> loc -loc p = head $ Foldable.toList p - -setLoc :: Pattern loc -> loc -> Pattern loc -setLoc p loc = case p of - EffectBind _ a b c d -> EffectBind loc a b c d - EffectPure _ a -> EffectPure loc a - As _ a -> As loc a - Constructor _ a b c -> Constructor loc a b c - SequenceLiteral _ ps -> SequenceLiteral loc ps - SequenceOp _ ph op pt -> SequenceOp loc ph op pt - x -> fmap (const loc) x - instance H.Tokenizable (Pattern p) where - tokens (Unbound _) = [H.Tag 0] - tokens (Var _) = [H.Tag 1] - tokens (Boolean _ b) = H.Tag 2 : [H.Tag $ if b then 1 else 0] - tokens (Int _ n) = H.Tag 3 : [H.Int n] - tokens (Nat _ n) = H.Tag 4 : [H.Nat n] - tokens (Float _ f) = H.Tag 5 : H.tokens f - tokens (Constructor _ r n args) = + tokens (PatternUnbound _) = [H.Tag 0] + tokens (PatternVar _) = [H.Tag 1] + tokens (PatternBoolean _ b) = H.Tag 2 : [H.Tag $ if b then 1 else 0] + tokens (PatternInt _ n) = H.Tag 3 : [H.Int n] + tokens (PatternNat _ n) = H.Tag 4 : [H.Nat n] + tokens (PatternFloat _ f) = H.Tag 5 : H.tokens f + tokens (PatternConstructor _ r n args) = [H.Tag 6, H.accumulateToken r, H.Nat $ fromIntegral n, H.accumulateToken args] - tokens (EffectPure _ p) = H.Tag 7 : H.tokens p - tokens (EffectBind _ r n args k) = + tokens (PatternEffectPure _ p) = H.Tag 7 : H.tokens p + tokens (PatternEffectBind _ r n args k) = [H.Tag 8, H.accumulateToken r, H.Nat $ fromIntegral n, H.accumulateToken args, H.accumulateToken k] - tokens (As _ p) = H.Tag 9 : H.tokens p - tokens (Text _ t) = H.Tag 10 : H.tokens t - tokens (SequenceLiteral _ ps) = H.Tag 11 : concatMap H.tokens ps - tokens (SequenceOp _ l op r) = H.Tag 12 : H.tokens op ++ H.tokens l ++ H.tokens r - tokens (Char _ c) = H.Tag 13 : H.tokens c + tokens (PatternAs _ p) = H.Tag 9 : H.tokens p + tokens (PatternText _ t) = H.Tag 10 : H.tokens t + tokens (PatternSequenceLiteral _ ps) = H.Tag 11 : concatMap H.tokens ps + tokens (PatternSequenceOp _ l op r) = H.Tag 12 : H.tokens op ++ H.tokens l ++ H.tokens r + tokens (PatternChar _ c) = H.Tag 13 : H.tokens c instance Eq (Pattern loc) where - Unbound _ == Unbound _ = True - Var _ == Var _ = True - Boolean _ b == Boolean _ b2 = b == b2 - Int _ n == Int _ m = n == m - Nat _ n == Nat _ m = n == m - Float _ f == Float _ g = f == g - Constructor _ r n args == Constructor _ s m brgs = r == s && n == m && args == brgs - EffectPure _ p == EffectPure _ q = p == q - EffectBind _ r ctor ps k == EffectBind _ r2 ctor2 ps2 k2 = r == r2 && ctor == ctor2 && ps == ps2 && k == k2 - As _ p == As _ q = p == q - Text _ t == Text _ t2 = t == t2 - SequenceLiteral _ ps == SequenceLiteral _ ps2 = ps == ps2 - SequenceOp _ ph op pt == SequenceOp _ ph2 op2 pt2 = ph == ph2 && op == op2 && pt == pt2 + PatternUnbound _ == PatternUnbound _ = True + PatternVar _ == PatternVar _ = True + PatternBoolean _ b == PatternBoolean _ b2 = b == b2 + PatternInt _ n == PatternInt _ m = n == m + PatternNat _ n == PatternNat _ m = n == m + PatternFloat _ f == PatternFloat _ g = f == g + PatternConstructor _ r n args == PatternConstructor _ s m brgs = r == s && n == m && args == brgs + PatternEffectPure _ p == PatternEffectPure _ q = p == q + PatternEffectBind _ r ctor ps k == PatternEffectBind _ r2 ctor2 ps2 k2 = r == r2 && ctor == ctor2 && ps == ps2 && k == k2 + PatternAs _ p == PatternAs _ q = p == q + PatternText _ t == PatternText _ t2 = t == t2 + PatternSequenceLiteral _ ps == PatternSequenceLiteral _ ps2 = ps == ps2 + PatternSequenceOp _ ph op pt == PatternSequenceOp _ ph2 op2 pt2 = ph == ph2 && op == op2 && pt == pt2 _ == _ = False - -foldMap' :: Monoid m => (Pattern loc -> m) -> Pattern loc -> m -foldMap' f p = case p of - Unbound _ -> f p - Var _ -> f p - Boolean _ _ -> f p - Int _ _ -> f p - Nat _ _ -> f p - Float _ _ -> f p - Text _ _ -> f p - Char _ _ -> f p - Constructor _ _ _ ps -> f p <> foldMap (foldMap' f) ps - As _ p' -> f p <> foldMap' f p' - EffectPure _ p' -> f p <> foldMap' f p' - EffectBind _ _ _ ps p' -> f p <> foldMap (foldMap' f) ps <> foldMap' f p' - SequenceLiteral _ ps -> f p <> foldMap (foldMap' f) ps - SequenceOp _ p1 _ p2 -> f p <> foldMap' f p1 <> foldMap' f p2 - -generalizedDependencies :: - Ord r => - (Reference -> r) -> - (Reference -> ConstructorId -> r) -> - (Reference -> r) -> - (Reference -> ConstructorId -> r) -> - (Reference -> r) -> - Pattern loc -> - Set r -generalizedDependencies literalType dataConstructor dataType effectConstructor effectType = - Set.fromList - . foldMap' - ( \case - Unbound _ -> mempty - Var _ -> mempty - As _ _ -> mempty - Constructor _ r cid _ -> [dataType r, dataConstructor r cid] - EffectPure _ _ -> [effectType Type.effectRef] - EffectBind _ r cid _ _ -> - [effectType Type.effectRef, effectType r, effectConstructor r cid] - SequenceLiteral _ _ -> [literalType Type.listRef] - SequenceOp {} -> [literalType Type.listRef] - Boolean _ _ -> [literalType Type.booleanRef] - Int _ _ -> [literalType Type.intRef] - Nat _ _ -> [literalType Type.natRef] - Float _ _ -> [literalType Type.floatRef] - Text _ _ -> [literalType Type.textRef] - Char _ _ -> [literalType Type.charRef] - ) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Reference.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Reference.hs index 8dff969e5..7b95c0326 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Reference.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Reference.hs @@ -1,25 +1,17 @@ -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE ViewPatterns #-} - module Unison.Hashing.V2.Reference - ( Reference, - pattern Builtin, - pattern Derived, - pattern DerivedId, - Id (..), + ( Reference (..), + pattern ReferenceDerived, + ReferenceId (..), components, ) where import qualified Data.Text as Text -import qualified Unison.Hash as H +import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import Unison.Hashing.V2.Tokenizable (Tokenizable) import qualified Unison.Hashing.V2.Tokenizable as Hashable import Unison.Prelude -import Unison.ShortHash (ShortHash) -import qualified Unison.ShortHash as SH -- | Either a builtin or a user defined (hashed) top-level declaration. -- @@ -27,45 +19,33 @@ import qualified Unison.ShortHash as SH -- -- Other used defined things like local variables don't get @Reference@s. data Reference - = Builtin Text.Text + = ReferenceBuiltin Text.Text | -- `Derived` can be part of a strongly connected component. -- The `Pos` refers to a particular element of the component -- and the `Size` is the number of elements in the component. -- Using an ugly name so no one tempted to use this - DerivedId Id - deriving (Eq, Ord) + ReferenceDerivedId ReferenceId + deriving stock (Eq, Ord, Show) type Pos = Word64 -pattern Derived :: H.Hash -> Pos -> Reference -pattern Derived h i = DerivedId (Id h i) +pattern ReferenceDerived :: Hash -> Pos -> Reference +pattern ReferenceDerived h i = ReferenceDerivedId (ReferenceId h i) -{-# COMPLETE Builtin, Derived #-} +{-# COMPLETE ReferenceBuiltin, ReferenceDerived #-} -- | @Pos@ is a position into a cycle of size @Size@, as cycles are hashed together. -data Id = Id H.Hash Pos deriving (Eq, Ord) +data ReferenceId + = ReferenceId Hash Pos + deriving stock (Eq, Ord, Show) --- todo: delete these, but `instance Show Reference` currently depends on SH -toShortHash :: Reference -> ShortHash -toShortHash (Builtin b) = SH.Builtin b -toShortHash (Derived h 0) = SH.ShortHash (H.base32Hex h) Nothing Nothing -toShortHash (Derived h i) = SH.ShortHash (H.base32Hex h) (Just $ showSuffix i) Nothing - -showSuffix :: Pos -> Text -showSuffix = Text.pack . show - -component :: H.Hash -> [k] -> [(k, Id)] +component :: Hash -> [k] -> [(k, ReferenceId)] component h ks = - let - in [(k, (Id h i)) | (k, i) <- ks `zip` [0 ..]] + [(k, (ReferenceId h i)) | (k, i) <- ks `zip` [0 ..]] -components :: [(H.Hash, [k])] -> [(k, Id)] +components :: [(Hash, [k])] -> [(k, ReferenceId)] components sccs = uncurry component =<< sccs -instance Show Id where show = SH.toString . SH.take 5 . toShortHash . DerivedId - -instance Show Reference where show = SH.toString . SH.take 5 . toShortHash - instance Tokenizable Reference where - tokens (Builtin txt) = [Hashable.Tag 0, Hashable.Text txt] - tokens (DerivedId (Id h i)) = [Hashable.Tag 1, Hashable.Bytes (H.toByteString h), Hashable.Nat i] + tokens (ReferenceBuiltin txt) = [Hashable.Tag 0, Hashable.Text txt] + tokens (ReferenceDerivedId (ReferenceId h i)) = [Hashable.Tag 1, Hashable.Bytes (Hash.toByteString h), Hashable.Nat i] diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Reference/Util.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Reference/Util.hs index e1db55628..1534f4aef 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Reference/Util.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Reference/Util.hs @@ -1,19 +1,23 @@ -module Unison.Hashing.V2.Reference.Util where +module Unison.Hashing.V2.Reference.Util + ( hashComponents, + ) +where import qualified Data.Map as Map import Unison.ABT (Var) import qualified Unison.Hashing.V2.ABT as ABT +import Unison.Hashing.V2.Reference (ReferenceId (..)) import qualified Unison.Hashing.V2.Reference as Reference import Unison.Hashing.V2.Tokenizable (Hashable1) import Unison.Prelude hashComponents :: (Functor f, Hashable1 f, Foldable f, Eq v, Show v, Var v) => - (Reference.Id -> ABT.Term f v ()) -> + (ReferenceId -> ABT.Term f v ()) -> Map v (ABT.Term f v a) -> - Map v (Reference.Id, ABT.Term f v a) + Map v (ReferenceId, ABT.Term f v a) hashComponents embedRef tms = Map.fromList [(v, (r, e)) | ((v, e), r) <- cs] where cs = Reference.components $ ABT.hashComponents ref tms - ref h i = embedRef (Reference.Id h i) + ref h i = embedRef (ReferenceId h i) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Referent.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Referent.hs index 6c8806631..61b81f01c 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Referent.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Referent.hs @@ -1,22 +1,18 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} - module Unison.Hashing.V2.Referent - ( Referent, - pattern Ref, - pattern Con, - ConstructorId, + ( Referent (..), ) where -import Unison.DataDeclaration.ConstructorId (ConstructorId) +import Unison.Hashing.V2.ConstructorId (ConstructorId) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Tokenizable (Tokenizable) import qualified Unison.Hashing.V2.Tokenizable as H -data Referent = Ref Reference | Con Reference ConstructorId - deriving (Show, Ord, Eq) +data Referent + = ReferentRef Reference + | ReferentCon Reference ConstructorId + deriving stock (Show, Ord, Eq) instance Tokenizable Referent where - tokens (Ref r) = [H.Tag 0] ++ H.tokens r - tokens (Con r i) = [H.Tag 2] ++ H.tokens r ++ H.tokens i + tokens (ReferentRef r) = [H.Tag 0] ++ H.tokens r + tokens (ReferentCon r i) = [H.Tag 2] ++ H.tokens r ++ H.tokens i diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs index 6e296b4aa..b8ed3de25 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs @@ -1,21 +1,10 @@ -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE InstanceSigs #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PartialTypeSignatures #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE Rank2Types #-} -{-# LANGUAGE UnicodeSyntax #-} -{-# LANGUAGE ViewPatterns #-} - module Unison.Hashing.V2.Term ( Term, - F (..), + TermF (..), MatchCase (..), hashClosedTerm, - hashComponents, - hashComponentsWithoutTypes, + hashTermComponents, + hashTermComponentsWithoutTypes, ) where @@ -29,8 +18,7 @@ import Unison.Hash (Hash) import qualified Unison.Hash as Hash import qualified Unison.Hashing.V2.ABT as ABT import Unison.Hashing.V2.Pattern (Pattern) -import Unison.Hashing.V2.Reference (Reference) -import qualified Unison.Hashing.V2.Reference as Reference +import Unison.Hashing.V2.Reference (Reference (..), ReferenceId (..), pattern ReferenceDerived) import qualified Unison.Hashing.V2.Reference.Util as ReferenceUtil import Unison.Hashing.V2.Referent (Referent) import Unison.Hashing.V2.Tokenizable (Hashable1, accumulateToken) @@ -41,37 +29,37 @@ import Unison.Var (Var) import Prelude hiding (and, or) data MatchCase loc a = MatchCase (Pattern loc) (Maybe a) a - deriving (Show, Eq, Foldable, Functor, Generic, Generic1, Traversable) + deriving stock (Show, Eq, Foldable, Functor, Generic, Generic1, Traversable) -- | Base functor for terms in the Unison language -- We need `typeVar` because the term and type variables may differ. -data F typeVar typeAnn patternAnn a - = Int Int64 - | Nat Word64 - | Float Double - | Boolean Bool - | Text Text - | Char Char - | Blank (B.Blank typeAnn) - | Ref Reference +data TermF typeVar typeAnn patternAnn a + = TermInt Int64 + | TermNat Word64 + | TermFloat Double + | TermBoolean Bool + | TermText Text + | TermChar Char + | TermBlank (B.Blank typeAnn) + | TermRef Reference | -- First argument identifies the data type, -- second argument identifies the constructor - Constructor Reference ConstructorId - | Request Reference ConstructorId - | Handle a a - | App a a - | Ann a (Type typeVar typeAnn) - | List (Seq a) - | If a a a - | And a a - | Or a a - | Lam a + TermConstructor Reference ConstructorId + | TermRequest Reference ConstructorId + | TermHandle a a + | TermApp a a + | TermAnn a (Type typeVar typeAnn) + | TermList (Seq a) + | TermIf a a a + | TermAnd a a + | TermOr a a + | TermLam a | -- Note: let rec blocks have an outer ABT.Cycle which introduces as many -- variables as there are bindings - LetRec [a] a + TermLetRec [a] a | -- Note: first parameter is the binding, second is the expression which may refer -- to this let bound variable. Constructed as `Let b (abs v e)` - Let a a + TermLet a a | -- Pattern matching / eliminating data types, example: -- case x of -- Just n -> rhs1 @@ -82,9 +70,9 @@ data F typeVar typeAnn patternAnn a -- Match x -- [ (Constructor 0 [Var], ABT.abs n rhs1) -- , (Constructor 1 [], rhs2) ] - Match a [MatchCase patternAnn a] - | TermLink Referent - | TypeLink Reference + TermMatch a [MatchCase patternAnn a] + | TermTermLink Referent + | TermTypeLink Reference deriving (Foldable, Functor, Generic, Generic1, Traversable) -- | Like `Term v`, but with an annotation of type `a` at every level in the tree @@ -92,32 +80,32 @@ type Term v a = Term2 v a a v a -- | Allow type variables, term variables, type annotations and term annotations -- to all differ -type Term2 vt at ap v a = ABT.Term (F vt at ap) v a +type Term2 vt at ap v a = ABT.Term (TermF vt at ap) v a -- some smart constructors ref :: Ord v => a -> Reference -> Term2 vt at ap v a -ref a r = ABT.tm' a (Ref r) +ref a r = ABT.tm' a (TermRef r) -refId :: Ord v => a -> Reference.Id -> Term2 vt at ap v a -refId a = ref a . Reference.DerivedId +refId :: Ord v => a -> ReferenceId -> Term2 vt at ap v a +refId a = ref a . ReferenceDerivedId -hashComponents :: +hashTermComponents :: forall v a. Var v => Map v (Term v a, Type v a) -> - Map v (Reference.Id, Term v a, Type v a) -hashComponents terms = + Map v (ReferenceId, Term v a, Type v a) +hashTermComponents terms = Zip.zipWith keepType terms (ReferenceUtil.hashComponents (refId ()) terms') where terms' :: Map v (Term v a) terms' = uncurry incorporateType <$> terms - keepType :: ((Term v a, Type v a) -> (Reference.Id, Term v a) -> (Reference.Id, Term v a, Type v a)) + keepType :: ((Term v a, Type v a) -> (ReferenceId, Term v a) -> (ReferenceId, Term v a, Type v a)) keepType (_oldTrm, typ) (refId, trm) = (refId, trm, typ) incorporateType :: Term v a -> Type v a -> Term v a - incorporateType a@(ABT.out -> ABT.Tm (Ann e _tp)) typ = ABT.tm' (ABT.annotation a) (Ann e typ) - incorporateType e typ = ABT.tm' (ABT.annotation e) (Ann e typ) + incorporateType a@(ABT.out -> ABT.Tm (TermAnn e _tp)) typ = ABT.tm' (ABT.annotation a) (TermAnn e typ) + incorporateType e typ = ABT.tm' (ABT.annotation e) (TermAnn e typ) -- keep these until we decide if we want to add the appropriate smart constructors back into this module -- incorporateType (Term.Ann' e _) typ = Term.ann () e typ @@ -128,14 +116,14 @@ hashComponents terms = -- What if there's a top-level Annotation but it doesn't match -- the type that was provided? -hashComponentsWithoutTypes :: Var v => Map v (Term v a) -> Map v (Reference.Id, Term v a) -hashComponentsWithoutTypes = ReferenceUtil.hashComponents $ refId () +hashTermComponentsWithoutTypes :: Var v => Map v (Term v a) -> Map v (ReferenceId, Term v a) +hashTermComponentsWithoutTypes = ReferenceUtil.hashComponents $ refId () -hashClosedTerm :: Var v => Term v a -> Reference.Id -hashClosedTerm tm = Reference.Id (ABT.hash tm) 0 +hashClosedTerm :: Var v => Term v a -> ReferenceId +hashClosedTerm tm = ReferenceId (ABT.hash tm) 0 -instance Var v => Hashable1 (F v a p) where - hash1 :: forall x. ([x] -> ([Hash], x -> Hash)) -> (x -> Hash) -> (F v a p) x -> Hash +instance Var v => Hashable1 (TermF v a p) where + hash1 :: forall x. ([x] -> ([Hash], x -> Hash)) -> (x -> Hash) -> (TermF v a p) x -> Hash hash1 hashCycle hash e = let varint :: Integral i => i -> Hashable.Token varint = Hashable.Nat . fromIntegral @@ -147,8 +135,8 @@ instance Var v => Hashable1 (F v a p) where -- are 'transparent' wrt hash and hashing is unaffected by whether -- expressions are linked. So for example `x = 1 + 1` and `y = x` hash -- the same. - Ref (Reference.Derived h 0) -> Hash.fromByteString (Hash.toByteString h) - Ref (Reference.Derived h i) -> + TermRef (ReferenceDerived h 0) -> Hash.fromByteString (Hash.toByteString h) + TermRef (ReferenceDerived h i) -> Hashable.accumulate [ tag 1, hashed $ Hash.fromByteString (Hash.toByteString h), @@ -161,42 +149,42 @@ instance Var v => Hashable1 (F v a p) where Hashable.accumulate $ tag 1 : case e of - Nat i -> [tag 64, accumulateToken i] - Int i -> [tag 65, accumulateToken i] - Float n -> [tag 66, Hashable.Double n] - Boolean b -> [tag 67, accumulateToken b] - Text t -> [tag 68, accumulateToken t] - Char c -> [tag 69, accumulateToken c] - Blank b -> + TermNat i -> [tag 64, accumulateToken i] + TermInt i -> [tag 65, accumulateToken i] + TermFloat n -> [tag 66, Hashable.Double n] + TermBoolean b -> [tag 67, accumulateToken b] + TermText t -> [tag 68, accumulateToken t] + TermChar c -> [tag 69, accumulateToken c] + TermBlank b -> tag 1 : case b of B.Blank -> [tag 0] B.Recorded (B.Placeholder _ s) -> [tag 1, Hashable.Text (Text.pack s)] B.Recorded (B.Resolve _ s) -> [tag 2, Hashable.Text (Text.pack s)] - Ref (Reference.Builtin name) -> [tag 2, accumulateToken name] - Ref Reference.Derived {} -> + TermRef (ReferenceBuiltin name) -> [tag 2, accumulateToken name] + TermRef ReferenceDerived {} -> error "handled above, but GHC can't figure this out" - App a a2 -> [tag 3, hashed (hash a), hashed (hash a2)] - Ann a t -> [tag 4, hashed (hash a), hashed (ABT.hash t)] - List as -> + TermApp a a2 -> [tag 3, hashed (hash a), hashed (hash a2)] + TermAnn a t -> [tag 4, hashed (hash a), hashed (ABT.hash t)] + TermList as -> tag 5 : varint (Sequence.length as) : map (hashed . hash) (toList as) - Lam a -> [tag 6, hashed (hash a)] + TermLam a -> [tag 6, hashed (hash a)] -- note: we use `hashCycle` to ensure result is independent of -- let binding order - LetRec as a -> case hashCycle as of + TermLetRec as a -> case hashCycle as of (hs, hash) -> tag 7 : hashed (hash a) : map hashed hs -- here, order is significant, so don't use hashCycle - Let b a -> [tag 8, hashed $ hash b, hashed $ hash a] - If b t f -> + TermLet b a -> [tag 8, hashed $ hash b, hashed $ hash a] + TermIf b t f -> [tag 9, hashed $ hash b, hashed $ hash t, hashed $ hash f] - Request r n -> [tag 10, accumulateToken r, varint n] - Constructor r n -> [tag 12, accumulateToken r, varint n] - Match e branches -> + TermRequest r n -> [tag 10, accumulateToken r, varint n] + TermConstructor r n -> [tag 12, accumulateToken r, varint n] + TermMatch e branches -> tag 13 : hashed (hash e) : concatMap h branches where h (MatchCase pat guard branch) = @@ -205,8 +193,8 @@ instance Var v => Hashable1 (F v a p) where toList (hashed . hash <$> guard), [hashed (hash branch)] ] - Handle h b -> [tag 15, hashed $ hash h, hashed $ hash b] - And x y -> [tag 16, hashed $ hash x, hashed $ hash y] - Or x y -> [tag 17, hashed $ hash x, hashed $ hash y] - TermLink r -> [tag 18, accumulateToken r] - TypeLink r -> [tag 19, accumulateToken r] + TermHandle h b -> [tag 15, hashed $ hash h, hashed $ hash b] + TermAnd x y -> [tag 16, hashed $ hash x, hashed $ hash y] + TermOr x y -> [tag 17, hashed $ hash x, hashed $ hash y] + TermTermLink r -> [tag 18, accumulateToken r] + TermTypeLink r -> [tag 19, accumulateToken r] diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/TermEdit.hs b/unison-hashing-v2/src/Unison/Hashing/V2/TermEdit.hs index e642df595..91bb5072e 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/TermEdit.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/TermEdit.hs @@ -4,9 +4,11 @@ import Unison.Hashing.V2.Referent (Referent) import Unison.Hashing.V2.Tokenizable (Tokenizable) import qualified Unison.Hashing.V2.Tokenizable as H -data TermEdit = Replace Referent | Deprecate +data TermEdit + = TermEditReplace Referent + | TermEditDeprecate deriving (Eq, Ord, Show) instance Tokenizable TermEdit where - tokens (Replace r) = [H.Tag 0] ++ H.tokens r - tokens Deprecate = [H.Tag 1] + tokens (TermEditReplace r) = [H.Tag 0] ++ H.tokens r + tokens TermEditDeprecate = [H.Tag 1] diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs index c587a2858..56039871f 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs @@ -1,12 +1,12 @@ module Unison.Hashing.V2.Type ( Type, - F (..), + TypeF (..), bindExternal, bindReferences, -- * find by type index stuff - toReference, - toReferenceMentions, + typeToReference, + typeToReferenceMentions, -- * builtin term references booleanRef, @@ -25,8 +25,7 @@ import qualified Data.Set as Set import qualified Unison.ABT as ABT import qualified Unison.Hashing.V2.ABT as ABT import qualified Unison.Hashing.V2.Kind as K -import Unison.Hashing.V2.Reference (Reference) -import qualified Unison.Hashing.V2.Reference as Reference +import Unison.Hashing.V2.Reference (Reference (..), pattern ReferenceDerived) import Unison.Hashing.V2.Tokenizable (Hashable1) import qualified Unison.Hashing.V2.Tokenizable as Hashable import qualified Unison.Name as Name @@ -36,21 +35,21 @@ import qualified Unison.Util.List as List import Unison.Var (Var) -- | Base functor for types in the Unison language -data F a - = Ref Reference - | Arrow a a - | Ann a K.Kind - | App a a - | Effect a a - | Effects [a] - | Forall a - | IntroOuter a -- binder like ∀, used to introduce variables that are +data TypeF a + = TypeRef Reference + | TypeArrow a a + | TypeAnn a K.Kind + | TypeApp a a + | TypeEffect a a + | TypeEffects [a] + | TypeForall a + | TypeIntroOuter a -- binder like ∀, used to introduce variables that are -- bound by outer type signatures, to support scoped type -- variables deriving (Foldable, Functor, Traversable) -- | Types are represented as ABTs over the base functor F, with variables in `v` -type Type v a = ABT.Term F v a +type Type v a = ABT.Term TypeF v a freeVars :: Type v a -> Set v freeVars = ABT.freeVars @@ -74,14 +73,14 @@ bindReferences unsafeVarToName keepFree ns t = in List.validate ok rs <&> \es -> bindExternal es t -- some smart patterns -pattern Ref' :: Reference -> ABT.Term F v a -pattern Ref' r <- ABT.Tm' (Ref r) +pattern TypeRef' :: Reference -> ABT.Term TypeF v a +pattern TypeRef' r <- ABT.Tm' (TypeRef r) pattern ForallsNamed' :: [v] -> Type v a -> Type v a pattern ForallsNamed' vs body <- (unForalls -> Just (vs, body)) -pattern ForallNamed' :: v -> ABT.Term F v a -> ABT.Term F v a -pattern ForallNamed' v body <- ABT.Tm' (Forall (ABT.out -> ABT.Abs v body)) +pattern ForallNamed' :: v -> ABT.Term TypeF v a -> ABT.Term TypeF v a +pattern ForallNamed' v body <- ABT.Tm' (TypeForall (ABT.out -> ABT.Abs v body)) unForalls :: Type v a -> Maybe ([v], Type v a) unForalls t = go t [] @@ -92,20 +91,20 @@ unForalls t = go t [] -- some smart constructors ref :: Ord v => a -> Reference -> Type v a -ref a = ABT.tm' a . Ref +ref a = ABT.tm' a . TypeRef intRef, natRef, floatRef, booleanRef, textRef, charRef, listRef, effectRef :: Reference -intRef = Reference.Builtin "Int" -natRef = Reference.Builtin "Nat" -floatRef = Reference.Builtin "Float" -booleanRef = Reference.Builtin "Boolean" -textRef = Reference.Builtin "Text" -charRef = Reference.Builtin "Char" -listRef = Reference.Builtin "Sequence" -effectRef = Reference.Builtin "Effect" +intRef = ReferenceBuiltin "Int" +natRef = ReferenceBuiltin "Nat" +floatRef = ReferenceBuiltin "Float" +booleanRef = ReferenceBuiltin "Boolean" +textRef = ReferenceBuiltin "Text" +charRef = ReferenceBuiltin "Char" +listRef = ReferenceBuiltin "Sequence" +effectRef = ReferenceBuiltin "Effect" forall :: Ord v => a -> v -> Type v a -> Type v a -forall a v body = ABT.tm' a (Forall (ABT.abs' a v body)) +forall a v body = ABT.tm' a (TypeForall (ABT.abs' a v body)) -- | Bind the given variables with an outer `forall`, if they are used in `t`. generalize :: Ord v => [v] -> Type v a -> Type v a @@ -118,36 +117,36 @@ unforall' :: Type v a -> ([v], Type v a) unforall' (ForallsNamed' vs t) = (vs, t) unforall' t = ([], t) -toReference :: (Ord v, Show v) => Type v a -> Reference -toReference (Ref' r) = r +typeToReference :: (Ord v, Show v) => Type v a -> Reference +typeToReference (TypeRef' r) = r -- a bit of normalization - any unused type parameters aren't part of the hash -toReference (ForallNamed' v body) | not (Set.member v (ABT.freeVars body)) = toReference body -toReference t = Reference.Derived (ABT.hash t) 0 +typeToReference (ForallNamed' v body) | not (Set.member v (ABT.freeVars body)) = typeToReference body +typeToReference t = ReferenceDerived (ABT.hash t) 0 -toReferenceMentions :: (Ord v, Show v) => Type v a -> Set Reference -toReferenceMentions ty = +typeToReferenceMentions :: (Ord v, Show v) => Type v a -> Set Reference +typeToReferenceMentions ty = let (vs, _) = unforall' ty gen ty = generalize (Set.toList (freeVars ty)) $ generalize vs ty - in Set.fromList $ toReference . gen <$> ABT.subterms ty + in Set.fromList $ typeToReference . gen <$> ABT.subterms ty -instance Hashable1 F where +instance Hashable1 TypeF where hash1 hashCycle hash e = let (tag, hashed) = (Hashable.Tag, Hashable.Hashed) in -- Note: start each layer with leading `0` byte, to avoid collisions with -- terms, which start each layer with leading `1`. See `Hashable1 Term.F` Hashable.accumulate $ tag 0 : case e of - Ref r -> [tag 0, Hashable.accumulateToken r] - Arrow a b -> [tag 1, hashed (hash a), hashed (hash b)] - App a b -> [tag 2, hashed (hash a), hashed (hash b)] - Ann a k -> [tag 3, hashed (hash a), Hashable.accumulateToken k] + TypeRef r -> [tag 0, Hashable.accumulateToken r] + TypeArrow a b -> [tag 1, hashed (hash a), hashed (hash b)] + TypeApp a b -> [tag 2, hashed (hash a), hashed (hash b)] + TypeAnn a k -> [tag 3, hashed (hash a), Hashable.accumulateToken k] -- Example: -- a) {Remote, Abort} (() -> {Remote} ()) should hash the same as -- b) {Abort, Remote} (() -> {Remote} ()) but should hash differently from -- c) {Remote, Abort} (() -> {Abort} ()) - Effects es -> + TypeEffects es -> let (hs, _) = hashCycle es in tag 4 : map hashed hs - Effect e t -> [tag 5, hashed (hash e), hashed (hash t)] - Forall a -> [tag 6, hashed (hash a)] - IntroOuter a -> [tag 7, hashed (hash a)] + TypeEffect e t -> [tag 5, hashed (hash e), hashed (hash t)] + TypeForall a -> [tag 6, hashed (hash a)] + TypeIntroOuter a -> [tag 7, hashed (hash a)] diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/TypeEdit.hs b/unison-hashing-v2/src/Unison/Hashing/V2/TypeEdit.hs index cf5833fb4..fc05e7bc3 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/TypeEdit.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/TypeEdit.hs @@ -4,9 +4,11 @@ import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Tokenizable (Tokenizable) import qualified Unison.Hashing.V2.Tokenizable as H -data TypeEdit = Replace Reference | Deprecate +data TypeEdit + = TypeEditReplace Reference + | TypeEditDeprecate deriving (Eq, Ord, Show) instance Tokenizable TypeEdit where - tokens (Replace r) = H.Tag 0 : H.tokens r - tokens Deprecate = [H.Tag 1] + tokens (TypeEditReplace r) = H.Tag 0 : H.tokens r + tokens TypeEditDeprecate = [H.Tag 1] diff --git a/unison-hashing-v2/unison-hashing-v2.cabal b/unison-hashing-v2/unison-hashing-v2.cabal index 5c2e7b690..b9e84eaa0 100644 --- a/unison-hashing-v2/unison-hashing-v2.cabal +++ b/unison-hashing-v2/unison-hashing-v2.cabal @@ -17,11 +17,13 @@ source-repository head library exposed-modules: + Unison.Hashing.V2 + other-modules: Unison.Hashing.V2.ABT Unison.Hashing.V2.Branch Unison.Hashing.V2.Causal + Unison.Hashing.V2.ConstructorId Unison.Hashing.V2.DataDeclaration - Unison.Hashing.V2.Hashable Unison.Hashing.V2.Kind Unison.Hashing.V2.NameSegment Unison.Hashing.V2.Patch From 3c20ab383489ac75f0359d9dc656fc0e42256e0c Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 21:00:55 -0500 Subject: [PATCH 026/467] change hashing v2 branch type name from Raw to Branch --- .../Migrations/MigrateSchema1To2/DbHelpers.hs | 2 +- parser-typechecker/src/Unison/Hashing/V2/Convert.hs | 4 ++-- unison-hashing-v2/src/Unison/Hashing/V2.hs | 6 +++--- unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs index 232875575..642233b05 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs @@ -43,7 +43,7 @@ syncCausalHash S.SyncCausalFormat {valueHash = valueHashId, parents = parentChId dbBranchHash :: S.DbBranch -> Transaction BranchHash dbBranchHash (S.Branch.Full.Branch tms tps patches children) = fmap (BranchHash . contentHash) $ - Hashing.Raw + Hashing.Branch <$> doTerms tms <*> doTypes tps <*> doPatches patches diff --git a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs index 1c635d93e..3b27dc667 100644 --- a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs +++ b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs @@ -357,9 +357,9 @@ hashCausal e tails = Hashing.Causal valueHash (Set.map Memory.Causal.unCausalHash tails) in (causalHash, HashFor valueHash) -m2hBranch0 :: Memory.Branch.Branch0 m -> Hashing.Raw +m2hBranch0 :: Memory.Branch.Branch0 m -> Hashing.Branch m2hBranch0 b = - Hashing.Raw + Hashing.Branch (doTerms (Memory.Branch._terms b)) (doTypes (Memory.Branch._types b)) (doPatches (Memory.Branch._edits b)) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2.hs b/unison-hashing-v2/src/Unison/Hashing/V2.hs index b91e9dbf4..2f92d6d50 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2.hs @@ -3,7 +3,8 @@ -- * Data types with 'ContentAddressable' instances that correspond to v2 of the Unison hash function. -- * Miscellaneous helper functions related to hashing. module Unison.Hashing.V2 - ( Causal (..), + ( Branch (..), + Causal (..), DataDeclaration (..), Decl, EffectDeclaration (..), @@ -14,7 +15,6 @@ module Unison.Hashing.V2 NameSegment (..), Patch (..), Pattern (..), - Raw (..), Reference (..), pattern ReferenceDerived, ReferenceId (..), @@ -35,7 +35,7 @@ module Unison.Hashing.V2 ) where -import Unison.Hashing.V2.Branch (MdValues (..), Raw (..)) +import Unison.Hashing.V2.Branch (Branch (..), MdValues (..)) import Unison.Hashing.V2.Causal (Causal (..)) import Unison.Hashing.V2.DataDeclaration (DataDeclaration (..), Decl, EffectDeclaration (..), Modifier (..), hashDecls) import Unison.Hashing.V2.Kind (Kind (..)) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs index 7719d02eb..e1780d63e 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs @@ -1,5 +1,5 @@ module Unison.Hashing.V2.Branch - ( Raw (..), + ( Branch (..), MdValues (..), ) where @@ -19,17 +19,17 @@ newtype MdValues = MdValues (Set MetadataValue) deriving (Eq, Ord, Show) deriving (Tokenizable) via Set MetadataValue -data Raw = Raw +data Branch = Branch { terms :: Map NameSegment (Map Referent MdValues), types :: Map NameSegment (Map Reference MdValues), patches :: Map NameSegment Hash, children :: Map NameSegment Hash -- the Causal Hash } -instance ContentAddressable Raw where +instance ContentAddressable Branch where contentHash = H.hashTokenizable -instance Tokenizable Raw where +instance Tokenizable Branch where tokens b = [ H.accumulateToken (terms b), H.accumulateToken (types b), From 9edbec27f4bc96718bdc87444c23c600631089dd Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 14 Dec 2022 21:04:16 -0500 Subject: [PATCH 027/467] haddock fix --- unison-hashing-v2/src/Unison/Hashing/V2.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2.hs b/unison-hashing-v2/src/Unison/Hashing/V2.hs index 2f92d6d50..9e64d6d05 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2.hs @@ -1,4 +1,5 @@ --- | Description: This module exports: +-- | +-- This module exports: -- -- * Data types with 'ContentAddressable' instances that correspond to v2 of the Unison hash function. -- * Miscellaneous helper functions related to hashing. From b5138c235ebe74a3ac8292270d7f8ac1f6c0f1ab Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 15 Dec 2022 12:04:07 -0500 Subject: [PATCH 028/467] fix errors in test suite --- .../tests/Unison/Test/Codebase/Causal.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs index c556aa404..ad2759db6 100644 --- a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs +++ b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs @@ -1,15 +1,20 @@ {-# LANGUAGE PartialTypeSignatures #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} module Unison.Test.Codebase.Causal (test) where -import Control.Monad (replicateM_) -import Data.Functor.Identity (Identity (runIdentity)) -import Data.Int (Int64) -import Data.Set (Set) import qualified Data.Set as Set +import qualified Data.Text.Encoding as Text import EasyTest import Unison.Codebase.Causal (Causal, one) import qualified Unison.Codebase.Causal as Causal +import Unison.ContentAddressable (ContentAddressable (contentHash)) +import qualified Unison.Hash as Hash +import Unison.Prelude + +-- Dummy instances for this test suite. Would probably be better if they weren't orphans. +instance ContentAddressable Int64 where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow +instance ContentAddressable (Set Int64) where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow test :: Test () test = From 3e395e3b89170ffafb5215d753e592e97184ebfc Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 15 Dec 2022 12:31:30 -0500 Subject: [PATCH 029/467] move unison-hash:Unison.ContentAddressable to unison-hashing:Unison.Hashing.ContentAddressable --- hie.yaml | 3 ++ lib/unison-hash/unison-hash.cabal | 1 - lib/unison-hashing/package.yaml | 43 +++++++++++++++ .../src/Unison/Hashing}/ContentAddressable.hs | 2 +- lib/unison-hashing/unison-hashing.cabal | 54 +++++++++++++++++++ .../src/Unison/Codebase/Branch.hs | 4 +- .../src/Unison/Codebase/Causal.hs | 26 ++++----- .../Migrations/MigrateSchema1To2.hs | 3 +- .../Migrations/MigrateSchema1To2/DbHelpers.hs | 7 ++- .../src/Unison/Hashing/V2/Convert.hs | 11 ++-- .../tests/Unison/Test/Codebase/Causal.hs | 2 +- stack.yaml | 1 + unison-hashing-v2/package.yaml | 1 + unison-hashing-v2/src/Unison/Hashing/V2.hs | 4 ++ .../src/Unison/Hashing/V2/Branch.hs | 2 +- .../src/Unison/Hashing/V2/Causal.hs | 2 +- .../src/Unison/Hashing/V2/Patch.hs | 2 +- unison-hashing-v2/unison-hashing-v2.cabal | 1 + 18 files changed, 136 insertions(+), 33 deletions(-) create mode 100644 lib/unison-hashing/package.yaml rename lib/{unison-hash/src/Unison => unison-hashing/src/Unison/Hashing}/ContentAddressable.hs (97%) create mode 100644 lib/unison-hashing/unison-hashing.cabal diff --git a/hie.yaml b/hie.yaml index 814ecee6b..e2408a532 100644 --- a/hie.yaml +++ b/hie.yaml @@ -36,6 +36,9 @@ cradle: - path: "lib/unison-hash-orphans-sqlite/src" component: "unison-hash-orphans-sqlite:lib" + - path: "lib/unison-hashing/src" + component: "unison-hashing:lib" + - path: "lib/unison-prelude/src" component: "unison-prelude:lib" diff --git a/lib/unison-hash/unison-hash.cabal b/lib/unison-hash/unison-hash.cabal index 7fec13121..091ab5e7a 100644 --- a/lib/unison-hash/unison-hash.cabal +++ b/lib/unison-hash/unison-hash.cabal @@ -19,7 +19,6 @@ library exposed-modules: U.Util.Hash U.Util.Hash32 - Unison.ContentAddressable Unison.Hash hs-source-dirs: src diff --git a/lib/unison-hashing/package.yaml b/lib/unison-hashing/package.yaml new file mode 100644 index 000000000..118a08adc --- /dev/null +++ b/lib/unison-hashing/package.yaml @@ -0,0 +1,43 @@ +name: unison-hashing +github: unisonweb/unison +copyright: Copyright (C) 2013-2021 Unison Computing, PBC and contributors + +ghc-options: -Wall -O0 -fno-warn-name-shadowing -fno-warn-missing-pattern-synonym-signatures + +dependencies: + - base + - unison-hash + +library: + source-dirs: src + when: + - condition: false + other-modules: Paths_unison_hashing + +default-extensions: + - ApplicativeDo + - BangPatterns + - BlockArguments + - DeriveAnyClass + - DeriveFunctor + - DeriveGeneric + - DeriveTraversable + - DerivingStrategies + - DerivingVia + - DoAndIfThenElse + - DuplicateRecordFields + - FlexibleContexts + - FlexibleInstances + - GeneralizedNewtypeDeriving + - LambdaCase + - MultiParamTypeClasses + - NamedFieldPuns + - OverloadedStrings + - PatternSynonyms + - RankNTypes + - ScopedTypeVariables + - StandaloneDeriving + - TupleSections + - TypeApplications + - TypeFamilies + - ViewPatterns diff --git a/lib/unison-hash/src/Unison/ContentAddressable.hs b/lib/unison-hashing/src/Unison/Hashing/ContentAddressable.hs similarity index 97% rename from lib/unison-hash/src/Unison/ContentAddressable.hs rename to lib/unison-hashing/src/Unison/Hashing/ContentAddressable.hs index 7f6d6fcb6..60535cf1b 100644 --- a/lib/unison-hash/src/Unison/ContentAddressable.hs +++ b/lib/unison-hashing/src/Unison/Hashing/ContentAddressable.hs @@ -1,4 +1,4 @@ -module Unison.ContentAddressable +module Unison.Hashing.ContentAddressable ( ContentAddressable (..), ) where diff --git a/lib/unison-hashing/unison-hashing.cabal b/lib/unison-hashing/unison-hashing.cabal new file mode 100644 index 000000000..0c5e5c97e --- /dev/null +++ b/lib/unison-hashing/unison-hashing.cabal @@ -0,0 +1,54 @@ +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.34.4. +-- +-- see: https://github.com/sol/hpack + +name: unison-hashing +version: 0.0.0 +homepage: https://github.com/unisonweb/unison#readme +bug-reports: https://github.com/unisonweb/unison/issues +copyright: Copyright (C) 2013-2021 Unison Computing, PBC and contributors +build-type: Simple + +source-repository head + type: git + location: https://github.com/unisonweb/unison + +library + exposed-modules: + Unison.Hashing.ContentAddressable + hs-source-dirs: + src + default-extensions: + ApplicativeDo + BangPatterns + BlockArguments + DeriveAnyClass + DeriveFunctor + DeriveGeneric + DeriveTraversable + DerivingStrategies + DerivingVia + DoAndIfThenElse + DuplicateRecordFields + FlexibleContexts + FlexibleInstances + GeneralizedNewtypeDeriving + LambdaCase + MultiParamTypeClasses + NamedFieldPuns + OverloadedStrings + PatternSynonyms + RankNTypes + ScopedTypeVariables + StandaloneDeriving + TupleSections + TypeApplications + TypeFamilies + ViewPatterns + ghc-options: -Wall -O0 -fno-warn-name-shadowing -fno-warn-missing-pattern-synonym-signatures + build-depends: + base + , unison-hash + default-language: Haskell2010 diff --git a/parser-typechecker/src/Unison/Codebase/Branch.hs b/parser-typechecker/src/Unison/Codebase/Branch.hs index 4fa697a57..e81376a34 100644 --- a/parser-typechecker/src/Unison/Codebase/Branch.hs +++ b/parser-typechecker/src/Unison/Codebase/Branch.hs @@ -113,7 +113,7 @@ import Unison.Codebase.Patch (Patch) import qualified Unison.Codebase.Patch as Patch import Unison.Codebase.Path (Path (..)) import qualified Unison.Codebase.Path as Path -import Unison.ContentAddressable (ContentAddressable (contentHash)) +import qualified Unison.Hashing.V2 as Hashing (ContentAddressable (contentHash)) import qualified Unison.Hashing.V2.Convert as H import Unison.Name (Name) import qualified Unison.Name as Name @@ -136,7 +136,7 @@ instance AsEmpty (Branch m) where | b0 == empty = Just () | otherwise = Nothing -instance ContentAddressable (Branch0 m) where +instance Hashing.ContentAddressable (Branch0 m) where contentHash = H.hashBranch0 deepReferents :: Branch0 m -> Set Referent diff --git a/parser-typechecker/src/Unison/Codebase/Causal.hs b/parser-typechecker/src/Unison/Codebase/Causal.hs index e8dfc2d0c..3d57dbfdc 100644 --- a/parser-typechecker/src/Unison/Codebase/Causal.hs +++ b/parser-typechecker/src/Unison/Codebase/Causal.hs @@ -51,14 +51,14 @@ import Unison.Codebase.Causal.Type pattern Merge, pattern One, ) -import Unison.ContentAddressable (ContentAddressable) import Unison.Hash (HashFor (HashFor)) +import qualified Unison.Hashing.V2 as Hashing (ContentAddressable) import qualified Unison.Hashing.V2.Convert as Hashing import Unison.Prelude import Prelude hiding (head, read, tail) -- | Focus the current head, keeping the hash up to date. -head_ :: ContentAddressable e => Lens.Lens' (Causal m e) e +head_ :: Hashing.ContentAddressable e => Lens.Lens' (Causal m e) e head_ = Lens.lens getter setter where getter = head @@ -74,7 +74,7 @@ head_ = Lens.lens getter setter -- (or is equal to `c2` if `c1` changes nothing). squashMerge' :: forall m e. - (Monad m, ContentAddressable e, Eq e) => + (Monad m, Hashing.ContentAddressable e, Eq e) => (Causal m e -> Causal m e -> m (Maybe (Causal m e))) -> (e -> m e) -> (Maybe e -> e -> e -> m e) -> @@ -93,7 +93,7 @@ squashMerge' lca discardHistory combine c1 c2 = do threeWayMerge :: forall m e. - (Monad m, ContentAddressable e) => + (Monad m, Hashing.ContentAddressable e) => (Maybe e -> e -> e -> m e) -> Causal m e -> Causal m e -> @@ -102,7 +102,7 @@ threeWayMerge = threeWayMerge' lca threeWayMerge' :: forall m e. - (Monad m, ContentAddressable e) => + (Monad m, Hashing.ContentAddressable e) => (Causal m e -> Causal m e -> m (Maybe (Causal m e))) -> (Maybe e -> e -> e -> m e) -> Causal m e -> @@ -138,11 +138,11 @@ beforeHash maxDepth h c = State.modify' (<> Set.fromList cs) Monad.anyM (Reader.local (1 +) . go) unseens -stepDistinct :: (Applicative m, Eq e, ContentAddressable e) => (e -> e) -> Causal m e -> Causal m e +stepDistinct :: (Applicative m, Eq e, Hashing.ContentAddressable e) => (e -> e) -> Causal m e -> Causal m e stepDistinct f c = f (head c) `consDistinct` c stepDistinctM :: - (Applicative m, Functor n, Eq e, ContentAddressable e) => + (Applicative m, Functor n, Eq e, Hashing.ContentAddressable e) => (e -> n e) -> Causal m e -> n (Causal m e) @@ -150,12 +150,12 @@ stepDistinctM f c = (`consDistinct` c) <$> f (head c) -- | Causal construction should go through here for uniformity; -- with an exception for `one`, which avoids an Applicative constraint. -fromList :: (Applicative m, ContentAddressable e) => e -> [Causal m e] -> Causal m e +fromList :: (Applicative m, Hashing.ContentAddressable e) => e -> [Causal m e] -> Causal m e fromList e cs = fromListM e (map (\c -> (currentHash c, pure c)) cs) -- | Construct a causal from a list of predecessors. The predecessors may be given in any order. -fromListM :: ContentAddressable e => e -> [(CausalHash, m (Causal m e))] -> Causal m e +fromListM :: Hashing.ContentAddressable e => e -> [(CausalHash, m (Causal m e))] -> Causal m e fromListM e ts = case ts of [] -> UnsafeOne ch eh e @@ -165,21 +165,21 @@ fromListM e ts = (ch, eh) = (Hashing.hashCausal e (Set.fromList (map fst ts))) -- | An optimized variant of 'fromListM' for when it is known we have 2+ predecessors (merge node). -mergeNode :: ContentAddressable e => e -> Map (CausalHash) (m (Causal m e)) -> Causal m e +mergeNode :: Hashing.ContentAddressable e => e -> Map (CausalHash) (m (Causal m e)) -> Causal m e mergeNode newHead predecessors = let (ch, eh) = Hashing.hashCausal newHead (Map.keysSet predecessors) in UnsafeMerge ch eh newHead predecessors -- duplicated logic here instead of delegating to `fromList` to avoid `Applicative m` constraint. -one :: ContentAddressable e => e -> Causal m e +one :: Hashing.ContentAddressable e => e -> Causal m e one e = UnsafeOne ch eh e where (ch, eh) = Hashing.hashCausal e mempty -cons :: (Applicative m, ContentAddressable e) => e -> Causal m e -> Causal m e +cons :: (Applicative m, Hashing.ContentAddressable e) => e -> Causal m e -> Causal m e cons e tail = fromList e [tail] -consDistinct :: (Applicative m, Eq e, ContentAddressable e) => e -> Causal m e -> Causal m e +consDistinct :: (Applicative m, Eq e, Hashing.ContentAddressable e) => e -> Causal m e -> Causal m e consDistinct e tl = if head tl == e then tl diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs index c2e4ed9aa..896618bb1 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs @@ -60,7 +60,6 @@ import qualified Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema1To2.DbH import qualified Unison.Codebase.SqliteCodebase.Operations as CodebaseOps import qualified Unison.ConstructorReference as ConstructorReference import qualified Unison.ConstructorType as CT -import Unison.ContentAddressable (contentHash) import qualified Unison.DataDeclaration as DD import Unison.DataDeclaration.ConstructorId (ConstructorId) import Unison.Hash (Hash) @@ -241,7 +240,7 @@ migrateCausal oldCausalHashId = fmap (either id id) . runExceptT $ do let newCausalHash :: CausalHash newCausalHash = CausalHash $ - contentHash + Hashing.contentHash Hashing.Causal { branchHash = unBranchHash newBranchHash, parents = newParentHashes diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs index 642233b05..806415489 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2/DbHelpers.hs @@ -25,7 +25,6 @@ import qualified U.Codebase.Sqlite.Patch.TypeEdit as S.TypeEdit import qualified U.Codebase.Sqlite.Queries as Q import qualified U.Codebase.Sqlite.Reference as S import qualified U.Codebase.Sqlite.Referent as S -import Unison.ContentAddressable (contentHash) import Unison.Hash (Hash) import qualified Unison.Hashing.V2 as Hashing import Unison.Prelude @@ -35,14 +34,14 @@ import qualified Unison.Util.Set as Set syncCausalHash :: S.SyncCausalFormat -> Transaction CausalHash syncCausalHash S.SyncCausalFormat {valueHash = valueHashId, parents = parentChIds} = do - fmap (CausalHash . contentHash) $ + fmap (CausalHash . Hashing.contentHash) $ Hashing.Causal <$> coerce @(Transaction BranchHash) @(Transaction Hash) (Q.expectBranchHash valueHashId) <*> fmap (Set.fromList . coerce @[CausalHash] @[Hash] . Vector.toList) (traverse Q.expectCausalHash parentChIds) dbBranchHash :: S.DbBranch -> Transaction BranchHash dbBranchHash (S.Branch.Full.Branch tms tps patches children) = - fmap (BranchHash . contentHash) $ + fmap (BranchHash . Hashing.contentHash) $ Hashing.Branch <$> doTerms tms <*> doTypes tps @@ -75,7 +74,7 @@ dbBranchHash (S.Branch.Full.Branch tms tps patches children) = dbPatchHash :: S.Patch -> Transaction PatchHash dbPatchHash S.Patch {S.termEdits, S.typeEdits} = - fmap (PatchHash . contentHash) $ + fmap (PatchHash . Hashing.contentHash) $ Hashing.Patch <$> doTermEdits termEdits <*> doTypeEdits typeEdits diff --git a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs index 12560558d..c05cfee9a 100644 --- a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs +++ b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs @@ -37,7 +37,6 @@ import qualified Unison.Codebase.TypeEdit as Memory.TypeEdit import qualified Unison.ConstructorReference as Memory.ConstructorReference import qualified Unison.ConstructorType as CT import qualified Unison.ConstructorType as Memory.ConstructorType -import Unison.ContentAddressable (ContentAddressable (contentHash)) import qualified Unison.DataDeclaration as Memory.DD import Unison.Hash (Hash, HashFor (HashFor)) import qualified Unison.Hashing.V2 as Hashing @@ -344,16 +343,16 @@ m2hPatch (Memory.Patch.Patch termEdits typeEdits) = Memory.TypeEdit.Deprecate -> Hashing.TypeEditDeprecate hashPatch :: Memory.Patch.Patch -> Hash -hashPatch = contentHash . m2hPatch +hashPatch = Hashing.contentHash . m2hPatch hashBranch0 :: Memory.Branch.Branch0 m -> Hash -hashBranch0 = contentHash . m2hBranch0 +hashBranch0 = Hashing.contentHash . m2hBranch0 -hashCausal :: ContentAddressable e => e -> Set CausalHash -> (CausalHash, HashFor e) +hashCausal :: Hashing.ContentAddressable e => e -> Set CausalHash -> (CausalHash, HashFor e) hashCausal e tails = - let valueHash = contentHash e + let valueHash = Hashing.contentHash e causalHash = - CausalHash . contentHash $ + CausalHash . Hashing.contentHash $ Hashing.Causal valueHash (Set.map unCausalHash tails) in (causalHash, HashFor valueHash) diff --git a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs index ad2759db6..4f8e2f814 100644 --- a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs +++ b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs @@ -8,8 +8,8 @@ import qualified Data.Text.Encoding as Text import EasyTest import Unison.Codebase.Causal (Causal, one) import qualified Unison.Codebase.Causal as Causal -import Unison.ContentAddressable (ContentAddressable (contentHash)) import qualified Unison.Hash as Hash +import Unison.Hashing.ContentAddressable (ContentAddressable (contentHash)) import Unison.Prelude -- Dummy instances for this test suite. Would probably be better if they weren't orphans. diff --git a/stack.yaml b/stack.yaml index f92bcad39..6c14a1366 100644 --- a/stack.yaml +++ b/stack.yaml @@ -28,6 +28,7 @@ packages: - lib/unison-hash - lib/unison-hash-orphans-aeson - lib/unison-hash-orphans-sqlite +- lib/unison-hashing - lib/unison-prelude - lib/unison-sqlite - lib/unison-util-base32hex diff --git a/unison-hashing-v2/package.yaml b/unison-hashing-v2/package.yaml index 46fbfb6e4..0bc7b846f 100644 --- a/unison-hashing-v2/package.yaml +++ b/unison-hashing-v2/package.yaml @@ -15,6 +15,7 @@ dependencies: - text - unison-core1 - unison-hash + - unison-hashing - unison-prelude - unison-util - unison-util-base32hex diff --git a/unison-hashing-v2/src/Unison/Hashing/V2.hs b/unison-hashing-v2/src/Unison/Hashing/V2.hs index 9e64d6d05..e7515859b 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2.hs @@ -33,9 +33,13 @@ module Unison.Hashing.V2 hashTermComponentsWithoutTypes, typeToReference, typeToReferenceMentions, + + -- * Re-exports + ContentAddressable (..), ) where +import Unison.Hashing.ContentAddressable (ContentAddressable (..)) import Unison.Hashing.V2.Branch (Branch (..), MdValues (..)) import Unison.Hashing.V2.Causal (Causal (..)) import Unison.Hashing.V2.DataDeclaration (DataDeclaration (..), Decl, EffectDeclaration (..), Modifier (..), hashDecls) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs index e1780d63e..df7c8bf7b 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Branch.hs @@ -4,8 +4,8 @@ module Unison.Hashing.V2.Branch ) where -import Unison.ContentAddressable (ContentAddressable (..)) import Unison.Hash (Hash) +import Unison.Hashing.ContentAddressable (ContentAddressable (..)) import Unison.Hashing.V2.NameSegment (NameSegment) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Referent (Referent) diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs index 475fe89cd..5f0b300c5 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Causal.hs @@ -4,8 +4,8 @@ module Unison.Hashing.V2.Causal where import qualified Data.Set as Set -import Unison.ContentAddressable (ContentAddressable (..)) import Unison.Hash (Hash) +import Unison.Hashing.ContentAddressable (ContentAddressable (..)) import qualified Unison.Hashing.V2.Tokenizable as H import Unison.Prelude diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs index 67e3f59a7..b9554a05b 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Patch.hs @@ -3,7 +3,7 @@ module Unison.Hashing.V2.Patch ) where -import Unison.ContentAddressable (ContentAddressable (contentHash)) +import Unison.Hashing.ContentAddressable (ContentAddressable (contentHash)) import Unison.Hashing.V2.Reference (Reference) import Unison.Hashing.V2.Referent (Referent) import Unison.Hashing.V2.TermEdit (TermEdit) diff --git a/unison-hashing-v2/unison-hashing-v2.cabal b/unison-hashing-v2/unison-hashing-v2.cabal index b9e84eaa0..5b7d13e94 100644 --- a/unison-hashing-v2/unison-hashing-v2.cabal +++ b/unison-hashing-v2/unison-hashing-v2.cabal @@ -75,6 +75,7 @@ library , text , unison-core1 , unison-hash + , unison-hashing , unison-prelude , unison-util , unison-util-base32hex From b062e7112f59edb1d7f2b23a87ef033cc99a62ba Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 15 Dec 2022 12:42:02 -0500 Subject: [PATCH 030/467] fix test suite again --- parser-typechecker/tests/Unison/Test/Codebase/Causal.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs index 4f8e2f814..78bfad9f8 100644 --- a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs +++ b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs @@ -9,12 +9,12 @@ import EasyTest import Unison.Codebase.Causal (Causal, one) import qualified Unison.Codebase.Causal as Causal import qualified Unison.Hash as Hash -import Unison.Hashing.ContentAddressable (ContentAddressable (contentHash)) +import qualified Unison.Hashing.V2 as Hashing import Unison.Prelude -- Dummy instances for this test suite. Would probably be better if they weren't orphans. -instance ContentAddressable Int64 where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow -instance ContentAddressable (Set Int64) where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow +instance Hashing.ContentAddressable Int64 where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow +instance Hashing.ContentAddressable (Set Int64) where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow test :: Test () test = From a87a688471f11d860bd8682ed55bda5be80f2cb8 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 15 Dec 2022 13:48:36 -0500 Subject: [PATCH 031/467] fold U.Util.Hash into Unison.Hash --- .../U/Codebase/Sqlite/HashHandle.hs | 2 +- .../U/Codebase/Sqlite/Operations.hs | 2 +- .../U/Codebase/Sqlite/Orphans.hs | 2 +- .../U/Codebase/Sqlite/Queries.hs | 4 +- codebase2/codebase/U/Codebase/Decl.hs | 10 +-- codebase2/codebase/U/Codebase/Reference.hs | 12 +-- codebase2/codebase/U/Codebase/Referent.hs | 7 +- codebase2/codebase/U/Codebase/Term.hs | 24 +----- codebase2/codebase/U/Codebase/Type.hs | 17 +---- codebase2/codebase/package.yaml | 2 + codebase2/codebase/unison-codebase.cabal | 2 + codebase2/core/U/Codebase/HashTags.hs | 2 +- lib/unison-hash/src/U/Util/Hash.hs | 59 --------------- lib/unison-hash/src/U/Util/Hash32.hs | 4 +- lib/unison-hash/src/Unison/Hash.hs | 73 ++++++++++++++----- lib/unison-hash/unison-hash.cabal | 1 - .../src/Unison/Hashing/ContentAddressable.hs | 2 +- .../src/Unison/Codebase/IntegrityCheck.hs | 2 +- .../src/Unison/Codebase/ShortCausalHash.hs | 7 +- .../Codebase/SqliteCodebase/Conversions.hs | 11 ++- .../Migrations/MigrateSchema5To6.hs | 2 +- .../Codebase/SqliteCodebase/Operations.hs | 3 +- .../src/Unison/Runtime/Serialize.hs | 2 +- .../tests/Unison/Test/DataDeclaration.hs | 2 +- parser-typechecker/tests/Unison/Test/Term.hs | 2 +- .../src/Unison/Codebase/Editor/HandleInput.hs | 2 +- .../src/Unison/Codebase/Editor/UriParser.hs | 6 +- .../src/Unison/CommandLine/OutputMessages.hs | 9 +-- unison-core/src/Unison/Hashable.hs | 11 ++- unison-core/src/Unison/Reference.hs | 12 +-- .../src/Unison/Hashing/V2/Tokenizable.hs | 6 +- unison-share-api/package.yaml | 2 + .../Server/Endpoints/NamespaceListing.hs | 10 +-- .../src/Unison/Server/Endpoints/Projects.hs | 8 +- unison-share-api/src/Unison/Server/Orphans.hs | 5 +- unison-share-api/src/Unison/Server/Types.hs | 4 +- unison-share-api/unison-share-api.cabal | 2 + unison-syntax/src/Unison/Syntax/Parser.hs | 2 +- 38 files changed, 124 insertions(+), 211 deletions(-) delete mode 100644 lib/unison-hash/src/U/Util/Hash.hs diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/HashHandle.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/HashHandle.hs index f219c1294..0924c6116 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/HashHandle.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/HashHandle.hs @@ -7,7 +7,7 @@ import qualified U.Codebase.Reference as C import U.Codebase.Sqlite.Symbol (Symbol) import qualified U.Codebase.Term as C.Term import qualified U.Codebase.Type as C.Type -import U.Util.Hash (Hash) +import Unison.Hash (Hash) import Unison.Prelude data HashHandle = HashHandle diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index 02a0c6edc..fbcd3353f 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -163,9 +163,9 @@ import qualified U.Codebase.TypeEdit as C import qualified U.Codebase.TypeEdit as C.TypeEdit import U.Codebase.WatchKind (WatchKind) import qualified U.Util.Base32Hex as Base32Hex -import qualified U.Util.Hash as H import qualified U.Util.Hash32 as Hash32 import qualified U.Util.Serialization as S +import qualified Unison.Hash as H import Unison.NameSegment (NameSegment (NameSegment)) import qualified Unison.NameSegment as NameSegment import Unison.Prelude diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Orphans.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Orphans.hs index 17e1ce303..6fc417472 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Orphans.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Orphans.hs @@ -12,7 +12,7 @@ import U.Codebase.Sqlite.DbId import U.Codebase.WatchKind (WatchKind) import qualified U.Codebase.WatchKind as WatchKind import U.Util.Base32Hex -import qualified U.Util.Hash as Hash +import qualified Unison.Hash as Hash import Unison.Prelude import Unison.Sqlite diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 3335684fe..011f0071c 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -270,13 +270,13 @@ import qualified U.Codebase.Term as C.Term import qualified U.Codebase.Type as C.Type import U.Codebase.WatchKind (WatchKind) import qualified U.Core.ABT as ABT -import U.Util.Hash (Hash) -import qualified U.Util.Hash as Hash import U.Util.Hash32 (Hash32) import qualified U.Util.Hash32 as Hash32 import U.Util.Hash32.Orphans.Sqlite () import qualified U.Util.Serialization as S import qualified U.Util.Term as TermUtil +import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import Unison.Prelude import Unison.Sqlite import qualified Unison.Util.Alternative as Alternative diff --git a/codebase2/codebase/U/Codebase/Decl.hs b/codebase2/codebase/U/Codebase/Decl.hs index 27f5b1a6e..ca07dbdbc 100644 --- a/codebase2/codebase/U/Codebase/Decl.hs +++ b/codebase2/codebase/U/Codebase/Decl.hs @@ -1,16 +1,10 @@ -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE RecordWildCards #-} - module U.Codebase.Decl where -import Data.Set (Set) -import Data.Text (Text) -import Data.Word (Word64) import U.Codebase.Reference (Reference') import U.Codebase.Type (TypeR) import qualified U.Codebase.Type as Type -import U.Util.Hash (Hash) +import Unison.Hash (Hash) +import Unison.Prelude type ConstructorId = Word64 diff --git a/codebase2/codebase/U/Codebase/Reference.hs b/codebase2/codebase/U/Codebase/Reference.hs index ea43f44d8..73b69d7fc 100644 --- a/codebase2/codebase/U/Codebase/Reference.hs +++ b/codebase2/codebase/U/Codebase/Reference.hs @@ -1,10 +1,3 @@ -{-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE TypeSynonymInstances #-} - module U.Codebase.Reference where import Control.Lens (Bifunctor (..), Lens, Prism, Traversal, lens, prism) @@ -14,8 +7,9 @@ import Data.Text (Text) import Data.Word (Word64) import U.Codebase.ShortHash (ShortHash) import qualified U.Codebase.ShortHash as SH -import U.Util.Hash (Hash) -import qualified U.Util.Hash as Hash +import Unison.Hash (Hash) +import qualified Unison.Hash as Hash +import Unison.Prelude -- | This is the canonical representation of Reference type Reference = Reference' Text Hash diff --git a/codebase2/codebase/U/Codebase/Referent.hs b/codebase2/codebase/U/Codebase/Referent.hs index 5e087240d..65bce2dd6 100644 --- a/codebase2/codebase/U/Codebase/Referent.hs +++ b/codebase2/codebase/U/Codebase/Referent.hs @@ -1,9 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TypeSynonymInstances #-} module U.Codebase.Referent where @@ -17,7 +12,7 @@ import U.Codebase.Reference (Reference, Reference') import qualified U.Codebase.Reference as Reference import U.Codebase.ShortHash (ShortHash) import qualified U.Codebase.ShortHash as SH -import U.Util.Hash (Hash) +import Unison.Hash (Hash) import Unison.Prelude data ConstructorType diff --git a/codebase2/codebase/U/Codebase/Term.hs b/codebase2/codebase/U/Codebase/Term.hs index 9b9617682..f2b90514e 100644 --- a/codebase2/codebase/U/Codebase/Term.hs +++ b/codebase2/codebase/U/Codebase/Term.hs @@ -1,35 +1,15 @@ -{-# LANGUAGE BlockArguments #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE Rank2Types #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE UnicodeSyntax #-} -{-# LANGUAGE ViewPatterns #-} - module U.Codebase.Term where import qualified Control.Monad.Writer as Writer import qualified Data.Foldable as Foldable -import Data.Int (Int64) -import Data.Sequence (Seq) -import Data.Set (Set) import qualified Data.Set as Set -import Data.Text (Text) -import Data.Word (Word64) -import GHC.Generics (Generic, Generic1) import U.Codebase.Reference (Reference, Reference') import U.Codebase.Referent (Referent') import U.Codebase.Type (TypeR) import qualified U.Codebase.Type as Type import qualified U.Core.ABT as ABT -import U.Util.Hash (Hash) +import Unison.Hash (Hash) +import Unison.Prelude type ConstructorId = Word64 diff --git a/codebase2/codebase/U/Codebase/Type.hs b/codebase2/codebase/U/Codebase/Type.hs index c503ba1d5..e25958e6d 100644 --- a/codebase2/codebase/U/Codebase/Type.hs +++ b/codebase2/codebase/U/Codebase/Type.hs @@ -1,27 +1,14 @@ -{-# LANGUAGE BlockArguments #-} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE Rank2Types #-} -{-# LANGUAGE ViewPatterns #-} - module U.Codebase.Type where import qualified Control.Monad.Writer.Strict as Writer import Data.Bifunctor (Bifunctor (bimap)) -import Data.Functor (($>)) import qualified Data.Maybe as Maybe -import Data.Set (Set) import qualified Data.Set as Set -import Data.Text (Text) import U.Codebase.Kind (Kind) import U.Codebase.Reference (Reference, Reference') import qualified U.Core.ABT as ABT -import U.Util.Hash (Hash) +import Unison.Hash (Hash) +import Unison.Prelude import Unsafe.Coerce (unsafeCoerce) -- | For standalone types, like those in Term.Ann diff --git a/codebase2/codebase/package.yaml b/codebase2/codebase/package.yaml index 24832747e..bb733a8be 100644 --- a/codebase2/codebase/package.yaml +++ b/codebase2/codebase/package.yaml @@ -4,8 +4,10 @@ github: unisonweb/unison default-extensions: - ApplicativeDo - BlockArguments + - DeriveFoldable - DeriveFunctor - DeriveGeneric + - DeriveTraversable - DerivingStrategies - DoAndIfThenElse - FlexibleContexts diff --git a/codebase2/codebase/unison-codebase.cabal b/codebase2/codebase/unison-codebase.cabal index 59ad9c3d0..a0fe07cf6 100644 --- a/codebase2/codebase/unison-codebase.cabal +++ b/codebase2/codebase/unison-codebase.cabal @@ -34,8 +34,10 @@ library default-extensions: ApplicativeDo BlockArguments + DeriveFoldable DeriveFunctor DeriveGeneric + DeriveTraversable DerivingStrategies DoAndIfThenElse FlexibleContexts diff --git a/codebase2/core/U/Codebase/HashTags.hs b/codebase2/core/U/Codebase/HashTags.hs index a78ed15ca..54531f0da 100644 --- a/codebase2/core/U/Codebase/HashTags.hs +++ b/codebase2/core/U/Codebase/HashTags.hs @@ -1,6 +1,6 @@ module U.Codebase.HashTags where -import U.Util.Hash (Hash) +import Unison.Hash (Hash) newtype BranchHash = BranchHash {unBranchHash :: Hash} deriving (Eq, Ord) diff --git a/lib/unison-hash/src/U/Util/Hash.hs b/lib/unison-hash/src/U/Util/Hash.hs deleted file mode 100644 index 05dfae334..000000000 --- a/lib/unison-hash/src/U/Util/Hash.hs +++ /dev/null @@ -1,59 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE OverloadedStrings #-} - -module U.Util.Hash - ( Hash (Hash, toShort), - unsafeFromBase32HexText, - fromBase32HexText, - fromBase32Hex, - fromByteString, - toBase32Hex, - toBase32HexText, - toByteString, - HashFor (..), - ) -where - -import Data.ByteString (ByteString) -import Data.ByteString.Short (ShortByteString, fromShort) -import qualified Data.ByteString.Short as B.Short -import Data.Text (Text) -import GHC.Generics (Generic) -import U.Util.Base32Hex (Base32Hex) -import qualified U.Util.Base32Hex as Base32Hex - --- | Hash which uniquely identifies a Unison type or term -newtype Hash = Hash {toShort :: ShortByteString} deriving (Eq, Ord, Generic) - -toBase32Hex :: Hash -> Base32Hex -toBase32Hex = Base32Hex.fromByteString . toByteString - -toBase32HexText :: Hash -> Text -toBase32HexText = Base32Hex.toText . toBase32Hex - -fromBase32Hex :: Base32Hex -> Hash -fromBase32Hex = Hash . B.Short.toShort . Base32Hex.toByteString - --- | Constructs a hash from base32 checks without any validation. --- Note that this converts Text -> ByteString -> ShortByteString and so is slower than --- we'd prefer. -unsafeFromBase32HexText :: Text -> Hash -unsafeFromBase32HexText = fromBase32Hex . Base32Hex.UnsafeFromText - -fromBase32HexText :: Text -> Maybe Hash -fromBase32HexText = fmap fromBase32Hex . Base32Hex.fromText - -toByteString :: Hash -> ByteString -toByteString = fromShort . toShort - -fromByteString :: ByteString -> Hash -fromByteString = Hash . B.Short.toShort - -instance Show Hash where - show h = (show . toBase32HexText) h - --- | A hash tagged with the type it's a hash of, useful for maintaining type safety --- guarantees. -newtype HashFor t = HashFor {genericHash :: Hash} - deriving newtype (Show, Eq, Ord, Generic) diff --git a/lib/unison-hash/src/U/Util/Hash32.hs b/lib/unison-hash/src/U/Util/Hash32.hs index 39f4205e0..1f349ba62 100644 --- a/lib/unison-hash/src/U/Util/Hash32.hs +++ b/lib/unison-hash/src/U/Util/Hash32.hs @@ -19,8 +19,8 @@ module U.Util.Hash32 where import U.Util.Base32Hex (Base32Hex (..)) -import U.Util.Hash (Hash) -import qualified U.Util.Hash as Hash +import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import Unison.Prelude -- | A 512-bit hash, internally represented as base32hex. diff --git a/lib/unison-hash/src/Unison/Hash.hs b/lib/unison-hash/src/Unison/Hash.hs index b94558c43..60842ebe0 100644 --- a/lib/unison-hash/src/Unison/Hash.hs +++ b/lib/unison-hash/src/Unison/Hash.hs @@ -1,30 +1,67 @@ -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE OverloadedStrings #-} - module Unison.Hash ( Hash (Hash), HashFor (..), - base32Hex, + + -- ** ShortByteString conversions + toShort, + + -- ** ByteString conversions + fromByteString, + toByteString, + + -- ** Base32Hex conversions fromBase32Hex, - Hash.fromByteString, - Hash.toByteString, - validBase32HexChars, + toBase32Hex, + + -- ** Base32Hex Text conversions + fromBase32HexText, + unsafeFromBase32HexText, + toBase32HexText, ) where +import Data.ByteString.Short (ShortByteString) +import qualified Data.ByteString.Short as B.Short +import U.Util.Base32Hex (Base32Hex) import qualified U.Util.Base32Hex as Base32Hex -import U.Util.Hash (Hash (Hash), HashFor (..)) -import qualified U.Util.Hash as Hash import Unison.Prelude +-- | A hash. +newtype Hash = Hash {toShort :: ShortByteString} + deriving stock (Eq, Ord, Generic) + +instance Show Hash where + show = show . toBase32HexText + +-- | A hash tagged with the type it's a hash of, useful for maintaining type safety guarantees. +newtype HashFor t = HashFor {genericHash :: Hash} + deriving newtype (Show, Eq, Ord, Generic) + +-- | Convert a hash to a byte string. +toByteString :: Hash -> ByteString +toByteString = B.Short.fromShort . toShort + +-- | Convert a byte string to a hash. +fromByteString :: ByteString -> Hash +fromByteString = Hash . B.Short.toShort + +-- | Convert base32 hex to a hash. +fromBase32Hex :: Base32Hex -> Hash +fromBase32Hex = fromByteString . Base32Hex.toByteString + +-- | Convert a hash to base32 hex. +toBase32Hex :: Hash -> Base32Hex +toBase32Hex = Base32Hex.fromByteString . toByteString + +-- | Produce a 'Hash' from a base32hex-encoded version of its binary representation +fromBase32HexText :: Text -> Maybe Hash +fromBase32HexText = fmap fromBase32Hex . Base32Hex.fromText + +-- | Convert a hash from base32 hex without any validation. +unsafeFromBase32HexText :: Text -> Hash +unsafeFromBase32HexText = fromBase32Hex . Base32Hex.UnsafeFromText + -- | Return the lowercase unpadded base32Hex encoding of this 'Hash'. -- Multibase prefix would be 'v', see https://github.com/multiformats/multibase -base32Hex :: Hash -> Text -base32Hex = Base32Hex.toText . Hash.toBase32Hex - --- | Produce a 'Hash' from a base32hex-encoded version of its binary representation -fromBase32Hex :: Text -> Maybe Hash -fromBase32Hex = fmap Hash.fromBase32Hex . Base32Hex.fromText - -validBase32HexChars :: Set Char -validBase32HexChars = Base32Hex.validChars +toBase32HexText :: Hash -> Text +toBase32HexText = Base32Hex.toText . toBase32Hex diff --git a/lib/unison-hash/unison-hash.cabal b/lib/unison-hash/unison-hash.cabal index 091ab5e7a..02e7a5ab8 100644 --- a/lib/unison-hash/unison-hash.cabal +++ b/lib/unison-hash/unison-hash.cabal @@ -17,7 +17,6 @@ source-repository head library exposed-modules: - U.Util.Hash U.Util.Hash32 Unison.Hash hs-source-dirs: diff --git a/lib/unison-hashing/src/Unison/Hashing/ContentAddressable.hs b/lib/unison-hashing/src/Unison/Hashing/ContentAddressable.hs index 60535cf1b..cc884d79d 100644 --- a/lib/unison-hashing/src/Unison/Hashing/ContentAddressable.hs +++ b/lib/unison-hashing/src/Unison/Hashing/ContentAddressable.hs @@ -3,7 +3,7 @@ module Unison.Hashing.ContentAddressable ) where -import U.Util.Hash (Hash) +import Unison.Hash (Hash) -- | A type class that is inhabited by types that can compute a hash of their content. -- diff --git a/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs b/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs index 2fcb8feac..0d9b1eb97 100644 --- a/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs +++ b/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs @@ -28,10 +28,10 @@ import qualified U.Codebase.Sqlite.Branch.Full as DBBranch import qualified U.Codebase.Sqlite.DbId as DB import qualified U.Codebase.Sqlite.Operations as Ops import qualified U.Codebase.Sqlite.Queries as Q -import qualified U.Util.Hash as Hash import qualified Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema1To2.DbHelpers as Helpers import qualified Unison.Debug as Debug import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import Unison.Prelude import qualified Unison.Sqlite as Sqlite import Unison.Util.Monoid (foldMapM) diff --git a/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs b/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs index cfb801fa2..7156962f9 100644 --- a/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs +++ b/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs @@ -9,6 +9,7 @@ where import qualified Data.Set as Set import qualified Data.Text as Text +import qualified U.Util.Base32Hex as Base32Hex import qualified Unison.Hash as Hash import Unison.Prelude @@ -20,17 +21,17 @@ toString :: ShortCausalHash -> String toString = Text.unpack . toText toHash :: Coercible Hash.Hash h => ShortCausalHash -> Maybe h -toHash = fmap coerce . Hash.fromBase32Hex . toText +toHash = fmap coerce . Hash.fromBase32HexText . toText fromHash :: Coercible h Hash.Hash => Int -> h -> ShortCausalHash fromHash len = - ShortCausalHash . Text.take len . Hash.base32Hex . coerce + ShortCausalHash . Text.take len . Hash.toBase32HexText . coerce -- abc -> SCH abc -- #abc -> SCH abc fromText :: Text -> Maybe ShortCausalHash fromText (Text.dropWhile (== '#') -> t) - | Text.all (`Set.member` Hash.validBase32HexChars) t = + | Text.all (`Set.member` Base32Hex.validChars) t = Just $ ShortCausalHash t fromText _ = Nothing diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs index 1e2d59dc6..4bb81f59d 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs @@ -1,11 +1,9 @@ -{-# LANGUAGE ViewPatterns #-} - module Unison.Codebase.SqliteCodebase.Conversions where import Data.Bifunctor (Bifunctor (bimap)) import qualified Data.Map as Map import qualified Data.Set as Set -import Data.Text (pack, unpack) +import Data.Text (pack) import qualified U.Codebase.Branch as V2.Branch import qualified U.Codebase.Causal as V2 import qualified U.Codebase.Decl as V2.Decl @@ -35,7 +33,8 @@ import qualified Unison.Codebase.TypeEdit as V1.TypeEdit import qualified Unison.ConstructorReference as V1 (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import qualified Unison.DataDeclaration as V1.Decl -import Unison.Hash (Hash, base32Hex) +import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import qualified Unison.Hash as V1 import qualified Unison.Kind as V1.Kind import Unison.NameSegment (NameSegment) @@ -114,7 +113,7 @@ term1to2 h = V1.Term.Match e cases -> V2.Term.Match e (goCase <$> cases) V1.Term.TermLink r -> V2.Term.TermLink (rreferent1to2 h r) V1.Term.TypeLink r -> V2.Term.TypeLink (reference1to2 r) - V1.Term.Blank _ -> error ("can't serialize term with blanks (" ++ unpack (base32Hex h) ++ ")") + V1.Term.Blank _ -> error ("can't serialize term with blanks (" ++ show h ++ ")") goCase (V1.Term.MatchCase p g b) = V2.Term.MatchCase (goPat p) g b @@ -553,7 +552,7 @@ referent2toshorthash1 hashLength ref = reference2toshorthash1 :: Maybe Int -> V2.Reference.Reference -> V1.ShortHash.ShortHash reference2toshorthash1 hashLength ref = maybe id V1.ShortHash.take hashLength $ case ref of (V2.Reference.ReferenceBuiltin b) -> V1.ShortHash.Builtin b - (V2.Reference.ReferenceDerived (V2.Reference.Id h i)) -> V1.ShortHash.ShortHash (base32Hex h) (showComponentPos i) Nothing + (V2.Reference.ReferenceDerived (V2.Reference.Id h i)) -> V1.ShortHash.ShortHash (Hash.toBase32HexText h) (showComponentPos i) Nothing where showComponentPos :: V2.Reference.Pos -> Maybe Text showComponentPos 0 = Nothing diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema5To6.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema5To6.hs index a5faf5f6b..25fd28058 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema5To6.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema5To6.hs @@ -53,7 +53,7 @@ oldReflogEntries reflogPath now = -- least puts them in the correct order chronologically. let offsetTime = addUTCTime (negate $ fromInteger @NominalDiffTime n) now in case Text.words txt of - (Hash.fromBase32Hex -> Just old) : (Hash.fromBase32Hex -> Just new) : (Text.unwords -> reason) -> + (Hash.fromBase32HexText -> Just old) : (Hash.fromBase32HexText -> Just new) : (Text.unwords -> reason) -> Just $ Reflog.Entry { time = offsetTime, diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs index 2c54b7841..edef2cba8 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs @@ -30,7 +30,6 @@ import U.Codebase.Sqlite.Operations (NamesByPath (..)) import qualified U.Codebase.Sqlite.Operations as Ops import qualified U.Codebase.Sqlite.Queries as Q import U.Codebase.Sqlite.V2.HashHandle (v2HashHandle) -import qualified U.Util.Hash as H2 import qualified Unison.Builtin as Builtins import Unison.Codebase.Branch (Branch (..)) import qualified Unison.Codebase.Branch as Branch @@ -151,7 +150,7 @@ tryFlushBuffer :: forall a. (Show a) => TVar (Map Hash (BufferEntry a)) -> - (H2.Hash -> [a] -> Transaction ()) -> + (Hash -> [a] -> Transaction ()) -> (Hash -> Transaction ()) -> Hash -> Transaction () diff --git a/parser-typechecker/src/Unison/Runtime/Serialize.hs b/parser-typechecker/src/Unison/Runtime/Serialize.hs index 6382eae29..5ef8e8b09 100644 --- a/parser-typechecker/src/Unison/Runtime/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/Serialize.hs @@ -21,10 +21,10 @@ import Data.Text.Encoding (decodeUtf8, encodeUtf8) import qualified Data.Vector.Primitive as BA import Data.Word (Word64, Word8) import GHC.Exts as IL (IsList (..)) -import qualified U.Util.Hash as Hash import Unison.ConstructorReference (ConstructorReference, GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import Unison.Reference (Id (..), Reference (..), pattern Derived) import Unison.Referent (Referent, pattern Con, pattern Ref) import Unison.Runtime.Exception diff --git a/parser-typechecker/tests/Unison/Test/DataDeclaration.hs b/parser-typechecker/tests/Unison/Test/DataDeclaration.hs index 2e42b521e..e7fcea751 100644 --- a/parser-typechecker/tests/Unison/Test/DataDeclaration.hs +++ b/parser-typechecker/tests/Unison/Test/DataDeclaration.hs @@ -8,9 +8,9 @@ import Data.Map ((!)) import qualified Data.Map as Map import EasyTest import Text.RawString.QQ -import qualified U.Util.Hash as Hash import Unison.DataDeclaration (DataDeclaration (..), Decl) import qualified Unison.DataDeclaration as DD +import qualified Unison.Hash as Hash import qualified Unison.Hashing.V2.Convert as Hashing import Unison.Parser.Ann (Ann) import Unison.Parsers (unsafeParseFile) diff --git a/parser-typechecker/tests/Unison/Test/Term.hs b/parser-typechecker/tests/Unison/Test/Term.hs index 319db7c7c..751d73653 100644 --- a/parser-typechecker/tests/Unison/Test/Term.hs +++ b/parser-typechecker/tests/Unison/Test/Term.hs @@ -6,7 +6,7 @@ import Data.Map ((!)) import qualified Data.Map as Map import Data.Text.Encoding (encodeUtf8) import EasyTest -import qualified U.Util.Hash as Hash +import qualified Unison.Hash as Hash import qualified Unison.Reference as R import Unison.Symbol (Symbol) import qualified Unison.Term as Term diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index de54efe7c..b87d89e35 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -44,7 +44,6 @@ import U.Codebase.HashTags (CausalHash (..)) import qualified U.Codebase.Reflog as Reflog import qualified U.Codebase.Sqlite.Operations as Ops import qualified U.Codebase.Sqlite.Queries as Queries -import qualified U.Util.Hash as Hash import U.Util.Hash32 (Hash32) import qualified U.Util.Hash32 as Hash32 import qualified Unison.ABT as ABT @@ -134,6 +133,7 @@ import qualified Unison.CommandLine.InputPatterns as IP import qualified Unison.CommandLine.InputPatterns as InputPatterns import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.DataDeclaration as DD +import qualified Unison.Hash as Hash import qualified Unison.HashQualified as HQ import qualified Unison.HashQualified' as HQ' import qualified Unison.Hashing.V2.Convert as Hashing diff --git a/unison-cli/src/Unison/Codebase/Editor/UriParser.hs b/unison-cli/src/Unison/Codebase/Editor/UriParser.hs index e1420459b..ee11eef6e 100644 --- a/unison-cli/src/Unison/Codebase/Editor/UriParser.hs +++ b/unison-cli/src/Unison/Codebase/Editor/UriParser.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE OverloadedStrings #-} - module Unison.Codebase.Editor.UriParser ( repoPath, writeGitRepo, @@ -17,6 +15,7 @@ import qualified Data.Text as Text import Data.Void import qualified Text.Megaparsec as P import qualified Text.Megaparsec.Char as C +import qualified U.Util.Base32Hex as Base32Hex import Unison.Codebase.Editor.RemoteRepo ( ReadGitRemoteNamespace (..), ReadGitRepo (..), @@ -31,7 +30,6 @@ import Unison.Codebase.Editor.RemoteRepo import Unison.Codebase.Path (Path (..)) import qualified Unison.Codebase.Path as Path import Unison.Codebase.ShortCausalHash (ShortCausalHash (..)) -import qualified Unison.Hash as Hash import Unison.NameSegment (NameSegment (..)) import qualified Unison.NameSegment as NameSegment import Unison.Prelude @@ -368,4 +366,4 @@ shortCausalHash :: P ShortCausalHash shortCausalHash = P.label "short causal hash" $ do void $ C.char '#' ShortCausalHash - <$> P.takeWhile1P (Just "base32hex chars") (`elem` Hash.validBase32HexChars) + <$> P.takeWhile1P (Just "base32hex chars") (`elem` Base32Hex.validChars) diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 4c62f8a81..12f0ce3cb 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -42,7 +42,6 @@ import U.Codebase.HashTags (CausalHash (..)) import U.Codebase.Sqlite.DbId (SchemaVersion (SchemaVersion)) import U.Util.Base32Hex (Base32Hex) import qualified U.Util.Base32Hex as Base32Hex -import qualified U.Util.Hash as Hash import U.Util.Hash32 (Hash32) import qualified U.Util.Hash32 as Hash32 import qualified Unison.ABT as ABT @@ -1232,7 +1231,7 @@ notifyUser dir o = case o of CouldntLoadRootBranch repo hash -> P.wrap $ "I couldn't load the designated root hash" - <> P.group ("(" <> P.text (Hash.base32Hex $ unCausalHash hash) <> ")") + <> P.group ("(" <> P.text (Hash.toBase32HexText $ unCausalHash hash) <> ")") <> "from the repository at" <> prettyReadGitRepo repo CouldntLoadSyncedBranch ns h -> @@ -1527,10 +1526,10 @@ notifyUser dir o = case o of Nothing -> go (renderLine head [] : output) queue Just tails -> go (renderLine head tails : output) (queue ++ tails) where - renderHash = take 10 . Text.unpack . Hash.base32Hex . unCausalHash + renderHash = take 10 . Text.unpack . Hash.toBase32HexText . unCausalHash renderLine head tail = (renderHash head) ++ "|" ++ intercalateMap " " renderHash tail - ++ case Map.lookup (Hash.base32Hex . unCausalHash $ head) tags of + ++ case Map.lookup (Hash.toBase32HexText . unCausalHash $ head) tags of Just t -> "|tag: " ++ t Nothing -> "" -- some specific hashes that we want to label in the output @@ -3213,7 +3212,7 @@ endangeredDependentsTable ppeDecl m = -- | Displays a full, non-truncated Branch.CausalHash to a string, e.g. #abcdef displayBranchHash :: CausalHash -> String -displayBranchHash = ("#" <>) . Text.unpack . Hash.base32Hex . unCausalHash +displayBranchHash = ("#" <>) . Text.unpack . Hash.toBase32HexText . unCausalHash prettyHumanReadableTime :: UTCTime -> UTCTime -> Pretty prettyHumanReadableTime now time = diff --git a/unison-core/src/Unison/Hashable.hs b/unison-core/src/Unison/Hashable.hs index 5bc24743f..82c5da56b 100644 --- a/unison-core/src/Unison/Hashable.hs +++ b/unison-core/src/Unison/Hashable.hs @@ -7,9 +7,8 @@ import Data.ByteString.Builder (doubleBE, int64BE, toLazyByteString, word64BE) import qualified Data.ByteString.Lazy as BL import qualified Data.Map as Map import qualified Data.Set as Set -import U.Util.Hash (Hash) -import qualified U.Util.Hash as H -import qualified U.Util.Hash as Hash +import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import Unison.Prelude import Unison.Util.Relation (Relation) import qualified Unison.Util.Relation as Relation @@ -109,8 +108,8 @@ instance Accumulate Hash where toBS (Text txt) = let tbytes = encodeUtf8 txt in [encodeLength (B.length tbytes), tbytes] - toBS (Hashed h) = [H.toByteString h] + toBS (Hashed h) = [Hash.toByteString h] encodeLength :: Integral n => n -> B.ByteString encodeLength = BL.toStrict . toLazyByteString . word64BE . fromIntegral - fromBytes = H.fromByteString - toBytes = H.toByteString + fromBytes = Hash.fromByteString + toBytes = Hash.toByteString diff --git a/unison-core/src/Unison/Reference.hs b/unison-core/src/Unison/Reference.hs index 06a799bb7..9a8eec199 100644 --- a/unison-core/src/Unison/Reference.hs +++ b/unison-core/src/Unison/Reference.hs @@ -1,8 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE ViewPatterns #-} module Unison.Reference ( Reference, @@ -110,8 +106,8 @@ idToShortHash = toShortHash . DerivedId -- but Show Reference currently depends on SH toShortHash :: Reference -> ShortHash toShortHash (Builtin b) = SH.Builtin b -toShortHash (Derived h 0) = SH.ShortHash (H.base32Hex h) Nothing Nothing -toShortHash (Derived h i) = SH.ShortHash (H.base32Hex h) (Just $ showSuffix i) Nothing +toShortHash (Derived h 0) = SH.ShortHash (H.toBase32HexText h) Nothing Nothing +toShortHash (Derived h i) = SH.ShortHash (H.toBase32HexText h) (Just $ showSuffix i) Nothing -- toShortHash . fromJust . fromShortHash == id and -- fromJust . fromShortHash . toShortHash == id @@ -122,7 +118,7 @@ toShortHash (Derived h i) = SH.ShortHash (H.base32Hex h) (Just $ showSuffix i) N fromShortHash :: ShortHash -> Maybe Reference fromShortHash (SH.Builtin b) = Just (Builtin b) fromShortHash (SH.ShortHash prefix cycle Nothing) = do - h <- H.fromBase32Hex prefix + h <- H.fromBase32HexText prefix case cycle of Nothing -> Just (Derived h 0) Just i -> Derived h <$> readMay (Text.unpack i) @@ -168,7 +164,7 @@ derivedBase32Hex :: Text -> Pos -> Reference derivedBase32Hex b32Hex i = DerivedId (Id (fromMaybe msg h) i) where msg = error $ "Reference.derivedBase32Hex " <> show h - h = H.fromBase32Hex b32Hex + h = H.fromBase32HexText b32Hex unsafeFromText :: Text -> Reference unsafeFromText = either error id . fromText diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs index d828c9916..fa29660b2 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs @@ -15,8 +15,8 @@ import Data.ByteString.Builder (doubleBE, int64BE, toLazyByteString, word64BE) import qualified Data.ByteString.Lazy as BL import qualified Data.Map as Map import qualified Data.Set as Set -import U.Util.Hash (Hash) -import qualified U.Util.Hash as Hash +import Unison.Hash (Hash) +import qualified Unison.Hash as Hash import Unison.Prelude import Unison.Util.Relation (Relation) import qualified Unison.Util.Relation as Relation @@ -131,7 +131,7 @@ accumulate = Hash.fromByteString . BA.convert . CH.hashFinalize . go CH.hashInit toBS (Double d) = [BL.toStrict . toLazyByteString . doubleBE $ d] toBS (Text txt) = let tbytes = encodeUtf8 txt - in [encodeLength (B.length tbytes), tbytes] + in [encodeLength (B.length tbytes), tbytes] toBS (Hashed h) = [Hash.toByteString h] encodeLength :: Integral n => n -> B.ByteString encodeLength = BL.toStrict . toLazyByteString . word64BE . fromIntegral diff --git a/unison-share-api/package.yaml b/unison-share-api/package.yaml index ce83c57ef..fbbd504ab 100644 --- a/unison-share-api/package.yaml +++ b/unison-share-api/package.yaml @@ -70,6 +70,7 @@ default-extensions: - ConstraintKinds - DeriveAnyClass - DeriveFunctor + - DeriveGeneric - DerivingStrategies - DerivingVia - DoAndIfThenElse @@ -87,6 +88,7 @@ default-extensions: - PatternSynonyms - RankNTypes - ScopedTypeVariables + - StandaloneDeriving - TupleSections - TypeApplications - TypeOperators diff --git a/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs b/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs index 7edb0045f..7e53b65db 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs @@ -1,10 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-orphans #-} module Unison.Server.Endpoints.NamespaceListing (serve, NamespaceListingAPI, NamespaceListing (..), NamespaceObject (..), NamedNamespace (..), NamedPatch (..), KindExpression (..)) where @@ -28,11 +22,11 @@ import U.Codebase.Branch (NamespaceStats (..)) import qualified U.Codebase.Causal as V2Causal import U.Codebase.HashTags (CausalHash (..)) import qualified U.Codebase.Sqlite.Operations as Operations -import qualified U.Util.Hash as Hash import Unison.Codebase (Codebase) import qualified Unison.Codebase as Codebase import qualified Unison.Codebase.Path as Path import Unison.Codebase.ShortCausalHash (ShortCausalHash) +import qualified Unison.Hash as Hash import qualified Unison.NameSegment as NameSegment import Unison.Parser.Ann (Ann) import Unison.Prelude @@ -82,7 +76,7 @@ data NamespaceListing = NamespaceListing namespaceListingHash :: UnisonHash, namespaceListingChildren :: [NamespaceObject] } - deriving (Generic, Show) + deriving stock (Generic, Show) instance ToJSON NamespaceListing where toEncoding = genericToEncoding defaultOptions diff --git a/unison-share-api/src/Unison/Server/Endpoints/Projects.hs b/unison-share-api/src/Unison/Server/Endpoints/Projects.hs index 7fd928acc..56ef56571 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/Projects.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/Projects.hs @@ -1,10 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TypeOperators #-} module Unison.Server.Endpoints.Projects where @@ -27,12 +21,12 @@ import Servant.Docs import qualified U.Codebase.Branch as V2Branch import qualified U.Codebase.Causal as V2Causal import U.Codebase.HashTags (CausalHash (..)) -import qualified U.Util.Hash as Hash import Unison.Codebase (Codebase) import qualified Unison.Codebase as Codebase import qualified Unison.Codebase.Path as Path import qualified Unison.Codebase.Path.Parse as Path import Unison.Codebase.ShortCausalHash (ShortCausalHash) +import qualified Unison.Hash as Hash import qualified Unison.NameSegment as NameSegment import Unison.Parser.Ann (Ann) import Unison.Prelude diff --git a/unison-share-api/src/Unison/Server/Orphans.hs b/unison-share-api/src/Unison/Server/Orphans.hs index e64f8752b..066b0528a 100644 --- a/unison-share-api/src/Unison/Server/Orphans.hs +++ b/unison-share-api/src/Unison/Server/Orphans.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -Wno-orphans #-} module Unison.Server.Orphans where @@ -16,8 +15,6 @@ import qualified Data.Text as Text import Servant import Servant.Docs (DocCapture (DocCapture), DocQueryParam (..), ParamKind (..), ToCapture (..), ToParam (..)) import U.Codebase.HashTags -import U.Util.Hash (Hash (..)) -import qualified U.Util.Hash as Hash import Unison.Codebase.Editor.DisplayObject import qualified Unison.Codebase.Path as Path import qualified Unison.Codebase.Path.Parse as Path @@ -26,6 +23,8 @@ import Unison.Codebase.ShortCausalHash ) import qualified Unison.Codebase.ShortCausalHash as SCH import Unison.ConstructorType (ConstructorType) +import Unison.Hash (Hash (..)) +import qualified Unison.Hash as Hash import qualified Unison.HashQualified as HQ import qualified Unison.HashQualified' as HQ' import Unison.Name (Name) diff --git a/unison-share-api/src/Unison/Server/Types.hs b/unison-share-api/src/Unison/Server/Types.hs index 9b511e468..a2becfe17 100644 --- a/unison-share-api/src/Unison/Server/Types.hs +++ b/unison-share-api/src/Unison/Server/Types.hs @@ -315,8 +315,8 @@ setCacheControl = addHeader @"Cache-Control" "public" branchToUnisonHash :: Branch.Branch m -> UnisonHash branchToUnisonHash b = - ("#" <>) . Hash.base32Hex . unCausalHash $ Branch.headHash b + ("#" <>) . Hash.toBase32HexText . unCausalHash $ Branch.headHash b v2CausalBranchToUnisonHash :: V2Branch.CausalBranch m -> UnisonHash v2CausalBranchToUnisonHash b = - ("#" <>) . Hash.base32Hex . unCausalHash $ V2Causal.causalHash b + ("#" <>) . Hash.toBase32HexText . unCausalHash $ V2Causal.causalHash b diff --git a/unison-share-api/unison-share-api.cabal b/unison-share-api/unison-share-api.cabal index da662717d..7df4859d8 100644 --- a/unison-share-api/unison-share-api.cabal +++ b/unison-share-api/unison-share-api.cabal @@ -45,6 +45,7 @@ library ConstraintKinds DeriveAnyClass DeriveFunctor + DeriveGeneric DerivingStrategies DerivingVia DoAndIfThenElse @@ -62,6 +63,7 @@ library PatternSynonyms RankNTypes ScopedTypeVariables + StandaloneDeriving TupleSections TypeApplications TypeOperators diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index 35f22cea5..7de7bcdcd 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -86,7 +86,7 @@ uniqueBase32Namegen rng = serialize $ VarInt (L.line pos) serialize $ VarInt (L.column pos) h = Hashable.accumulate' $ bytes <> posBytes - b58 = Hash.base32Hex h + b58 = Hash.toBase32HexText h in if Char.isDigit (Text.head b58) then go pos lenInBase32Hex rng else Just . Text.take lenInBase32Hex $ b58 From 27835af5524dbbff7c9f4932ebfc8a55f5e9d220 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 15 Dec 2022 14:06:45 -0500 Subject: [PATCH 032/467] U.Util.Hash32 -> Unison.Hash32 --- .../codebase-sqlite/U/Codebase/Sqlite/Operations.hs | 2 +- codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs | 6 +++--- .../codebase-sqlite/U/Codebase/Sqlite/Serialization.hs | 10 ++-------- .../codebase-sqlite/U/Codebase/Sqlite/TempEntity.hs | 2 +- .../src/{U/Util => Unison}/Hash32/Orphans/Aeson.hs | 4 ++-- .../unison-hash-orphans-aeson.cabal | 2 +- .../src/{U/Util => Unison}/Hash32/Orphans/Sqlite.hs | 4 ++-- .../unison-hash-orphans-sqlite.cabal | 2 +- lib/unison-hash/src/{U/Util => Unison}/Hash32.hs | 2 +- lib/unison-hash/unison-hash.cabal | 2 +- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 4 ++-- unison-cli/src/Unison/CommandLine/OutputMessages.hs | 4 ++-- unison-cli/src/Unison/Share/Sync.hs | 2 +- unison-cli/src/Unison/Share/Sync/Types.hs | 2 +- unison-share-api/src/Unison/Sync/Common.hs | 4 ++-- unison-share-api/src/Unison/Sync/Types.hs | 4 ++-- 16 files changed, 25 insertions(+), 31 deletions(-) rename lib/unison-hash-orphans-aeson/src/{U/Util => Unison}/Hash32/Orphans/Aeson.hs (81%) rename lib/unison-hash-orphans-sqlite/src/{U/Util => Unison}/Hash32/Orphans/Sqlite.hs (78%) rename lib/unison-hash/src/{U/Util => Unison}/Hash32.hs (98%) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index fbcd3353f..59d1a0ad1 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -163,9 +163,9 @@ import qualified U.Codebase.TypeEdit as C import qualified U.Codebase.TypeEdit as C.TypeEdit import U.Codebase.WatchKind (WatchKind) import qualified U.Util.Base32Hex as Base32Hex -import qualified U.Util.Hash32 as Hash32 import qualified U.Util.Serialization as S import qualified Unison.Hash as H +import qualified Unison.Hash32 as Hash32 import Unison.NameSegment (NameSegment (NameSegment)) import qualified Unison.NameSegment as NameSegment import Unison.Prelude diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 011f0071c..1703f2b18 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -270,13 +270,13 @@ import qualified U.Codebase.Term as C.Term import qualified U.Codebase.Type as C.Type import U.Codebase.WatchKind (WatchKind) import qualified U.Core.ABT as ABT -import U.Util.Hash32 (Hash32) -import qualified U.Util.Hash32 as Hash32 -import U.Util.Hash32.Orphans.Sqlite () import qualified U.Util.Serialization as S import qualified U.Util.Term as TermUtil import Unison.Hash (Hash) import qualified Unison.Hash as Hash +import Unison.Hash32 (Hash32) +import qualified Unison.Hash32 as Hash32 +import Unison.Hash32.Orphans.Sqlite () import Unison.Prelude import Unison.Sqlite import qualified Unison.Util.Alternative as Alternative diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs index 784eb91df..e87b08331 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs @@ -1,10 +1,4 @@ -{-# LANGUAGE BlockArguments #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TupleSections #-} -{-# LANGUAGE TypeApplications #-} -{-# LANGUAGE ViewPatterns #-} module U.Codebase.Sqlite.Serialization where @@ -44,9 +38,9 @@ import qualified U.Codebase.Term as Term import qualified U.Codebase.Type as Type import qualified U.Core.ABT as ABT import qualified U.Util.Base32Hex as Base32Hex -import U.Util.Hash32 (Hash32) -import qualified U.Util.Hash32 as Hash32 import U.Util.Serialization hiding (debug) +import Unison.Hash32 (Hash32) +import qualified Unison.Hash32 as Hash32 import Unison.Prelude import qualified Unison.Util.Monoid as Monoid import Prelude hiding (getChar, putChar) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/TempEntity.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/TempEntity.hs index be966233b..205396d78 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/TempEntity.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/TempEntity.hs @@ -7,7 +7,7 @@ import qualified U.Codebase.Sqlite.Entity as Entity import U.Codebase.Sqlite.LocalIds (LocalIds') import qualified U.Codebase.Sqlite.Patch.Format as Patch import qualified U.Codebase.Sqlite.Term.Format as Term -import U.Util.Hash32 (Hash32) +import Unison.Hash32 (Hash32) import Unison.Prelude -- | diff --git a/lib/unison-hash-orphans-aeson/src/U/Util/Hash32/Orphans/Aeson.hs b/lib/unison-hash-orphans-aeson/src/Unison/Hash32/Orphans/Aeson.hs similarity index 81% rename from lib/unison-hash-orphans-aeson/src/U/Util/Hash32/Orphans/Aeson.hs rename to lib/unison-hash-orphans-aeson/src/Unison/Hash32/Orphans/Aeson.hs index 4cc9efbbe..3d52a35b5 100644 --- a/lib/unison-hash-orphans-aeson/src/U/Util/Hash32/Orphans/Aeson.hs +++ b/lib/unison-hash-orphans-aeson/src/Unison/Hash32/Orphans/Aeson.hs @@ -1,11 +1,11 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -module U.Util.Hash32.Orphans.Aeson () where +module Unison.Hash32.Orphans.Aeson () where import Data.Aeson (FromJSON, FromJSONKey, ToJSON, ToJSONKey) import Data.Text (Text) import U.Util.Base32Hex (Base32Hex (..)) -import U.Util.Hash32 (Hash32 (..)) +import Unison.Hash32 (Hash32 (..)) deriving via Text instance FromJSON Hash32 diff --git a/lib/unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal b/lib/unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal index deb05ca6c..d85db2665 100644 --- a/lib/unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal +++ b/lib/unison-hash-orphans-aeson/unison-hash-orphans-aeson.cabal @@ -17,7 +17,7 @@ source-repository head library exposed-modules: - U.Util.Hash32.Orphans.Aeson + Unison.Hash32.Orphans.Aeson hs-source-dirs: src default-extensions: diff --git a/lib/unison-hash-orphans-sqlite/src/U/Util/Hash32/Orphans/Sqlite.hs b/lib/unison-hash-orphans-sqlite/src/Unison/Hash32/Orphans/Sqlite.hs similarity index 78% rename from lib/unison-hash-orphans-sqlite/src/U/Util/Hash32/Orphans/Sqlite.hs rename to lib/unison-hash-orphans-sqlite/src/Unison/Hash32/Orphans/Sqlite.hs index 4602e8737..941e56480 100644 --- a/lib/unison-hash-orphans-sqlite/src/U/Util/Hash32/Orphans/Sqlite.hs +++ b/lib/unison-hash-orphans-sqlite/src/Unison/Hash32/Orphans/Sqlite.hs @@ -1,12 +1,12 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -module U.Util.Hash32.Orphans.Sqlite () where +module Unison.Hash32.Orphans.Sqlite () where import Data.Text (Text) import Database.SQLite.Simple.FromField (FromField) import Database.SQLite.Simple.ToField (ToField) import U.Util.Base32Hex (Base32Hex (..)) -import U.Util.Hash32 (Hash32 (..)) +import Unison.Hash32 (Hash32 (..)) deriving via Text instance ToField Hash32 diff --git a/lib/unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal b/lib/unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal index 8e0378321..2f14ce5fc 100644 --- a/lib/unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal +++ b/lib/unison-hash-orphans-sqlite/unison-hash-orphans-sqlite.cabal @@ -17,7 +17,7 @@ source-repository head library exposed-modules: - U.Util.Hash32.Orphans.Sqlite + Unison.Hash32.Orphans.Sqlite hs-source-dirs: src default-extensions: diff --git a/lib/unison-hash/src/U/Util/Hash32.hs b/lib/unison-hash/src/Unison/Hash32.hs similarity index 98% rename from lib/unison-hash/src/U/Util/Hash32.hs rename to lib/unison-hash/src/Unison/Hash32.hs index 1f349ba62..25704f026 100644 --- a/lib/unison-hash/src/U/Util/Hash32.hs +++ b/lib/unison-hash/src/Unison/Hash32.hs @@ -1,5 +1,5 @@ -- | A 512-bit hash, internally represented as base32hex. -module U.Util.Hash32 +module Unison.Hash32 ( -- * Hash32 type Hash32 (..), diff --git a/lib/unison-hash/unison-hash.cabal b/lib/unison-hash/unison-hash.cabal index 02e7a5ab8..783c09a53 100644 --- a/lib/unison-hash/unison-hash.cabal +++ b/lib/unison-hash/unison-hash.cabal @@ -17,8 +17,8 @@ source-repository head library exposed-modules: - U.Util.Hash32 Unison.Hash + Unison.Hash32 hs-source-dirs: src default-extensions: diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index b87d89e35..72b9a1bda 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -44,8 +44,6 @@ import U.Codebase.HashTags (CausalHash (..)) import qualified U.Codebase.Reflog as Reflog import qualified U.Codebase.Sqlite.Operations as Ops import qualified U.Codebase.Sqlite.Queries as Queries -import U.Util.Hash32 (Hash32) -import qualified U.Util.Hash32 as Hash32 import qualified Unison.ABT as ABT import qualified Unison.Builtin as Builtin import qualified Unison.Builtin.Decls as DD @@ -134,6 +132,8 @@ import qualified Unison.CommandLine.InputPatterns as InputPatterns import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.DataDeclaration as DD import qualified Unison.Hash as Hash +import Unison.Hash32 (Hash32) +import qualified Unison.Hash32 as Hash32 import qualified Unison.HashQualified as HQ import qualified Unison.HashQualified' as HQ' import qualified Unison.Hashing.V2.Convert as Hashing diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 12f0ce3cb..5d59e3b3c 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -42,8 +42,6 @@ import U.Codebase.HashTags (CausalHash (..)) import U.Codebase.Sqlite.DbId (SchemaVersion (SchemaVersion)) import U.Util.Base32Hex (Base32Hex) import qualified U.Util.Base32Hex as Base32Hex -import U.Util.Hash32 (Hash32) -import qualified U.Util.Hash32 as Hash32 import qualified Unison.ABT as ABT import qualified Unison.Auth.Types as Auth import qualified Unison.Builtin.Decls as DD @@ -86,6 +84,8 @@ import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import qualified Unison.DataDeclaration as DD import qualified Unison.Hash as Hash +import Unison.Hash32 (Hash32) +import qualified Unison.Hash32 as Hash32 import qualified Unison.HashQualified as HQ import qualified Unison.HashQualified' as HQ' import Unison.LabeledDependency as LD diff --git a/unison-cli/src/Unison/Share/Sync.hs b/unison-cli/src/Unison/Share/Sync.hs index 14b00ed31..348cff8a2 100644 --- a/unison-cli/src/Unison/Share/Sync.hs +++ b/unison-cli/src/Unison/Share/Sync.hs @@ -49,10 +49,10 @@ import qualified Servant.Client as Servant import U.Codebase.HashTags (CausalHash) import qualified U.Codebase.Sqlite.Queries as Q import U.Codebase.Sqlite.V2.HashHandle (v2HashHandle) -import U.Util.Hash32 (Hash32) import Unison.Auth.HTTPClient (AuthenticatedHttpClient) import qualified Unison.Auth.HTTPClient as Auth import qualified Unison.Debug as Debug +import Unison.Hash32 (Hash32) import Unison.Prelude import Unison.Share.Sync.Types import qualified Unison.Sqlite as Sqlite diff --git a/unison-cli/src/Unison/Share/Sync/Types.hs b/unison-cli/src/Unison/Share/Sync/Types.hs index 3d9903457..6e75bbe40 100644 --- a/unison-cli/src/Unison/Share/Sync/Types.hs +++ b/unison-cli/src/Unison/Share/Sync/Types.hs @@ -5,7 +5,7 @@ module Unison.Share.Sync.Types where import Data.Set.NonEmpty (NESet) import qualified Servant.Client as Servant -import U.Util.Hash32 (Hash32) +import Unison.Hash32 (Hash32) import Unison.Prelude import qualified Unison.Sync.Types as Share diff --git a/unison-share-api/src/Unison/Sync/Common.hs b/unison-share-api/src/Unison/Sync/Common.hs index 8bad96a97..bdc2ae341 100644 --- a/unison-share-api/src/Unison/Sync/Common.hs +++ b/unison-share-api/src/Unison/Sync/Common.hs @@ -25,8 +25,8 @@ import U.Codebase.Sqlite.TempEntity (TempEntity) import qualified U.Codebase.Sqlite.TempEntity as Sqlite import qualified U.Codebase.Sqlite.TempEntity as TempEntity import qualified U.Codebase.Sqlite.Term.Format as TermFormat -import U.Util.Hash32 (Hash32) -import qualified U.Util.Hash32 as Hash32 +import Unison.Hash32 (Hash32) +import qualified Unison.Hash32 as Hash32 import Unison.Prelude import qualified Unison.Sqlite as Sqlite import qualified Unison.Sync.Types as Share diff --git a/unison-share-api/src/Unison/Sync/Types.hs b/unison-share-api/src/Unison/Sync/Types.hs index 8fa5ae1e9..c307f47e1 100644 --- a/unison-share-api/src/Unison/Sync/Types.hs +++ b/unison-share-api/src/Unison/Sync/Types.hs @@ -88,8 +88,8 @@ import Data.Set.NonEmpty (NESet) import qualified Data.Text as Text import qualified Data.Text.Encoding as Text import Servant.Auth.JWT -import U.Util.Hash32 (Hash32) -import U.Util.Hash32.Orphans.Aeson () +import Unison.Hash32 (Hash32) +import Unison.Hash32.Orphans.Aeson () import Unison.Prelude import qualified Unison.Util.Set as Set import qualified Web.JWT as JWT From 781881dbfb1bf79ef74ba0d56244f52f728b64bb Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 16 Dec 2022 12:31:44 -0500 Subject: [PATCH 033/467] Add debug bounds checking for arrays used in the interpreter --- parser-typechecker/package.yaml | 5 + .../src/Unison/Runtime/Array.hs | 378 ++++++++++++++++++ .../src/Unison/Runtime/Machine.hs | 3 +- .../src/Unison/Runtime/Stack.hs | 4 +- .../unison-parser-typechecker.cabal | 9 + 5 files changed, 394 insertions(+), 5 deletions(-) create mode 100644 parser-typechecker/src/Unison/Runtime/Array.hs diff --git a/parser-typechecker/package.yaml b/parser-typechecker/package.yaml index 29c04a619..9daca3c0b 100644 --- a/parser-typechecker/package.yaml +++ b/parser-typechecker/package.yaml @@ -8,10 +8,15 @@ flags: optimized: manual: true default: true + arraychecks: + manual: true + default: false when: - condition: flag(optimized) ghc-options: -funbox-strict-fields -O2 + - condition: flag(arraychecks) + cpp-options: -DARRAY_CHECK dependencies: - ListLike diff --git a/parser-typechecker/src/Unison/Runtime/Array.hs b/parser-typechecker/src/Unison/Runtime/Array.hs new file mode 100644 index 000000000..3d3382fe0 --- /dev/null +++ b/parser-typechecker/src/Unison/Runtime/Array.hs @@ -0,0 +1,378 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE StandaloneKindSignatures #-} + +-- This module wraps the operations in the primitive package so that +-- bounds checks can be toggled on during the build for debugging +-- purposes. It exports the entire API for the three array types +-- needed, and adds wrappers for the operations that are unchecked in +-- the base library. +-- +-- Checking is toggled using the `arraychecks` flag. +module Unison.Runtime.Array + ( module EPA, + readArray, + writeArray, + copyArray, + copyMutableArray, + cloneMutableArray, + readByteArray, + writeByteArray, + indexByteArray, + copyByteArray, + copyMutableByteArray, + moveByteArray, + readPrimArray, + writePrimArray, + indexPrimArray, + ) +where + +import Control.Monad.Primitive +import Data.Kind (Constraint) +import Data.Primitive.Array as EPA hiding + ( cloneMutableArray, + copyArray, + copyMutableArray, + readArray, + writeArray, + ) +import qualified Data.Primitive.Array as PA +import Data.Primitive.ByteArray as EPA hiding + ( copyByteArray, + copyMutableByteArray, + indexByteArray, + moveByteArray, + readByteArray, + writeByteArray, + ) +import qualified Data.Primitive.ByteArray as PA +import Data.Primitive.PrimArray as EPA hiding + ( indexPrimArray, + readPrimArray, + writePrimArray, + ) +import qualified Data.Primitive.PrimArray as PA +import Data.Primitive.Types + +#ifdef ARRAY_CHECK +import GHC.Stack + +type CheckCtx :: Constraint +type CheckCtx = HasCallStack + +type MA = MutableArray +type MBA = MutableByteArray +type A = Array +type BA = ByteArray + +-- check index mutable array +checkIMArray + :: CheckCtx + => String + -> (MA s a -> Int -> r) + -> MA s a -> Int -> r +checkIMArray name f arr i + | i < 0 || sizeofMutableArray arr <= i + = error $ name ++ " unsafe check out of bounds: " ++ show i + | otherwise = f arr i +{-# inline checkIMArray #-} + +-- check copy array +checkCArray + :: CheckCtx + => String + -> (MA s a -> Int -> A a -> Int -> Int -> r) + -> MA s a -> Int -> A a -> Int -> Int -> r +checkCArray name f dst d src s l + | d < 0 + || s < 0 + || sizeofMutableArray dst < d + l + || sizeofArray src < s + l + = error $ name ++ " unsafe check out of bounds: " ++ show (d, s, l) + | otherwise = f dst d src s l +{-# inline checkCArray #-} + +-- check copy mutable array +checkCMArray + :: CheckCtx + => String + -> (MA s a -> Int -> MA s a -> Int -> Int -> r) + -> MA s a -> Int -> MA s a -> Int -> Int -> r +checkCMArray name f dst d src s l + | d < 0 + || s < 0 + || sizeofMutableArray dst < d + l + || sizeofMutableArray src < s + l + = error $ name ++ " unsafe check out of bounds: " ++ show (d, s, l) + | otherwise = f dst d src s l +{-# inline checkCMArray #-} + +-- check range mutable array +checkRMArray + :: CheckCtx + => String + -> (MA s a -> Int -> Int -> r) + -> MA s a -> Int -> Int -> r +checkRMArray name f arr o l + | o < 0 || sizeofMutableArray arr < o+l + = error $ name ++ "unsafe check out of bounds: " ++ show (o, l) + | otherwise = f arr o l +{-# inline checkRMArray #-} + +-- check index byte array +checkIBArray + :: CheckCtx + => Prim a + => String + -> a + -> (ByteArray -> Int -> r) + -> ByteArray -> Int -> r +checkIBArray name a f arr i + | i < 0 || sizeofByteArray arr `quot` sizeOf a <= i + = error $ name ++ " unsafe check out of bounds: " ++ show i + | otherwise = f arr i +{-# inline checkIBArray #-} + +-- check index mutable byte array +checkIMBArray + :: CheckCtx + => Prim a + => String + -> a + -> (MutableByteArray s -> Int -> r) + -> MutableByteArray s -> Int -> r +checkIMBArray name a f arr i + | i < 0 || sizeofMutableByteArray arr `quot` sizeOf a <= i + = error $ name ++ " unsafe check out of bounds: " ++ show i + | otherwise = f arr i +{-# inline checkIMBArray #-} + +-- check copy byte array +checkCBArray + :: CheckCtx + => String + -> (MBA s -> Int -> BA -> Int -> Int -> r) + -> MBA s -> Int -> BA -> Int -> Int -> r +checkCBArray name f dst d src s l + | d < 0 + || s < 0 + || sizeofMutableByteArray dst < d + l + || sizeofByteArray src < s + l + = error $ name ++ " unsafe check out of bounds: " ++ show (d, s, l) + | otherwise = f dst d src s l +{-# inline checkCBArray #-} + +-- check copy mutable byte array +checkCMBArray + :: CheckCtx + => String + -> (MBA s -> Int -> MBA s -> Int -> Int -> r) + -> MBA s -> Int -> MBA s -> Int -> Int -> r +checkCMBArray name f dst d src s l + | d < 0 + || s < 0 + || sizeofMutableByteArray dst < d + l + || sizeofMutableByteArray src < s + l + = error $ name ++ " unsafe check out of bounds: " ++ show (d, s, l) + | otherwise = f dst d src s l +{-# inline checkCMBArray #-} + +-- check index prim array +checkIPArray + :: CheckCtx + => Prim a + => String + -> (PrimArray a -> Int -> r) + -> PrimArray a -> Int -> r +checkIPArray name f arr i + | i < 0 || sizeofPrimArray arr <= i + = error $ name ++ " unsafe check out of bounds: " ++ show i + | otherwise = f arr i +{-# inline checkIPArray #-} + +-- check index mutable prim array +checkIMPArray + :: CheckCtx + => Prim a + => String + -> (MutablePrimArray s a -> Int -> r) + -> MutablePrimArray s a -> Int -> r +checkIMPArray name f arr i + | i < 0 || sizeofMutablePrimArray arr <= i + = error $ name ++ " unsafe check out of bounds: " ++ show i + | otherwise = f arr i +{-# inline checkIMPArray #-} + +#else +type CheckCtx :: Constraint +type CheckCtx = () + +checkIMArray, checkIMPArray, checkIPArray :: String -> r -> r +checkCArray, checkCMArray, checkRMArray :: String -> r -> r +checkIMArray _ = id +checkIMPArray _ = id +checkCArray _ = id +checkCMArray _ = id +checkRMArray _ = id +checkIPArray _ = id + +checkIBArray, checkIMBArray :: String -> a -> r -> r +checkCBArray, checkCMBArray :: String -> r -> r +checkIBArray _ _ = id +checkIMBArray _ _ = id +checkCBArray _ = id +checkCMBArray _ = id +#endif + +readArray :: + CheckCtx => + PrimMonad m => + MutableArray (PrimState m) a -> + Int -> + m a +readArray = checkIMArray "readArray" PA.readArray +{-# INLINE readArray #-} + +writeArray :: + CheckCtx => + PrimMonad m => + MutableArray (PrimState m) a -> + Int -> + a -> + m () +writeArray = checkIMArray "writeArray" PA.writeArray +{-# INLINE writeArray #-} + +copyArray :: + CheckCtx => + PrimMonad m => + MutableArray (PrimState m) a -> + Int -> + Array a -> + Int -> + Int -> + m () +copyArray = checkCArray "copyArray" PA.copyArray +{-# INLINE copyArray #-} + +cloneMutableArray :: + CheckCtx => + PrimMonad m => + MutableArray (PrimState m) a -> + Int -> + Int -> + m (MutableArray (PrimState m) a) +cloneMutableArray = checkRMArray "cloneMutableArray" PA.cloneMutableArray +{-# INLINE cloneMutableArray #-} + +copyMutableArray :: + CheckCtx => + PrimMonad m => + MutableArray (PrimState m) a -> + Int -> + MutableArray (PrimState m) a -> + Int -> + Int -> + m () +copyMutableArray = checkCMArray "copyMutableArray" PA.copyMutableArray +{-# INLINE copyMutableArray #-} + +readByteArray :: + forall a m. + CheckCtx => + PrimMonad m => + Prim a => + MutableByteArray (PrimState m) -> + Int -> + m a +readByteArray = checkIMBArray @a "readByteArray" undefined PA.readByteArray +{-# INLINE readByteArray #-} + +writeByteArray :: + forall a m. + CheckCtx => + PrimMonad m => + Prim a => + MutableByteArray (PrimState m) -> + Int -> + a -> + m () +writeByteArray = checkIMBArray @a "writeByteArray" undefined PA.writeByteArray +{-# INLINE writeByteArray #-} + +indexByteArray :: + forall a. + CheckCtx => + Prim a => + ByteArray -> + Int -> + a +indexByteArray = checkIBArray @a "indexByteArray" undefined PA.indexByteArray +{-# INLINE indexByteArray #-} + +copyByteArray :: + CheckCtx => + PrimMonad m => + MutableByteArray (PrimState m) -> + Int -> + ByteArray -> + Int -> + Int -> + m () +copyByteArray = checkCBArray "copyByteArray" PA.copyByteArray +{-# INLINE copyByteArray #-} + +copyMutableByteArray :: + CheckCtx => + PrimMonad m => + MutableByteArray (PrimState m) -> + Int -> + MutableByteArray (PrimState m) -> + Int -> + Int -> + m () +copyMutableByteArray = checkCMBArray "copyMutableByteArray" PA.copyMutableByteArray +{-# INLINE copyMutableByteArray #-} + +moveByteArray :: + CheckCtx => + PrimMonad m => + MutableByteArray (PrimState m) -> + Int -> + MutableByteArray (PrimState m) -> + Int -> + Int -> + m () +moveByteArray = checkCMBArray "moveByteArray" PA.moveByteArray +{-# INLINE moveByteArray #-} + +readPrimArray :: + CheckCtx => + PrimMonad m => + Prim a => + MutablePrimArray (PrimState m) a -> + Int -> + m a +readPrimArray = checkIMPArray "readPrimArray" PA.readPrimArray +{-# INLINE readPrimArray #-} + +writePrimArray :: + CheckCtx => + PrimMonad m => + Prim a => + MutablePrimArray (PrimState m) a -> + Int -> + a -> + m () +writePrimArray = checkIMPArray "writePrimArray" PA.writePrimArray +{-# INLINE writePrimArray #-} + +indexPrimArray :: + CheckCtx => + Prim a => + PrimArray a -> + Int -> + a +indexPrimArray = checkIPArray "indexPrimArray" PA.indexPrimArray +{-# INLINE indexPrimArray #-} diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index 35eda4feb..7ed248469 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -15,8 +15,6 @@ import Control.Exception import Data.Bits import qualified Data.Map.Strict as M import Data.Ord (comparing) -import qualified Data.Primitive.Array as PA -import qualified Data.Primitive.PrimArray as PA import qualified Data.Sequence as Sq import qualified Data.Set as S import qualified Data.Set as Set @@ -40,6 +38,7 @@ import Unison.Runtime.ANF as ANF valueLinks, ) import qualified Unison.Runtime.ANF as ANF +import Unison.Runtime.Array as PA import Unison.Runtime.Builtin import Unison.Runtime.Exception import Unison.Runtime.Foreign diff --git a/parser-typechecker/src/Unison/Runtime/Stack.hs b/parser-typechecker/src/Unison/Runtime/Stack.hs index a22f185d5..9be21473c 100644 --- a/parser-typechecker/src/Unison/Runtime/Stack.hs +++ b/parser-typechecker/src/Unison/Runtime/Stack.hs @@ -48,15 +48,13 @@ import Control.Monad (when) import Control.Monad.Primitive import Data.Foldable as F (for_) import qualified Data.Kind as Kind -import Data.Primitive.Array -import Data.Primitive.ByteArray -import Data.Primitive.PrimArray import Data.Sequence (Seq) import Data.Word import GHC.Exts as L (IsList (..)) import GHC.Stack (HasCallStack) import Unison.Reference (Reference) import Unison.Runtime.ANF as ANF (Mem (..)) +import Unison.Runtime.Array import Unison.Runtime.Foreign import Unison.Runtime.MCode import qualified Unison.Type as Ty diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index e460d4389..e19f6ce76 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -17,6 +17,10 @@ source-repository head type: git location: https://github.com/unisonweb/unison +flag arraychecks + manual: True + default: False + flag optimized manual: True default: True @@ -103,6 +107,7 @@ library Unison.Result Unison.Runtime.ANF Unison.Runtime.ANF.Serialize + Unison.Runtime.Array Unison.Runtime.Builtin Unison.Runtime.Debug Unison.Runtime.Decompile @@ -301,6 +306,8 @@ library , zlib if flag(optimized) ghc-options: -funbox-strict-fields -O2 + if flag(arraychecks) + cpp-options: -DARRAY_CHECK default-language: Haskell2010 test-suite parser-typechecker-tests @@ -489,4 +496,6 @@ test-suite parser-typechecker-tests , zlib if flag(optimized) ghc-options: -funbox-strict-fields -O2 + if flag(arraychecks) + cpp-options: -DARRAY_CHECK default-language: Haskell2010 From 09413134fd610de95a72d73956dc77e129fd69dd Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Fri, 16 Dec 2022 13:24:11 -0500 Subject: [PATCH 034/467] delete a couple unused imports --- codebase2/codebase/U/Codebase/Reference.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/codebase2/codebase/U/Codebase/Reference.hs b/codebase2/codebase/U/Codebase/Reference.hs index 73b69d7fc..5578a7173 100644 --- a/codebase2/codebase/U/Codebase/Reference.hs +++ b/codebase2/codebase/U/Codebase/Reference.hs @@ -3,8 +3,6 @@ module U.Codebase.Reference where import Control.Lens (Bifunctor (..), Lens, Prism, Traversal, lens, prism) import Data.Bifoldable (Bifoldable (..)) import Data.Bitraversable (Bitraversable (..)) -import Data.Text (Text) -import Data.Word (Word64) import U.Codebase.ShortHash (ShortHash) import qualified U.Codebase.ShortHash as SH import Unison.Hash (Hash) From e2ea03374707e2bad63f914bb4e28b689f70e5ad Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 16 Dec 2022 19:56:19 -0500 Subject: [PATCH 035/467] Use unsafe checked arrays to back array builtins. - These already have checks in the foreign operations, but another layer couldn't hurt for debugging. --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 5fa23695c..89e001923 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -51,7 +51,7 @@ import Data.IORef as SYS ) import qualified Data.Map as Map import Data.PEM (PEM, pemContent, pemParseLBS) -import qualified Data.Primitive as PA +import qualified Unison.Runtime.Array as PA import Data.Set (insert) import qualified Data.Set as Set import qualified Data.Text From 754a294d58380663aaa27af0adfdfb1108dd0159 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 16 Dec 2022 20:00:33 -0500 Subject: [PATCH 036/467] Revise implementation of foreign universal eq/compare - It seems that there are situations where implementing foreign equality as: promote ((==) @ T) (where `promote` wraps the inputs with coercions) can cause memory faults. This is _not_ because the runtime is (currently) erroneously coercing between distinct types (at least in the test case used to find this error). Rather, it has something to do with `unsafeCoerce` causing invalid GHC to generate some invalid code, whether via optimization or otherwise. It seems that separating out the equality test into its own, noinline function prevents the issue. So, that has been done for all cases. It is actually quite difficult to find simple code that triggers the issue, however, so it is difficult to say whether this definitively fixes the problem. --- .../src/Unison/Runtime/Foreign.hs | 90 ++++++++++++++++--- 1 file changed, 76 insertions(+), 14 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index 6d10eba6c..a807005bb 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -44,6 +44,68 @@ data Foreign where promote :: (a -> a -> r) -> b -> c -> r promote (~~) x y = unsafeCoerce x ~~ unsafeCoerce y +-- These functions are explicit aliases of the overloaded function. +-- When the overloaded function is used in their place, it seems to +-- cause issues with regard to `promote` above. Somehow, the +-- unsafeCoerce can cause memory faults, even when the values are +-- being coerced to appropriate types. Having an explicit, noinline +-- alias seems to prevent the faults. +txtEq :: Text -> Text -> Bool +txtEq l r = l == r +{-# noinline txtEq #-} + +txtCmp :: Text -> Text -> Ordering +txtCmp l r = compare l r +{-# noinline txtCmp #-} + +bytesEq :: Bytes -> Bytes -> Bool +bytesEq l r = l == r +{-# noinline bytesEq #-} + +bytesCmp :: Bytes -> Bytes -> Ordering +bytesCmp l r = compare l r +{-# noinline bytesCmp #-} + +mvarEq :: MVar () -> MVar () -> Bool +mvarEq l r = l == r +{-# noinline mvarEq #-} + +refEq :: IORef () -> IORef () -> Bool +refEq l r = l == r +{-# noinline refEq #-} + +tidEq :: ThreadId -> ThreadId -> Bool +tidEq l r = l == r +{-# noinline tidEq #-} + +tidCmp :: ThreadId -> ThreadId -> Ordering +tidCmp l r = compare l r +{-# noinline tidCmp #-} + +marrEq :: MutableArray () () -> MutableArray () () -> Bool +marrEq l r = l == r +{-# noinline marrEq #-} + +mbarrEq :: MutableByteArray () -> MutableByteArray () -> Bool +mbarrEq l r = l == r +{-# noinline mbarrEq #-} + +barrEq :: ByteArray -> ByteArray -> Bool +barrEq l r = l == r +{-# noinline barrEq #-} + +barrCmp :: ByteArray -> ByteArray -> Ordering +barrCmp l r = compare l r +{-# noinline barrCmp #-} + +cpatEq :: CPattern -> CPattern -> Bool +cpatEq l r = l == r +{-# noinline cpatEq #-} + +cpatCmp :: CPattern -> CPattern -> Ordering +cpatCmp l r = compare l r +{-# noinline cpatCmp #-} + tylEq :: Reference -> Reference -> Bool tylEq r l = r == l {-# NOINLINE tylEq #-} @@ -62,31 +124,31 @@ tmlCmp r l = compare r l ref2eq :: Reference -> Maybe (a -> b -> Bool) ref2eq r - | r == Ty.textRef = Just $ promote ((==) @Text) + | r == Ty.textRef = Just $ promote txtEq | r == Ty.termLinkRef = Just $ promote tmlEq | r == Ty.typeLinkRef = Just $ promote tylEq - | r == Ty.bytesRef = Just $ promote ((==) @Bytes) + | r == Ty.bytesRef = Just $ promote bytesEq -- Note: MVar equality is just reference equality, so it shouldn't -- matter what type the MVar holds. - | r == Ty.mvarRef = Just $ promote ((==) @(MVar ())) + | r == Ty.mvarRef = Just $ promote mvarEq -- Ditto - | r == Ty.refRef = Just $ promote ((==) @(IORef ())) - | r == Ty.threadIdRef = Just $ promote ((==) @ThreadId) - | r == Ty.marrayRef = Just $ promote ((==) @(MutableArray () ())) - | r == Ty.mbytearrayRef = Just $ promote ((==) @(MutableByteArray ())) - | r == Ty.ibytearrayRef = Just $ promote ((==) @ByteArray) - | r == Ty.patternRef = Just $ promote ((==) @CPattern) + | r == Ty.refRef = Just $ promote refEq + | r == Ty.threadIdRef = Just $ promote tidEq + | r == Ty.marrayRef = Just $ promote marrEq + | r == Ty.mbytearrayRef = Just $ promote mbarrEq + | r == Ty.ibytearrayRef = Just $ promote barrEq + | r == Ty.patternRef = Just $ promote cpatEq | otherwise = Nothing ref2cmp :: Reference -> Maybe (a -> b -> Ordering) ref2cmp r - | r == Ty.textRef = Just $ promote (compare @Text) + | r == Ty.textRef = Just $ promote txtCmp | r == Ty.termLinkRef = Just $ promote tmlCmp | r == Ty.typeLinkRef = Just $ promote tylCmp - | r == Ty.bytesRef = Just $ promote (compare @Bytes) - | r == Ty.threadIdRef = Just $ promote (compare @ThreadId) - | r == Ty.ibytearrayRef = Just $ promote (compare @ByteArray) - | r == Ty.patternRef = Just $ promote (compare @CPattern) + | r == Ty.bytesRef = Just $ promote bytesCmp + | r == Ty.threadIdRef = Just $ promote tidCmp + | r == Ty.ibytearrayRef = Just $ promote barrCmp + | r == Ty.patternRef = Just $ promote cpatCmp | otherwise = Nothing instance Eq Foreign where From 413a60069643e0aa51b43308fee769d1f93f364f Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Mon, 19 Dec 2022 13:48:44 -0500 Subject: [PATCH 037/467] make io.test look in scratch file first --- unison-cli/src/Unison/Cli/Monad.hs | 1 - .../src/Unison/Codebase/Editor/HandleInput.hs | 119 ++++++++++++------ .../Editor/HandleInput/TermResolution.hs | 2 +- .../src/Unison/Codebase/Editor/Output.hs | 14 ++- .../src/Unison/CommandLine/InputPatterns.hs | 24 ++-- .../src/Unison/CommandLine/OutputMessages.hs | 4 +- unison-core/src/Unison/Names.hs | 18 ++- 7 files changed, 125 insertions(+), 57 deletions(-) diff --git a/unison-cli/src/Unison/Cli/Monad.hs b/unison-cli/src/Unison/Cli/Monad.hs index 638fb6fcf..e04b40685 100644 --- a/unison-cli/src/Unison/Cli/Monad.hs +++ b/unison-cli/src/Unison/Cli/Monad.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DefaultSignatures #-} -- | The main CLI monad. module Unison.Cli.Monad diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index de54efe7c..e1e276c2e 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -269,7 +269,7 @@ loop e = do go (ann, kind, _hash, _uneval, eval, isHit) = (ann, kind, eval, isHit) when (not (null e')) do Cli.respond $ Evaluated text ppe bindings e' - #latestTypecheckedFile .= (Just unisonFile) + #latestTypecheckedFile .= Just unisonFile case e of Left (IncomingRootBranch hashes) -> Cli.time "IncomingRootBranch" do @@ -1186,41 +1186,7 @@ loop e = do ExecuteSchemeI main -> doRunAsScheme main GenSchemeLibsI -> doGenerateSchemeBoot True Nothing FetchSchemeCompilerI -> doFetchCompiler - IOTestI main -> do - Cli.Env {codebase, runtime} <- ask - -- todo - allow this to run tests from scratch file, using addRunMain - let testType = Runtime.ioTestType runtime - parseNames <- (`NamesWithHistory.NamesWithHistory` mempty) <$> basicParseNames - ppe <- suffixifiedPPE parseNames - -- use suffixed names for resolving the argument to display - let oks results = - [ (r, msg) - | (r, Term.List' ts) <- results, - Term.App' (Term.Constructor' (ConstructorReference ref cid)) (Term.Text' msg) <- toList ts, - cid == DD.okConstructorId && ref == DD.testResultRef - ] - fails results = - [ (r, msg) - | (r, Term.List' ts) <- results, - Term.App' (Term.Constructor' (ConstructorReference ref cid)) (Term.Text' msg) <- toList ts, - cid == DD.failConstructorId && ref == DD.testResultRef - ] - - results = NamesWithHistory.lookupHQTerm main parseNames - ref <- do - let noMain = Cli.returnEarly $ NoMainFunction (HQ.toString main) ppe [testType] - case toList results of - [Referent.Ref ref] -> do - Cli.runTransaction (loadTypeOfTerm codebase (Referent.Ref ref)) >>= \case - Just typ | Typechecker.isSubtype typ testType -> pure ref - _ -> noMain - _ -> noMain - let a = ABT.annotation tm - tm = DD.forceTerm a a (Term.ref a ref) - -- Don't cache IO tests - tm' <- evalUnisonTerm False ppe False tm - Cli.respond $ TestResults Output.NewlyComputed ppe True True (oks [(ref, tm')]) (fails [(ref, tm')]) - + IOTestI main -> handleIOTest main -- UpdateBuiltinsI -> do -- stepAt updateBuiltins -- checkTodo @@ -1869,6 +1835,83 @@ handleDiffNamespaceToPatch description input = do description (Path.unabsolute patchPath, Branch.modifyPatches patchName (const patch)) +handleIOTest :: HQ.HashQualified Name -> Cli () +handleIOTest main = do + Cli.Env {codebase, runtime} <- ask + + let testType = Runtime.ioTestType runtime + parseNames <- (`NamesWithHistory.NamesWithHistory` mempty) <$> basicParseNames + -- use suffixed names for resolving the argument to display + ppe <- suffixifiedPPE parseNames + let oks results = + [ (r, msg) + | (r, Term.List' ts) <- results, + Term.App' (Term.Constructor' (ConstructorReference ref cid)) (Term.Text' msg) <- toList ts, + cid == DD.okConstructorId && ref == DD.testResultRef + ] + fails results = + [ (r, msg) + | (r, Term.List' ts) <- results, + Term.App' (Term.Constructor' (ConstructorReference ref cid)) (Term.Text' msg) <- toList ts, + cid == DD.failConstructorId && ref == DD.testResultRef + ] + + matches <- + Cli.label \returnMatches -> do + -- First, look at the terms in the latest typechecked file for a name-match. + whenJustM Cli.getLatestTypecheckedFile \typecheckedFile -> do + let refToType :: Reference -> Type Symbol Ann + refToType ref = + typecheckedFile + & UF.indexByReference + & fst + -- These two unsafe functions are actually safe: + -- 1. We can assert ref is actually a Reference.Id because it came from the latest typechecked file. + -- 2. The reference has to be in this map because we got it from the file itself. + & (Map.! (Reference.unsafeId ref)) + & snd + let matches :: [(TermReference, Type Symbol Ann)] + matches = + typecheckedFile + & UF.typecheckedToNames + & (\names -> Names.refTermsHQNamed names main) + & Set.toList + & map (\r -> (r, refToType r)) + + -- If 1+ matches (which we know will be exactly 1, since you can't have two definitions in a scratch file with + -- the same name), then return them. Otherwise, fall through to looking up in the codebase. + when (not (null matches)) (returnMatches matches) + + -- Then, if we get here (because nothing in the scratch file matched), look at the terms in the codebase. + fmap catMaybes do + Cli.runTransaction do + for (Set.toList (NamesWithHistory.lookupHQTerm main parseNames)) \ref0 -> + runMaybeT do + ref <- MaybeT (pure (Referent.toTermReference ref0)) + typ <- MaybeT (loadTypeOfTerm codebase (Referent.Ref ref)) + pure (ref, typ) + + ref <- + case matches of + [] -> Cli.returnEarly (NoMainFunction (HQ.toString main) ppe [testType]) + [(ref, typ)] -> + if Typechecker.isSubtype typ testType + then pure ref + else Cli.returnEarly (BadMainFunction "io.test" (HQ.toString main) typ ppe [testType]) + _ -> do + hashLength <- Cli.runTransaction Codebase.hashLength + let labeledDependencies = + matches + & map (\(ref, _typ) -> LD.termRef ref) + & Set.fromList + Cli.returnEarly (LabeledReferenceAmbiguous hashLength main labeledDependencies) + + let a = ABT.annotation tm + tm = DD.forceTerm a a (Term.ref a ref) + -- Don't cache IO tests + tm' <- evalUnisonTerm False ppe False tm + Cli.respond $ TestResults Output.NewlyComputed ppe True True (oks [(ref, tm')]) (fails [(ref, tm')]) + -- | Handle a @push@ command. handlePushRemoteBranch :: PushRemoteBranchInput -> Cli () handlePushRemoteBranch PushRemoteBranchInput {maybeRemoteRepo = mayRepo, localPath = path, pushBehavior, syncMode} = @@ -2687,7 +2730,7 @@ typecheckAndEval ppe tm = do | Typechecker.fitsScheme ty mty -> () <$ evalUnisonTerm False ppe False tm | otherwise -> - Cli.returnEarly $ BadMainFunction rendered ty ppe [mty] + Cli.returnEarly $ BadMainFunction "run" rendered ty ppe [mty] Result.Result notes Nothing -> do currentPath <- Cli.getCurrentPath let tes = [err | Result.TypeError err <- toList notes] @@ -3122,7 +3165,7 @@ getTerm main = mainType <- Runtime.mainType <$> view #runtime basicPrettyPrintNames <- getBasicPrettyPrintNames ppe <- suffixifiedPPE (NamesWithHistory.NamesWithHistory basicPrettyPrintNames mempty) - Cli.returnEarly $ BadMainFunction main ty ppe [mainType] + Cli.returnEarly $ BadMainFunction "run" main ty ppe [mainType] GetTermSuccess x -> pure x getTerm' :: String -> Cli GetTermResult diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/TermResolution.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/TermResolution.hs index f2e8c1e1f..459d1e28d 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/TermResolution.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/TermResolution.hs @@ -120,5 +120,5 @@ resolveMainRef main = do lookupTermRefWithType codebase main >>= \case [(rf, ty)] | Typechecker.fitsScheme ty mainType -> pure (rf, ppe) - | otherwise -> Cli.returnEarly (BadMainFunction smain ty ppe [mainType]) + | otherwise -> Cli.returnEarly (BadMainFunction "main" smain ty ppe [mainType]) _ -> Cli.returnEarly (NoMainFunction smain ppe [mainType]) diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index fb67f9ef7..863ea3775 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -121,8 +121,18 @@ data Output | SourceLoadFailed String | -- No main function, the [Type v Ann] are the allowed types NoMainFunction String PPE.PrettyPrintEnv [Type Symbol Ann] - | -- Main function found, but has improper type - BadMainFunction String (Type Symbol Ann) PPE.PrettyPrintEnv [Type Symbol Ann] + | -- | Function found, but has improper type + -- Note: the constructor name is misleading here; we weren't necessarily looking for a "main". + BadMainFunction + String + -- ^ what we were trying to do (e.g. "run", "io.test") + String + -- ^ name of function + (Type Symbol Ann) + -- ^ bad type of function + PPE.PrettyPrintEnv + [Type Symbol Ann] + -- ^ acceptable type(s) of function | BranchEmpty (Either ShortCausalHash Path') | BranchNotEmpty Path' | LoadPullRequest ReadRemoteNamespace ReadRemoteNamespace Path' Path' Path' Path' diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index 111e7afe4..ba90c72f1 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -2084,20 +2084,20 @@ saveExecuteResult = ioTest :: InputPattern ioTest = InputPattern - "io.test" - ["test.io"] - I.Visible - [(Required, exactDefinitionTermQueryArg)] - ( P.wrapColumn2 - [ ( "`io.test mytest`", - "Runs `!mytest`, where `mytest` is a delayed test that can use the `IO` and `Exception` abilities. Note: `mytest` must already be added to the codebase." - ) - ] - ) - ( \case + { patternName = "io.test", + aliases = ["test.io"], + visibility = I.Visible, + argTypes = [(Required, exactDefinitionTermQueryArg)], + help = + P.wrapColumn2 + [ ( "`io.test mytest`", + "Runs `!mytest`, where `mytest` is a delayed test that can use the `IO` and `Exception` abilities." + ) + ], + parse = \case [thing] -> fmap Input.IOTestI $ parseHashQualifiedName thing _ -> Left $ showPatternHelp ioTest - ) + } makeStandalone :: InputPattern makeStandalone = diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 99f167bfa..ecfafa36e 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -799,14 +799,14 @@ notifyUser dir o = case o of "", P.indentN 2 $ P.lines [P.string main <> " : " <> TypePrinter.pretty ppe t | t <- ts] ] - BadMainFunction main ty ppe ts -> + BadMainFunction what main ty ppe ts -> pure . P.callout "😶" $ P.lines [ P.string "I found this function:", "", P.indentN 2 $ P.string main <> " : " <> TypePrinter.pretty ppe ty, "", - P.wrap $ P.string "but in order for me to" <> P.backticked (P.string "run") <> "it needs be a subtype of:", + P.wrap $ P.string "but in order for me to" <> P.backticked (P.string what) <> "it needs be a subtype of:", "", P.indentN 2 $ P.lines [P.string main <> " : " <> TypePrinter.pretty ppe t | t <- ts] ] diff --git a/unison-core/src/Unison/Names.hs b/unison-core/src/Unison/Names.hs index cb4182534..7bc3e27e8 100644 --- a/unison-core/src/Unison/Names.hs +++ b/unison-core/src/Unison/Names.hs @@ -29,6 +29,7 @@ module Unison.Names prefix0, restrictReferences, refTermsNamed, + refTermsHQNamed, termReferences, termReferents, typeReferences, @@ -71,6 +72,7 @@ import qualified Unison.ShortHash as SH import Unison.Util.Relation (Relation) import qualified Unison.Util.Relation as R import qualified Unison.Util.Relation as Relation +import qualified Unison.Util.Set as Set (mapMaybe) import Prelude hiding (filter, map) import qualified Prelude @@ -249,9 +251,23 @@ numHashChars = 3 termsNamed :: Names -> Name -> Set Referent termsNamed = flip R.lookupDom . terms +-- | Get all terms with a specific name. refTermsNamed :: Names -> Name -> Set TermReference refTermsNamed names n = - Set.fromList [r | Referent.Ref r <- toList $ termsNamed names n] + Set.mapMaybe Referent.toTermReference (termsNamed names n) + +-- | Get all terms with a specific hash-qualified name. +refTermsHQNamed :: Names -> HQ.HashQualified Name -> Set TermReference +refTermsHQNamed names = \case + HQ.NameOnly name -> refTermsNamed names name + HQ.HashOnly _hash -> Set.empty + HQ.HashQualified name hash -> + let f :: Referent -> Maybe TermReference + f ref0 = do + ref <- Referent.toTermReference ref0 + guard (Reference.isPrefixOf hash ref) + Just ref + in Set.mapMaybe f (termsNamed names name) typesNamed :: Names -> Name -> Set TypeReference typesNamed = flip R.lookupDom . types From 9dbafc10c95dd7c9b6ab3ce890e140551d61d0fc Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Mon, 19 Dec 2022 16:05:15 -0500 Subject: [PATCH 038/467] warn after pulling an empty namespace --- .../src/Unison/Codebase/Editor/RemoteRepo.hs | 3 --- .../src/Unison/Codebase/Editor/HandleInput.hs | 11 +++++++++-- unison-cli/src/Unison/Codebase/Editor/Output.hs | 11 ++++++++--- unison-cli/src/Unison/CommandLine/OutputMessages.hs | 13 ++++++++++--- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs b/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs index 7b1d13973..fdc5de86b 100644 --- a/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs +++ b/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs @@ -1,6 +1,3 @@ -{-# LANGUAGE DuplicateRecordFields #-} -{-# LANGUAGE OverloadedLabels #-} -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} module Unison.Codebase.Editor.RemoteRepo where diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 389477d20..811eccece 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -445,7 +445,12 @@ loop e = do description <- inputDescription input dest <- Cli.resolvePath' dest0 ok <- Cli.updateAtM description dest (const $ pure srcb) - Cli.respond if ok then Success else BranchEmpty src0 + Cli.respond + if ok + then Success + else BranchEmpty case src0 of + Left hash -> WhichBranchEmptyHash hash + Right path -> WhichBranchEmptyPath path MergeLocalBranchI src0 dest0 mergeMode -> do description <- inputDescription input srcb <- Cli.expectBranchAtPath' src0 @@ -1317,7 +1322,7 @@ loop e = do Cli.Env {codebase} <- ask path <- maybe Cli.getCurrentPath Cli.resolvePath' namespacePath' Cli.getMaybeBranchAt path >>= \case - Nothing -> Cli.respond $ BranchEmpty (Right (Path.absoluteToPath' path)) + Nothing -> Cli.respond $ BranchEmpty (WhichBranchEmptyPath (Path.absoluteToPath' path)) Just b -> do externalDependencies <- Cli.runTransaction (NamespaceDependencies.namespaceDependencies codebase (Branch.head b)) @@ -2819,6 +2824,8 @@ doPullRemoteBranch mayRepo path syncMode pullMode verbosity description = do Cli.ioE (Codebase.importRemoteBranch codebase repo syncMode preprocess) \err -> Cli.returnEarly (Output.GitError err) ReadRemoteNamespaceShare repo -> importRemoteShareBranch repo + when (Branch.isEmpty0 (Branch.head remoteBranch)) do + Cli.respond (BranchEmpty (WhichBranchEmptyRemote ns)) let unchangedMsg = PullAlreadyUpToDate ns path destAbs <- Cli.resolvePath' path let printDiffPath = if Verbosity.isSilent verbosity then Nothing else Just path diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index fb67f9ef7..57bca7074 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -1,7 +1,6 @@ -{-# LANGUAGE PatternSynonyms #-} - module Unison.Codebase.Editor.Output ( Output (..), + WhichBranchEmpty(..), NumberedOutput (..), NumberedArgs, ListDetailed, @@ -123,7 +122,7 @@ data Output NoMainFunction String PPE.PrettyPrintEnv [Type Symbol Ann] | -- Main function found, but has improper type BadMainFunction String (Type Symbol Ann) PPE.PrettyPrintEnv [Type Symbol Ann] - | BranchEmpty (Either ShortCausalHash Path') + | BranchEmpty WhichBranchEmpty | BranchNotEmpty Path' | LoadPullRequest ReadRemoteNamespace ReadRemoteNamespace Path' Path' Path' Path' | CreatedNewBranch Path.Absolute @@ -278,6 +277,12 @@ data Output | DisplayDebugNameDiff NameChanges | DisplayDebugCompletions [Completion.Completion] +-- | A branch was empty. But how do we refer to that branch? +data WhichBranchEmpty + = WhichBranchEmptyHash ShortCausalHash + | WhichBranchEmptyPath Path' + | WhichBranchEmptyRemote ReadRemoteNamespace + data ShareError = ShareErrorCheckAndSetPush Sync.CheckAndSetPushError | ShareErrorFastForwardPush Sync.FastForwardPushError diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 99f167bfa..c3eb9ddb7 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -780,7 +780,7 @@ notifyUser dir o = case o of pure . P.warnCallout $ "A patch by that name already exists." BranchEmpty b -> pure . P.warnCallout . P.wrap $ - P.group (either P.shown prettyPath' b) <> "is an empty namespace." + P.group (prettyWhichBranchEmpty b) <> "is an empty namespace." BranchNotEmpty path -> pure . P.warnCallout $ P.lines @@ -1505,12 +1505,12 @@ notifyUser dir o = case o of PullSuccessful ns dest -> pure . P.okCallout $ P.wrap $ - "✅ Successfully updated" <> prettyPath' dest <> "from" + "Successfully updated" <> prettyPath' dest <> "from" <> P.group (prettyReadRemoteNamespace ns <> ".") MergeOverEmpty dest -> pure . P.okCallout $ P.wrap $ - "✅ Successfully pulled into newly created namespace " <> P.group (prettyPath' dest <> ".") + "Successfully pulled into newly created namespace " <> P.group (prettyPath' dest <> ".") MergeAlreadyUpToDate src dest -> pure . P.callout "😶" $ P.wrap $ @@ -3157,6 +3157,13 @@ prettyWriteGitRepo RemoteRepo.WriteGitRepo {url} = P.blue (P.text url) -- RemoteRepo.WriteRepoGit RemoteRepo.WriteGitRepo {url} -> P.blue (P.text url) -- RemoteRepo.WriteRepoShare s -> P.blue (P.text (RemoteRepo.printShareRepo s)) +-- | Pretty-print a 'WhichBranchEmpty'. +prettyWhichBranchEmpty :: WhichBranchEmpty -> Pretty +prettyWhichBranchEmpty = \case + WhichBranchEmptyHash hash -> P.shown hash + WhichBranchEmptyPath path -> prettyPath' path + WhichBranchEmptyRemote remote -> prettyReadRemoteNamespace remote + isTestOk :: Term v Ann -> Bool isTestOk tm = case tm of Term.List' ts -> all isSuccess ts From 6ef58e5947ae292e2a4abebc001d3414d75156cd Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 19 Dec 2022 16:33:29 -0500 Subject: [PATCH 039/467] Add machinery for checking alpha equivalence of intermediate code --- parser-typechecker/src/Unison/Runtime/ANF.hs | 152 +++++++++++++++++- .../src/Unison/Util/EnumContainers.hs | 24 ++- unison-core/src/Unison/ABT/Normalized.hs | 45 ++++++ 3 files changed, 215 insertions(+), 6 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/ANF.hs b/parser-typechecker/src/Unison/Runtime/ANF.hs index 3a63e2555..9c0c3b9cc 100644 --- a/parser-typechecker/src/Unison/Runtime/ANF.hs +++ b/parser-typechecker/src/Unison/Runtime/ANF.hs @@ -58,6 +58,8 @@ module Unison.Runtime.ANF ANFM, Branched (.., MatchDataCover), Func (..), + SGEqv(..), + equivocate, superNormalize, anfTerm, valueTermLinks, @@ -66,6 +68,8 @@ module Unison.Runtime.ANF groupLinks, normalLinks, prettyGroup, + prettySuperNormal, + prettyANF, ) where @@ -600,8 +604,9 @@ data ANormalF v e | AApp (Func v) [v] | AFrc v | AVar v - deriving (Show) + deriving (Show, Eq) + -- Types representing components that will go into the runtime tag of -- a data type value. RTags correspond to references, while CTags -- correspond to constructors. @@ -701,6 +706,109 @@ instance Bifoldable ANormalF where bifoldMap f _ (AFrc v) = f v bifoldMap f _ (AApp func args) = foldMap f func <> foldMap f args +instance ABTN.Align ANormalF where + align f _ (AVar u) (AVar v) = Just $ AVar <$> f u v + align _ _ (ALit l) (ALit r) + | l == r = Just $ pure (ALit l) + align _ g (ALet dl ccl bl el) (ALet dr ccr br er) + | dl == dr, ccl == ccr = + Just $ ALet dl ccl <$> g bl br <*> g el er + align f g (AName hl asl el) (AName hr asr er) + | length asl == length asr + , Just hs <- alignEither f hl hr = + Just $ + AName <$> hs + <*> traverse (uncurry f) (zip asl asr) + <*> g el er + align f g (AMatch vl bsl) (AMatch vr bsr) + | Just bss <- alignBranch g bsl bsr = + Just $ AMatch <$> f vl vr <*> bss + align f g (AHnd rl hl bl) (AHnd rr hr br) + | rl == rr = Just $ AHnd rl <$> f hl hr <*> g bl br + align _ g (AShift rl bl) (AShift rr br) + | rl == rr = Just $ AShift rl <$> g bl br + align f _ (AFrc u) (AFrc v) = Just $ AFrc <$> f u v + align f _ (AApp hl asl) (AApp hr asr) + | Just hs <- alignFunc f hl hr + , length asl == length asr + = Just $ AApp <$> hs <*> traverse (uncurry f) (zip asl asr) + align _ _ _ _ = Nothing + +alignEither :: + Applicative f => + (l -> r -> f s) -> + Either Reference l -> Either Reference r -> Maybe (f (Either Reference s)) +alignEither _ (Left rl) (Left rr) | rl == rr = Just . pure $ Left rl +alignEither f (Right u) (Right v) = Just $ Right <$> f u v +alignEither _ _ _ = Nothing + +alignMaybe :: + Applicative f => + (l -> r -> f s) -> + Maybe l -> Maybe r -> Maybe (f (Maybe s)) +alignMaybe f (Just l) (Just r) = Just $ Just <$> f l r +alignMaybe _ Nothing Nothing = Just (pure Nothing) +alignMaybe _ _ _ = Nothing + +alignFunc :: + Applicative f => + (vl -> vr -> f vs) -> + Func vl -> Func vr -> Maybe (f (Func vs)) +alignFunc f (FVar u) (FVar v) = Just $ FVar <$> f u v +alignFunc _ (FComb rl) (FComb rr) | rl == rr = Just . pure $ FComb rl +alignFunc f (FCont u) (FCont v) = Just $ FCont <$> f u v +alignFunc _ (FCon rl tl) (FCon rr tr) + | rl == rr, tl == tr = Just . pure $ FCon rl tl +alignFunc _ (FReq rl tl) (FReq rr tr) + | rl == rr, tl == tr = Just . pure $ FReq rl tl +alignFunc _ (FPrim ol) (FPrim or) + | ol == or = Just . pure $ FPrim ol +alignFunc _ _ _ = Nothing + +alignBranch :: + Applicative f => + (el -> er -> f es) -> + Branched el -> Branched er -> Maybe (f (Branched es)) +alignBranch _ MatchEmpty MatchEmpty = Just $ pure MatchEmpty +alignBranch f (MatchIntegral bl dl) (MatchIntegral br dr) + | keysSet bl == keysSet br + , Just ds <- alignMaybe f dl dr + = Just $ MatchIntegral + <$> interverse f bl br + <*> ds +alignBranch f (MatchText bl dl) (MatchText br dr) + | Map.keysSet bl == Map.keysSet br + , Just ds <- alignMaybe f dl dr + = Just $ MatchText + <$> traverse id (Map.intersectionWith f bl br) + <*> ds +alignBranch f (MatchRequest bl pl) (MatchRequest br pr) + | Map.keysSet bl == Map.keysSet br + , all p (Map.keysSet bl) + = Just $ MatchRequest + <$> traverse id (Map.intersectionWith (interverse (alignCCs f)) bl br) + <*> f pl pr + where + p r = keysSet hsl == keysSet hsr && all q (keys hsl) + where + hsl = bl Map.! r + hsr = br Map.! r + q t = fst (hsl ! t) == fst (hsr ! t) +alignBranch f (MatchData rfl bl dl) (MatchData rfr br dr) + | rfl == rfr + , keysSet bl == keysSet br + , all (\t -> fst (bl ! t) == fst (br ! t)) (keys bl) + , Just ds <- alignMaybe f dl dr + = Just $ MatchData rfl <$> interverse (alignCCs f) bl br <*> ds +alignBranch f (MatchSum bl) (MatchSum br) + | keysSet bl == keysSet br + , all (\w -> fst (bl ! w) == fst (br ! w)) (keys bl) + = Just $ MatchSum <$> interverse (alignCCs f) bl br +alignBranch _ _ _ = Nothing + +alignCCs :: Functor f => (l -> r -> f s) -> (a, l) -> (a, r) -> f (a, s) +alignCCs f (ccs, l) (_, r) = (,) ccs <$> f l r + matchLit :: Term v a -> Maybe Lit matchLit (Int' i) = Just $ I i matchLit (Nat' n) = Just $ N n @@ -927,7 +1035,7 @@ data Branched e | MatchEmpty | MatchData Reference (EnumMap CTag ([Mem], e)) (Maybe e) | MatchSum (EnumMap Word64 ([Mem], e)) - deriving (Show, Functor, Foldable, Traversable) + deriving (Show, Eq, Functor, Foldable, Traversable) -- Data cases expected to cover all constructors pattern MatchDataCover :: Reference -> EnumMap CTag ([Mem], e) -> Branched e @@ -1038,7 +1146,7 @@ data Func v FReq !Reference !CTag | -- prim op FPrim (Either POp FOp) - deriving (Show, Functor, Foldable, Traversable) + deriving (Show, Eq, Functor, Foldable, Traversable) data Lit = I Int64 @@ -1048,7 +1156,7 @@ data Lit | C Char | LM Referent | LY Reference - deriving (Show) + deriving (Show, Eq) litRef :: Lit -> Reference litRef (I _) = Ty.intRef @@ -1227,7 +1335,7 @@ type DNormal v = Directed () (ANormal v) -- Should be a completely closed term data SuperNormal v = Lambda {conventions :: [Mem], bound :: ANormal v} - deriving (Show) + deriving (Show, Eq) data SuperGroup v = Rec { group :: [(v, SuperNormal v)], @@ -1235,6 +1343,40 @@ data SuperGroup v = Rec } deriving (Show) +instance Var v => Eq (SuperGroup v) where + g0 == g1 | Left _ <- equivocate g0 g1 = False | otherwise = True + +-- Failure modes for SuperGroup alpha equivalence test +data SGEqv v + -- mismatch number of definitions in group + = NumDefns (SuperGroup v) (SuperGroup v) + -- mismatched SuperNormal calling conventions + | DefnConventions (SuperNormal v) (SuperNormal v) + -- mismatched subterms in corresponding definition + | Subterms (ANormal v) (ANormal v) + +-- Checks if two SuperGroups are equivalent up to renaming. The rest +-- of the structure must match on the nose. If the two groups are not +-- equivalent, an example of conflicting structure is returned. +equivocate :: + Var v => + SuperGroup v -> SuperGroup v -> Either (SGEqv v) () +equivocate g0@(Rec bs0 e0) g1@(Rec bs1 e1) + | length bs0 == length bs1 = + traverse_ eqvSN (zip ns0 ns1) *> eqvSN (e0, e1) + | otherwise = Left $ NumDefns g0 g1 + where + (vs0, ns0) = unzip bs0 + (vs1, ns1) = unzip bs1 + vm = Map.fromList (zip vs1 vs0) + + promote (Left (l, r)) = Left $ Subterms l r + promote (Right v) = Right v + + eqvSN (Lambda ccs0 e0, Lambda ccs1 e1) + | ccs0 == ccs1 = promote $ ABTN.alpha vm e0 e1 + eqvSN (n0, n1) = Left $ DefnConventions n0 n1 + type ANFM v = ReaderT (Set v) diff --git a/parser-typechecker/src/Unison/Util/EnumContainers.hs b/parser-typechecker/src/Unison/Util/EnumContainers.hs index 51def1b04..41a5cb727 100644 --- a/parser-typechecker/src/Unison/Util/EnumContainers.hs +++ b/parser-typechecker/src/Unison/Util/EnumContainers.hs @@ -9,6 +9,7 @@ module Unison.Util.EnumContainers setSingleton, mapInsert, unionWith, + intersectionWith, hasKey, keys, keysSet, @@ -22,7 +23,9 @@ module Unison.Util.EnumContainers mapToList, (!), findMin, + interverse, traverseSet_, + traverseWithKey, setSize, ) where @@ -89,7 +92,6 @@ mapInsert :: EnumKey k => k -> a -> EnumMap k a -> EnumMap k a mapInsert e x (EM m) = EM $ IM.insert (keyToInt e) x m unionWith :: - EnumKey k => EnumKey k => (a -> a -> a) -> EnumMap k a -> @@ -97,6 +99,11 @@ unionWith :: EnumMap k a unionWith f (EM l) (EM r) = EM $ IM.unionWith f l r +intersectionWith :: + (a -> b -> c) -> + EnumMap k a -> EnumMap k b -> EnumMap k c +intersectionWith f (EM l) (EM r) = EM $ IM.intersectionWith f l r + keys :: EnumKey k => EnumMap k a -> [k] keys (EM m) = fmap intToKey . IM.keys $ m @@ -141,5 +148,20 @@ traverseSet_ :: traverseSet_ f (ES s) = IS.foldr (\i r -> f (intToKey i) *> r) (pure ()) s +interverse + :: Applicative f + => (a -> b -> f c) + -> EnumMap k a -> EnumMap k b -> f (EnumMap k c) +interverse f (EM l) (EM r) = + fmap EM . traverse id $ IM.intersectionWith f l r + +traverseWithKey :: + Applicative f => + EnumKey k => + (k -> a -> f b) -> + EnumMap k a -> + f (EnumMap k b) +traverseWithKey f (EM m) = EM <$> IM.traverseWithKey (f . intToKey) m + setSize :: EnumSet k -> Int setSize (ES s) = IS.size s diff --git a/unison-core/src/Unison/ABT/Normalized.hs b/unison-core/src/Unison/ABT/Normalized.hs index 36dd06a4e..d8f516ff8 100644 --- a/unison-core/src/Unison/ABT/Normalized.hs +++ b/unison-core/src/Unison/ABT/Normalized.hs @@ -12,6 +12,8 @@ module Unison.ABT.Normalized ( ABT (..), Term (.., TAbs, TTm, TAbss), + Align (..), + alpha, renames, rename, transform, @@ -20,6 +22,7 @@ where import Data.Bifoldable import Data.Bifunctor +import Data.Foldable (toList) -- import Data.Bitraversable import Data.Map.Strict (Map) @@ -58,6 +61,22 @@ instance showsPrec p (Term _ e) = showParen (p >= 9) $ showString "Term " . showsPrec 10 e +instance + (forall a b. Eq a => Eq b => Eq (f a b), Bifunctor f, Bifoldable f, Var v) => + Eq (ABT f v) + where + Abs v1 e1 == Abs v2 e2 + | v1 == v2 = e1 == e2 + | otherwise = e1 == rename v2 v1 e2 + Tm e1 == Tm e2 = e1 == e2 + _ == _ = False + +instance + (forall a b. Eq a => Eq b => Eq (f a b), Bifunctor f, Bifoldable f, Var v) => + Eq (Term f v) + where + Term _ abt1 == Term _ abt2 = abt1 == abt2 + pattern TAbs :: Var v => v -> Term f v -> Term f v pattern TAbs u bd <- Term _ (Abs u bd) @@ -72,6 +91,32 @@ pattern TTm bd <- {-# COMPLETE TAbs, TTm #-} +class (Bifoldable f, Bifunctor f) => Align f where + align :: + Applicative g => + (vl -> vr -> g vs) -> + (el -> er -> g es) -> + f vl el -> f vr er -> Maybe (g (f vs es)) + +alphaErr :: + Align f => Var v => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) a +alphaErr un tml tmr = Left (tml, renames count un tmr) + where + count = Map.fromListWith (+) . flip zip [1,1..] $ toList un + +-- Checks if two terms are equal up to a given variable renaming. The +-- renaming should map variables in the right hand term to the +-- equivalent variable in the left hand term. +alpha :: Align f => Var v => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) () +alpha un (TAbs u tml) (TAbs v tmr) + = alpha (Map.insert v u (Map.filter (/= u) un)) tml tmr +alpha un tml@(TTm bdl) tmr@(TTm bdr) + | Just sub <- align av (alpha un) bdl bdr = () <$ sub + where + av u v | maybe False (== u) (Map.lookup v un) = pure () + | otherwise = alphaErr un tml tmr +alpha un tml tmr = alphaErr un tml tmr + unabss :: Var v => Term f v -> ([v], Term f v) unabss (TAbs v (unabss -> (vs, bd))) = (v : vs, bd) unabss bd = ([], bd) From e148f3c2e82d91ad3cecfba729425d8c50065e0a Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 19 Dec 2022 16:53:38 -0500 Subject: [PATCH 040/467] Fix formatting. --- .../src/Unison/Runtime/Builtin.hs | 4 +-- .../src/Unison/Runtime/Foreign.hs | 28 +++++++++---------- .../src/Unison/Runtime/Stack.hs | 13 +++++---- .../src/Unison/Util/EnumContainers.hs | 14 ++++++---- unison-core/src/Unison/ABT/Normalized.hs | 15 ++++++---- 5 files changed, 41 insertions(+), 33 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 89e001923..be0a7e2d2 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -51,7 +51,6 @@ import Data.IORef as SYS ) import qualified Data.Map as Map import Data.PEM (PEM, pemContent, pemParseLBS) -import qualified Unison.Runtime.Array as PA import Data.Set (insert) import qualified Data.Set as Set import qualified Data.Text @@ -131,6 +130,7 @@ import Unison.Reference import Unison.Referent (pattern Ref) import Unison.Runtime.ANF as ANF import Unison.Runtime.ANF.Serialize as ANF +import qualified Unison.Runtime.Array as PA import Unison.Runtime.Exception (die) import Unison.Runtime.Foreign ( Foreign (Wrap), @@ -1970,7 +1970,7 @@ declareForeign sand name op func0 = do | sanitize, Tracked <- sand, FF r w _ <- func0 = - FF r w (bomb name) + FF r w (bomb name) | otherwise = func0 code = (name, (sand, uncurry Lambda (op w))) in (w + 1, code : codes, mapInsert w (name, func) funcs) diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index a807005bb..6f567a70d 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -52,59 +52,59 @@ promote (~~) x y = unsafeCoerce x ~~ unsafeCoerce y -- alias seems to prevent the faults. txtEq :: Text -> Text -> Bool txtEq l r = l == r -{-# noinline txtEq #-} +{-# NOINLINE txtEq #-} txtCmp :: Text -> Text -> Ordering txtCmp l r = compare l r -{-# noinline txtCmp #-} +{-# NOINLINE txtCmp #-} bytesEq :: Bytes -> Bytes -> Bool bytesEq l r = l == r -{-# noinline bytesEq #-} +{-# NOINLINE bytesEq #-} bytesCmp :: Bytes -> Bytes -> Ordering bytesCmp l r = compare l r -{-# noinline bytesCmp #-} +{-# NOINLINE bytesCmp #-} mvarEq :: MVar () -> MVar () -> Bool mvarEq l r = l == r -{-# noinline mvarEq #-} +{-# NOINLINE mvarEq #-} refEq :: IORef () -> IORef () -> Bool refEq l r = l == r -{-# noinline refEq #-} +{-# NOINLINE refEq #-} tidEq :: ThreadId -> ThreadId -> Bool tidEq l r = l == r -{-# noinline tidEq #-} +{-# NOINLINE tidEq #-} tidCmp :: ThreadId -> ThreadId -> Ordering tidCmp l r = compare l r -{-# noinline tidCmp #-} +{-# NOINLINE tidCmp #-} marrEq :: MutableArray () () -> MutableArray () () -> Bool marrEq l r = l == r -{-# noinline marrEq #-} +{-# NOINLINE marrEq #-} mbarrEq :: MutableByteArray () -> MutableByteArray () -> Bool mbarrEq l r = l == r -{-# noinline mbarrEq #-} +{-# NOINLINE mbarrEq #-} barrEq :: ByteArray -> ByteArray -> Bool barrEq l r = l == r -{-# noinline barrEq #-} +{-# NOINLINE barrEq #-} barrCmp :: ByteArray -> ByteArray -> Ordering barrCmp l r = compare l r -{-# noinline barrCmp #-} +{-# NOINLINE barrCmp #-} cpatEq :: CPattern -> CPattern -> Bool cpatEq l r = l == r -{-# noinline cpatEq #-} +{-# NOINLINE cpatEq #-} cpatCmp :: CPattern -> CPattern -> Ordering cpatCmp l r = compare l r -{-# noinline cpatCmp #-} +{-# NOINLINE cpatCmp #-} tylEq :: Reference -> Reference -> Bool tylEq r l = r == l diff --git a/parser-typechecker/src/Unison/Runtime/Stack.hs b/parser-typechecker/src/Unison/Runtime/Stack.hs index 9be21473c..7e02a74ac 100644 --- a/parser-typechecker/src/Unison/Runtime/Stack.hs +++ b/parser-typechecker/src/Unison/Runtime/Stack.hs @@ -109,12 +109,13 @@ data Closure deriving (Show, Eq, Ord) traceK :: Reference -> K -> [(Reference, Int)] -traceK begin = dedup (begin, 1) where - dedup p (Mark _ _ _ _ k) = dedup p k - dedup p@(cur,n) (Push _ _ _ _ (CIx r _ _) k) - | cur == r = dedup (cur,1+n) k - | otherwise = p : dedup (r,1) k - dedup p _ = [p] +traceK begin = dedup (begin, 1) + where + dedup p (Mark _ _ _ _ k) = dedup p k + dedup p@(cur, n) (Push _ _ _ _ (CIx r _ _) k) + | cur == r = dedup (cur, 1 + n) k + | otherwise = p : dedup (r, 1) k + dedup p _ = [p] splitData :: Closure -> Maybe (Reference, Word64, [Int], [Closure]) splitData (Enum r t) = Just (r, t, [], []) diff --git a/parser-typechecker/src/Unison/Util/EnumContainers.hs b/parser-typechecker/src/Unison/Util/EnumContainers.hs index 41a5cb727..22f559d36 100644 --- a/parser-typechecker/src/Unison/Util/EnumContainers.hs +++ b/parser-typechecker/src/Unison/Util/EnumContainers.hs @@ -101,7 +101,9 @@ unionWith f (EM l) (EM r) = EM $ IM.unionWith f l r intersectionWith :: (a -> b -> c) -> - EnumMap k a -> EnumMap k b -> EnumMap k c + EnumMap k a -> + EnumMap k b -> + EnumMap k c intersectionWith f (EM l) (EM r) = EM $ IM.intersectionWith f l r keys :: EnumKey k => EnumMap k a -> [k] @@ -148,10 +150,12 @@ traverseSet_ :: traverseSet_ f (ES s) = IS.foldr (\i r -> f (intToKey i) *> r) (pure ()) s -interverse - :: Applicative f - => (a -> b -> f c) - -> EnumMap k a -> EnumMap k b -> f (EnumMap k c) +interverse :: + Applicative f => + (a -> b -> f c) -> + EnumMap k a -> + EnumMap k b -> + f (EnumMap k c) interverse f (EM l) (EM r) = fmap EM . traverse id $ IM.intersectionWith f l r diff --git a/unison-core/src/Unison/ABT/Normalized.hs b/unison-core/src/Unison/ABT/Normalized.hs index d8f516ff8..c620e20f5 100644 --- a/unison-core/src/Unison/ABT/Normalized.hs +++ b/unison-core/src/Unison/ABT/Normalized.hs @@ -96,25 +96,28 @@ class (Bifoldable f, Bifunctor f) => Align f where Applicative g => (vl -> vr -> g vs) -> (el -> er -> g es) -> - f vl el -> f vr er -> Maybe (g (f vs es)) + f vl el -> + f vr er -> + Maybe (g (f vs es)) alphaErr :: Align f => Var v => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) a alphaErr un tml tmr = Left (tml, renames count un tmr) where - count = Map.fromListWith (+) . flip zip [1,1..] $ toList un + count = Map.fromListWith (+) . flip zip [1, 1 ..] $ toList un -- Checks if two terms are equal up to a given variable renaming. The -- renaming should map variables in the right hand term to the -- equivalent variable in the left hand term. alpha :: Align f => Var v => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) () -alpha un (TAbs u tml) (TAbs v tmr) - = alpha (Map.insert v u (Map.filter (/= u) un)) tml tmr +alpha un (TAbs u tml) (TAbs v tmr) = + alpha (Map.insert v u (Map.filter (/= u) un)) tml tmr alpha un tml@(TTm bdl) tmr@(TTm bdr) | Just sub <- align av (alpha un) bdl bdr = () <$ sub where - av u v | maybe False (== u) (Map.lookup v un) = pure () - | otherwise = alphaErr un tml tmr + av u v + | maybe False (== u) (Map.lookup v un) = pure () + | otherwise = alphaErr un tml tmr alpha un tml tmr = alphaErr un tml tmr unabss :: Var v => Term f v -> ([v], Term f v) From 884e966ad893c4718caa605e1ebc5af052b1190c Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 20 Dec 2022 11:29:02 -0500 Subject: [PATCH 041/467] Make take/drop builtins behave better w.r.t large numbers --- .../src/Unison/Runtime/Machine.hs | 31 +++++++++++++++---- unison-src/transcripts/builtins.md | 19 ++++++++++-- unison-src/transcripts/builtins.output.md | 19 ++++++++++-- 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index 7ed248469..9ad0c4557 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -1464,7 +1464,11 @@ bprim2 !ustk !bstk DRPT i j = do n <- peekOff ustk i t <- peekOffBi bstk j bstk <- bump bstk - pokeBi bstk $ Util.Text.drop n t + -- Note; if n < 0, the Nat argument was greater than the maximum + -- signed integer. As an approximation, just return the empty + -- string, as a string larger than this would require an absurd + -- amount of memory. + pokeBi bstk $ if n < 0 then Util.Text.empty else Util.Text.drop n t pure (ustk, bstk) bprim2 !ustk !bstk CATT i j = do x <- peekOffBi bstk i @@ -1476,7 +1480,10 @@ bprim2 !ustk !bstk TAKT i j = do n <- peekOff ustk i t <- peekOffBi bstk j bstk <- bump bstk - pokeBi bstk $ Util.Text.take n t + -- Note: if n < 0, the Nat argument was greater than the maximum + -- signed integer. As an approximation, we just return the original + -- string, because it's unlikely such a large string exists. + pokeBi bstk $ if n < 0 then t else Util.Text.take n t pure (ustk, bstk) bprim2 !ustk !bstk EQLT i j = do x <- peekOffBi @Util.Text.Text bstk i @@ -1500,13 +1507,21 @@ bprim2 !ustk !bstk DRPS i j = do n <- peekOff ustk i s <- peekOffS bstk j bstk <- bump bstk - pokeS bstk $ Sq.drop n s + -- Note: if n < 0, then the Nat argument was larger than the largest + -- signed integer. Seq actually doesn't handle this well, despite it + -- being possible to build (lazy) sequences this large. So, + -- approximate by yielding the empty sequence. + pokeS bstk $ if n < 0 then Sq.empty else Sq.drop n s pure (ustk, bstk) bprim2 !ustk !bstk TAKS i j = do n <- peekOff ustk i s <- peekOffS bstk j bstk <- bump bstk - pokeS bstk $ Sq.take n s + -- Note: if n < 0, then the Nat argument was greater than the + -- largest signed integer. It is possible to build such large + -- sequences, but the internal size will actually be wrong then. So, + -- we just return the original sequence as an approximation. + pokeS bstk $ if n < 0 then s else Sq.take n s pure (ustk, bstk) bprim2 !ustk !bstk CONS i j = do x <- peekOff bstk i @@ -1576,13 +1591,17 @@ bprim2 !ustk !bstk TAKB i j = do n <- peekOff ustk i b <- peekOffBi bstk j bstk <- bump bstk - pokeBi bstk $ By.take n b + -- If n < 0, the Nat argument was larger than the maximum signed + -- integer. Building a value this large would reuire an absurd + -- amount of memory, so just assume n is larger. + pokeBi bstk $ if n < 0 then b else By.take n b pure (ustk, bstk) bprim2 !ustk !bstk DRPB i j = do n <- peekOff ustk i b <- peekOffBi bstk j bstk <- bump bstk - pokeBi bstk $ By.drop n b + -- See above for n < 0 + pokeBi bstk $ if n < 0 then By.empty else By.drop n b pure (ustk, bstk) bprim2 !ustk !bstk IDXB i j = do n <- peekOff ustk i diff --git a/unison-src/transcripts/builtins.md b/unison-src/transcripts/builtins.md index bcd652022..ff63a8827 100644 --- a/unison-src/transcripts/builtins.md +++ b/unison-src/transcripts/builtins.md @@ -14,6 +14,9 @@ This transcript defines unit tests for builtin functions. There's a single `.> t ```unison:hide use Int +-- used for some take/drop tests later +bigN = Nat.shiftLeft 1 63 + -- Note: you can make the tests more fine-grained if you -- want to be able to tell which one is failing test> Int.tests.arithmetic = @@ -198,7 +201,9 @@ test> Text.tests.takeDropAppend = Text.take 99 "yabba" == "yabba", Text.drop 0 "yabba" == "yabba", Text.drop 2 "yabba" == "bba", - Text.drop 99 "yabba" == "" + Text.drop 99 "yabba" == "", + Text.take bigN "yabba" == "yabba", + Text.drop bigN "yabba" == "" ] test> Text.tests.repeat = @@ -255,7 +260,9 @@ test> Bytes.tests.at = checks [ Bytes.at 1 bs == Some 13, Bytes.at 0 bs == Some 77, - Bytes.at 99 bs == None + Bytes.at 99 bs == None, + Bytes.take bigN bs == bs, + Bytes.drop bigN bs == empty ] test> Bytes.tests.compression = @@ -306,6 +313,14 @@ test> checks [ .> add ``` +Other list functions +```unison:hide +test> checks [ + List.take bigN [1,2,3] == [1,2,3], + List.drop bigN [1,2,3] == [] + ] +``` + ## `Any` functions ```unison diff --git a/unison-src/transcripts/builtins.output.md b/unison-src/transcripts/builtins.output.md index f3f8f21a7..d6802faac 100644 --- a/unison-src/transcripts/builtins.output.md +++ b/unison-src/transcripts/builtins.output.md @@ -7,6 +7,9 @@ This transcript defines unit tests for builtin functions. There's a single `.> t ```unison use Int +-- used for some take/drop tests later +bigN = Nat.shiftLeft 1 63 + -- Note: you can make the tests more fine-grained if you -- want to be able to tell which one is failing test> Int.tests.arithmetic = @@ -179,7 +182,9 @@ test> Text.tests.takeDropAppend = Text.take 99 "yabba" == "yabba", Text.drop 0 "yabba" == "yabba", Text.drop 2 "yabba" == "bba", - Text.drop 99 "yabba" == "" + Text.drop 99 "yabba" == "", + Text.take bigN "yabba" == "yabba", + Text.drop bigN "yabba" == "" ] test> Text.tests.repeat = @@ -232,7 +237,9 @@ test> Bytes.tests.at = checks [ Bytes.at 1 bs == Some 13, Bytes.at 0 bs == Some 77, - Bytes.at 99 bs == None + Bytes.at 99 bs == None, + Bytes.take bigN bs == bs, + Bytes.drop bigN bs == empty ] test> Bytes.tests.compression = @@ -275,6 +282,14 @@ test> checks [ ] ``` +Other list functions +```unison +test> checks [ + List.take bigN [1,2,3] == [1,2,3], + List.drop bigN [1,2,3] == [] + ] +``` + ## `Any` functions ```unison From f16514c9a9fe9261ca8e8ffd0efe511d184af1a3 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 20 Dec 2022 15:12:01 -0500 Subject: [PATCH 042/467] Avoid trailing separators in temp directory functions --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index be0a7e2d2..d20b57b0f 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -100,6 +100,7 @@ import System.Environment as SYS ( getArgs, getEnv, ) +import System.FilePath (isPathSeparator) import System.IO (Handle) import System.IO as SYS ( IOMode (..), @@ -2102,13 +2103,15 @@ declareForeigns = do declareForeign Tracked "Clock.internals.nsec.v1" boxToNat $ mkForeign (\n -> pure (fromIntegral $ nsec n :: Word64)) + let chop = reverse . dropWhile isPathSeparator . reverse + declareForeign Tracked "IO.getTempDirectory.impl.v3" unitToEFBox $ - mkForeignIOF $ \() -> getTemporaryDirectory + mkForeignIOF $ \() -> chop <$> getTemporaryDirectory declareForeign Tracked "IO.createTempDirectory.impl.v3" boxToEFBox $ mkForeignIOF $ \prefix -> do temp <- getTemporaryDirectory - createTempDirectory temp prefix + chop <$> createTempDirectory temp prefix declareForeign Tracked "IO.getCurrentDirectory.impl.v3" unitToEFBox . mkForeignIOF From 5e9535425c4ff4a8dc9a6bfc7d12419ab0e53c0d Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Tue, 20 Dec 2022 15:49:09 -0500 Subject: [PATCH 043/467] prepend "test>" to edited tests --- .../src/Unison/Util/Relation3.hs | 4 + .../src/Unison/Util/Relation4.hs | 6 + .../src/Unison/Codebase/Metadata.hs | 5 +- .../src/Unison/Syntax/TermPrinter.hs | 127 +++++++++++++----- .../src/Unison/Codebase/Editor/HandleInput.hs | 26 +++- .../Codebase/Editor/HandleInput/Update.hs | 4 +- .../src/Unison/Codebase/Editor/Output.hs | 21 +-- .../src/Unison/CommandLine/InputPatterns.hs | 27 ++-- .../src/Unison/CommandLine/OutputMessages.hs | 127 ++++++++++-------- unison-core/src/Unison/WatchKind.hs | 3 - unison-share-api/package.yaml | 2 + unison-share-api/src/Unison/Server/Backend.hs | 10 +- unison-share-api/src/Unison/Server/Types.hs | 5 - unison-share-api/unison-share-api.cabal | 2 + 14 files changed, 228 insertions(+), 141 deletions(-) diff --git a/lib/unison-util-relation/src/Unison/Util/Relation3.hs b/lib/unison-util-relation/src/Unison/Util/Relation3.hs index 9a564505d..0e598ec03 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation3.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation3.hs @@ -94,6 +94,10 @@ mapD2Monotonic f Relation3 {d1, d2, d3} = member :: (Ord a, Ord b, Ord c) => a -> b -> c -> Relation3 a b c -> Bool member a b c = R.member b c . lookupD1 a +memberD2 :: Ord b => b -> Relation3 a b c -> Bool +memberD2 b = + Map.member b . d2 + lookupD1 :: (Ord a, Ord b, Ord c) => a -> Relation3 a b c -> Relation b c lookupD1 a = fromMaybe mempty . Map.lookup a . d1 diff --git a/lib/unison-util-relation/src/Unison/Util/Relation4.hs b/lib/unison-util-relation/src/Unison/Util/Relation4.hs index 9e5251fa0..b38f8873f 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation4.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation4.hs @@ -55,6 +55,12 @@ fromList xs = insertAll xs empty filter :: (Ord a, Ord b, Ord c, Ord d) => ((a, b, c, d) -> Bool) -> Relation4 a b c d -> Relation4 a b c d filter f = fromList . Prelude.filter f . toList +memberD13 :: (Ord a, Ord c) => a -> c -> Relation4 a b c d -> Bool +memberD13 a c r4 = + case Map.lookup a (d1 r4) of + Nothing -> False + Just r3 -> R3.memberD2 c r3 + selectD3 :: (Ord a, Ord b, Ord c, Ord d) => c -> diff --git a/parser-typechecker/src/Unison/Codebase/Metadata.hs b/parser-typechecker/src/Unison/Codebase/Metadata.hs index d91677afb..8f66e70db 100644 --- a/parser-typechecker/src/Unison/Codebase/Metadata.hs +++ b/parser-typechecker/src/Unison/Codebase/Metadata.hs @@ -7,7 +7,6 @@ import Unison.Reference (Reference) import qualified Unison.Util.List as List import Unison.Util.Relation (Relation) import qualified Unison.Util.Relation as R -import qualified Unison.Util.Relation3 as R3 import Unison.Util.Relation4 (Relation4) import qualified Unison.Util.Relation4 as R4 import Unison.Util.Star3 (Star3) @@ -44,8 +43,8 @@ hasMetadata :: Ord a => a -> Type -> Value -> Star a n -> Bool hasMetadata a t v = Set.member (t, v) . R.lookupDom a . Star3.d3 hasMetadataWithType' :: Ord a => a -> Type -> R4 a n -> Bool -hasMetadataWithType' a t r = - fromMaybe False $ Set.member t . R3.d2s <$> (Map.lookup a $ R4.d1 r) +hasMetadataWithType' = + R4.memberD13 hasMetadataWithType :: Ord a => a -> Type -> Star a n -> Bool hasMetadataWithType a t = Set.member t . R.lookupDom a . Star3.d2 diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index b93ddbd4e..696085a11 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -1,4 +1,16 @@ -module Unison.Syntax.TermPrinter (emptyAc, pretty, prettyBlock, prettyBlock', pretty', prettyBinding, prettyBinding', pretty0, runPretty) where +module Unison.Syntax.TermPrinter + ( emptyAc, + pretty, + prettyBlock, + prettyBlock', + pretty', + prettyBinding, + prettyBinding', + prettyBindingWithoutTypeSignature, + pretty0, + runPretty, + ) +where import Control.Lens (unsnoc, (^.)) import Control.Monad.State (evalState) @@ -508,7 +520,7 @@ pretty0 printBinding (v, binding) = if Var.isAction v then pretty0 (ac (-1) Normal im doc) binding - else prettyBinding0 (ac (-1) Normal im doc) (HQ.unsafeFromVar v) binding + else renderPrettyBinding <$> prettyBinding0 (ac (-1) Normal im doc) (HQ.unsafeFromVar v) binding letIntro = case sc of Block -> id Normal -> \x -> fmt S.ControlKeyword "let" `PP.hang` x @@ -775,27 +787,63 @@ printCase im doc ms0 = <$> pretty0 (ac 2 Normal im doc) g printBody b = let (im', uses) = calcImports im b in goBody im' uses b -{- Render a binding, producing output of the form +-- A pretty term binding, split into the type signature (possibly empty) and the term. +data PrettyBinding = PrettyBinding + { typeSignature :: Maybe (Pretty SyntaxText), + term :: Pretty SyntaxText + } -foo : t -> u -foo a = ... +-- Render a pretty binding. +renderPrettyBinding :: PrettyBinding -> Pretty SyntaxText +renderPrettyBinding PrettyBinding {typeSignature, term} = + case typeSignature of + Nothing -> term + Just ty -> PP.lines [ty, term] -The first line is only output if the term has a type annotation as the -outermost constructor. +-- Render a pretty binding without a type signature. +renderPrettyBindingWithoutTypeSignature :: PrettyBinding -> Pretty SyntaxText +renderPrettyBindingWithoutTypeSignature PrettyBinding {term} = + term -Binary functions with symbolic names are output infix, as follows: - -(+) : t -> t -> t -a + b = ... - --} +-- | Render a binding, producing output of the form +-- +-- foo : t -> u +-- foo a = ... +-- +-- The first line is only output if the term has a type annotation as the +-- outermost constructor. +-- +-- Binary functions with symbolic names are output infix, as follows: +-- +-- (+) : t -> t -> t +-- a + b = ... prettyBinding :: Var v => PrettyPrintEnv -> HQ.HashQualified Name -> Term2 v at ap v a -> Pretty SyntaxText -prettyBinding ppe n = runPretty ppe . prettyBinding0 (ac (-1) Block Map.empty MaybeDoc) n +prettyBinding = + prettyBinding_ renderPrettyBinding + +-- | Like 'prettyBinding', but elides the type signature (if any). +prettyBindingWithoutTypeSignature :: + Var v => + PrettyPrintEnv -> + HQ.HashQualified Name -> + Term2 v at ap v a -> + Pretty SyntaxText +prettyBindingWithoutTypeSignature = + prettyBinding_ renderPrettyBindingWithoutTypeSignature + +prettyBinding_ :: + Var v => + (PrettyBinding -> Pretty SyntaxText) -> + PrettyPrintEnv -> + HQ.HashQualified Name -> + Term2 v at ap v a -> + Pretty SyntaxText +prettyBinding_ go ppe n = runPretty ppe . fmap go . prettyBinding0 (ac (-1) Block Map.empty MaybeDoc) n prettyBinding' :: Var v => @@ -812,7 +860,7 @@ prettyBinding0 :: AmbientContext -> HQ.HashQualified Name -> Term2 v at ap v a -> - m (Pretty SyntaxText) + m PrettyBinding prettyBinding0 a@AmbientContext {imports = im, docContext = doc} v term = go (symbolic && isBinary term) term where @@ -831,26 +879,26 @@ prettyBinding0 a@AmbientContext {imports = im, docContext = doc} v term = _ -> id tp' <- TypePrinter.pretty0 im (-1) tp tm' <- avoidCapture (prettyBinding0 a v tm) - pure $ - PP.lines - [ PP.group - ( renderName v - <> PP.hang - (fmt S.TypeAscriptionColon " :") - tp' - ), - PP.group tm' - ] + pure + PrettyBinding + { typeSignature = Just (PP.group (renderName v <> PP.hang (fmt S.TypeAscriptionColon " :") tp')), + term = PP.group (renderPrettyBinding tm') + } (printAnnotate env -> LamsNamedMatch' vs branches) -> do branches' <- printCase im doc branches - pure . PP.group $ - PP.group - ( defnLhs v vs <> fmt S.BindingEquals " =" <> " " - <> fmt - S.ControlKeyword - "cases" - ) - `PP.hang` branches' + pure + PrettyBinding + { typeSignature = Nothing, + term = + PP.group $ + PP.group + ( defnLhs v vs <> fmt S.BindingEquals " =" <> " " + <> fmt + S.ControlKeyword + "cases" + ) + `PP.hang` branches' + } LamsNamedOrDelay' vs body -> do -- In the case where we're being called from inside `pretty0`, this -- call to printAnnotate is unfortunately repeating work we've already @@ -862,10 +910,15 @@ prettyBinding0 a@AmbientContext {imports = im, docContext = doc} v term = let hang = case body' of Delay' (Lets' _ _) -> PP.softHang _ -> PP.hang - pure . PP.group $ - PP.group (defnLhs v vs <> fmt S.BindingEquals " =") - `hang` uses [prettyBody] - t -> pure $ l "error: " <> l (show t) + pure + PrettyBinding + { typeSignature = Nothing, + term = + PP.group $ + PP.group (defnLhs v vs <> fmt S.BindingEquals " =") + `hang` uses [prettyBody] + } + t -> error ("prettyBinding0: unexpected term: " ++ show t) where defnLhs v vs | infix' = case vs of diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 389477d20..23ef75447 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -164,8 +164,6 @@ import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Referent as Referent import qualified Unison.Result as Result -import Unison.Runtime.IOSource (isTest) -import qualified Unison.Runtime.IOSource as DD import qualified Unison.Runtime.IOSource as IOSource import Unison.Server.Backend (ShallowListEntry (..)) import qualified Unison.Server.Backend as Backend @@ -2078,8 +2076,24 @@ handleShowDefinition outputLoc showDefinitionScope inputQuery = do Cli.runTransaction (Backend.definitionsBySuffixes codebase nameSearch includeCycles query) outputPath <- getOutputPath when (not (null types && null terms)) do - let ppe = PPED.biasTo (mapMaybe HQ.toName inputQuery) unbiasedPPE - Cli.respond (DisplayDefinitions outputPath ppe types terms) + -- We need an 'isTest' check in the output layer, so it can prepend "test>" to tests in a scratch file. Since we + -- currently have the whole branch in memory, we just use that to make our predicate, but this could/should get this + -- information from the database instead, once it's efficient to do so. + isTest <- do + branch <- Cli.getCurrentBranch0 + pure \ref -> + branch + & Branch.deepTermMetadata + & Metadata.hasMetadataWithType' (Referent.fromTermReference ref) IOSource.isTestReference + Cli.respond $ + DisplayDefinitions + DisplayDefinitionsOutput + { isTest, + outputFile = outputPath, + prettyPrintEnv = PPED.biasTo (mapMaybe HQ.toName inputQuery) unbiasedPPE, + terms, + types + } when (not (null misses)) (Cli.respond (SearchTermsNotFound misses)) for_ outputPath \p -> do -- We set latestFile to be programmatically generated, if we @@ -2115,7 +2129,7 @@ handleTest TestInput {includeLibNamespace, showFailures, showSuccesses} = do branch <- Cli.getCurrentBranch0 branch & Branch.deepTermMetadata - & R4.restrict34d12 isTest + & R4.restrict34d12 IOSource.isTest & (if includeLibNamespace then id else R.filterRan (not . isInLibNamespace)) & R.dom & pure @@ -2962,7 +2976,7 @@ docsI srcLoc prettyPrintNames src = codebaseByMetadata :: Cli () codebaseByMetadata = do - (ppe, out) <- getLinks srcLoc src (Left $ Set.fromList [DD.docRef, DD.doc2Ref]) + (ppe, out) <- getLinks srcLoc src (Left $ Set.fromList [DD.docRef, IOSource.doc2Ref]) case out of [] -> codebaseByName [(_name, ref, _tm)] -> do diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs index f55a5cfad..24555f0f7 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs @@ -53,7 +53,7 @@ import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Referent as Referent import qualified Unison.Result as Result -import Unison.Runtime.IOSource (isTest) +import qualified Unison.Runtime.IOSource as IOSource import qualified Unison.Sqlite as Sqlite import Unison.Symbol (Symbol) import qualified Unison.Syntax.Name as Name (toVar, unsafeFromVar) @@ -589,7 +589,7 @@ doSlurpAdds slurp uf = Branch.batchUpdates (typeActions <> termActions) SC.terms slurp <> UF.constructorsForDecls (SC.types slurp) uf names = UF.typecheckedToNames uf tests = Set.fromList $ fst <$> UF.watchesOfKind WK.TestWatch (UF.discardTypes uf) - (isTestType, isTestValue) = isTest + (isTestType, isTestValue) = IOSource.isTest md v = if Set.member v tests then Metadata.singleton isTestType isTestValue diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index fb67f9ef7..de6f1f5dd 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -1,7 +1,6 @@ -{-# LANGUAGE PatternSynonyms #-} - module Unison.Codebase.Editor.Output ( Output (..), + DisplayDefinitionsOutput (..), NumberedOutput (..), NumberedArgs, ListDetailed, @@ -54,7 +53,7 @@ import Unison.Parser.Ann (Ann) import Unison.Prelude import qualified Unison.PrettyPrintEnv as PPE import qualified Unison.PrettyPrintEnvDecl as PPE -import Unison.Reference (Reference) +import Unison.Reference (Reference, TermReference) import qualified Unison.Reference as Reference import Unison.Referent (Referent) import Unison.Server.Backend (ShallowListEntry (..)) @@ -203,11 +202,7 @@ data Output | Typechecked SourceName PPE.PrettyPrintEnv SlurpResult (UF.TypecheckedUnisonFile Symbol Ann) | DisplayRendered (Maybe FilePath) (P.Pretty P.ColorText) | -- "display" definitions, possibly to a FilePath on disk (e.g. editing) - DisplayDefinitions - (Maybe FilePath) - PPE.PrettyPrintEnvDecl - (Map Reference (DisplayObject () (Decl Symbol Ann))) - (Map Reference (DisplayObject (Type Symbol Ann) (Term Symbol Ann))) + DisplayDefinitions DisplayDefinitionsOutput | TestIncrementalOutputStart PPE.PrettyPrintEnv (Int, Int) Reference (Term Symbol Ann) | TestIncrementalOutputEnd PPE.PrettyPrintEnv (Int, Int) Reference (Term Symbol Ann) | TestResults @@ -278,6 +273,14 @@ data Output | DisplayDebugNameDiff NameChanges | DisplayDebugCompletions [Completion.Completion] +data DisplayDefinitionsOutput = DisplayDefinitionsOutput + { isTest :: TermReference -> Bool, + outputFile :: Maybe FilePath, + prettyPrintEnv :: PPE.PrettyPrintEnvDecl, + terms :: Map Reference (DisplayObject (Type Symbol Ann) (Term Symbol Ann)), + types :: Map Reference (DisplayObject () (Decl Symbol Ann)) + } + data ShareError = ShareErrorCheckAndSetPush Sync.CheckAndSetPushError | ShareErrorFastForwardPush Sync.FastForwardPushError @@ -369,7 +372,7 @@ isFailure o = case o of EvaluationFailure {} -> True Evaluated {} -> False Typechecked {} -> False - DisplayDefinitions _ _ m1 m2 -> null m1 && null m2 + DisplayDefinitions DisplayDefinitionsOutput {terms, types} -> null terms && null types DisplayRendered {} -> False TestIncrementalOutputStart {} -> False TestIncrementalOutputEnd {} -> False diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index 111e7afe4..9677550ba 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -1537,19 +1537,20 @@ viewReflog = edit :: InputPattern edit = InputPattern - "edit" - [] - I.Visible - [(OnePlus, definitionQueryArg)] - ( P.lines - [ "`edit foo` prepends the definition of `foo` to the top of the most " - <> "recently saved file.", - "`edit` without arguments invokes a search to select a definition for editing, which requires that `fzf` can be found within your PATH." - ] - ) - ( fmap (Input.ShowDefinitionI Input.LatestFileLocation Input.ShowDefinitionLocal) - . traverse parseHashQualifiedName - ) + { patternName = "edit", + aliases = [], + visibility = I.Visible, + argTypes = [(OnePlus, definitionQueryArg)], + help = + P.lines + [ "`edit foo` prepends the definition of `foo` to the top of the most " + <> "recently saved file.", + "`edit` without arguments invokes a search to select a definition for editing, which requires that `fzf` can be found within your PATH." + ], + parse = + fmap (Input.ShowDefinitionI Input.LatestFileLocation Input.ShowDefinitionLocal) + . traverse parseHashQualifiedName + } topicNameArg :: ArgumentType topicNameArg = diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 99f167bfa..d51a524c2 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -112,7 +112,7 @@ import Unison.PrintError printNoteWithSource, renderCompilerBug, ) -import Unison.Reference (Reference) +import Unison.Reference (Reference, TermReference) import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Referent as Referent @@ -125,12 +125,14 @@ import qualified Unison.Share.Sync as Share import Unison.Share.Sync.Types (CodeserverTransportError (..)) import qualified Unison.ShortHash as SH import qualified Unison.ShortHash as ShortHash +import Unison.Symbol (Symbol) import qualified Unison.Sync.Types as Share import qualified Unison.Syntax.DeclPrinter as DeclPrinter import qualified Unison.Syntax.HashQualified as HQ (toString, toText, unsafeFromVar) import qualified Unison.Syntax.Name as Name (toString, toText) import Unison.Syntax.NamePrinter - ( prettyHashQualified, + ( SyntaxText, + prettyHashQualified, prettyHashQualified', prettyLabeledDependency, prettyName, @@ -658,8 +660,7 @@ notifyUser dir o = case o of [prettyReadRemoteNamespace baseNS, prettyPath' squashedPath] <> "to push the changes." ] - DisplayDefinitions outputLoc ppe types terms -> - displayDefinitions outputLoc ppe types terms + DisplayDefinitions output -> displayDefinitions output DisplayRendered outputLoc pp -> displayRendered outputLoc pp TestResults stats ppe _showSuccess _showFailures oks fails -> case stats of @@ -2034,24 +2035,18 @@ displayRendered outputLoc pp = P.indentN 2 pp ] -displayDefinitions :: - Var v => - Ord a1 => - Maybe FilePath -> - PPED.PrettyPrintEnvDecl -> - Map Reference.Reference (DisplayObject () (DD.Decl v a1)) -> - Map Reference.Reference (DisplayObject (Type v a1) (Term v a1)) -> - IO Pretty -displayDefinitions _outputLoc _ppe types terms - | Map.null types && Map.null terms = pure $ P.callout "😶" "No results to display." -displayDefinitions outputLoc ppe types terms = - maybe displayOnly scratchAndDisplay outputLoc +displayDefinitions :: DisplayDefinitionsOutput -> IO Pretty +displayDefinitions DisplayDefinitionsOutput {isTest, outputFile, prettyPrintEnv = ppe, terms, types} = + if Map.null types && Map.null terms + then pure $ P.callout "😶" "No results to display." + else maybe displayOnly scratchAndDisplay outputFile where - displayOnly = pure code + ppeDecl = PPED.unsuffixifiedPPE ppe + displayOnly = pure (code (const False)) scratchAndDisplay path = do path' <- canonicalizePath path - prependToFile code path' - pure (message code path') + prependToFile (code isTest) path' + pure (message (code (const False)) path') where prependToFile code path = do existingContents <- do @@ -2078,47 +2073,63 @@ displayDefinitions outputLoc ppe types terms = "You can edit them there, then do" <> makeExample' IP.update <> "to replace the definitions currently in this namespace." ] - code = - P.syntaxToColor $ P.sep "\n\n" (prettyTypes <> prettyTerms) + + code :: (TermReference -> Bool) -> Pretty + code isTest = + P.syntaxToColor $ P.sep "\n\n" (prettyTypes <> prettyTerms isTest) + + prettyTypes :: [P.Pretty SyntaxText] + prettyTypes = + types + & Map.toList + & map (\(ref, dt) -> (PPE.typeName ppeDecl ref, ref, dt)) + & List.sortBy (\(n0, _, _) (n1, _, _) -> Name.compareAlphabetical n0 n1) + & map prettyType + + prettyTerms :: (TermReference -> Bool) -> [P.Pretty SyntaxText] + prettyTerms isTest = + terms + & Map.toList + & map (\(ref, dt) -> (PPE.termName ppeDecl (Referent.Ref ref), ref, dt)) + & List.sortBy (\(n0, _, _) (n1, _, _) -> Name.compareAlphabetical n0 n1) + & map (\t -> prettyTerm (isTest (t ^. _2)) t) + + prettyTerm :: + Bool -> + (HQ.HashQualified Name, Reference, DisplayObject (Type Symbol Ann) (Term Symbol Ann)) -> + P.Pretty SyntaxText + prettyTerm isTest (n, r, dt) = + case dt of + MissingObject r -> missing n r + BuiltinObject typ -> + (if isJust outputFile then P.indent "-- " else id) $ + P.hang + ("builtin " <> prettyHashQualified n <> " :") + (TypePrinter.prettySyntax (ppeBody n r) typ) + UserObject tm -> + if isTest + then WK.TestWatch <> "> " <> TermPrinter.prettyBindingWithoutTypeSignature (ppeBody n r) n tm + else TermPrinter.prettyBinding (ppeBody n r) n tm where ppeBody n r = PPE.biasTo (maybeToList $ HQ.toName n) $ PPE.declarationPPE ppe r - ppeDecl = PPED.unsuffixifiedPPE ppe - prettyTerms = - terms - & Map.toList - & map (\(ref, dt) -> (PPE.termName ppeDecl (Referent.Ref ref), ref, dt)) - & List.sortBy (\(n0, _, _) (n1, _, _) -> Name.compareAlphabetical n0 n1) - & map go - prettyTypes = - types - & Map.toList - & map (\(ref, dt) -> (PPE.typeName ppeDecl ref, ref, dt)) - & List.sortBy (\(n0, _, _) (n1, _, _) -> Name.compareAlphabetical n0 n1) - & map go2 - go (n, r, dt) = - case dt of - MissingObject r -> missing n r - BuiltinObject typ -> - (if isJust outputLoc then P.indent "-- " else id) $ - P.hang - ("builtin " <> prettyHashQualified n <> " :") - (TypePrinter.prettySyntax (ppeBody n r) typ) - UserObject tm -> TermPrinter.prettyBinding (ppeBody n r) n tm - go2 (n, r, dt) = - case dt of - MissingObject r -> missing n r - BuiltinObject _ -> builtin n - UserObject decl -> DeclPrinter.prettyDecl (PPED.biasTo (maybeToList $ HQ.toName n) $ PPE.declarationPPEDecl ppe r) r n decl - builtin n = P.wrap $ "--" <> prettyHashQualified n <> " is built-in." - missing n r = - P.wrap - ( "-- The name " <> prettyHashQualified n <> " is assigned to the " - <> "reference " - <> fromString (show r ++ ",") - <> "which is missing from the codebase." - ) - <> P.newline - <> tip "You might need to repair the codebase manually." + + prettyType :: (HQ.HashQualified Name, Reference, DisplayObject () (DD.Decl Symbol Ann)) -> P.Pretty SyntaxText + prettyType (n, r, dt) = + case dt of + MissingObject r -> missing n r + BuiltinObject _ -> builtin n + UserObject decl -> DeclPrinter.prettyDecl (PPED.biasTo (maybeToList $ HQ.toName n) $ PPE.declarationPPEDecl ppe r) r n decl + + builtin n = P.wrap $ "--" <> prettyHashQualified n <> " is built-in." + missing n r = + P.wrap + ( "-- The name " <> prettyHashQualified n <> " is assigned to the " + <> "reference " + <> fromString (show r ++ ",") + <> "which is missing from the codebase." + ) + <> P.newline + <> tip "You might need to repair the codebase manually." displayTestResults :: Bool -> -- whether to show the tip diff --git a/unison-core/src/Unison/WatchKind.hs b/unison-core/src/Unison/WatchKind.hs index 084cbcdce..3e52f45f1 100644 --- a/unison-core/src/Unison/WatchKind.hs +++ b/unison-core/src/Unison/WatchKind.hs @@ -1,7 +1,4 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ViewPatterns #-} module Unison.WatchKind where diff --git a/unison-share-api/package.yaml b/unison-share-api/package.yaml index 2d92ecdf4..d151ab733 100644 --- a/unison-share-api/package.yaml +++ b/unison-share-api/package.yaml @@ -69,6 +69,7 @@ default-extensions: - ConstraintKinds - DeriveAnyClass - DeriveFunctor + - DeriveGeneric - DerivingStrategies - DerivingVia - DoAndIfThenElse @@ -86,6 +87,7 @@ default-extensions: - PatternSynonyms - RankNTypes - ScopedTypeVariables + - StandaloneDeriving - TupleSections - TypeApplications - TypeOperators diff --git a/unison-share-api/src/Unison/Server/Backend.hs b/unison-share-api/src/Unison/Server/Backend.hs index f02159f48..e778b708f 100644 --- a/unison-share-api/src/Unison/Server/Backend.hs +++ b/unison-share-api/src/Unison/Server/Backend.hs @@ -701,7 +701,7 @@ makeNameSearch hashLength names = } -- | Interpret a 'Search' as a function from name to search results. -applySearch :: (Show r) => Search r -> HQ'.HashQualified Name -> [SR.SearchResult] +applySearch :: Show r => Search r -> HQ'.HashQualified Name -> [SR.SearchResult] applySearch Search {lookupNames, lookupRelativeHQRefs', makeResult, matchesNamedRef} query = do -- a bunch of references will match a HQ ref. toList (lookupRelativeHQRefs' query) <&> \ref -> @@ -778,9 +778,9 @@ hqNameQuery codebase NameSearch {typeSearch, termSearch} hqs = do } -- TODO: Move this to its own module -data DefinitionResults v = DefinitionResults - { termResults :: Map Reference (DisplayObject (Type v Ann) (Term v Ann)), - typeResults :: Map Reference (DisplayObject () (DD.Decl v Ann)), +data DefinitionResults = DefinitionResults + { termResults :: Map Reference (DisplayObject (Type Symbol Ann) (Term Symbol Ann)), + typeResults :: Map Reference (DisplayObject () (DD.Decl Symbol Ann)), noResults :: [HQ.HashQualified Name] } @@ -1204,7 +1204,7 @@ definitionsBySuffixes :: NameSearch -> IncludeCycles -> [HQ.HashQualified Name] -> - Sqlite.Transaction (DefinitionResults Symbol) + Sqlite.Transaction DefinitionResults definitionsBySuffixes codebase nameSearch includeCycles query = do QueryResult misses results <- hqNameQuery codebase nameSearch query -- todo: remember to replace this with getting components directly, diff --git a/unison-share-api/src/Unison/Server/Types.hs b/unison-share-api/src/Unison/Server/Types.hs index 9b511e468..684b530bd 100644 --- a/unison-share-api/src/Unison/Server/Types.hs +++ b/unison-share-api/src/Unison/Server/Types.hs @@ -1,10 +1,5 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DerivingVia #-} -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE StandaloneDeriving #-} module Unison.Server.Types where diff --git a/unison-share-api/unison-share-api.cabal b/unison-share-api/unison-share-api.cabal index 0f0e0c6a1..f18c33fdf 100644 --- a/unison-share-api/unison-share-api.cabal +++ b/unison-share-api/unison-share-api.cabal @@ -45,6 +45,7 @@ library ConstraintKinds DeriveAnyClass DeriveFunctor + DeriveGeneric DerivingStrategies DerivingVia DoAndIfThenElse @@ -62,6 +63,7 @@ library PatternSynonyms RankNTypes ScopedTypeVariables + StandaloneDeriving TupleSections TypeApplications TypeOperators From bcba9df787c1980f31e39202dd35ddc25c1e119e Mon Sep 17 00:00:00 2001 From: Cody Allen Date: Wed, 21 Dec 2022 09:48:39 -0500 Subject: [PATCH 044/467] default pull to silent mode What was `pull.silent` is now also `pull`. What was `pull` is now `pull.verbose`. Resolves #3566. Before this change, the `Verbosity` type (which I believe was only used for variations of pulling code) was either `Silent` or `Default`. This is awkward because silent became the new default. So I changed it to `Silent` or `Verbose` and filled in default values as needed. I retained the verbose functionality for `debug.pull-exhaustive` because if you are in the state that you need that command, some extra output about what is happening might be useful. --- .../src/Unison/Codebase/Verbosity.hs | 4 +-- .../src/Unison/CommandLine/InputPatterns.hs | 33 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/Verbosity.hs b/parser-typechecker/src/Unison/Codebase/Verbosity.hs index 2182dae0d..fdbe6d3b4 100644 --- a/parser-typechecker/src/Unison/Codebase/Verbosity.hs +++ b/parser-typechecker/src/Unison/Codebase/Verbosity.hs @@ -1,8 +1,8 @@ module Unison.Codebase.Verbosity where -data Verbosity = Default | Silent deriving (Eq, Show) +data Verbosity = Verbose | Silent deriving (Eq, Show) isSilent :: Verbosity -> Bool isSilent v = case v of - Default -> False + Verbose -> False Silent -> True diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index 111e7afe4..37f3f079b 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -1007,29 +1007,30 @@ resetRoot = _ -> Left (I.help resetRoot) ) -pullSilent :: InputPattern -pullSilent = - pullImpl "pull.silent" Verbosity.Silent Input.PullWithHistory "without listing the merged entities" - pull :: InputPattern -pull = pullImpl "pull" Verbosity.Default Input.PullWithHistory "" +pull = + pullImpl "pull" ["pull.silent"] Verbosity.Silent Input.PullWithHistory "without listing the merged entities" + +pullVerbose :: InputPattern +pullVerbose = pullImpl "pull.verbose" [] Verbosity.Verbose Input.PullWithHistory "and lists the merged entities" pullWithoutHistory :: InputPattern pullWithoutHistory = pullImpl "pull.without-history" - Verbosity.Default + [] + Verbosity.Silent Input.PullWithoutHistory "without including the remote's history. This usually results in smaller codebase sizes." -pullImpl :: String -> Verbosity -> Input.PullMode -> P.Pretty CT.ColorText -> InputPattern -pullImpl name verbosity pullMode addendum = do +pullImpl :: String -> [String] -> Verbosity -> Input.PullMode -> P.Pretty CT.ColorText -> InputPattern +pullImpl name aliases verbosity pullMode addendum = do self where self = InputPattern name - [] + aliases I.Visible [(Optional, remoteNamespaceArg), (Optional, namespaceArg)] ( P.lines @@ -1080,7 +1081,7 @@ pullExhaustive = ( P.lines [ P.wrap $ "The " <> makeExample' pullExhaustive <> "command can be used in place of" - <> makeExample' pull + <> makeExample' pullVerbose <> "to complete namespaces" <> "which were pulled incompletely due to a bug in UCM" <> "versions M1l and earlier. It may be extra slow!" @@ -1088,15 +1089,15 @@ pullExhaustive = ) ( \case [] -> - Right $ Input.PullRemoteBranchI Nothing Path.relativeEmpty' SyncMode.Complete Input.PullWithHistory Verbosity.Default + Right $ Input.PullRemoteBranchI Nothing Path.relativeEmpty' SyncMode.Complete Input.PullWithHistory Verbosity.Verbose [url] -> do ns <- parseReadRemoteNamespace "remote-namespace" url - Right $ Input.PullRemoteBranchI (Just ns) Path.relativeEmpty' SyncMode.Complete Input.PullWithHistory Verbosity.Default + Right $ Input.PullRemoteBranchI (Just ns) Path.relativeEmpty' SyncMode.Complete Input.PullWithHistory Verbosity.Verbose [url, path] -> do ns <- parseReadRemoteNamespace "remote-namespace" url p <- first fromString $ Path.parsePath' path - Right $ Input.PullRemoteBranchI (Just ns) p SyncMode.Complete Input.PullWithHistory Verbosity.Default - _ -> Left (I.help pull) + Right $ Input.PullRemoteBranchI (Just ns) p SyncMode.Complete Input.PullWithHistory Verbosity.Verbose + _ -> Left (I.help pullVerbose) ) debugTabCompletion :: InputPattern @@ -2340,9 +2341,9 @@ validInputs = push, pushCreate, pushForce, - pull, + pullVerbose, pullWithoutHistory, - pullSilent, + pull, pushExhaustive, pullExhaustive, createPullRequest, From 4ef0563a6629193e9a26c4354025f05e8128e15c Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 21 Dec 2022 11:32:20 -0500 Subject: [PATCH 045/467] fix misplaced early return --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index f175d105d..97dfc87f9 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1970,15 +1970,15 @@ handlePushToUnisonShare remote@WriteShareRemotePath {server, repo, path = remote let checkAndSetPush :: Maybe Hash32 -> Cli () checkAndSetPush remoteHash = when (Just (Hash32.fromHash (unCausalHash localCausalHash)) /= remoteHash) do - Cli.with withEntitiesUploadedProgressCallback \uploadedCallback -> do - let push = + let push = + Cli.with withEntitiesUploadedProgressCallback \uploadedCallback -> do Share.checkAndSetPush baseURL sharePath remoteHash localCausalHash uploadedCallback - push & onLeftM (pushError ShareErrorCheckAndSetPush) + push & onLeftM (pushError ShareErrorCheckAndSetPush) case behavior of PushBehavior.ForcePush -> do From e1ba6ed9a8d7be24b8fc3d7620efb67b7acfbfd1 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 21 Dec 2022 11:43:59 -0500 Subject: [PATCH 046/467] cleanups from code review --- .../src/Unison/Codebase/Editor/HandleInput.hs | 37 +++++-------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index e1e276c2e..c519558d1 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1860,36 +1860,17 @@ handleIOTest main = do Cli.label \returnMatches -> do -- First, look at the terms in the latest typechecked file for a name-match. whenJustM Cli.getLatestTypecheckedFile \typecheckedFile -> do - let refToType :: Reference -> Type Symbol Ann - refToType ref = - typecheckedFile - & UF.indexByReference - & fst - -- These two unsafe functions are actually safe: - -- 1. We can assert ref is actually a Reference.Id because it came from the latest typechecked file. - -- 2. The reference has to be in this map because we got it from the file itself. - & (Map.! (Reference.unsafeId ref)) - & snd - let matches :: [(TermReference, Type Symbol Ann)] - matches = - typecheckedFile - & UF.typecheckedToNames - & (\names -> Names.refTermsHQNamed names main) - & Set.toList - & map (\r -> (r, refToType r)) - - -- If 1+ matches (which we know will be exactly 1, since you can't have two definitions in a scratch file with - -- the same name), then return them. Otherwise, fall through to looking up in the codebase. - when (not (null matches)) (returnMatches matches) + whenJust (HQ.toName main) \mainName -> + whenJust (Map.lookup (Name.toVar mainName) (UF.hashTermsId typecheckedFile)) \(ref, _wk, _term, typ) -> + returnMatches [(Reference.fromId ref, typ)] -- Then, if we get here (because nothing in the scratch file matched), look at the terms in the codebase. - fmap catMaybes do - Cli.runTransaction do - for (Set.toList (NamesWithHistory.lookupHQTerm main parseNames)) \ref0 -> - runMaybeT do - ref <- MaybeT (pure (Referent.toTermReference ref0)) - typ <- MaybeT (loadTypeOfTerm codebase (Referent.Ref ref)) - pure (ref, typ) + Cli.runTransaction do + forMaybe (Set.toList (NamesWithHistory.lookupHQTerm main parseNames)) \ref0 -> + runMaybeT do + ref <- MaybeT (pure (Referent.toTermReference ref0)) + typ <- MaybeT (loadTypeOfTerm codebase (Referent.Ref ref)) + pure (ref, typ) ref <- case matches of From 4e215336499733a54d0c636faebe221226bdca36 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 21 Dec 2022 11:50:09 -0500 Subject: [PATCH 047/467] add all-base-hashes.md transcript --- .../transcripts-using-base/all-base-hashes.md | 5 + .../all-base-hashes.output.md | 2682 +++++++++++++++++ 2 files changed, 2687 insertions(+) create mode 100644 unison-src/transcripts-using-base/all-base-hashes.md create mode 100644 unison-src/transcripts-using-base/all-base-hashes.output.md diff --git a/unison-src/transcripts-using-base/all-base-hashes.md b/unison-src/transcripts-using-base/all-base-hashes.md new file mode 100644 index 000000000..d7050cb77 --- /dev/null +++ b/unison-src/transcripts-using-base/all-base-hashes.md @@ -0,0 +1,5 @@ +This transcript is intended to make visible accidental changes to the hashing algorithm. + +```ucm +.> find.verbose +``` diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md new file mode 100644 index 000000000..3bcdd2a8a --- /dev/null +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -0,0 +1,2682 @@ +This transcript is intended to make visible accidental changes to the hashing algorithm. + +```ucm +.> find.verbose + + 1. -- #0moj6a30dak6suns8qefi93ljsl8j59ha9bpcu8qbmh49rbobik4bn9m4rre8sm7pprsistr9o5m4a667i82gs089eur75ua8geldj8 + ascii : Text -> Bytes + + 2. -- #8gr403lgh2aq58nj3tfgc6bek1hqlv3he0hge0nlperojc99tdjg2cfdbu0vko5a4mp7jqt08npk4fa8grbbdu9fn47s0qmp1oa0aqo + autoCleaned : '{IO, TempDirs} r ->{IO, Exception} r + + 3. -- #lf7arjlkufc078rdqh1653j7ft4tt59b1deugc513p21kep0kj1cp7q7v43o6u8csoi172pt27i2mtu2unsv1au7g0ue52s5pmamjk0 + autoCleaned.handler : '{IO} (Request {TempDirs} r + ->{IO, Exception} r) + + 4. -- #fajcv3ki8h80htov5pu2beu6f9d5dqsr0he47jssjvivgcpo2n1mqmbh7e0plv5cuqte3kjg18ken8gv1kmtpppkjjein4rr7a50ep8 + bContains : [(a, b)] -> a -> Boolean + + 5. -- #js3u40odrqs74lpcqjoemr1b08cbu7co41sf0ubp7gq3eaohl72db3khi0p1neqtmk2ede9f00n07no0kju13i7tliopsgsm69nh38o + bInsert : [(a, b)] -> a -> b -> [(a, b)] + + 6. -- #avou19csadtmkejvdovufstrhtsbvnauqan05o9na0kqo7jon7ql05f7ooccbv777k68jj56ufufthp1cjd0jvium7j2ghrlpghnh58 + bSearch : [(a, b)] -> a -> Optional b + + 7. -- #ps5jpme6lr6fgv1a3cjmd4tpqr62pg3flmunkhcu9creojv2hsmei86nb6nndiam5p4q79nlerddrgto5um4ugm0p9evb8isoqu9ur0 + bSort : [(a, b)] -> [(a, b)] + + 8. -- #vb7eo70iavak378net6hohjkosud6ooabo1j0dev8l7254ls2j48f4e8gmk46d4016l41tpe7k8gqjqtb84g0gdc93vrh8bh4d62nf8 + bSplit : [(a, b)] -> a -> ([(a, b)], [(a, b)]) + + 9. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0 + unique type builtin.ANSI.Color + + 10. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#0 + builtin.ANSI.Color.Black : Color + + 11. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#4 + builtin.ANSI.Color.Blue : Color + + 12. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#8 + builtin.ANSI.Color.BrightBlack : Color + + 13. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#12 + builtin.ANSI.Color.BrightBlue : Color + + 14. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#14 + builtin.ANSI.Color.BrightCyan : Color + + 15. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#10 + builtin.ANSI.Color.BrightGreen : Color + + 16. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#13 + builtin.ANSI.Color.BrightMagenta : Color + + 17. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#9 + builtin.ANSI.Color.BrightRed : Color + + 18. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#15 + builtin.ANSI.Color.BrightWhite : Color + + 19. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#11 + builtin.ANSI.Color.BrightYellow : Color + + 20. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#6 + builtin.ANSI.Color.Cyan : Color + + 21. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#2 + builtin.ANSI.Color.Green : Color + + 22. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#5 + builtin.ANSI.Color.Magenta : Color + + 23. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#1 + builtin.ANSI.Color.Red : Color + + 24. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#7 + builtin.ANSI.Color.White : Color + + 25. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0#3 + builtin.ANSI.Color.Yellow : Color + + 26. -- ##Any + builtin type builtin.Any + + 27. -- ##Any.Any + builtin.Any.Any : a -> Any + + 28. -- ##Any.unsafeExtract + builtin.Any.unsafeExtract : Any -> a + + 29. -- #345f3nptqq1c1ped6gq8578kb2bhp1jejnqborsn6fq59rpe1rren3ogia9o9u8oc339vll953inma8pocc686ooknaitud8i5m27vg + unique type builtin.Author + + 30. -- #345f3nptqq1c1ped6gq8578kb2bhp1jejnqborsn6fq59rpe1rren3ogia9o9u8oc339vll953inma8pocc686ooknaitud8i5m27vg#0 + builtin.Author.Author : GUID -> Text -> Author + + 31. -- #09po4pftofof2dl6r5ddr5ucjmbiktvg139pjueica5ncrmbq6irin52tm83mu02r59dbktv7d550ik53bbgvue1qvdbvses746s0f0 + builtin.Author.guid : Author -> GUID + + 32. -- #adci09ncqjm7nle4v7irv1skla5q05glhsf2ld2b6cbre33ej7hbvf64deng8o5edv16vm0cat18ehj384gk4u9il7g6v4e7spgisuo + builtin.Author.guid.modify : (GUID ->{g} GUID) + -> Author + ->{g} Author + + 33. -- #5grcsob7l7dh440he3dibln7m628t4lregtv718vsb33mehvs72muugusuuajc8m804659h0e989dnks2adqr1vb8fnd912854t6nv0 + builtin.Author.guid.set : GUID -> Author -> Author + + 34. -- #vm19g9c23c3g186nkmreodqckso1belvfeb3bhbnfe4kfpjnq4bbo91le6bndfq5761eovt7rind30sp74fs1eqo44ukqmr96ggk1jg + builtin.Author.name : Author -> Text + + 35. -- #9udtng9ee5kq8bkq0fte4a4oknjl5h7tg8i6olebmgvat864n9q5k8cf7kpmtbhpdi9js0egpihprgt22v949bff4523h39noopeepo + builtin.Author.name.modify : (Text ->{g} Text) + -> Author + ->{g} Author + + 36. -- #v7l3vi93crov1681dom6fv17825dpf8rd1q4lpjdr6bn9ltsfliiertoju3rftvdubhn3n8lpf7vtfrmo3p9v47n5in98dq1aosnmq0 + builtin.Author.name.set : Text -> Author -> Author + + 37. -- ##Boolean + builtin type builtin.Boolean + + 38. -- ##Boolean.not + builtin.Boolean.not : Boolean -> Boolean + + 39. -- ##bug + builtin.bug : a -> b + + 40. -- ##Bytes + builtin type builtin.Bytes + + 41. -- ##Bytes.++ + builtin.Bytes.++ : Bytes -> Bytes -> Bytes + + 42. -- ##Bytes.at + builtin.Bytes.at : Nat -> Bytes -> Optional Nat + + 43. -- ##Bytes.decodeNat16be + builtin.Bytes.decodeNat16be : Bytes + -> Optional (Nat, Bytes) + + 44. -- ##Bytes.decodeNat16le + builtin.Bytes.decodeNat16le : Bytes + -> Optional (Nat, Bytes) + + 45. -- ##Bytes.decodeNat32be + builtin.Bytes.decodeNat32be : Bytes + -> Optional (Nat, Bytes) + + 46. -- ##Bytes.decodeNat32le + builtin.Bytes.decodeNat32le : Bytes + -> Optional (Nat, Bytes) + + 47. -- ##Bytes.decodeNat64be + builtin.Bytes.decodeNat64be : Bytes + -> Optional (Nat, Bytes) + + 48. -- ##Bytes.decodeNat64le + builtin.Bytes.decodeNat64le : Bytes + -> Optional (Nat, Bytes) + + 49. -- ##Bytes.drop + builtin.Bytes.drop : Nat -> Bytes -> Bytes + + 50. -- ##Bytes.empty + builtin.Bytes.empty : Bytes + + 51. -- ##Bytes.encodeNat16be + builtin.Bytes.encodeNat16be : Nat -> Bytes + + 52. -- ##Bytes.encodeNat16le + builtin.Bytes.encodeNat16le : Nat -> Bytes + + 53. -- ##Bytes.encodeNat32be + builtin.Bytes.encodeNat32be : Nat -> Bytes + + 54. -- ##Bytes.encodeNat32le + builtin.Bytes.encodeNat32le : Nat -> Bytes + + 55. -- ##Bytes.encodeNat64be + builtin.Bytes.encodeNat64be : Nat -> Bytes + + 56. -- ##Bytes.encodeNat64le + builtin.Bytes.encodeNat64le : Nat -> Bytes + + 57. -- ##Bytes.flatten + builtin.Bytes.flatten : Bytes -> Bytes + + 58. -- ##Bytes.fromBase16 + builtin.Bytes.fromBase16 : Bytes -> Either Text Bytes + + 59. -- ##Bytes.fromBase32 + builtin.Bytes.fromBase32 : Bytes -> Either Text Bytes + + 60. -- ##Bytes.fromBase64 + builtin.Bytes.fromBase64 : Bytes -> Either Text Bytes + + 61. -- ##Bytes.fromBase64UrlUnpadded + builtin.Bytes.fromBase64UrlUnpadded : Bytes + -> Either Text Bytes + + 62. -- ##Bytes.fromList + builtin.Bytes.fromList : [Nat] -> Bytes + + 63. -- ##Bytes.gzip.compress + builtin.Bytes.gzip.compress : Bytes -> Bytes + + 64. -- ##Bytes.gzip.decompress + builtin.Bytes.gzip.decompress : Bytes + -> Either Text Bytes + + 65. -- ##Bytes.size + builtin.Bytes.size : Bytes -> Nat + + 66. -- ##Bytes.take + builtin.Bytes.take : Nat -> Bytes -> Bytes + + 67. -- ##Bytes.toBase16 + builtin.Bytes.toBase16 : Bytes -> Bytes + + 68. -- ##Bytes.toBase32 + builtin.Bytes.toBase32 : Bytes -> Bytes + + 69. -- ##Bytes.toBase64 + builtin.Bytes.toBase64 : Bytes -> Bytes + + 70. -- ##Bytes.toBase64UrlUnpadded + builtin.Bytes.toBase64UrlUnpadded : Bytes -> Bytes + + 71. -- ##Bytes.toList + builtin.Bytes.toList : Bytes -> [Nat] + + 72. -- ##Bytes.zlib.compress + builtin.Bytes.zlib.compress : Bytes -> Bytes + + 73. -- ##Bytes.zlib.decompress + builtin.Bytes.zlib.decompress : Bytes + -> Either Text Bytes + + 74. -- ##Char + builtin type builtin.Char + + 75. -- ##Char.fromNat + builtin.Char.fromNat : Nat -> Char + + 76. -- ##Char.toNat + builtin.Char.toNat : Char -> Nat + + 77. -- ##Char.toText + builtin.Char.toText : Char -> Text + + 78. -- ##Code + builtin type builtin.Code + + 79. -- ##Code.cache_ + builtin.Code.cache_ : [(Link.Term, Code)] + ->{IO} [Link.Term] + + 80. -- ##Code.dependencies + builtin.Code.dependencies : Code -> [Link.Term] + + 81. -- ##Code.deserialize + builtin.Code.deserialize : Bytes -> Either Text Code + + 82. -- ##Code.display + builtin.Code.display : Text -> Code -> Text + + 83. -- ##Code.isMissing + builtin.Code.isMissing : Link.Term ->{IO} Boolean + + 84. -- ##Code.lookup + builtin.Code.lookup : Link.Term ->{IO} Optional Code + + 85. -- ##Code.serialize + builtin.Code.serialize : Code -> Bytes + + 86. -- ##Code.validate + builtin.Code.validate : [(Link.Term, Code)] + ->{IO} Optional Failure + + 87. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0 + unique type builtin.ConsoleText + + 88. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#5 + builtin.ConsoleText.Background : Color + -> ConsoleText + -> ConsoleText + + 89. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#0 + builtin.ConsoleText.Bold : ConsoleText -> ConsoleText + + 90. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#4 + builtin.ConsoleText.Foreground : Color + -> ConsoleText + -> ConsoleText + + 91. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#2 + builtin.ConsoleText.Invert : ConsoleText -> ConsoleText + + 92. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#3 + builtin.ConsoleText.Plain : Text -> ConsoleText + + 93. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#1 + builtin.ConsoleText.Underline : ConsoleText + -> ConsoleText + + 94. -- #pgornst1pqaea8qmf8ckbtvrm7f6hn49djhffgebajmo12faf4jku63ftc9fp0r4k58e0qcdi77g08f34b2ihvsu97s48du6mfn7vko + unique type builtin.CopyrightHolder + + 95. -- #pgornst1pqaea8qmf8ckbtvrm7f6hn49djhffgebajmo12faf4jku63ftc9fp0r4k58e0qcdi77g08f34b2ihvsu97s48du6mfn7vko#0 + builtin.CopyrightHolder.CopyrightHolder : GUID + -> Text + -> CopyrightHolder + + 96. -- #9jpkv5bb0d680ffs4f2j4lntj54m1iq9kaei8foqv5973i04jq9fugbn9msmpeiorjh4umhdeak625u53hejkvkm3buruj33msd1p6g + builtin.CopyrightHolder.guid : CopyrightHolder -> GUID + + 97. -- #6fhjsi02lnhvotndl6ufqnnsv20f3b9b4eg45n0rgo96m8f21dpqe5erb2dtn9nhdlp028vkock07r0foqune3jojhcrnmti9srsmdg + builtin.CopyrightHolder.guid.modify : (GUID ->{g} GUID) + -> CopyrightHolder + ->{g} CopyrightHolder + + 98. -- #1lk04okan4prc9kkh7julshv5l2q331pa5tf5f0ghm7ob5vkep3t6dnqejc8aju4i2vob6b5seliccer3a1kmtq4481i36alivhgdr0 + builtin.CopyrightHolder.guid.set : GUID + -> CopyrightHolder + -> CopyrightHolder + + 99. -- #u1k741o71gg743tr5o7fc3joeqdm14qkd58cf2h2tmkpejr2uj3qhclvugqsgoighd7o4ijlrp17i6iadgsuhhhb56vi4j22i6c2lbo + builtin.CopyrightHolder.name : CopyrightHolder -> Text + + 100. -- #3845ei99ci6p7dh3bcsctodd0otjtsntik5n0q7fpafo3s7v45a8nl7mk6ae7qot87jr9p4q3857tm4jtvmkb4s3rtn77t7goaphmf8 + builtin.CopyrightHolder.name.modify : (Text ->{g} Text) + -> CopyrightHolder + ->{g} CopyrightHolder + + 101. -- #2ehufgpsgnd2jq0i1topsir6dvv2m132dp2phs2bncnm6n9qrf7oaod6pbmvs9muihlq9dckpnughb3pajrmit7chdr67qco6tsd8j0 + builtin.CopyrightHolder.name.set : Text + -> CopyrightHolder + -> CopyrightHolder + + 102. -- ##crypto.hash + builtin.crypto.hash : HashAlgorithm -> a -> Bytes + + 103. -- ##crypto.HashAlgorithm + builtin type builtin.crypto.HashAlgorithm + + 104. -- ##crypto.HashAlgorithm.Blake2b_256 + builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm + + 105. -- ##crypto.HashAlgorithm.Blake2b_512 + builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm + + 106. -- ##crypto.HashAlgorithm.Blake2s_256 + builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm + + 107. -- ##crypto.HashAlgorithm.Sha1 + builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm + + 108. -- ##crypto.HashAlgorithm.Sha2_256 + builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + + 109. -- ##crypto.HashAlgorithm.Sha2_512 + builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + + 110. -- ##crypto.HashAlgorithm.Sha3_256 + builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + + 111. -- ##crypto.HashAlgorithm.Sha3_512 + builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + + 112. -- ##crypto.hashBytes + builtin.crypto.hashBytes : HashAlgorithm + -> Bytes + -> Bytes + + 113. -- ##crypto.hmac + builtin.crypto.hmac : HashAlgorithm + -> Bytes + -> a + -> Bytes + + 114. -- ##crypto.hmacBytes + builtin.crypto.hmacBytes : HashAlgorithm + -> Bytes + -> Bytes + -> Bytes + + 115. -- ##Debug.trace + builtin.Debug.trace : Text -> a -> () + + 116. -- ##Debug.watch + builtin.Debug.watch : Text -> a -> a + + 117. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8 + unique type builtin.Doc + + 118. -- #baiqeiovdrs4ju0grn5q5akq64k4kuhgifqno52smkkttqg31jkgm3qa9o3ohe54fgpiigd1tj0an7rfveopfg622sjj9v9g44n27go + builtin.Doc.++ : Doc2 -> Doc2 -> Doc2 + + 119. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#0 + builtin.Doc.Blob : Text -> Doc + + 120. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#4 + builtin.Doc.Evaluate : Link.Term -> Doc + + 121. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#5 + builtin.Doc.Join : [Doc] -> Doc + + 122. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#1 + builtin.Doc.Link : Link -> Doc + + 123. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#3 + builtin.Doc.Signature : Link.Term -> Doc + + 124. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#2 + builtin.Doc.Source : Link -> Doc + + 125. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0 + unique type builtin.Doc2 + + 126. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#27 + builtin.Doc2.Anchor : Text -> Doc2 -> Doc2 + + 127. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#11 + builtin.Doc2.Aside : Doc2 -> Doc2 + + 128. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#15 + builtin.Doc2.Blankline : Doc2 + + 129. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#10 + builtin.Doc2.Blockquote : Doc2 -> Doc2 + + 130. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#7 + builtin.Doc2.Bold : Doc2 -> Doc2 + + 131. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#21 + builtin.Doc2.BulletedList : [Doc2] -> Doc2 + + 132. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#3 + builtin.Doc2.Callout : Optional Doc2 -> Doc2 -> Doc2 + + 133. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#6 + builtin.Doc2.Code : Doc2 -> Doc2 + + 134. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#25 + builtin.Doc2.CodeBlock : Text -> Doc2 -> Doc2 + + 135. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#24 + builtin.Doc2.Column : [Doc2] -> Doc2 + + 136. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#0 + builtin.Doc2.Folded : Boolean -> Doc2 -> Doc2 -> Doc2 + + 137. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68 + unique type builtin.Doc2.FrontMatter + + 138. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68#0 + builtin.Doc2.FrontMatter.FrontMatter : [(Text, Text)] + -> FrontMatter + + 139. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#12 + builtin.Doc2.Group : Doc2 -> Doc2 + + 140. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#14 + builtin.Doc2.Image : Doc2 + -> Doc2 + -> Optional Doc2 + -> Doc2 + + 141. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#8 + builtin.Doc2.Italic : Doc2 -> Doc2 + + 142. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 + builtin.Doc2.Join : [Doc2] -> Doc2 + + 143. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 + builtin.Doc2.Linebreak : Doc2 + + 144. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 + unique type builtin.Doc2.MediaSource + + 145. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 + builtin.Doc2.MediaSource.MediaSource : Text + -> Optional Text + -> MediaSource + + 146. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so + builtin.Doc2.MediaSource.mimeType : MediaSource + -> Optional Text + + 147. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg + builtin.Doc2.MediaSource.mimeType.modify : (Optional Text + ->{g} Optional Text) + -> MediaSource + ->{g} MediaSource + + 148. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 + builtin.Doc2.MediaSource.mimeType.set : Optional Text + -> MediaSource + -> MediaSource + + 149. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg + builtin.Doc2.MediaSource.sourceUrl : MediaSource -> Text + + 150. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 + builtin.Doc2.MediaSource.sourceUrl.modify : (Text + ->{g} Text) + -> MediaSource + ->{g} MediaSource + + 151. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo + builtin.Doc2.MediaSource.sourceUrl.set : Text + -> MediaSource + -> MediaSource + + 152. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 + builtin.Doc2.NamedLink : Doc2 -> Doc2 -> Doc2 + + 153. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 + builtin.Doc2.NumberedList : Nat -> [Doc2] -> Doc2 + + 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 + builtin.Doc2.Paragraph : [Doc2] -> Doc2 + + 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 + builtin.Doc2.Section : Doc2 -> [Doc2] -> Doc2 + + 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 + builtin.Doc2.SectionBreak : Doc2 + + 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 + builtin.Doc2.Special : SpecialForm -> Doc2 + + 158. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 + unique type builtin.Doc2.SpecialForm + + 159. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 + builtin.Doc2.SpecialForm.Embed : Any -> SpecialForm + + 160. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 + builtin.Doc2.SpecialForm.EmbedInline : Any -> SpecialForm + + 161. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 + builtin.Doc2.SpecialForm.Eval : Doc2.Term -> SpecialForm + + 162. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 + builtin.Doc2.SpecialForm.EvalInline : Doc2.Term + -> SpecialForm + + 163. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 + builtin.Doc2.SpecialForm.Example : Nat + -> Doc2.Term + -> SpecialForm + + 164. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 + builtin.Doc2.SpecialForm.ExampleBlock : Nat + -> Doc2.Term + -> SpecialForm + + 165. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 + builtin.Doc2.SpecialForm.FoldedSource : [( Either + Type Doc2.Term, + [Doc2.Term])] + -> SpecialForm + + 166. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 + builtin.Doc2.SpecialForm.Link : Either Type Doc2.Term + -> SpecialForm + + 167. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 + builtin.Doc2.SpecialForm.Signature : [Doc2.Term] + -> SpecialForm + + 168. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 + builtin.Doc2.SpecialForm.SignatureInline : Doc2.Term + -> SpecialForm + + 169. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 + builtin.Doc2.SpecialForm.Source : [( Either + Type Doc2.Term, + [Doc2.Term])] + -> SpecialForm + + 170. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 + builtin.Doc2.Strikethrough : Doc2 -> Doc2 + + 171. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 + builtin.Doc2.Style : Text -> Doc2 -> Doc2 + + 172. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 + builtin.Doc2.Table : [[Doc2]] -> Doc2 + + 173. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg + unique type builtin.Doc2.Term + + 174. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 + builtin.Doc2.term : '{g} a -> Doc2.Term + + 175. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 + builtin.Doc2.Term.Term : Any -> Doc2.Term + + 176. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 + builtin.Doc2.Tooltip : Doc2 -> Doc2 -> Doc2 + + 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 + builtin.Doc2.UntitledSection : [Doc2] -> Doc2 + + 178. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 + unique type builtin.Doc2.Video + + 179. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 + builtin.Doc2.Video.config : Video -> [(Text, Text)] + + 180. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g + builtin.Doc2.Video.config.modify : ([(Text, Text)] + ->{g} [(Text, Text)]) + -> Video + ->{g} Video + + 181. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 + builtin.Doc2.Video.config.set : [(Text, Text)] + -> Video + -> Video + + 182. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o + builtin.Doc2.Video.sources : Video -> [MediaSource] + + 183. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo + builtin.Doc2.Video.sources.modify : ([MediaSource] + ->{g} [MediaSource]) + -> Video + ->{g} Video + + 184. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 + builtin.Doc2.Video.sources.set : [MediaSource] + -> Video + -> Video + + 185. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 + builtin.Doc2.Video.Video : [MediaSource] + -> [(Text, Text)] + -> Video + + 186. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 + builtin.Doc2.Word : Text -> Doc2 + + 187. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 + structural type builtin.Either a b + + 188. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 + builtin.Either.Left : a -> Either a b + + 189. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g + builtin.Either.mapRight : (a ->{g} b) + -> Either e a + ->{g} Either e b + + 190. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 + builtin.Either.Right : b -> Either a b + + 191. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + structural ability builtin.Exception + structural ability Exception + + 192. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + builtin.Exception.raise, + Exception.raise : Failure + ->{Exception} x + + 193. -- ##Float + builtin type builtin.Float + + 194. -- ##Float.* + builtin.Float.* : Float -> Float -> Float + + 195. -- ##Float.+ + builtin.Float.+ : Float -> Float -> Float + + 196. -- ##Float.- + builtin.Float.- : Float -> Float -> Float + + 197. -- ##Float./ + builtin.Float./ : Float -> Float -> Float + + 198. -- ##Float.abs + builtin.Float.abs : Float -> Float + + 199. -- ##Float.acos + builtin.Float.acos : Float -> Float + + 200. -- ##Float.acosh + builtin.Float.acosh : Float -> Float + + 201. -- ##Float.asin + builtin.Float.asin : Float -> Float + + 202. -- ##Float.asinh + builtin.Float.asinh : Float -> Float + + 203. -- ##Float.atan + builtin.Float.atan : Float -> Float + + 204. -- ##Float.atan2 + builtin.Float.atan2 : Float -> Float -> Float + + 205. -- ##Float.atanh + builtin.Float.atanh : Float -> Float + + 206. -- ##Float.ceiling + builtin.Float.ceiling : Float -> Int + + 207. -- ##Float.cos + builtin.Float.cos : Float -> Float + + 208. -- ##Float.cosh + builtin.Float.cosh : Float -> Float + + 209. -- ##Float.== + builtin.Float.eq : Float -> Float -> Boolean + + 210. -- ##Float.exp + builtin.Float.exp : Float -> Float + + 211. -- ##Float.floor + builtin.Float.floor : Float -> Int + + 212. -- ##Float.fromRepresentation + builtin.Float.fromRepresentation : Nat -> Float + + 213. -- ##Float.fromText + builtin.Float.fromText : Text -> Optional Float + + 214. -- ##Float.> + builtin.Float.gt : Float -> Float -> Boolean + + 215. -- ##Float.>= + builtin.Float.gteq : Float -> Float -> Boolean + + 216. -- ##Float.log + builtin.Float.log : Float -> Float + + 217. -- ##Float.logBase + builtin.Float.logBase : Float -> Float -> Float + + 218. -- ##Float.< + builtin.Float.lt : Float -> Float -> Boolean + + 219. -- ##Float.<= + builtin.Float.lteq : Float -> Float -> Boolean + + 220. -- ##Float.max + builtin.Float.max : Float -> Float -> Float + + 221. -- ##Float.min + builtin.Float.min : Float -> Float -> Float + + 222. -- ##Float.pow + builtin.Float.pow : Float -> Float -> Float + + 223. -- ##Float.round + builtin.Float.round : Float -> Int + + 224. -- ##Float.sin + builtin.Float.sin : Float -> Float + + 225. -- ##Float.sinh + builtin.Float.sinh : Float -> Float + + 226. -- ##Float.sqrt + builtin.Float.sqrt : Float -> Float + + 227. -- ##Float.tan + builtin.Float.tan : Float -> Float + + 228. -- ##Float.tanh + builtin.Float.tanh : Float -> Float + + 229. -- ##Float.toRepresentation + builtin.Float.toRepresentation : Float -> Nat + + 230. -- ##Float.toText + builtin.Float.toText : Float -> Text + + 231. -- ##Float.truncate + builtin.Float.truncate : Float -> Int + + 232. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 + unique type builtin.GUID + + 233. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 + builtin.GUID.GUID : Bytes -> GUID + + 234. -- ##Handle.toText + builtin.Handle.toText : Handle -> Text + + 235. -- ##ImmutableArray + builtin type builtin.ImmutableArray + + 236. -- ##ImmutableArray.copyTo! + builtin.ImmutableArray.copyTo! : MutableArray g a + -> Nat + -> ImmutableArray a + -> Nat + -> Nat + ->{g, Exception} () + + 237. -- ##ImmutableArray.read + builtin.ImmutableArray.read : ImmutableArray a + -> Nat + ->{Exception} a + + 238. -- ##ImmutableArray.size + builtin.ImmutableArray.size : ImmutableArray a -> Nat + + 239. -- ##ImmutableByteArray + builtin type builtin.ImmutableByteArray + + 240. -- ##ImmutableByteArray.copyTo! + builtin.ImmutableByteArray.copyTo! : MutableByteArray g + -> Nat + -> ImmutableByteArray + -> Nat + -> Nat + ->{g, Exception} () + + 241. -- ##ImmutableByteArray.read16be + builtin.ImmutableByteArray.read16be : ImmutableByteArray + -> Nat + ->{Exception} Nat + + 242. -- ##ImmutableByteArray.read24be + builtin.ImmutableByteArray.read24be : ImmutableByteArray + -> Nat + ->{Exception} Nat + + 243. -- ##ImmutableByteArray.read32be + builtin.ImmutableByteArray.read32be : ImmutableByteArray + -> Nat + ->{Exception} Nat + + 244. -- ##ImmutableByteArray.read40be + builtin.ImmutableByteArray.read40be : ImmutableByteArray + -> Nat + ->{Exception} Nat + + 245. -- ##ImmutableByteArray.read64be + builtin.ImmutableByteArray.read64be : ImmutableByteArray + -> Nat + ->{Exception} Nat + + 246. -- ##ImmutableByteArray.read8 + builtin.ImmutableByteArray.read8 : ImmutableByteArray + -> Nat + ->{Exception} Nat + + 247. -- ##ImmutableByteArray.size + builtin.ImmutableByteArray.size : ImmutableByteArray + -> Nat + + 248. -- ##Int + builtin type builtin.Int + + 249. -- ##Int.* + builtin.Int.* : Int -> Int -> Int + + 250. -- ##Int.+ + builtin.Int.+ : Int -> Int -> Int + + 251. -- ##Int.- + builtin.Int.- : Int -> Int -> Int + + 252. -- ##Int./ + builtin.Int./ : Int -> Int -> Int + + 253. -- ##Int.and + builtin.Int.and : Int -> Int -> Int + + 254. -- ##Int.complement + builtin.Int.complement : Int -> Int + + 255. -- ##Int.== + builtin.Int.eq : Int -> Int -> Boolean + + 256. -- ##Int.fromRepresentation + builtin.Int.fromRepresentation : Nat -> Int + + 257. -- ##Int.fromText + builtin.Int.fromText : Text -> Optional Int + + 258. -- ##Int.> + builtin.Int.gt : Int -> Int -> Boolean + + 259. -- ##Int.>= + builtin.Int.gteq : Int -> Int -> Boolean + + 260. -- ##Int.increment + builtin.Int.increment : Int -> Int + + 261. -- ##Int.isEven + builtin.Int.isEven : Int -> Boolean + + 262. -- ##Int.isOdd + builtin.Int.isOdd : Int -> Boolean + + 263. -- ##Int.leadingZeros + builtin.Int.leadingZeros : Int -> Nat + + 264. -- ##Int.< + builtin.Int.lt : Int -> Int -> Boolean + + 265. -- ##Int.<= + builtin.Int.lteq : Int -> Int -> Boolean + + 266. -- ##Int.mod + builtin.Int.mod : Int -> Int -> Int + + 267. -- ##Int.negate + builtin.Int.negate : Int -> Int + + 268. -- ##Int.or + builtin.Int.or : Int -> Int -> Int + + 269. -- ##Int.popCount + builtin.Int.popCount : Int -> Nat + + 270. -- ##Int.pow + builtin.Int.pow : Int -> Nat -> Int + + 271. -- ##Int.shiftLeft + builtin.Int.shiftLeft : Int -> Nat -> Int + + 272. -- ##Int.shiftRight + builtin.Int.shiftRight : Int -> Nat -> Int + + 273. -- ##Int.signum + builtin.Int.signum : Int -> Int + + 274. -- ##Int.toFloat + builtin.Int.toFloat : Int -> Float + + 275. -- ##Int.toRepresentation + builtin.Int.toRepresentation : Int -> Nat + + 276. -- ##Int.toText + builtin.Int.toText : Int -> Text + + 277. -- ##Int.trailingZeros + builtin.Int.trailingZeros : Int -> Nat + + 278. -- ##Int.truncate0 + builtin.Int.truncate0 : Int -> Nat + + 279. -- ##Int.xor + builtin.Int.xor : Int -> Int -> Int + + 280. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 + unique type builtin.io2.ArithmeticFailure + + 281. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag + unique type builtin.io2.ArrayFailure + + 282. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 + unique type builtin.io2.BufferMode + + 283. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 + builtin.io2.BufferMode.BlockBuffering : BufferMode + + 284. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 + builtin.io2.BufferMode.LineBuffering : BufferMode + + 285. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 + builtin.io2.BufferMode.NoBuffering : BufferMode + + 286. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 + builtin.io2.BufferMode.SizedBlockBuffering : Nat + -> BufferMode + + 287. -- ##Clock.internals.monotonic.v1 + builtin.io2.Clock.internals.monotonic : '{IO} Either + Failure TimeSpec + + 288. -- ##Clock.internals.nsec.v1 + builtin.io2.Clock.internals.nsec : TimeSpec -> Nat + + 289. -- ##Clock.internals.processCPUTime.v1 + builtin.io2.Clock.internals.processCPUTime : '{IO} Either + Failure TimeSpec + + 290. -- ##Clock.internals.realtime.v1 + builtin.io2.Clock.internals.realtime : '{IO} Either + Failure TimeSpec + + 291. -- ##Clock.internals.sec.v1 + builtin.io2.Clock.internals.sec : TimeSpec -> Int + + 292. -- ##Clock.internals.threadCPUTime.v1 + builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + Failure TimeSpec + + 293. -- ##TimeSpec + builtin type builtin.io2.Clock.internals.TimeSpec + + 294. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 + unique type builtin.io2.Failure + + 295. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 + builtin.io2.Failure.Failure : Type + -> Text + -> Any + -> Failure + + 296. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 + unique type builtin.io2.FileMode + + 297. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 + builtin.io2.FileMode.Append : FileMode + + 298. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 + builtin.io2.FileMode.Read : FileMode + + 299. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 + builtin.io2.FileMode.ReadWrite : FileMode + + 300. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 + builtin.io2.FileMode.Write : FileMode + + 301. -- ##Handle + builtin type builtin.io2.Handle + + 302. -- ##IO + builtin type builtin.io2.IO + + 303. -- ##IO.array + builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a + + 304. -- ##IO.arrayOf + builtin.io2.IO.arrayOf : a + -> Nat + ->{IO} MutableArray {IO} a + + 305. -- ##IO.bytearray + builtin.io2.IO.bytearray : Nat + ->{IO} MutableByteArray {IO} + + 306. -- ##IO.bytearrayOf + builtin.io2.IO.bytearrayOf : Nat + -> Nat + ->{IO} MutableByteArray {IO} + + 307. -- ##IO.clientSocket.impl.v3 + builtin.io2.IO.clientSocket.impl : Text + -> Text + ->{IO} Either Failure Socket + + 308. -- ##IO.closeFile.impl.v3 + builtin.io2.IO.closeFile.impl : Handle + ->{IO} Either Failure () + + 309. -- ##IO.closeSocket.impl.v3 + builtin.io2.IO.closeSocket.impl : Socket + ->{IO} Either Failure () + + 310. -- ##IO.createDirectory.impl.v3 + builtin.io2.IO.createDirectory.impl : Text + ->{IO} Either Failure () + + 311. -- ##IO.createTempDirectory.impl.v3 + builtin.io2.IO.createTempDirectory.impl : Text + ->{IO} Either Failure Text + + 312. -- ##IO.delay.impl.v3 + builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () + + 313. -- ##IO.directoryContents.impl.v3 + builtin.io2.IO.directoryContents.impl : Text + ->{IO} Either Failure [Text] + + 314. -- ##IO.fileExists.impl.v3 + builtin.io2.IO.fileExists.impl : Text + ->{IO} Either Failure Boolean + + 315. -- ##IO.forkComp.v2 + builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId + + 316. -- ##IO.getArgs.impl.v1 + builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] + + 317. -- ##IO.getBuffering.impl.v3 + builtin.io2.IO.getBuffering.impl : Handle + ->{IO} Either Failure BufferMode + + 318. -- ##IO.getBytes.impl.v3 + builtin.io2.IO.getBytes.impl : Handle + -> Nat + ->{IO} Either Failure Bytes + + 319. -- ##IO.getChar.impl.v1 + builtin.io2.IO.getChar.impl : Handle + ->{IO} Either Failure Char + + 320. -- ##IO.getCurrentDirectory.impl.v3 + builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either + Failure Text + + 321. -- ##IO.getEcho.impl.v1 + builtin.io2.IO.getEcho.impl : Handle + ->{IO} Either Failure Boolean + + 322. -- ##IO.getEnv.impl.v1 + builtin.io2.IO.getEnv.impl : Text + ->{IO} Either Failure Text + + 323. -- ##IO.getFileSize.impl.v3 + builtin.io2.IO.getFileSize.impl : Text + ->{IO} Either Failure Nat + + 324. -- ##IO.getFileTimestamp.impl.v3 + builtin.io2.IO.getFileTimestamp.impl : Text + ->{IO} Either Failure Nat + + 325. -- ##IO.getLine.impl.v1 + builtin.io2.IO.getLine.impl : Handle + ->{IO} Either Failure Text + + 326. -- ##IO.getSomeBytes.impl.v1 + builtin.io2.IO.getSomeBytes.impl : Handle + -> Nat + ->{IO} Either Failure Bytes + + 327. -- ##IO.getTempDirectory.impl.v3 + builtin.io2.IO.getTempDirectory.impl : '{IO} Either + Failure Text + + 328. -- ##IO.handlePosition.impl.v3 + builtin.io2.IO.handlePosition.impl : Handle + ->{IO} Either Failure Nat + + 329. -- ##IO.isDirectory.impl.v3 + builtin.io2.IO.isDirectory.impl : Text + ->{IO} Either Failure Boolean + + 330. -- ##IO.isFileEOF.impl.v3 + builtin.io2.IO.isFileEOF.impl : Handle + ->{IO} Either Failure Boolean + + 331. -- ##IO.isFileOpen.impl.v3 + builtin.io2.IO.isFileOpen.impl : Handle + ->{IO} Either Failure Boolean + + 332. -- ##IO.isSeekable.impl.v3 + builtin.io2.IO.isSeekable.impl : Handle + ->{IO} Either Failure Boolean + + 333. -- ##IO.kill.impl.v3 + builtin.io2.IO.kill.impl : ThreadId + ->{IO} Either Failure () + + 334. -- ##IO.listen.impl.v3 + builtin.io2.IO.listen.impl : Socket + ->{IO} Either Failure () + + 335. -- ##IO.openFile.impl.v3 + builtin.io2.IO.openFile.impl : Text + -> FileMode + ->{IO} Either Failure Handle + + 336. -- ##IO.putBytes.impl.v3 + builtin.io2.IO.putBytes.impl : Handle + -> Bytes + ->{IO} Either Failure () + + 337. -- ##IO.ready.impl.v1 + builtin.io2.IO.ready.impl : Handle + ->{IO} Either Failure Boolean + + 338. -- ##IO.ref + builtin.io2.IO.ref : a ->{IO} Ref {IO} a + + 339. -- ##IO.removeDirectory.impl.v3 + builtin.io2.IO.removeDirectory.impl : Text + ->{IO} Either Failure () + + 340. -- ##IO.removeFile.impl.v3 + builtin.io2.IO.removeFile.impl : Text + ->{IO} Either Failure () + + 341. -- ##IO.renameDirectory.impl.v3 + builtin.io2.IO.renameDirectory.impl : Text + -> Text + ->{IO} Either Failure () + + 342. -- ##IO.renameFile.impl.v3 + builtin.io2.IO.renameFile.impl : Text + -> Text + ->{IO} Either Failure () + + 343. -- ##IO.seekHandle.impl.v3 + builtin.io2.IO.seekHandle.impl : Handle + -> SeekMode + -> Int + ->{IO} Either Failure () + + 344. -- ##IO.serverSocket.impl.v3 + builtin.io2.IO.serverSocket.impl : Optional Text + -> Text + ->{IO} Either Failure Socket + + 345. -- ##IO.setBuffering.impl.v3 + builtin.io2.IO.setBuffering.impl : Handle + -> BufferMode + ->{IO} Either Failure () + + 346. -- ##IO.setCurrentDirectory.impl.v3 + builtin.io2.IO.setCurrentDirectory.impl : Text + ->{IO} Either Failure () + + 347. -- ##IO.setEcho.impl.v1 + builtin.io2.IO.setEcho.impl : Handle + -> Boolean + ->{IO} Either Failure () + + 348. -- ##IO.socketAccept.impl.v3 + builtin.io2.IO.socketAccept.impl : Socket + ->{IO} Either Failure Socket + + 349. -- ##IO.socketPort.impl.v3 + builtin.io2.IO.socketPort.impl : Socket + ->{IO} Either Failure Nat + + 350. -- ##IO.socketReceive.impl.v3 + builtin.io2.IO.socketReceive.impl : Socket + -> Nat + ->{IO} Either Failure Bytes + + 351. -- ##IO.socketSend.impl.v3 + builtin.io2.IO.socketSend.impl : Socket + -> Bytes + ->{IO} Either Failure () + + 352. -- ##IO.stdHandle + builtin.io2.IO.stdHandle : StdHandle -> Handle + + 353. -- ##IO.systemTime.impl.v3 + builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat + + 354. -- ##IO.systemTimeMicroseconds.v1 + builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + + 355. -- ##IO.tryEval + builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a + + 356. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 + unique type builtin.io2.IOError + + 357. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 + builtin.io2.IOError.AlreadyExists : IOError + + 358. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 + builtin.io2.IOError.EOF : IOError + + 359. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 + builtin.io2.IOError.IllegalOperation : IOError + + 360. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 + builtin.io2.IOError.NoSuchThing : IOError + + 361. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 + builtin.io2.IOError.PermissionDenied : IOError + + 362. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 + builtin.io2.IOError.ResourceBusy : IOError + + 363. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 + builtin.io2.IOError.ResourceExhausted : IOError + + 364. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 + builtin.io2.IOError.UserError : IOError + + 365. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g + unique type builtin.io2.IOFailure + + 366. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg + unique type builtin.io2.MiscFailure + + 367. -- ##MVar + builtin type builtin.io2.MVar + + 368. -- ##MVar.isEmpty + builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean + + 369. -- ##MVar.new + builtin.io2.MVar.new : a ->{IO} MVar a + + 370. -- ##MVar.newEmpty.v2 + builtin.io2.MVar.newEmpty : '{IO} MVar a + + 371. -- ##MVar.put.impl.v3 + builtin.io2.MVar.put.impl : MVar a + -> a + ->{IO} Either Failure () + + 372. -- ##MVar.read.impl.v3 + builtin.io2.MVar.read.impl : MVar a + ->{IO} Either Failure a + + 373. -- ##MVar.swap.impl.v3 + builtin.io2.MVar.swap.impl : MVar a + -> a + ->{IO} Either Failure a + + 374. -- ##MVar.take.impl.v3 + builtin.io2.MVar.take.impl : MVar a + ->{IO} Either Failure a + + 375. -- ##MVar.tryPut.impl.v3 + builtin.io2.MVar.tryPut.impl : MVar a + -> a + ->{IO} Either Failure Boolean + + 376. -- ##MVar.tryRead.impl.v3 + builtin.io2.MVar.tryRead.impl : MVar a + ->{IO} Either Failure (Optional a) + + 377. -- ##MVar.tryTake + builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a + + 378. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 + unique type builtin.io2.RuntimeFailure + + 379. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 + unique type builtin.io2.SeekMode + + 380. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 + builtin.io2.SeekMode.AbsoluteSeek : SeekMode + + 381. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 + builtin.io2.SeekMode.RelativeSeek : SeekMode + + 382. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 + builtin.io2.SeekMode.SeekFromEnd : SeekMode + + 383. -- ##Socket + builtin type builtin.io2.Socket + + 384. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 + unique type builtin.io2.StdHandle + + 385. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 + builtin.io2.StdHandle.StdErr : StdHandle + + 386. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 + builtin.io2.StdHandle.StdIn : StdHandle + + 387. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 + builtin.io2.StdHandle.StdOut : StdHandle + + 388. -- ##STM + builtin type builtin.io2.STM + + 389. -- ##STM.atomically + builtin.io2.STM.atomically : '{STM} a ->{IO} a + + 390. -- ##STM.retry + builtin.io2.STM.retry : '{STM} a + + 391. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g + unique type builtin.io2.STMFailure + + 392. -- ##ThreadId + builtin type builtin.io2.ThreadId + + 393. -- ##Tls + builtin type builtin.io2.Tls + + 394. -- ##Tls.Cipher + builtin type builtin.io2.Tls.Cipher + + 395. -- ##Tls.ClientConfig + builtin type builtin.io2.Tls.ClientConfig + + 396. -- ##Tls.ClientConfig.certificates.set + builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + -> ClientConfig + -> ClientConfig + + 397. -- ##TLS.ClientConfig.ciphers.set + builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + -> ClientConfig + -> ClientConfig + + 398. -- ##Tls.ClientConfig.default + builtin.io2.Tls.ClientConfig.default : Text + -> Bytes + -> ClientConfig + + 399. -- ##Tls.ClientConfig.versions.set + builtin.io2.Tls.ClientConfig.versions.set : [Version] + -> ClientConfig + -> ClientConfig + + 400. -- ##Tls.decodeCert.impl.v3 + builtin.io2.Tls.decodeCert.impl : Bytes + -> Either Failure SignedCert + + 401. -- ##Tls.decodePrivateKey + builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] + + 402. -- ##Tls.encodeCert + builtin.io2.Tls.encodeCert : SignedCert -> Bytes + + 403. -- ##Tls.encodePrivateKey + builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes + + 404. -- ##Tls.handshake.impl.v3 + builtin.io2.Tls.handshake.impl : Tls + ->{IO} Either Failure () + + 405. -- ##Tls.newClient.impl.v3 + builtin.io2.Tls.newClient.impl : ClientConfig + -> Socket + ->{IO} Either Failure Tls + + 406. -- ##Tls.newServer.impl.v3 + builtin.io2.Tls.newServer.impl : ServerConfig + -> Socket + ->{IO} Either Failure Tls + + 407. -- ##Tls.PrivateKey + builtin type builtin.io2.Tls.PrivateKey + + 408. -- ##Tls.receive.impl.v3 + builtin.io2.Tls.receive.impl : Tls + ->{IO} Either Failure Bytes + + 409. -- ##Tls.send.impl.v3 + builtin.io2.Tls.send.impl : Tls + -> Bytes + ->{IO} Either Failure () + + 410. -- ##Tls.ServerConfig + builtin type builtin.io2.Tls.ServerConfig + + 411. -- ##Tls.ServerConfig.certificates.set + builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + -> ServerConfig + -> ServerConfig + + 412. -- ##Tls.ServerConfig.ciphers.set + builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + -> ServerConfig + -> ServerConfig + + 413. -- ##Tls.ServerConfig.default + builtin.io2.Tls.ServerConfig.default : [SignedCert] + -> PrivateKey + -> ServerConfig + + 414. -- ##Tls.ServerConfig.versions.set + builtin.io2.Tls.ServerConfig.versions.set : [Version] + -> ServerConfig + -> ServerConfig + + 415. -- ##Tls.SignedCert + builtin type builtin.io2.Tls.SignedCert + + 416. -- ##Tls.terminate.impl.v3 + builtin.io2.Tls.terminate.impl : Tls + ->{IO} Either Failure () + + 417. -- ##Tls.Version + builtin type builtin.io2.Tls.Version + + 418. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + unique type builtin.io2.TlsFailure + + 419. -- ##TVar + builtin type builtin.io2.TVar + + 420. -- ##TVar.new + builtin.io2.TVar.new : a ->{STM} TVar a + + 421. -- ##TVar.newIO + builtin.io2.TVar.newIO : a ->{IO} TVar a + + 422. -- ##TVar.read + builtin.io2.TVar.read : TVar a ->{STM} a + + 423. -- ##TVar.readIO + builtin.io2.TVar.readIO : TVar a ->{IO} a + + 424. -- ##TVar.swap + builtin.io2.TVar.swap : TVar a -> a ->{STM} a + + 425. -- ##TVar.write + builtin.io2.TVar.write : TVar a -> a ->{STM} () + + 426. -- ##validateSandboxed + builtin.io2.validateSandboxed : [Link.Term] + -> a + -> Boolean + + 427. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + unique type builtin.IsPropagated + + 428. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + builtin.IsPropagated.IsPropagated : IsPropagated + + 429. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + unique type builtin.IsTest + + 430. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + builtin.IsTest.IsTest : IsTest + + 431. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + unique type builtin.License + + 432. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + builtin.License.copyrightHolders : License + -> [CopyrightHolder] + + 433. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + builtin.License.copyrightHolders.modify : ([CopyrightHolder] + ->{g} [CopyrightHolder]) + -> License + ->{g} License + + 434. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + builtin.License.copyrightHolders.set : [CopyrightHolder] + -> License + -> License + + 435. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + builtin.License.License : [CopyrightHolder] + -> [Year] + -> LicenseType + -> License + + 436. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + builtin.License.licenseType : License -> LicenseType + + 437. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + builtin.License.licenseType.modify : (LicenseType + ->{g} LicenseType) + -> License + ->{g} License + + 438. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + builtin.License.licenseType.set : LicenseType + -> License + -> License + + 439. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + builtin.License.years : License -> [Year] + + 440. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + builtin.License.years.modify : ([Year] ->{g} [Year]) + -> License + ->{g} License + + 441. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + builtin.License.years.set : [Year] -> License -> License + + 442. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + unique type builtin.LicenseType + + 443. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + builtin.LicenseType.LicenseType : Doc -> LicenseType + + 444. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + unique type builtin.Link + + 445. -- ##Link.Term + builtin type builtin.Link.Term + + 446. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + builtin.Link.Term : Link.Term -> Link + + 447. -- ##Link.Term.toText + builtin.Link.Term.toText : Link.Term -> Text + + 448. -- ##Link.Type + builtin type builtin.Link.Type + + 449. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + builtin.Link.Type : Type -> Link + + 450. -- ##Sequence + builtin type builtin.List + + 451. -- ##List.++ + builtin.List.++ : [a] -> [a] -> [a] + + 452. -- ##List.cons + builtin.List.+:, builtin.List.cons : a -> [a] -> [a] + + 453. -- ##List.snoc + builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] + + 454. -- ##List.at + builtin.List.at : Nat -> [a] -> Optional a + + 455. -- ##List.cons + builtin.List.cons, builtin.List.+: : a -> [a] -> [a] + + 456. -- ##List.drop + builtin.List.drop : Nat -> [a] -> [a] + + 457. -- ##List.empty + builtin.List.empty : [a] + + 458. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] + + 459. -- ##List.size + builtin.List.size : [a] -> Nat + + 460. -- ##List.snoc + builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] + + 461. -- ##List.take + builtin.List.take : Nat -> [a] -> [a] + + 462. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + builtin.metadata.isPropagated : IsPropagated + + 463. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + builtin.metadata.isTest : IsTest + + 464. -- ##MutableArray + builtin type builtin.MutableArray + + 465. -- ##MutableArray.copyTo! + builtin.MutableArray.copyTo! : MutableArray g a + -> Nat + -> MutableArray g a + -> Nat + -> Nat + ->{g, Exception} () + + 466. -- ##MutableArray.freeze + builtin.MutableArray.freeze : MutableArray g a + -> Nat + -> Nat + ->{g} ImmutableArray a + + 467. -- ##MutableArray.freeze! + builtin.MutableArray.freeze! : MutableArray g a + ->{g} ImmutableArray a + + 468. -- ##MutableArray.read + builtin.MutableArray.read : MutableArray g a + -> Nat + ->{g, Exception} a + + 469. -- ##MutableArray.size + builtin.MutableArray.size : MutableArray g a -> Nat + + 470. -- ##MutableArray.write + builtin.MutableArray.write : MutableArray g a + -> Nat + -> a + ->{g, Exception} () + + 471. -- ##MutableByteArray + builtin type builtin.MutableByteArray + + 472. -- ##MutableByteArray.copyTo! + builtin.MutableByteArray.copyTo! : MutableByteArray g + -> Nat + -> MutableByteArray g + -> Nat + -> Nat + ->{g, Exception} () + + 473. -- ##MutableByteArray.freeze + builtin.MutableByteArray.freeze : MutableByteArray g + -> Nat + -> Nat + ->{g} ImmutableByteArray + + 474. -- ##MutableByteArray.freeze! + builtin.MutableByteArray.freeze! : MutableByteArray g + ->{g} ImmutableByteArray + + 475. -- ##MutableByteArray.read16be + builtin.MutableByteArray.read16be : MutableByteArray g + -> Nat + ->{g, Exception} Nat + + 476. -- ##MutableByteArray.read24be + builtin.MutableByteArray.read24be : MutableByteArray g + -> Nat + ->{g, Exception} Nat + + 477. -- ##MutableByteArray.read32be + builtin.MutableByteArray.read32be : MutableByteArray g + -> Nat + ->{g, Exception} Nat + + 478. -- ##MutableByteArray.read40be + builtin.MutableByteArray.read40be : MutableByteArray g + -> Nat + ->{g, Exception} Nat + + 479. -- ##MutableByteArray.read64be + builtin.MutableByteArray.read64be : MutableByteArray g + -> Nat + ->{g, Exception} Nat + + 480. -- ##MutableByteArray.read8 + builtin.MutableByteArray.read8 : MutableByteArray g + -> Nat + ->{g, Exception} Nat + + 481. -- ##MutableByteArray.size + builtin.MutableByteArray.size : MutableByteArray g -> Nat + + 482. -- ##MutableByteArray.write16be + builtin.MutableByteArray.write16be : MutableByteArray g + -> Nat + -> Nat + ->{g, Exception} () + + 483. -- ##MutableByteArray.write32be + builtin.MutableByteArray.write32be : MutableByteArray g + -> Nat + -> Nat + ->{g, Exception} () + + 484. -- ##MutableByteArray.write64be + builtin.MutableByteArray.write64be : MutableByteArray g + -> Nat + -> Nat + ->{g, Exception} () + + 485. -- ##MutableByteArray.write8 + builtin.MutableByteArray.write8 : MutableByteArray g + -> Nat + -> Nat + ->{g, Exception} () + + 486. -- ##Nat + builtin type builtin.Nat + + 487. -- ##Nat.* + builtin.Nat.* : Nat -> Nat -> Nat + + 488. -- ##Nat.+ + builtin.Nat.+ : Nat -> Nat -> Nat + + 489. -- ##Nat./ + builtin.Nat./ : Nat -> Nat -> Nat + + 490. -- ##Nat.and + builtin.Nat.and : Nat -> Nat -> Nat + + 491. -- ##Nat.complement + builtin.Nat.complement : Nat -> Nat + + 492. -- ##Nat.drop + builtin.Nat.drop : Nat -> Nat -> Nat + + 493. -- ##Nat.== + builtin.Nat.eq : Nat -> Nat -> Boolean + + 494. -- ##Nat.fromText + builtin.Nat.fromText : Text -> Optional Nat + + 495. -- ##Nat.> + builtin.Nat.gt : Nat -> Nat -> Boolean + + 496. -- ##Nat.>= + builtin.Nat.gteq : Nat -> Nat -> Boolean + + 497. -- ##Nat.increment + builtin.Nat.increment : Nat -> Nat + + 498. -- ##Nat.isEven + builtin.Nat.isEven : Nat -> Boolean + + 499. -- ##Nat.isOdd + builtin.Nat.isOdd : Nat -> Boolean + + 500. -- ##Nat.leadingZeros + builtin.Nat.leadingZeros : Nat -> Nat + + 501. -- ##Nat.< + builtin.Nat.lt : Nat -> Nat -> Boolean + + 502. -- ##Nat.<= + builtin.Nat.lteq : Nat -> Nat -> Boolean + + 503. -- ##Nat.mod + builtin.Nat.mod : Nat -> Nat -> Nat + + 504. -- ##Nat.or + builtin.Nat.or : Nat -> Nat -> Nat + + 505. -- ##Nat.popCount + builtin.Nat.popCount : Nat -> Nat + + 506. -- ##Nat.pow + builtin.Nat.pow : Nat -> Nat -> Nat + + 507. -- ##Nat.shiftLeft + builtin.Nat.shiftLeft : Nat -> Nat -> Nat + + 508. -- ##Nat.shiftRight + builtin.Nat.shiftRight : Nat -> Nat -> Nat + + 509. -- ##Nat.sub + builtin.Nat.sub : Nat -> Nat -> Int + + 510. -- ##Nat.toFloat + builtin.Nat.toFloat : Nat -> Float + + 511. -- ##Nat.toInt + builtin.Nat.toInt : Nat -> Int + + 512. -- ##Nat.toText + builtin.Nat.toText : Nat -> Text + + 513. -- ##Nat.trailingZeros + builtin.Nat.trailingZeros : Nat -> Nat + + 514. -- ##Nat.xor + builtin.Nat.xor : Nat -> Nat -> Nat + + 515. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + structural type builtin.Optional a + + 516. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + builtin.Optional.None : Optional a + + 517. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + builtin.Optional.Some : a -> Optional a + + 518. -- ##Pattern + builtin type builtin.Pattern + + 519. -- ##Pattern.capture + builtin.Pattern.capture : Pattern a -> Pattern a + + 520. -- ##Pattern.isMatch + builtin.Pattern.isMatch : Pattern a -> a -> Boolean + + 521. -- ##Pattern.join + builtin.Pattern.join : [Pattern a] -> Pattern a + + 522. -- ##Pattern.many + builtin.Pattern.many : Pattern a -> Pattern a + + 523. -- ##Pattern.or + builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a + + 524. -- ##Pattern.replicate + builtin.Pattern.replicate : Nat + -> Nat + -> Pattern a + -> Pattern a + + 525. -- ##Pattern.run + builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) + + 526. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + structural type builtin.Pretty txt + + 527. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + unique type builtin.Pretty.Annotated w txt + + 528. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + builtin.Pretty.Annotated.Append : w + -> [Annotated w txt] + -> Annotated w txt + + 529. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + builtin.Pretty.Annotated.Empty : Annotated w txt + + 530. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + builtin.Pretty.Annotated.Group : w + -> Annotated w txt + -> Annotated w txt + + 531. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + builtin.Pretty.Annotated.Indent : w + -> Annotated w txt + -> Annotated w txt + -> Annotated w txt + -> Annotated w txt + + 532. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + builtin.Pretty.Annotated.Lit : w + -> txt + -> Annotated w txt + + 533. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + builtin.Pretty.Annotated.OrElse : w + -> Annotated w txt + -> Annotated w txt + -> Annotated w txt + + 534. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + builtin.Pretty.Annotated.Table : w + -> [[Annotated w txt]] + -> Annotated w txt + + 535. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + builtin.Pretty.Annotated.Wrap : w + -> Annotated w txt + -> Annotated w txt + + 536. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + builtin.Pretty.append : Pretty txt + -> Pretty txt + -> Pretty txt + + 537. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + builtin.Pretty.empty : Pretty txt + + 538. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + builtin.Pretty.get : Pretty txt -> Annotated () txt + + 539. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + builtin.Pretty.group : Pretty txt -> Pretty txt + + 540. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + builtin.Pretty.indent : Pretty txt + -> Pretty txt + -> Pretty txt + + 541. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + builtin.Pretty.indent' : Pretty txt + -> Pretty txt + -> Pretty txt + -> Pretty txt + + 542. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + builtin.Pretty.join : [Pretty txt] -> Pretty txt + + 543. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + builtin.Pretty.lit : txt -> Pretty txt + + 544. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + builtin.Pretty.map : (txt ->{g} txt2) + -> Pretty txt + ->{g} Pretty txt2 + + 545. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + builtin.Pretty.orElse : Pretty txt + -> Pretty txt + -> Pretty txt + + 546. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + builtin.Pretty.Pretty : Annotated () txt -> Pretty txt + + 547. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + builtin.Pretty.sepBy : Pretty txt + -> [Pretty txt] + -> Pretty txt + + 548. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + builtin.Pretty.table : [[Pretty txt]] -> Pretty txt + + 549. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + builtin.Pretty.wrap : Pretty txt -> Pretty txt + + 550. -- ##Ref + builtin type builtin.Ref + + 551. -- ##Ref.read + builtin.Ref.read : Ref g a ->{g} a + + 552. -- ##Ref.write + builtin.Ref.write : Ref g a -> a ->{g} () + + 553. -- ##Effect + builtin type builtin.Request + + 554. -- ##Scope + builtin type builtin.Scope + + 555. -- ##Scope.array + builtin.Scope.array : Nat + ->{Scope s} MutableArray (Scope s) a + + 556. -- ##Scope.arrayOf + builtin.Scope.arrayOf : a + -> Nat + ->{Scope s} MutableArray (Scope s) a + + 557. -- ##Scope.bytearray + builtin.Scope.bytearray : Nat + ->{Scope s} MutableByteArray (Scope s) + + 558. -- ##Scope.bytearrayOf + builtin.Scope.bytearrayOf : Nat + -> Nat + ->{Scope s} MutableByteArray (Scope s) + + 559. -- ##Scope.ref + builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a + + 560. -- ##Scope.run + builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r + + 561. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + structural type builtin.SeqView a b + + 562. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + builtin.SeqView.VElem : a -> b -> SeqView a b + + 563. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + builtin.SeqView.VEmpty : SeqView a b + + 564. -- ##Socket.toText + builtin.Socket.toText : Socket -> Text + + 565. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + builtin.syntax.docAside : Doc2 -> Doc2 + + 566. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + builtin.syntax.docBlockquote : Doc2 -> Doc2 + + 567. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + builtin.syntax.docBold : Doc2 -> Doc2 + + 568. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + builtin.syntax.docBulletedList : [Doc2] -> Doc2 + + 569. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 + + 570. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + builtin.syntax.docCode : Doc2 -> Doc2 + + 571. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + builtin.syntax.docCodeBlock : Text -> Text -> Doc2 + + 572. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + builtin.syntax.docColumn : [Doc2] -> Doc2 + + 573. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term + + 574. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + builtin.syntax.docEmbedAnnotations : tms -> tms + + 575. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + builtin.syntax.docEmbedSignatureLink : '{g} t + -> Doc2.Term + + 576. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + builtin.syntax.docEmbedTermLink : '{g} t + -> Either a Doc2.Term + + 577. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + builtin.syntax.docEmbedTypeLink : typ -> Either typ b + + 578. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + builtin.syntax.docEval : 'a -> Doc2 + + 579. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + builtin.syntax.docEvalInline : 'a -> Doc2 + + 580. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + builtin.syntax.docExample : Nat -> '{g} t -> Doc2 + + 581. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 + + 582. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, + [Doc2.Term])] + -> Doc2 + + 583. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + builtin.syntax.docFormatConsole : Doc2 + -> Pretty (Either SpecialForm ConsoleText) + + 584. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + builtin.syntax.docGroup : Doc2 -> Doc2 + + 585. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + builtin.syntax.docItalic : Doc2 -> Doc2 + + 586. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + builtin.syntax.docJoin : [Doc2] -> Doc2 + + 587. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 + + 588. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 + + 589. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 + + 590. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + builtin.syntax.docParagraph : [Doc2] -> Doc2 + + 591. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 + + 592. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + builtin.syntax.docSignature : [Doc2.Term] -> Doc2 + + 593. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 + + 594. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + builtin.syntax.docSource : [( Either Type Doc2.Term, + [Doc2.Term])] + -> Doc2 + + 595. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + builtin.syntax.docSourceElement : link + -> annotations + -> (link, annotations) + + 596. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + builtin.syntax.docStrikethrough : Doc2 -> Doc2 + + 597. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + builtin.syntax.docTable : [[Doc2]] -> Doc2 + + 598. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 + + 599. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + builtin.syntax.docTransclude : d -> d + + 600. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + builtin.syntax.docUntitledSection : [Doc2] -> Doc2 + + 601. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + builtin.syntax.docVerbatim : Doc2 -> Doc2 + + 602. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + builtin.syntax.docWord : Text -> Doc2 + + 603. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + unique type builtin.Test.Result + + 604. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + builtin.Test.Result.Fail : Text -> Result + + 605. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + builtin.Test.Result.Ok : Text -> Result + + 606. -- ##Text + builtin type builtin.Text + + 607. -- ##Text.!= + builtin.Text.!= : Text -> Text -> Boolean + + 608. -- ##Text.++ + builtin.Text.++ : Text -> Text -> Text + + 609. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text + + 610. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + builtin.Text.alignRightWith : Nat -> Char -> Text -> Text + + 611. -- ##Text.drop + builtin.Text.drop : Nat -> Text -> Text + + 612. -- ##Text.empty + builtin.Text.empty : Text + + 613. -- ##Text.== + builtin.Text.eq : Text -> Text -> Boolean + + 614. -- ##Text.fromCharList + builtin.Text.fromCharList : [Char] -> Text + + 615. -- ##Text.fromUtf8.impl.v3 + builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text + + 616. -- ##Text.> + builtin.Text.gt : Text -> Text -> Boolean + + 617. -- ##Text.>= + builtin.Text.gteq : Text -> Text -> Boolean + + 618. -- ##Text.< + builtin.Text.lt : Text -> Text -> Boolean + + 619. -- ##Text.<= + builtin.Text.lteq : Text -> Text -> Boolean + + 620. -- ##Text.patterns.anyChar + builtin.Text.patterns.anyChar : Pattern Text + + 621. -- ##Text.patterns.charIn + builtin.Text.patterns.charIn : [Char] -> Pattern Text + + 622. -- ##Text.patterns.charRange + builtin.Text.patterns.charRange : Char + -> Char + -> Pattern Text + + 623. -- ##Text.patterns.digit + builtin.Text.patterns.digit : Pattern Text + + 624. -- ##Text.patterns.eof + builtin.Text.patterns.eof : Pattern Text + + 625. -- ##Text.patterns.letter + builtin.Text.patterns.letter : Pattern Text + + 626. -- ##Text.patterns.literal + builtin.Text.patterns.literal : Text -> Pattern Text + + 627. -- ##Text.patterns.notCharIn + builtin.Text.patterns.notCharIn : [Char] -> Pattern Text + + 628. -- ##Text.patterns.notCharRange + builtin.Text.patterns.notCharRange : Char + -> Char + -> Pattern Text + + 629. -- ##Text.patterns.punctuation + builtin.Text.patterns.punctuation : Pattern Text + + 630. -- ##Text.patterns.space + builtin.Text.patterns.space : Pattern Text + + 631. -- ##Text.repeat + builtin.Text.repeat : Nat -> Text -> Text + + 632. -- ##Text.reverse + builtin.Text.reverse : Text -> Text + + 633. -- ##Text.size + builtin.Text.size : Text -> Nat + + 634. -- ##Text.take + builtin.Text.take : Nat -> Text -> Text + + 635. -- ##Text.toCharList + builtin.Text.toCharList : Text -> [Char] + + 636. -- ##Text.toLowercase + builtin.Text.toLowercase : Text -> Text + + 637. -- ##Text.toUppercase + builtin.Text.toUppercase : Text -> Text + + 638. -- ##Text.toUtf8 + builtin.Text.toUtf8 : Text -> Bytes + + 639. -- ##Text.uncons + builtin.Text.uncons : Text -> Optional (Char, Text) + + 640. -- ##Text.unsnoc + builtin.Text.unsnoc : Text -> Optional (Text, Char) + + 641. -- ##ThreadId.toText + builtin.ThreadId.toText : ThreadId -> Text + + 642. -- ##todo + builtin.todo : a -> b + + 643. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + structural type builtin.Tuple a b + + 644. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + builtin.Tuple.Cons : a -> b -> Tuple a b + + 645. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + structural type builtin.Unit + + 646. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + builtin.Unit.Unit : () + + 647. -- ##Universal.< + builtin.Universal.< : a -> a -> Boolean + + 648. -- ##Universal.<= + builtin.Universal.<= : a -> a -> Boolean + + 649. -- ##Universal.== + builtin.Universal.== : a -> a -> Boolean + + 650. -- ##Universal.> + builtin.Universal.> : a -> a -> Boolean + + 651. -- ##Universal.>= + builtin.Universal.>= : a -> a -> Boolean + + 652. -- ##Universal.compare + builtin.Universal.compare : a -> a -> Int + + 653. -- ##unsafe.coerceAbilities + builtin.unsafe.coerceAbilities : (a ->{e1} b) + -> a + ->{e2} b + + 654. -- ##Value + builtin type builtin.Value + + 655. -- ##Value.dependencies + builtin.Value.dependencies : Value -> [Link.Term] + + 656. -- ##Value.deserialize + builtin.Value.deserialize : Bytes -> Either Text Value + + 657. -- ##Value.load + builtin.Value.load : Value ->{IO} Either [Link.Term] a + + 658. -- ##Value.serialize + builtin.Value.serialize : Value -> Bytes + + 659. -- ##Value.value + builtin.Value.value : a -> Value + + 660. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + unique type builtin.Year + + 661. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + builtin.Year.Year : Nat -> Year + + 662. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + cache : [(Link.Term, Code)] ->{IO, Exception} () + + 663. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + check : Text -> Boolean ->{Stream Result} () + + 664. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + checks : [Boolean] -> [Result] + + 665. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + clientSocket : Text -> Text ->{IO, Exception} Socket + + 666. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + closeFile : Handle ->{IO, Exception} () + + 667. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + closeSocket : Socket ->{IO, Exception} () + + 668. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + Code.transitiveDeps : Link.Term + ->{IO} [(Link.Term, Code)] + + 669. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + compose : ∀ o g1 i1 g i. + (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o + + 670. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + compose2 : ∀ o g2 i2 g1 g i i1. + (i2 ->{g2} o) + -> (i1 ->{g1} i ->{g} i2) + -> i1 + -> i + ->{g2, g1, g} o + + 671. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. + (i3 ->{g3} o) + -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) + -> i2 + -> i1 + -> i + ->{g3, g2, g1, g} o + + 672. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + contains : Text -> Text -> Boolean + + 673. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + crawl : [(Link.Term, Code)] + -> [Link.Term] + ->{IO} [(Link.Term, Code)] + + 674. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + createTempDirectory : Text ->{IO, Exception} Text + + 675. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + decodeCert : Bytes ->{Exception} SignedCert + + 676. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + delay : Nat ->{IO, Exception} () + + 677. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + directoryContents : Text ->{IO, Exception} [Text] + + 678. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + Either.isLeft : Either a b -> Boolean + + 679. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + Either.mapLeft : (i ->{g} o) + -> Either i b + ->{g} Either o b + + 680. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + Either.raiseMessage : v -> Either Text b ->{Exception} b + + 681. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + evalTest : '{IO, TempDirs, Exception, Stream Result} a + ->{IO, Exception} ([Result], a) + + 682. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + structural ability Exception + structural ability builtin.Exception + + 683. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + Exception.catch : '{g, Exception} a + ->{g} Either Failure a + + 684. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + Exception.failure : Text -> a -> Failure + + 685. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + Exception.raise, + builtin.Exception.raise : Failure + ->{Exception} x + + 686. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + Exception.reraise : Either Failure a ->{Exception} a + + 687. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + Exception.toEither : '{ε, Exception} a + ->{ε} Either Failure a + + 688. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + Exception.toEither.handler : Request {Exception} a + -> Either Failure a + + 689. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + Exception.unsafeRun! : '{g, Exception} a ->{g} a + + 690. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + expect : Text + -> (a -> a -> Boolean) + -> a + -> a + ->{Stream Result} () + + 691. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + expectU : Text -> a -> a ->{Stream Result} () + + 692. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + fail : Text -> b ->{Exception} c + + 693. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + fileExists : Text ->{IO, Exception} Boolean + + 694. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + fromB32 : Bytes ->{Exception} Bytes + + 695. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + fromHex : Text -> Bytes + + 696. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + getBuffering : Handle ->{IO, Exception} BufferMode + + 697. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + getBytes : Handle -> Nat ->{IO, Exception} Bytes + + 698. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + getChar : Handle ->{IO, Exception} Char + + 699. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + getEcho : Handle ->{IO, Exception} Boolean + + 700. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + getLine : Handle ->{IO, Exception} Text + + 701. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes + + 702. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + getTempDirectory : '{IO, Exception} Text + + 703. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + handlePosition : Handle ->{IO, Exception} Nat + + 704. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + handshake : Tls ->{IO, Exception} () + + 705. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + hex : Bytes -> Text + + 706. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + id : a -> a + + 707. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + isDirectory : Text ->{IO, Exception} Boolean + + 708. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + isFileEOF : Handle ->{IO, Exception} Boolean + + 709. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + isFileOpen : Handle ->{IO, Exception} Boolean + + 710. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + isNone : Optional a -> Boolean + + 711. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + isSeekable : Handle ->{IO, Exception} Boolean + + 712. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean + + 713. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] + + 714. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b + + 715. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + List.forEach : [a] -> (a ->{e} ()) ->{e} () + + 716. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + listen : Socket ->{IO, Exception} () + + 717. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + loadCodeBytes : Bytes ->{Exception} Code + + 718. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + loadSelfContained : Text ->{IO, Exception} a + + 719. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + loadValueBytes : Bytes + ->{IO, Exception} ([(Link.Term, Code)], Value) + + 720. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + MVar.put : MVar i -> i ->{IO, Exception} () + + 721. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + MVar.read : MVar o ->{IO, Exception} o + + 722. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + MVar.swap : MVar o -> o ->{IO, Exception} o + + 723. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + MVar.take : MVar o ->{IO, Exception} o + + 724. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + newClient : ClientConfig -> Socket ->{IO, Exception} Tls + + 725. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + newServer : ServerConfig -> Socket ->{IO, Exception} Tls + + 726. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + openFile : Text -> FileMode ->{IO, Exception} Handle + + 727. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + printLine : Text ->{IO, Exception} () + + 728. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + printText : Text ->{IO} Either Failure () + + 729. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + putBytes : Handle -> Bytes ->{IO, Exception} () + + 730. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + readFile : Text ->{IO, Exception} Bytes + + 731. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + ready : Handle ->{IO, Exception} Boolean + + 732. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + receive : Tls ->{IO, Exception} Bytes + + 733. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + removeDirectory : Text ->{IO, Exception} () + + 734. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + renameDirectory : Text -> Text ->{IO, Exception} () + + 735. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + runTest : '{IO, TempDirs, Exception, Stream Result} a + ->{IO} [Result] + + 736. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + saveSelfContained : a -> Text ->{IO, Exception} () + + 737. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + saveTestCase : Text + -> (a -> Text) + -> a + ->{IO, Exception} () + + 738. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + seekHandle : Handle + -> SeekMode + -> Int + ->{IO, Exception} () + + 739. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + send : Tls -> Bytes ->{IO, Exception} () + + 740. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + serverSocket : Optional Text + -> Text + ->{IO, Exception} Socket + + 741. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + setBuffering : Handle -> BufferMode ->{IO, Exception} () + + 742. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + setEcho : Handle -> Boolean ->{IO, Exception} () + + 743. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + snd : ∀ a a1. (a1, a) -> a + + 744. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + socketAccept : Socket ->{IO, Exception} Socket + + 745. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + socketPort : Socket ->{IO, Exception} Nat + + 746. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + startsWith : Text -> Text -> Boolean + + 747. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + stdout : Handle + + 748. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + structural ability Stream a + + 749. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + Stream.collect : '{e, Stream a} r ->{e} ([a], r) + + 750. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + Stream.collect.handler : Request {Stream a} r -> ([a], r) + + 751. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + Stream.emit : a ->{Stream a} () + + 752. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + Stream.toList : '{Stream a} r -> [a] + + 753. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + Stream.toList.handler : Request {Stream a} r -> [a] + + 754. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + systemTime : '{IO, Exception} Nat + + 755. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + structural ability TempDirs + + 756. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + TempDirs.newTempDir : Text ->{TempDirs} Text + + 757. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + TempDirs.removeDir : Text ->{TempDirs} () + + 758. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + terminate : Tls ->{IO, Exception} () + + 759. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + testAutoClean : '{IO} [Result] + + 760. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + Text.fromUtf8 : Bytes ->{Exception} Text + + 761. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + structural ability Throw e + + 762. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + Throw.throw : e ->{Throw e} a + + 763. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + uncurry : ∀ o g1 i g i1. + (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o + + 764. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] + + 765. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + void : x -> () + + 766. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + writeFile : Text -> Bytes ->{IO, Exception} () + + 767. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + |> : a -> (a ->{g} t) ->{g} t + + + +``` From aeafe90c7e32d25b34fc1dbb0d7c355cdca288af Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 21 Dec 2022 12:20:14 -0500 Subject: [PATCH 048/467] delete unused Backticks lexeme --- unison-syntax/src/Unison/Syntax/Lexer.hs | 3 --- 1 file changed, 3 deletions(-) diff --git a/unison-syntax/src/Unison/Syntax/Lexer.hs b/unison-syntax/src/Unison/Syntax/Lexer.hs index 68f6ded23..e08b866d5 100644 --- a/unison-syntax/src/Unison/Syntax/Lexer.hs +++ b/unison-syntax/src/Unison/Syntax/Lexer.hs @@ -128,7 +128,6 @@ data Lexeme | Reserved String -- reserved tokens such as `{`, `(`, `type`, `of`, etc | Textual String -- text literals, `"foo bar"` | Character Char -- character literals, `?X` - | Backticks String (Maybe ShortHash) -- an identifier in backticks | WordyId String (Maybe ShortHash) -- a (non-infix) identifier | SymbolyId String (Maybe ShortHash) -- an infix identifier | Blank String -- a typed hole or placeholder @@ -1373,8 +1372,6 @@ instance P.VisualStream [Token Lexeme] where case showEscapeChar c of Just c -> "?\\" ++ [c] Nothing -> '?' : [c] - pretty (Backticks n h) = - '`' : n ++ (toList h >>= SH.toString) ++ ['`'] pretty (WordyId n h) = n ++ (toList h >>= SH.toString) pretty (SymbolyId n h) = n ++ (toList h >>= SH.toString) pretty (Blank s) = "_" ++ s From e5d9662c6c8802eecc63da2d6348e899d0d3ba8c Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 3 Jan 2023 14:17:46 -0600 Subject: [PATCH 049/467] Add Clear command (#3705) --- unison-cli/package.yaml | 1 + .../src/Unison/Codebase/Editor/HandleInput.hs | 2 ++ .../src/Unison/Codebase/Editor/Input.hs | 1 + .../src/Unison/Codebase/Editor/Output.hs | 2 ++ .../src/Unison/CommandLine/InputPatterns.hs | 19 +++++++++++++++++++ .../src/Unison/CommandLine/OutputMessages.hs | 5 +++++ unison-cli/unison-cli.cabal | 5 +++++ 7 files changed, 35 insertions(+) diff --git a/unison-cli/package.yaml b/unison-cli/package.yaml index 79091f0c2..376ef2cdf 100644 --- a/unison-cli/package.yaml +++ b/unison-cli/package.yaml @@ -14,6 +14,7 @@ dependencies: - ListLike - aeson - aeson-pretty + - ansi-terminal - async - base - bytes diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index c7edf8133..7197652a9 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1101,6 +1101,7 @@ loop e = do Cli.LoadError -> Cli.returnEarly $ SourceLoadFailed path Cli.LoadSuccess contents -> pure contents loadUnisonFile (Text.pack path) contents + ClearI -> Cli.respond ClearScreen AddI requestedNames -> do description <- inputDescription input let vars = Set.map Name.toVar requestedNames @@ -1591,6 +1592,7 @@ inputDescription input = ListDependentsI {} -> wat ListEditsI {} -> wat LoadI {} -> wat + ClearI {} -> pure "clear" NamesI {} -> wat NamespaceDependenciesI {} -> wat PopBranchI {} -> wat diff --git a/unison-cli/src/Unison/Codebase/Editor/Input.hs b/unison-cli/src/Unison/Codebase/Editor/Input.hs index 8f1a860ae..c662e0a72 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Input.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Input.hs @@ -129,6 +129,7 @@ data Input | ResolveTypeNameI Path.HQSplit' | -- edits stuff: LoadI (Maybe FilePath) + | ClearI | AddI (Set Name) | PreviewAddI (Set Name) | UpdateI OptionalPatch (Set Name) diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index dce3bfe9b..0395039f5 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -282,6 +282,7 @@ data Output | IntegrityCheck IntegrityResult | DisplayDebugNameDiff NameChanges | DisplayDebugCompletions [Completion.Completion] + | ClearScreen data DisplayDefinitionsOutput = DisplayDefinitionsOutput { isTest :: TermReference -> Bool, @@ -437,6 +438,7 @@ isFailure o = case o of ViewOnShare {} -> False DisplayDebugCompletions {} -> False DisplayDebugNameDiff {} -> False + ClearScreen -> False isNumberedFailure :: NumberedOutput -> Bool isNumberedFailure = \case diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index 07908a8ff..cb9126450 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -168,6 +168,24 @@ load = _ -> Left (I.help load) ) +clear :: InputPattern +clear = + InputPattern + "clear" + [] + I.Visible + [] + ( P.wrapColumn2 + [ ( makeExample' clear, + "Clears the screen." + ) + ] + ) + ( \case + [] -> pure $ Input.ClearI + _ -> Left (I.help clear) + ) + add :: InputPattern add = InputPattern @@ -2324,6 +2342,7 @@ validInputs = [ help, helpTopics, load, + clear, add, previewAdd, update, diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 84480fe12..dd56aaac8 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -30,6 +30,7 @@ import qualified Network.HTTP.Types as Http import Network.URI (URI) import qualified Network.URI.Encode as URI import qualified Servant.Client as Servant +import qualified System.Console.ANSI as ANSI import qualified System.Console.Haskeline.Completion as Completion import System.Directory ( canonicalizePath, @@ -1847,6 +1848,10 @@ notifyUser dir o = case o of else "" in (isCompleteTxt, P.string (Completion.replacement comp)) ) + ClearScreen -> do + ANSI.clearScreen + ANSI.setCursorPosition 0 0 + pure mempty where _nameChange _cmd _pastTenseCmd _oldName _newName _r = error "todo" expectedEmptyPushDest writeRemotePath = diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 42a64b438..7c59e5b8a 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -129,6 +129,7 @@ library , ListLike , aeson , aeson-pretty + , ansi-terminal , async , base , bytes @@ -253,6 +254,7 @@ executable cli-integration-tests , ListLike , aeson , aeson-pretty + , ansi-terminal , async , base , bytes @@ -373,6 +375,7 @@ executable transcripts , ListLike , aeson , aeson-pretty + , ansi-terminal , async , base , bytes @@ -499,6 +502,7 @@ executable unison , ListLike , aeson , aeson-pretty + , ansi-terminal , async , base , bytes @@ -631,6 +635,7 @@ test-suite cli-tests , ListLike , aeson , aeson-pretty + , ansi-terminal , async , base , bytes From f9aec0b8db24cf5f8b00048000422d1dc5f5b055 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Wed, 4 Jan 2023 10:36:21 -0500 Subject: [PATCH 050/467] Various scheme primop additions/fixes --- chez-libs/unison/primops.ss | 80 +++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 7 deletions(-) diff --git a/chez-libs/unison/primops.ss b/chez-libs/unison/primops.ss index bd54c585c..d7a1d96b8 100644 --- a/chez-libs/unison/primops.ss +++ b/chez-libs/unison/primops.ss @@ -39,6 +39,14 @@ unison-FOp-IO.stdHandle unison-FOp-IO.getArgs.impl.v1 + unison-FOp-ImmutableArray.copyTo! + unison-FOp-ImmutableArray.read + + unison-FOp-MutableArray.freeze! + unison-FOp-MutableArray.freeze + unison-FOp-MutableArray.read + unison-FOp-MutableArray.write + unison-FOp-ImmutableByteArray.copyTo! unison-FOp-ImmutableByteArray.read8 @@ -46,6 +54,7 @@ unison-FOp-MutableByteArray.write8 unison-FOp-Scope.bytearray + unison-FOp-Scope.array unison-POp-ADDN unison-POp-ANDN @@ -72,6 +81,7 @@ ; unison-POp-LKUP unison-POp-LZRO unison-POp-MULN + unison-POp-MODN unison-POp-NTOT unison-POp-PAKT unison-POp-SHLI @@ -98,6 +108,16 @@ (unison string) (unison bytevector)) + (define (reify-exn thunk) + (call/1cc + (lambda (k) + (with-exception-handler + (lambda (e) + (let-values ([(port result) (open-string-output-port)]) + (display-condition e port) + (k (list 0 '() (result) e)))) + thunk)))) + ; Core implemented primops, upon which primops-in-unison can be built. (define (unison-POp-ADDN m n) (fx+ m n)) (define (unison-POp-ANDN m n) (fxlogand m n)) @@ -124,12 +144,18 @@ (raise (g)))) (define (unison-POp-FTOT f) (number->istring f)) (define (unison-POp-IDXB n bs) (bytevector-u8-ref bs n)) - (define (unison-POp-IDXS n l) (list-ref l n)) + (define (unison-POp-IDXS n l) + (call/1cc + (lambda (k) + (with-exception-handler + (lambda (e) (list 0)) + (lambda () (list-ref l n)))))) (define (unison-POp-IORN m n) (fxlogior m n)) (define (unison-POp-ITOT i) (signed-number->istring i)) - (define (unison-POp-LEQN m n) (if (fx< m n) 1 0)) + (define (unison-POp-LEQN m n) (if (fx<= m n) 1 0)) (define (unison-POp-LZRO m) (- 64 (fxlength m))) - (define (unison-POp-MULN m n) (* m n)) + (define (unison-POp-MULN m n) (fx* m n)) + (define (unison-POp-MODN m n) (fxmodulo m n)) (define (unison-POp-NTOT m) (number->istring m)) (define (unison-POp-PAKB l) (u8-list->ibytevector l)) (define (unison-POp-PAKT l) (list->istring l)) @@ -192,15 +218,54 @@ (define (unison-FOp-Text.repeat n t) (istring-repeat n t)) (define (catch-array thunk) - (with-exception-handler - (lambda (e) (list 0 '() "array index out of boudns" e)) - thunk)) + (reify-exn thunk)) + + (define (unison-FOp-ImmutableArray.read vec i) + (catch-array + (lambda () + (list 1 (vector-ref vec i))))) + + (define (unison-FOp-ImmutableArray.copyTo! dst doff src soff n) + (catch-array + (lambda () + (let next ([i (fx1- n)]) + (if (< i 0) + (list 1 #f) + (begin + (vector-set! dst (+ doff i) (vector-ref src (+ soff i))) + (next (fx1- i)))))))) + + (define (unison-FOp-MutableArray.freeze! vec) + (($primitive $vector-set-immutable!) vec) + vec) + + (define (unison-FOp-MutableArray.freeze src off len) + (let ([dst (make-vector len)]) + (let next ([i (fx1- len)]) + (if (< i 0) + (begin + (($primitive $vector-set-immutable!) dst) + (list 1 dst)) + (begin + (vector-set! dst i (vector-ref src (+ off i))) + (next (fx1- i))))))) + + (define (unison-FOp-MutableArray.read src i) + (catch-array + (lambda () + (list 1 (vector-ref src i))))) + + (define (unison-FOp-MutableArray.write dst i x) + (catch-array + (lambda () + (vector-set! dst i x) + (list 1)))) (define (unison-FOp-ImmutableByteArray.copyTo! dst doff src soff n) (catch-array (lambda () (bytevector-copy! src soff dst doff n) - (list 1)))) + (list 1 #f)))) (define (unison-FOp-ImmutableByteArray.read8 arr i) (catch-array @@ -217,6 +282,7 @@ (list 1)))) (define (unison-FOp-Scope.bytearray n) (make-bytevector n)) + (define (unison-FOp-Scope.array n) (make-vector n)) ) From 2e0ffc78324732749faf8f7ebc88f888ab524bab Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 4 Jan 2023 13:01:15 -0600 Subject: [PATCH 051/467] Split doc evaluation from doc rendering (#3694) --- unison-core/src/Unison/DataDeclaration.hs | 9 + unison-core/src/Unison/Type.hs | 4 + unison-share-api/src/Unison/Server/Backend.hs | 2 +- unison-share-api/src/Unison/Server/Doc.hs | 422 ++++++++++++------ .../src/Unison/Server/Doc/AsHtml.hs | 3 +- 5 files changed, 309 insertions(+), 131 deletions(-) diff --git a/unison-core/src/Unison/DataDeclaration.hs b/unison-core/src/Unison/DataDeclaration.hs index 490550275..43e6e5c92 100644 --- a/unison-core/src/Unison/DataDeclaration.hs +++ b/unison-core/src/Unison/DataDeclaration.hs @@ -17,8 +17,10 @@ module Unison.DataDeclaration constructorIds, declConstructorReferents, declDependencies, + labeledDeclDependencies, declFields, dependencies, + labeledDependencies, generateRecordAccessors, unhashComponent, mkDataDecl', @@ -41,6 +43,7 @@ import qualified Unison.ABT as ABT import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.DataDeclaration.ConstructorId (ConstructorId) +import qualified Unison.LabeledDependency as LD import qualified Unison.Name as Name import qualified Unison.Names.ResolutionResult as Names import qualified Unison.Pattern as Pattern @@ -70,6 +73,9 @@ asDataDecl = either toDataDecl id declDependencies :: Ord v => Decl v a -> Set Reference declDependencies = either (dependencies . toDataDecl) dependencies +labeledDeclDependencies :: Ord v => Decl v a -> Set LD.LabeledDependency +labeledDeclDependencies = Set.map LD.TypeReference . declDependencies + constructorType :: Decl v a -> CT.ConstructorType constructorType = \case Left {} -> CT.Effect @@ -254,6 +260,9 @@ dependencies :: Ord v => DataDeclaration v a -> Set Reference dependencies dd = Set.unions (Type.dependencies <$> constructorTypes dd) +labeledDependencies :: Ord v => DataDeclaration v a -> Set LD.LabeledDependency +labeledDependencies = Set.map LD.TypeReference . dependencies + mkEffectDecl' :: Modifier -> a -> [v] -> [(a, v, Type v a)] -> EffectDeclaration v a mkEffectDecl' m a b cs = EffectDeclaration (DataDeclaration m a b cs) diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index 18f4fe4c9..6bdd79aa2 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -11,6 +11,7 @@ import Data.Monoid (Any (..)) import qualified Data.Set as Set import qualified Unison.ABT as ABT import qualified Unison.Kind as K +import qualified Unison.LabeledDependency as LD import qualified Unison.Name as Name import qualified Unison.Names.ResolutionResult as Names import Unison.Prelude @@ -522,6 +523,9 @@ dependencies t = Set.fromList . Writer.execWriter $ ABT.visit' f t f t@(Ref r) = Writer.tell [r] $> t f t = pure t +labeledDependencies :: Ord v => Type v a -> Set LD.LabeledDependency +labeledDependencies = Set.map LD.TypeReference . dependencies + updateDependencies :: Ord v => Map Reference Reference -> Type v a -> Type v a updateDependencies typeUpdates = ABT.rebuildUp go where diff --git a/unison-share-api/src/Unison/Server/Backend.hs b/unison-share-api/src/Unison/Server/Backend.hs index e778b708f..2f386744a 100644 --- a/unison-share-api/src/Unison/Server/Backend.hs +++ b/unison-share-api/src/Unison/Server/Backend.hs @@ -974,7 +974,7 @@ renderDoc ppe width rt codebase r = do let hash = Reference.toText r (name,hash,) <$> let tm = Term.ref () r - in Doc.renderDoc + in Doc.evalAndRenderDoc ppe terms typeOf diff --git a/unison-share-api/src/Unison/Server/Doc.hs b/unison-share-api/src/Unison/Server/Doc.hs index ea0c9eb44..4c839f350 100644 --- a/unison-share-api/src/Unison/Server/Doc.hs +++ b/unison-share-api/src/Unison/Server/Doc.hs @@ -3,25 +3,20 @@ {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE ViewPatterns #-} module Unison.Server.Doc where import Control.Lens (view, (^.)) import Control.Monad -import Control.Monad.Trans.Maybe (MaybeT (..), runMaybeT) import Data.Aeson (ToJSON) import Data.Foldable import Data.Functor -import Data.Map (Map) import qualified Data.Map as Map -import Data.Maybe (fromMaybe) import Data.OpenApi (ToSchema) import qualified Data.Set as Set -import Data.Text (Text) -import qualified Data.Text as Text import Data.Word -import GHC.Generics (Generic) import qualified Unison.ABT as ABT import qualified Unison.Builtin.Decls as DD import qualified Unison.Builtin.Decls as Decls @@ -29,6 +24,8 @@ import Unison.Codebase.Editor.DisplayObject (DisplayObject) import qualified Unison.Codebase.Editor.DisplayObject as DO import qualified Unison.ConstructorReference as ConstructorReference import qualified Unison.DataDeclaration as DD +import qualified Unison.LabeledDependency as LD +import Unison.Prelude import qualified Unison.PrettyPrintEnv as PPE import qualified Unison.PrettyPrintEnvDecl as PPE import Unison.Reference (Reference) @@ -57,37 +54,48 @@ type Nat = Word64 type SSyntaxText = S.SyntaxText' Reference -data Doc +-- | A doc rendered down to SyntaxText. +type Doc = DocG RenderedSpecialForm + +-- | A doc which has been evaluated and includes all information necessary to be rendered. +type EvaluatedDoc v = DocG (EvaluatedSpecialForm v) + +type SrcRefs = Ref (UnisonHash, DisplayObject SyntaxText Src) + +-- | A doc parameterized by its special forms. +data DocG specialForm = Word Text - | Code Doc - | CodeBlock Text Doc - | Bold Doc - | Italic Doc - | Strikethrough Doc - | Style Text Doc - | Anchor Text Doc - | Blockquote Doc + | Code (DocG specialForm) + | CodeBlock Text (DocG specialForm) + | Bold (DocG specialForm) + | Italic (DocG specialForm) + | Strikethrough (DocG specialForm) + | Style Text (DocG specialForm) + | Anchor Text (DocG specialForm) + | Blockquote (DocG specialForm) | Blankline | Linebreak | SectionBreak - | Tooltip Doc Doc - | Aside Doc - | Callout (Maybe Doc) Doc - | Table [[Doc]] - | Folded Bool Doc Doc - | Paragraph [Doc] - | BulletedList [Doc] - | NumberedList Nat [Doc] - | Section Doc [Doc] - | NamedLink Doc Doc - | Image Doc Doc (Maybe Doc) - | Special SpecialForm - | Join [Doc] - | UntitledSection [Doc] - | Column [Doc] - | Group Doc - deriving stock (Eq, Show, Generic) - deriving anyclass (ToJSON, ToSchema) + | Tooltip (DocG specialForm) (DocG specialForm) + | Aside (DocG specialForm) + | Callout (Maybe (DocG specialForm)) (DocG specialForm) + | Table [[(DocG specialForm)]] + | Folded Bool (DocG specialForm) (DocG specialForm) + | Paragraph [(DocG specialForm)] + | BulletedList [(DocG specialForm)] + | NumberedList Nat [(DocG specialForm)] + | Section (DocG specialForm) [(DocG specialForm)] + | NamedLink (DocG specialForm) (DocG specialForm) + | Image (DocG specialForm) (DocG specialForm) (Maybe (DocG specialForm)) + | Special specialForm + | Join [(DocG specialForm)] + | UntitledSection [(DocG specialForm)] + | Column [(DocG specialForm)] + | Group (DocG specialForm) + deriving stock (Eq, Show, Generic, Functor, Foldable, Traversable) + deriving anyclass (ToJSON) + +deriving instance ToSchema specialForm => ToSchema (DocG specialForm) type UnisonHash = Text @@ -101,9 +109,9 @@ data MediaSource = MediaSource {mediaSourceUrl :: Text, mediaSourceMimeType :: M deriving stock (Eq, Show, Generic) deriving anyclass (ToJSON, ToSchema) -data SpecialForm - = Source [Ref (UnisonHash, DisplayObject SyntaxText Src)] - | FoldedSource [Ref (UnisonHash, DisplayObject SyntaxText Src)] +data RenderedSpecialForm + = Source [SrcRefs] + | FoldedSource [SrcRefs] | Example SyntaxText | ExampleBlock SyntaxText | Link SyntaxText @@ -115,15 +123,36 @@ data SpecialForm | EmbedInline SyntaxText | Video [MediaSource] (Map Text Text) | FrontMatter (Map Text [Text]) + | RenderError (RenderError SyntaxText) deriving stock (Eq, Show, Generic) deriving anyclass (ToJSON, ToSchema) +data EvaluatedSpecialForm v + = ESource [(EvaluatedSrc v)] + | EFoldedSource [(EvaluatedSrc v)] + | EExample (Term v ()) + | EExampleBlock (Term v ()) + | ELink (Either (Term v ()) LD.LabeledDependency) + | ESignature [(Referent, Type v ())] + | ESignatureInline (Referent, Type v ()) + | -- Result is Nothing if there was an Eval failure + EEval (Term v ()) (Maybe (Term v ())) + | -- Result is Nothing if there was an Eval failure + EEvalInline (Term v ()) (Maybe (Term v ())) + | EEmbed (Term v ()) + | EEmbedInline (Term v ()) + | EVideo [MediaSource] (Map Text Text) + | EFrontMatter (Map Text [Text]) + | ERenderError (RenderError (Term v ())) + deriving stock (Eq, Show, Generic) + -- `Src folded unfolded` data Src = Src SyntaxText SyntaxText deriving stock (Eq, Show, Generic) deriving anyclass (ToJSON, ToSchema) -renderDoc :: +-- | Evaluate the doc, then render it. +evalAndRenderDoc :: forall v m. (Var v, Monad m) => PPE.PrettyPrintEnvDecl -> @@ -133,11 +162,118 @@ renderDoc :: (Reference -> m (Maybe (DD.Decl v ()))) -> Term v () -> m Doc -renderDoc pped terms typeOf eval types tm = +evalAndRenderDoc pped terms typeOf eval types tm = + renderDoc pped <$> evalDoc terms typeOf eval types tm + +-- | Renders the given doc, which must have been evaluated using 'evalDoc' +renderDoc :: + forall v. + Var v => + PPE.PrettyPrintEnvDecl -> + EvaluatedDoc v -> + Doc +renderDoc pped doc = renderSpecial <$> doc + where + suffixifiedPPE = PPE.suffixifiedPPE pped + formatPretty = fmap Syntax.convertElement . P.render (P.Width 70) + + formatPrettyType :: PPE.PrettyPrintEnv -> Type v a -> SyntaxText + formatPrettyType ppe typ = formatPretty (TypePrinter.prettySyntax ppe typ) + + source :: Term v () -> SyntaxText + source tm = formatPretty $ TermPrinter.prettyBlock' True (PPE.suffixifiedPPE pped) tm + + goSignatures :: [(Referent, Type v ())] -> [P.Pretty SSyntaxText] + goSignatures types = + fmap P.group $ + TypePrinter.prettySignaturesST + (PPE.suffixifiedPPE pped) + [(r, PPE.termName (PPE.suffixifiedPPE pped) r, ty) | (r, ty) <- types] + + renderSpecial :: EvaluatedSpecialForm v -> RenderedSpecialForm + renderSpecial = \case + ESource srcs -> Source (renderSrc srcs) + EFoldedSource srcs -> FoldedSource (renderSrc srcs) + EExample trm -> Example (source trm) + EExampleBlock trm -> ExampleBlock (source trm) + ELink ref -> + let ppe = PPE.suffixifiedPPE pped + tm :: Referent -> P.Pretty SSyntaxText + tm r = (NP.styleHashQualified'' (NP.fmt (S.TermReference r)) . PPE.termName ppe) r + ty :: Reference -> P.Pretty SSyntaxText + ty r = (NP.styleHashQualified'' (NP.fmt (S.TypeReference r)) . PPE.typeName ppe) r + in Link $ case ref of + Left trm -> source trm + Right ld -> case ld of + LD.TermReferent r -> (formatPretty . tm) r + LD.TypeReference r -> (formatPretty . ty) r + ESignature rs -> Signature (map formatPretty $ goSignatures rs) + ESignatureInline r -> SignatureInline (formatPretty (P.lines $ goSignatures [r])) + EEval trm result -> + let renderedTrm = source trm + in case result of + Nothing -> Eval renderedTrm evalErrMsg + Just renderedResult -> Eval renderedTrm (source renderedResult) + EEvalInline trm result -> + let renderedTrm = source trm + in case result of + Nothing -> EvalInline renderedTrm evalErrMsg + Just renderedResult -> EvalInline renderedTrm (source renderedResult) + EEmbed any -> Embed ("{{ embed {{" <> source any <> "}} }}") + EEmbedInline any -> EmbedInline ("{{ embed {{" <> source any <> "}} }}") + EVideo sources config -> Video sources config + EFrontMatter frontMatter -> FrontMatter frontMatter + ERenderError (InvalidTerm tm) -> Embed ("🆘 unable to render " <> source tm) + + evalErrMsg :: SyntaxText + evalErrMsg = "🆘 An error occured during evaluation" + + renderSrc :: [EvaluatedSrc v] -> [Ref (UnisonHash, DisplayObject SyntaxText Src)] + renderSrc srcs = + srcs & foldMap \case + EvaluatedSrcDecl srcDecl -> case srcDecl of + MissingDecl r -> [(Type (Reference.toText r, DO.MissingObject (SH.unsafeFromText $ Reference.toText r)))] + BuiltinDecl r -> + let name = + formatPretty . NP.styleHashQualified (NP.fmt (S.TypeReference r)) + . PPE.typeName suffixifiedPPE + $ r + in [Type (Reference.toText r, DO.BuiltinObject name)] + FoundDecl r decl -> [Type (Reference.toText r, DO.UserObject (Src folded full))] + where + full = formatPretty (DeclPrinter.prettyDecl pped r (PPE.typeName suffixifiedPPE r) decl) + folded = formatPretty (DeclPrinter.prettyDeclHeader (PPE.typeName suffixifiedPPE r) decl) + EvaluatedSrcTerm srcTerm -> case srcTerm of + MissingBuiltinTypeSig r -> [(Type (Reference.toText r, DO.BuiltinObject "🆘 missing type signature"))] + BuiltinTypeSig r typ -> [Type (Reference.toText r, DO.BuiltinObject (formatPrettyType suffixifiedPPE typ))] + MissingTerm r -> [Term (Reference.toText r, DO.MissingObject (SH.unsafeFromText $ Reference.toText r))] + FoundTerm ref typ tm -> + let name = PPE.termName suffixifiedPPE (Referent.Ref ref) + folded = + formatPretty . P.lines $ + TypePrinter.prettySignaturesST suffixifiedPPE [(Referent.Ref ref, name, typ)] + full tm@(Term.Ann' _ _) _ = + formatPretty (TermPrinter.prettyBinding suffixifiedPPE name tm) + full tm typ = + formatPretty (TermPrinter.prettyBinding suffixifiedPPE name (Term.ann () tm typ)) + in [Term (Reference.toText ref, DO.UserObject (Src folded (full tm typ)))] + +-- | Evaluates the given doc, expanding transclusions, expressions, etc. +evalDoc :: + forall v m. + (Var v, Monad m) => + (Reference -> m (Maybe (Term v ()))) -> + (Referent -> m (Maybe (Type v ()))) -> + (Term v () -> m (Maybe (Term v ()))) -> + (Reference -> m (Maybe (DD.Decl v ()))) -> + Term v () -> + m (EvaluatedDoc v) +evalDoc terms typeOf eval types tm = eval tm >>= \case Nothing -> pure $ Word "🆘 doc rendering failed during evaluation" Just tm -> go tm where + go :: Term v () -> m (EvaluatedDoc v) go = \case DD.Doc2Word txt -> pure $ Word txt DD.Doc2Code d -> Code <$> go d @@ -172,78 +308,62 @@ renderDoc pped terms typeOf eval types tm = DD.Doc2UntitledSection ds -> UntitledSection <$> traverse go ds DD.Doc2Column ds -> Column <$> traverse go ds DD.Doc2Group d -> Group <$> go d - wat -> - pure . Word . Text.pack . P.toPlain (P.Width 80) . P.indent "🆘 " - . TermPrinter.pretty (PPE.suffixifiedPPE pped) - $ wat + wat -> pure $ Special $ ERenderError (InvalidTerm wat) - formatPretty = fmap Syntax.convertElement . P.render (P.Width 70) - formatPrettyType ppe typ = formatPretty (TypePrinter.prettySyntax ppe typ) - - source :: Term v () -> m SyntaxText - source tm = pure . formatPretty $ TermPrinter.prettyBlock' True (PPE.suffixifiedPPE pped) tm - - goSignatures :: [Referent] -> m [P.Pretty SSyntaxText] + goSignatures :: [Referent] -> m [(Referent, Type v ())] goSignatures rs = runMaybeT (traverse (MaybeT . typeOf) rs) >>= \case - Nothing -> pure ["🆘 codebase is missing type signature for these definitions"] - Just types -> - pure . fmap P.group $ - TypePrinter.prettySignaturesST - (PPE.suffixifiedPPE pped) - [(r, PPE.termName (PPE.suffixifiedPPE pped) r, ty) | (r, ty) <- zip rs types] + Nothing -> error "🆘 codebase is missing type signature for these definitions" + Just types -> pure (zip rs types) - goSpecial :: Term v () -> m SpecialForm + goSpecial :: Term v () -> m (EvaluatedSpecialForm v) goSpecial = \case - DD.Doc2SpecialFormFoldedSource (Term.List' es) -> FoldedSource <$> goSrc (toList es) + DD.Doc2SpecialFormFoldedSource (Term.List' es) -> EFoldedSource <$> goSrc (toList es) -- Source [Either Link.Type Doc2.Term] - DD.Doc2SpecialFormSource (Term.List' es) -> Source <$> goSrc (toList es) + DD.Doc2SpecialFormSource (Term.List' es) -> ESource <$> goSrc (toList es) -- Example Nat Doc2.Term -- Examples like `foo x y` are encoded as `Example 2 (_ x y -> foo)`, where -- 2 is the number of variables that should be dropped from the rendering. -- So this will render as `foo x y`. DD.Doc2SpecialFormExample n (DD.Doc2Example vs body) -> - Example <$> source ex + pure $ EExample ex where ex = Term.lam' (ABT.annotation body) (drop (fromIntegral n) vs) body DD.Doc2SpecialFormExampleBlock n (DD.Doc2Example vs body) -> - ExampleBlock <$> source ex + pure $ EExampleBlock ex where ex = Term.lam' (ABT.annotation body) (drop (fromIntegral n) vs) body -- Link (Either Link.Type Doc2.Term) DD.Doc2SpecialFormLink e -> - let ppe = PPE.suffixifiedPPE pped - tm :: Referent -> P.Pretty SSyntaxText - tm r = (NP.styleHashQualified'' (NP.fmt (S.TermReference r)) . PPE.termName ppe) r - ty :: Reference -> P.Pretty SSyntaxText - ty r = (NP.styleHashQualified'' (NP.fmt (S.TypeReference r)) . PPE.typeName ppe) r - in Link <$> case e of - DD.EitherLeft' (Term.TypeLink' r) -> (pure . formatPretty . ty) r + let tm :: Referent -> (Either a LD.LabeledDependency) + tm r = Right $ LD.TermReferent r + ty :: Reference -> (Either a LD.LabeledDependency) + ty r = Right $ LD.TypeReference r + in ELink <$> case e of + DD.EitherLeft' (Term.TypeLink' r) -> pure $ ty r DD.EitherRight' (DD.Doc2Term t) -> case Term.etaNormalForm t of - Term.Referent' r -> (pure . formatPretty . tm) r - x -> source x - _ -> source e + Term.Referent' r -> pure $ tm r + x -> pure $ Left x + _ -> pure $ Left e DD.Doc2SpecialFormSignature (Term.List' tms) -> let rs = [r | DD.Doc2Term (Term.Referent' r) <- toList tms] - in goSignatures rs <&> \s -> Signature (map formatPretty s) + in goSignatures rs <&> \s -> ESignature s -- SignatureInline Doc2.Term DD.Doc2SpecialFormSignatureInline (DD.Doc2Term (Term.Referent' r)) -> - goSignatures [r] <&> \s -> SignatureInline (formatPretty (P.lines s)) + goSignatures [r] <&> \[s] -> ESignatureInline s -- Eval Doc2.Term - DD.Doc2SpecialFormEval (DD.Doc2Term tm) -> - eval tm >>= \case - Nothing -> Eval <$> source tm <*> pure evalErrMsg - Just result -> Eval <$> source tm <*> source result + DD.Doc2SpecialFormEval (DD.Doc2Term tm) -> do + result <- eval tm + pure $ EEval tm result -- EvalInline Doc2.Term - DD.Doc2SpecialFormEvalInline (DD.Doc2Term tm) -> - eval tm >>= \case - Nothing -> EvalInline <$> source tm <*> pure evalErrMsg - Just result -> EvalInline <$> source tm <*> source result + DD.Doc2SpecialFormEvalInline (DD.Doc2Term tm) -> do + result <- eval tm + pure $ EEvalInline tm result -- Embed Video DD.Doc2SpecialFormEmbedVideo sources config -> - pure $ Video sources' config' + pure $ EVideo sources' config' where sources' = [MediaSource url mimeType | DD.Doc2MediaSource (Term.Text' url) (maybeText -> mimeType) <- sources] config' = Map.fromList [(k, v) | Decls.TupleTerm' [Term.Text' k, Term.Text' v] <- config] @@ -252,49 +372,37 @@ renderDoc pped terms typeOf eval types tm = -- Embed FrontMatter DD.Doc2SpecialFormEmbedFrontMatter frontMatter -> - pure $ FrontMatter frontMatter' + pure $ EFrontMatter frontMatter' where frontMatter' = List.multimap [(k, v) | Decls.TupleTerm' [Term.Text' k, Term.Text' v] <- frontMatter] -- Embed Any DD.Doc2SpecialFormEmbed (Term.App' _ any) -> - source any <&> \p -> Embed ("{{ embed {{" <> p <> "}} }}") + pure $ EEmbed any -- EmbedInline Any DD.Doc2SpecialFormEmbedInline any -> - source any <&> \p -> EmbedInline ("{{ embed {{" <> p <> "}} }}") - tm -> source tm <&> \p -> Embed ("🆘 unable to render " <> p) + pure $ EEmbedInline any + tm -> pure $ ERenderError (InvalidTerm tm) - evalErrMsg = "🆘 An error occured during evaluation" - - goSrc :: [Term v ()] -> m [Ref (UnisonHash, DisplayObject SyntaxText Src)] + goSrc :: [Term v ()] -> m [EvaluatedSrc v] goSrc es = do let toRef (Term.Ref' r) = Set.singleton r toRef (Term.RequestOrCtor' r) = Set.singleton (r ^. ConstructorReference.reference_) toRef _ = mempty - ppe = PPE.suffixifiedPPE pped - goType :: Reference -> m (Ref (UnisonHash, DisplayObject SyntaxText Src)) - goType r@(Reference.Builtin _) = - pure (Type (Reference.toText r, DO.BuiltinObject name)) - where - name = - formatPretty . NP.styleHashQualified (NP.fmt (S.TypeReference r)) - . PPE.typeName ppe - $ r - goType r = - Type . (Reference.toText r,) <$> do - d <- types r - case d of - Nothing -> pure (DO.MissingObject (SH.unsafeFromText $ Reference.toText r)) - Just decl -> - pure $ DO.UserObject (Src folded full) - where - full = formatPretty (DeclPrinter.prettyDecl pped r (PPE.typeName ppe r) decl) - folded = formatPretty (DeclPrinter.prettyDeclHeader (PPE.typeName ppe r) decl) + goType :: Reference -> m (EvaluatedSrc v) + goType r@(Reference.Builtin _builtin) = + pure (EvaluatedSrcDecl (BuiltinDecl r)) + goType r = do + d <- types r + case d of + Nothing -> pure (EvaluatedSrcDecl $ MissingDecl r) + Just decl -> + pure $ EvaluatedSrcDecl (FoundDecl r decl) go :: - (Set.Set Reference, [Ref (UnisonHash, DisplayObject SyntaxText Src)]) -> + (Set.Set Reference, [EvaluatedSrc v]) -> Term v () -> - m (Set.Set Reference, [Ref (UnisonHash, DisplayObject SyntaxText Src)]) + m (Set.Set Reference, [EvaluatedSrc v]) go s1@(!seen, !acc) = \case -- we ignore the annotations; but this could be extended later DD.TupleTerm' [DD.EitherRight' (DD.Doc2Term tm), _anns] -> @@ -303,29 +411,85 @@ renderDoc pped terms typeOf eval types tm = acc' = case tm of Term.Ref' r | Set.notMember r seen -> - (: acc) . Term . (Reference.toText r,) <$> case r of - Reference.Builtin _ -> - typeOf (Referent.Ref r) <&> \case - Nothing -> DO.BuiltinObject "🆘 missing type signature" - Just ty -> DO.BuiltinObject (formatPrettyType ppe ty) - ref -> - terms ref >>= \case - Nothing -> pure $ DO.MissingObject (SH.unsafeFromText $ Reference.toText ref) - Just tm -> do - typ <- fromMaybe (Type.builtin () "unknown") <$> typeOf (Referent.Ref ref) - let name = PPE.termName ppe (Referent.Ref ref) - let folded = - formatPretty . P.lines $ - TypePrinter.prettySignaturesST ppe [(Referent.Ref ref, name, typ)] - let full tm@(Term.Ann' _ _) _ = - formatPretty (TermPrinter.prettyBinding ppe name tm) - full tm typ = - formatPretty (TermPrinter.prettyBinding ppe name (Term.ann () tm typ)) - pure (DO.UserObject (Src folded (full tm typ))) + (: acc) <$> case r of + Reference.Builtin _ -> + typeOf (Referent.Ref r) <&> \case + Nothing -> EvaluatedSrcTerm (MissingBuiltinTypeSig r) + Just ty -> EvaluatedSrcTerm (BuiltinTypeSig r ty) + ref -> + terms ref >>= \case + Nothing -> pure . EvaluatedSrcTerm . MissingTerm $ ref + Just tm -> do + typ <- fromMaybe (Type.builtin () "unknown") <$> typeOf (Referent.Ref ref) + pure $ EvaluatedSrcTerm (FoundTerm ref typ tm) Term.RequestOrCtor' (view ConstructorReference.reference_ -> r) | Set.notMember r seen -> (: acc) <$> goType r _ -> pure acc DD.TupleTerm' [DD.EitherLeft' (Term.TypeLink' ref), _anns] | Set.notMember ref seen -> - (Set.insert ref seen,) . (: acc) <$> goType ref + (Set.insert ref seen,) . (: acc) <$> goType ref _ -> pure s1 reverse . snd <$> foldM go mempty es + +data RenderError trm + = InvalidTerm trm + deriving stock (Eq, Show, Generic) + deriving anyclass (ToJSON) + +deriving anyclass instance ToSchema trm => ToSchema (RenderError trm) + +data EvaluatedSrc v + = EvaluatedSrcDecl (EvaluatedDecl v) + | EvaluatedSrcTerm (EvaluatedTerm v) + deriving stock (Show, Eq, Generic) + +data EvaluatedDecl v + = MissingDecl Reference + | BuiltinDecl Reference + | FoundDecl Reference (DD.Decl v ()) + deriving stock (Show, Eq, Generic) + +data EvaluatedTerm v + = MissingTerm Reference + | BuiltinTypeSig Reference (Type v ()) + | MissingBuiltinTypeSig Reference + | FoundTerm Reference (Type v ()) (Term v ()) + deriving stock (Show, Eq, Generic) + +-- Determines all dependencies which will be required to render a doc. +dependencies :: Ord v => EvaluatedDoc v -> Set LD.LabeledDependency +dependencies = foldMap dependenciesSpecial + +-- | Determines all dependencies of a special form +dependenciesSpecial :: forall v. Ord v => EvaluatedSpecialForm v -> Set LD.LabeledDependency +dependenciesSpecial = \case + ESource srcs -> srcDeps srcs + EFoldedSource srcs -> srcDeps srcs + EExample trm -> Term.labeledDependencies trm + EExampleBlock trm -> Term.labeledDependencies trm + ELink ref -> either Term.labeledDependencies Set.singleton ref + ESignature sigtyps -> sigtypDeps sigtyps + ESignatureInline sig -> sigtypDeps [sig] + EEval trm mayTrm -> Term.labeledDependencies trm <> foldMap Term.labeledDependencies mayTrm + EEvalInline trm mayTrm -> Term.labeledDependencies trm <> foldMap Term.labeledDependencies mayTrm + EEmbed trm -> Term.labeledDependencies trm + EEmbedInline trm -> Term.labeledDependencies trm + EVideo {} -> mempty + EFrontMatter {} -> mempty + ERenderError (InvalidTerm trm) -> Term.labeledDependencies trm + where + sigtypDeps :: [(Referent, Type v a)] -> Set LD.LabeledDependency + sigtypDeps sigtyps = + sigtyps & foldMap \(ref, typ) -> + Set.singleton (LD.TermReferent ref) <> Type.labeledDependencies typ + srcDeps :: [EvaluatedSrc v] -> Set LD.LabeledDependency + srcDeps srcs = + srcs & foldMap \case + EvaluatedSrcDecl srcDecl -> case srcDecl of + MissingDecl ref -> Set.singleton (LD.TypeReference ref) + BuiltinDecl ref -> Set.singleton (LD.TypeReference ref) + FoundDecl ref decl -> Set.singleton (LD.TypeReference ref) <> DD.labeledDeclDependencies decl + EvaluatedSrcTerm srcTerm -> case srcTerm of + MissingTerm ref -> Set.singleton (LD.TermReference ref) + BuiltinTypeSig ref _ -> Set.singleton (LD.TermReference ref) + MissingBuiltinTypeSig ref -> Set.singleton (LD.TermReference ref) + FoundTerm ref typ trm -> Set.singleton (LD.TermReference ref) <> Type.labeledDependencies typ <> Term.labeledDependencies trm diff --git a/unison-share-api/src/Unison/Server/Doc/AsHtml.hs b/unison-share-api/src/Unison/Server/Doc/AsHtml.hs index db2e7115c..46ade29d7 100644 --- a/unison-share-api/src/Unison/Server/Doc/AsHtml.hs +++ b/unison-share-api/src/Unison/Server/Doc/AsHtml.hs @@ -11,7 +11,6 @@ import qualified Data.Char as Char import Data.Foldable import Data.Map (Map) import qualified Data.Map as Map -import qualified Unison.Syntax.Name as Name (toText) import Data.Maybe import Data.Sequence (Seq) import Data.Text (Text) @@ -27,6 +26,7 @@ import Unison.Server.Doc import qualified Unison.Server.Doc as Doc import Unison.Server.Syntax (SyntaxText) import qualified Unison.Server.Syntax as Syntax +import qualified Unison.Syntax.Name as Name (toText) data NamedLinkHref = Href Text @@ -478,6 +478,7 @@ toHtml docNamesByRef document = pure $ div_ [class_ "source rich embed"] $ codeBlock [] (Syntax.toHtml syntax) EmbedInline syntax -> pure $ span_ [class_ "source rich embed-inline"] $ inlineCode [] (Syntax.toHtml syntax) + RenderError (InvalidTerm err) -> pure $ Syntax.toHtml err Join docs -> span_ [class_ "join"] <$> renderSequence currentSectionLevelToHtml (mergeWords " " docs) UntitledSection docs -> From eb50643c848543adc1a405b26dab1d15ddfdf08c Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 5 Jan 2023 15:33:10 -0500 Subject: [PATCH 052/467] Allow running via scheme with arguments --- .../src/Unison/Codebase/Editor/HandleInput.hs | 29 +++++++++++-------- .../src/Unison/Codebase/Editor/Input.hs | 2 +- .../src/Unison/CommandLine/InputPatterns.hs | 6 ++-- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 987d847f6..ba4755f72 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -36,7 +36,7 @@ import System.Directory ) import System.Environment (withArgs) import System.FilePath (()) -import System.Process (callCommand, readCreateProcess, shell) +import System.Process (callProcess, readCreateProcess, shell) import qualified Text.Megaparsec as P import qualified U.Codebase.Branch.Diff as V2Branch import qualified U.Codebase.Causal as V2Causal @@ -1184,7 +1184,7 @@ loop e = do whenJustM (liftIO (Runtime.compileTo runtime codeLookup ppe ref (output <> ".uc"))) \err -> Cli.returnEarly (EvaluationFailure err) CompileSchemeI output main -> doCompileScheme output main - ExecuteSchemeI main -> doRunAsScheme main + ExecuteSchemeI main args -> doRunAsScheme main args GenSchemeLibsI -> doGenerateSchemeBoot True Nothing FetchSchemeCompilerI -> doFetchCompiler IOTestI main -> do @@ -1553,7 +1553,12 @@ inputDescription input = MergeBuiltinsI -> pure "builtins.merge" MergeIOBuiltinsI -> pure "builtins.mergeio" MakeStandaloneI out nm -> pure ("compile " <> Text.pack out <> " " <> HQ.toText nm) - ExecuteSchemeI nm -> pure ("run.native " <> HQ.toText nm) + ExecuteSchemeI nm args -> + pure $ + "run.native " + <> HQ.toText nm + <> " " + <> Text.unwords (fmap Text.pack args) CompileSchemeI fi nm -> pure ("compile.native " <> HQ.toText nm <> " " <> Text.pack fi) GenSchemeLibsI -> pure "compile.native.genlibs" FetchSchemeCompilerI -> pure "compile.native.fetch" @@ -2713,18 +2718,18 @@ ensureSchemeExists = (True <$ readCreateProcess (shell "scheme -q") "") (\(_ :: IOException) -> pure False) -runScheme :: String -> Cli () -runScheme file = do +runScheme :: String -> [String] -> Cli () +runScheme file args0 = do ensureSchemeExists gendir <- getSchemeGenLibDir statdir <- getSchemeStaticLibDir let includes = gendir ++ ":" ++ statdir - lib = "--libdirs " ++ includes - opt = "--optimize-level 3" - cmd = "scheme -q " ++ opt ++ " " ++ lib ++ " --script " ++ file + lib = ["--libdirs", includes] + opt = ["--optimize-level", "3"] + args = "-q" : opt ++ lib ++ ["--script", file] ++ args0 success <- liftIO $ - (True <$ callCommand cmd) `catch` \(_ :: IOException) -> + (True <$ callProcess "scheme" args) `catch` \(_ :: IOException) -> pure False unless success $ Cli.returnEarly (PrintMessage "Scheme evaluation failed.") @@ -2755,10 +2760,10 @@ buildScheme main file = do ++ lns gd gen ++ [surround file] -doRunAsScheme :: HQ.HashQualified Name -> Cli () -doRunAsScheme main = do +doRunAsScheme :: HQ.HashQualified Name -> [String] -> Cli () +doRunAsScheme main args = do fullpath <- generateSchemeFile (HQ.toString main) main - runScheme fullpath + runScheme fullpath args doCompileScheme :: String -> HQ.HashQualified Name -> Cli () doCompileScheme out main = diff --git a/unison-cli/src/Unison/Codebase/Editor/Input.hs b/unison-cli/src/Unison/Codebase/Editor/Input.hs index ec2fe95ce..530eed0c4 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Input.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Input.hs @@ -155,7 +155,7 @@ data Input | -- make a standalone binary file MakeStandaloneI String (HQ.HashQualified Name) | -- execute an IO thunk using scheme - ExecuteSchemeI (HQ.HashQualified Name) + ExecuteSchemeI (HQ.HashQualified Name) [String] | -- compile to a scheme file CompileSchemeI String (HQ.HashQualified Name) | -- generate scheme libraries diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index 111e7afe4..093678a6f 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -2128,14 +2128,14 @@ runScheme = I.Visible [(Required, exactDefinitionTermQueryArg)] ( P.wrapColumn2 - [ ( makeExample runScheme ["main"], + [ ( makeExample runScheme ["main", "args"], "Executes !main using native compilation via scheme." ) ] ) ( \case - [main] -> - Input.ExecuteSchemeI <$> parseHashQualifiedName main + (main:args) -> + flip Input.ExecuteSchemeI args <$> parseHashQualifiedName main _ -> Left $ showPatternHelp runScheme ) From 9e74fb1b41a92c2877a50fb7dc4d2531a084ca3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8jberg?= Date: Thu, 5 Jan 2023 15:33:12 -0500 Subject: [PATCH 053/467] Doc: add support for inline latex and svg Add new helpers for creating `Embed` and `EmbedInline` for `LaTeX` and `Svg`, similar to the form we use for `FrontMatter` and `Video`. --- .../src/Unison/Runtime/IOSource.hs | 23 +++++++++++++++++++ unison-share-api/src/Unison/Server/Doc.hs | 8 +++++++ .../src/Unison/Server/Doc/AsHtml.hs | 6 ++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index 53c20ca10..289b50e2e 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -194,6 +194,16 @@ doc2FrontMatterRef = typeNamed "Doc2.FrontMatter" pattern Doc2FrontMatterRef <- ((== doc2FrontMatterRef) -> True) +doc2LaTeXInlineRef :: R.Reference +doc2LaTeXInlineRef = typeNamed "Doc2.LaTeXInline" + +pattern Doc2LaTeXInlineRef <- ((== doc2LaTeXInlineRef) -> True) + +doc2SvgRef :: R.Reference +doc2SvgRef = typeNamed "Doc2.Svg" + +pattern Doc2SvgRef <- ((== doc2SvgRef) -> True) + pattern Doc2Word txt <- Term.App' (Term.Constructor' (ConstructorReference Doc2Ref ((==) doc2WordId -> True))) (Term.Text' txt) pattern Doc2Code d <- Term.App' (Term.Constructor' (ConstructorReference Doc2Ref ((==) doc2CodeId -> True))) d @@ -302,6 +312,10 @@ pattern Doc2SpecialFormEmbedVideo sources config <- Doc2SpecialFormEmbed (Term.A pattern Doc2SpecialFormEmbedFrontMatter frontMatter <- Doc2SpecialFormEmbed (Term.App' _ (Term.App' (Term.Constructor' (ConstructorReference Doc2FrontMatterRef _)) (Term.List' (toList -> frontMatter)))) +pattern Doc2SpecialFormEmbedLaTeXInline latex <- Doc2SpecialFormEmbedInline (Term.App' _ (Term.App' (Term.Constructor' (ConstructorReference Doc2LaTeXInlineRef _)) (Term.Text' latex))) + +pattern Doc2SpecialFormEmbedSvg svg <- Doc2SpecialFormEmbed (Term.App' _ (Term.App' (Term.Constructor' (ConstructorReference Doc2SvgRef _)) (Term.Text' svg))) + -- pulls out `vs body` in `Doc2.Term (Any '(vs -> body))`, where -- vs can be any number of parameters pattern Doc2Example vs body <- Term.App' _term (Term.App' _any (Term.LamNamed' _ (Term.LamsNamedOpt' vs body))) @@ -554,6 +568,15 @@ unique[b2ada5dfd4112ca3a7ba0a6483ce3d82811400c56eff8e6eca1b3fbf] type Doc2.Video unique[ea60b6205a6b25449a8784de87c113833bacbcdfe32829c7a76985d5] type Doc2.FrontMatter = FrontMatter [(Text, Text)] +-- Similar to using triple backticks with a latex pragma (```latex), but for +-- when you'd want to render LaTeX inline +unique[d1dc0515a2379df8a4c91571fe2f9bf9322adaf97677c87b806e49572447c688] type Doc2.LaTeXInline + = LaTeXInline Text + +-- Used for embedding SVGs +unique[ae4e05d8bede04825145db1a6a2222fdf2d890b3044d86fd4368f53b265de7f9] type Doc2.Svg + = Svg Text + -- ex: Doc2.term 'List.map Doc2.term : 'a -> Doc2.Term Doc2.term a = Doc2.Term.Term (Any a) diff --git a/unison-share-api/src/Unison/Server/Doc.hs b/unison-share-api/src/Unison/Server/Doc.hs index ea0c9eb44..0dec01f5f 100644 --- a/unison-share-api/src/Unison/Server/Doc.hs +++ b/unison-share-api/src/Unison/Server/Doc.hs @@ -115,6 +115,8 @@ data SpecialForm | EmbedInline SyntaxText | Video [MediaSource] (Map Text Text) | FrontMatter (Map Text [Text]) + | LaTeXInline Text + | Svg Text deriving stock (Eq, Show, Generic) deriving anyclass (ToJSON, ToSchema) @@ -256,6 +258,12 @@ renderDoc pped terms typeOf eval types tm = where frontMatter' = List.multimap [(k, v) | Decls.TupleTerm' [Term.Text' k, Term.Text' v] <- frontMatter] + -- Embed LaTeXInline + DD.Doc2SpecialFormEmbedLaTeXInline latex -> + pure $ LaTeXInline latex + -- Embed Svg + DD.Doc2SpecialFormEmbedSvg svg -> + pure $ Svg svg -- Embed Any DD.Doc2SpecialFormEmbed (Term.App' _ any) -> source any <&> \p -> Embed ("{{ embed {{" <> p <> "}} }}") diff --git a/unison-share-api/src/Unison/Server/Doc/AsHtml.hs b/unison-share-api/src/Unison/Server/Doc/AsHtml.hs index db2e7115c..b06eae655 100644 --- a/unison-share-api/src/Unison/Server/Doc/AsHtml.hs +++ b/unison-share-api/src/Unison/Server/Doc/AsHtml.hs @@ -11,7 +11,6 @@ import qualified Data.Char as Char import Data.Foldable import Data.Map (Map) import qualified Data.Map as Map -import qualified Unison.Syntax.Name as Name (toText) import Data.Maybe import Data.Sequence (Seq) import Data.Text (Text) @@ -27,6 +26,7 @@ import Unison.Server.Doc import qualified Unison.Server.Doc as Doc import Unison.Server.Syntax (SyntaxText) import qualified Unison.Server.Syntax as Syntax +import qualified Unison.Syntax.Name as Name (toText) data NamedLinkHref = Href Text @@ -474,6 +474,10 @@ toHtml docNamesByRef document = Doc.FrontMatter fm -> do Writer.tell (pure $ FrontMatterContent fm) pure mempty + LaTeXInline latex -> + pure $ div_ [class_ "source rich embed latex-inline"] $ codeBlock [] (L.toHtml latex) + Svg svg -> + pure $ iframe_ [class_ "embed svg", sandbox_ "true", srcdoc_ svg] $ sequence_ [] Embed syntax -> pure $ div_ [class_ "source rich embed"] $ codeBlock [] (Syntax.toHtml syntax) EmbedInline syntax -> From cebac0ca8c9ccf99a9bf1a8b0fb5e8fb6ee9a86d Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 5 Jan 2023 20:22:45 -0500 Subject: [PATCH 054/467] Fix trace primop --- chez-libs/unison/primops.ss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chez-libs/unison/primops.ss b/chez-libs/unison/primops.ss index d7a1d96b8..86039ed4c 100644 --- a/chez-libs/unison/primops.ss +++ b/chez-libs/unison/primops.ss @@ -169,7 +169,11 @@ (define (unison-POp-SUBN m n) (fx- m n)) (define (unison-POp-TAKS n s) (list-head s n)) (define (unison-POp-TAKT n t) (istring-take n t)) - (define (unison-POp-TRCE x) (display (describe-value x))) + (define (unison-POp-TRCE s x) + (display s) + (display "\n") + (display (describe-value x)) + (display "\n")) (define (unison-POp-TTON s) (let ([mn (string->number s)]) (if mn (list 1 mn) (list 0)))) From 8c2d32edc877e1a9e3752ed16fb7701176f977fb Mon Sep 17 00:00:00 2001 From: pragdave Date: Fri, 6 Jan 2023 11:11:47 -0600 Subject: [PATCH 055/467] Update vim support. Comments are now correct, and syntax is closer to current Unison --- editor-support/vim/ftplugin/unison.vim | 7 +- editor-support/vim/syntax/unison.vim | 117 ++++++++++--------------- 2 files changed, 52 insertions(+), 72 deletions(-) diff --git a/editor-support/vim/ftplugin/unison.vim b/editor-support/vim/ftplugin/unison.vim index ce410f091..1e8afb627 100644 --- a/editor-support/vim/ftplugin/unison.vim +++ b/editor-support/vim/ftplugin/unison.vim @@ -4,4 +4,9 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 -call unison#SetBufferDefaults() +setlocal commentstring=--\ %s +setlocal iskeyword+=!,' +" setlocal tabstop=2 +" setlocal softtabstop=2 +" setlocal shiftwidth=2 +" setlocal completefunc=syntaxcomplete#Complete diff --git a/editor-support/vim/syntax/unison.vim b/editor-support/vim/syntax/unison.vim index ebf998528..b43c4119a 100644 --- a/editor-support/vim/syntax/unison.vim +++ b/editor-support/vim/syntax/unison.vim @@ -17,7 +17,7 @@ " u_allow_hash_operator - Don't highlight seemingly incorrect C " preprocessor directives but assume them to be " operators -" +" 2023 Jan 6: Update for current syntax (dt) " 2018 Aug 23: Adapt Haskell highlighting to Unison, cleanup. " 2004 Feb 19: Added C preprocessor directive handling, corrected eol comments " cleaned away literate unison support (should be entirely in @@ -34,20 +34,9 @@ elseif exists("b:current_syntax") finish endif -" (Qualified) identifiers (no default highlighting) -syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" -syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" -" Infix operators--most punctuation characters and any (qualified) identifier -" enclosed in `backquotes`. An operator starting with : is a constructor, -" others are variables (e.g. functions). -syn match uVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*" -syn match uConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*" -syn match uVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`" -syn match uConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`" - -" Reserved symbols--cannot be overloaded. -syn match uDelimiter "(\|)\|\[\|\]\|,\|_\|{\|}" +syn match uOperator "[-!#$%&\*\+/<=>\?@\\^|~]" +syn match uDelimiter "[\[\[(){},.]" " Strings and constants syn match uSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" @@ -64,32 +53,14 @@ syn match uFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" " "literate" comment (see lu.vim). syn match uModule "\" syn match uImport "\" -syn match uInfix "\<\(infix\|infixl\|infixr\)\>" -syn match uTypedef "\<\(∀\|forall\)\>" -syn match uStatement "\<\(unique\|ability\|type\|where\|match\|cases\|;\|let\|with\|handle\)\>" +syn match uTypedef "\<\(unique\|structural\|∀\|forall\)\>" +syn match uStatement "\<\(ability\|do\|type\|where\|match\|cases\|;\|let\|with\|handle\)\>" syn match uConditional "\<\(if\|else\|then\)\>" -" Not real keywords, but close. -if exists("u_highlight_boolean") - " Boolean constants from the standard prelude. - syn match uBoolean "\<\(true\|false\)\>" -endif -if exists("u_highlight_types") - " Primitive types from the standard prelude and libraries. - syn match uType "\<\(Float\|Nat\|Int\|Boolean\|Remote\|Text\)\>" -endif -if exists("u_highlight_more_types") - " Types from the standard prelude libraries. - syn match uType "\<\(Optional\|Either\|Sequence\|Effect\)\>" - syn match uMaybe "\" - syn match uExitCode "\<\(ExitSuccess\)\>" - syn match uOrdering "\<\(GT\|LT\|EQ\)\>" -endif -if exists("u_highlight_debug") - " Debugging functions from the standard prelude. - syn match uDebug "\<\(undefined\|error\|trace\)\>" -endif +syn match uBoolean "\<\(true\|false\)\>" +syn match uType "\<[A-Z_][A-Za-z_'!]*\>" +syn match uName "\<[a-z_][A-Za-z_'!]*\>" " Comments syn match uLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" @@ -98,9 +69,19 @@ syn region uPragma start="{-#" end="#-}" syn region uBelowFold start="^---" skip="." end="." contains=uBelowFold " Docs -syn region uDocBlock start="\[:" end=":]" contains=uLink,uDocDirective -syn match uLink contained "@\([A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>" +syn region uDocBlock start="{{" end="}}" contains=uLink,uDocDirective,uDocIncluded +syn match uLink contained "{[A-Z][a-zA-Z0-9_']*\.[a-z][a-zA-Z0-9_'.]*}" syn match uDocDirective contained "@\[\([A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>] \(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>" +syn match uDocIncluded contained "{{[^}]+}}" + +" things like +" > my_func 1 3 +" test> Function.tap.tests.t1 = check let +" use Nat == + +" ( 99, 100 ) === (withInitialValue 0 do +" : : : + +syn match uDebug "^[A-Za-z]*>.*\(\_s\s*\S[^\n]*\)*" " Define the default highlighting. " For version 5.7 and earlier: only when not done already @@ -113,38 +94,32 @@ if version >= 508 || !exists("did_u_syntax_inits") command -nargs=+ HiLink hi def link endif - HiLink uImport Include - HiLink uInfix PreProc - HiLink uStatement Statement - HiLink uConditional Conditional - HiLink uSpecialChar SpecialChar - HiLink uTypedef Typedef - HiLink uVarSym uOperator - HiLink uConSym uOperator - HiLink uOperator Operator - HiLink uDelimiter Delimiter - HiLink uSpecialCharError Error - HiLink uString String - HiLink uCharacter Character - HiLink uNumber Number - HiLink uFloat Float - HiLink uConditional Conditional - HiLink uLiterateComment uComment - HiLink uBlockComment uComment - HiLink uLineComment uComment - HiLink uComment Comment - HiLink uBelowFold Comment - HiLink uDocBlock String - HiLink uLink uType - HiLink uDocDirective uImport - HiLink uPragma SpecialComment - HiLink uBoolean Boolean - HiLink uType Type - HiLink uMaybe uEnumConst - HiLink uOrdering uEnumConst - HiLink uEnumConst Constant - HiLink uDebug Debug - + HiLink uBelowFold Comment + HiLink uBlockComment uComment + HiLink uBoolean Boolean + HiLink uCharacter Character + HiLink uComment Comment + HiLink uConditional Conditional + HiLink uConditional Conditional + HiLink uDebug Debug + HiLink uDelimiter Delimiter + HiLink uDocBlock String + HiLink uDocDirective uImport + HiLink uDocIncluded uImport + HiLink uFloat Float + HiLink uImport Include + HiLink uLineComment uComment + HiLink uLink uType + HiLink uName Identifier + HiLink uNumber Number + HiLink uOperator Operator + HiLink uPragma SpecialComment + HiLink uSpecialChar SpecialChar + HiLink uSpecialCharError Error + HiLink uStatement Statement + HiLink uString String + HiLink uType Type + HiLink uTypedef Typedef delcommand HiLink endif From 84f36ff4a8306d47c82046d5e733c80bda4ee2d0 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 9 Jan 2023 08:42:44 -0600 Subject: [PATCH 056/467] Parse share handles separate from name segments (#3704) * Parse share handles with `-` in them --- .../src/Unison/Codebase/Editor/RemoteRepo.hs | 13 ++++++++----- .../src/Unison/Codebase/Editor/HandleInput.hs | 9 +++++---- .../src/Unison/Codebase/Editor/UriParser.hs | 18 +++++++++++++++--- .../Unison/Codebase/Editor/VersionParser.hs | 2 +- .../src/Unison/CommandLine/OutputMessages.hs | 6 ++++-- unison-cli/tests/Unison/Test/UriParser.hs | 10 ++-------- unison-cli/tests/Unison/Test/VersionParser.hs | 2 +- 7 files changed, 36 insertions(+), 24 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs b/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs index 7b1d13973..452ffe2de 100644 --- a/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs +++ b/parser-typechecker/src/Unison/Codebase/Editor/RemoteRepo.hs @@ -26,6 +26,9 @@ data ShareCodeserver | CustomCodeserver CodeserverURI deriving stock (Eq, Ord, Show) +newtype ShareUserHandle = ShareUserHandle {shareUserHandleToText :: Text} + deriving stock (Eq, Ord, Show) + -- | -- >>> :set -XOverloadedLists -- >>> import Data.Maybe (fromJust) @@ -36,12 +39,12 @@ data ShareCodeserver -- "share" -- >>> displayShareCodeserver (CustomCodeserver . fromJust $ parseURI "https://share-next.unison-lang.org/api" >>= codeserverFromURI ) "unison" ["base", "List"] -- "share(https://share-next.unison-lang.org:443/api).unison.base.List" -displayShareCodeserver :: ShareCodeserver -> Text -> Path -> Text -displayShareCodeserver cs repo path = +displayShareCodeserver :: ShareCodeserver -> ShareUserHandle -> Path -> Text +displayShareCodeserver cs shareUser path = let shareServer = case cs of DefaultCodeserver -> "" CustomCodeserver cu -> "share(" <> tShow cu <> ")." - in shareServer <> repo <> maybePrintPath path + in shareServer <> shareUserHandleToText shareUser <> maybePrintPath path data ReadGitRepo = ReadGitRepo {url :: Text, ref :: Maybe Text} deriving stock (Eq, Ord, Show) @@ -117,7 +120,7 @@ data ReadGitRemoteNamespace = ReadGitRemoteNamespace data ReadShareRemoteNamespace = ReadShareRemoteNamespace { server :: ShareCodeserver, - repo :: Text, + repo :: ShareUserHandle, -- sch :: Maybe ShortCausalHash, -- maybe later path :: Path } @@ -153,7 +156,7 @@ data WriteGitRemotePath = WriteGitRemotePath data WriteShareRemotePath = WriteShareRemotePath { server :: ShareCodeserver, - repo :: Text, + repo :: ShareUserHandle, path :: Path } deriving stock (Eq, Show) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 7197652a9..d126f309a 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -91,6 +91,7 @@ import Unison.Codebase.Editor.RemoteRepo ( ReadGitRemoteNamespace (..), ReadRemoteNamespace (..), ReadShareRemoteNamespace (..), + ShareUserHandle (..), WriteGitRemotePath (..), WriteGitRepo, WriteRemotePath (..), @@ -179,7 +180,7 @@ import Unison.Share.Types (codeserverBaseURL) import qualified Unison.ShortHash as SH import qualified Unison.Sqlite as Sqlite import Unison.Symbol (Symbol) -import qualified Unison.Sync.Types as Share (Path (..), hashJWTHash) +import qualified Unison.Sync.Types as Share import qualified Unison.Syntax.HashQualified as HQ (fromString, toString, toText, unsafeFromString) import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Name as Name (toString, toVar, unsafeFromString, unsafeFromVar) @@ -1985,7 +1986,7 @@ handlePushToUnisonShare :: WriteShareRemotePath -> Path.Absolute -> PushBehavior handlePushToUnisonShare remote@WriteShareRemotePath {server, repo, path = remotePath} localPath behavior = do let codeserver = Codeserver.resolveCodeserver server let baseURL = codeserverBaseURL codeserver - let sharePath = Share.Path (repo Nel.:| pathToSegments remotePath) + let sharePath = Share.Path (shareUserHandleToText repo Nel.:| pathToSegments remotePath) ensureAuthenticatedWithCodeserver codeserver -- doesn't handle the case where a non-existent path is supplied @@ -2288,7 +2289,7 @@ importRemoteShareBranch rrn@(ReadShareRemoteNamespace {server, repo, path}) = do let baseURL = codeserverBaseURL codeserver -- Auto-login to share if pulling from a non-public path when (not $ RemoteRepo.isPublic rrn) $ ensureAuthenticatedWithCodeserver codeserver - let shareFlavoredPath = Share.Path (repo Nel.:| coerce @[NameSegment] @[Text] (Path.toList path)) + let shareFlavoredPath = Share.Path (shareUserHandleToText repo Nel.:| coerce @[NameSegment] @[Text] (Path.toList path)) Cli.Env {codebase} <- ask causalHash <- Cli.with withEntitiesDownloadedProgressCallback \downloadedCallback -> @@ -2644,7 +2645,7 @@ doFetchCompiler = ns = ReadShareRemoteNamespace { server = RemoteRepo.DefaultCodeserver, - repo = "dolio", + repo = ShareUserHandle "dolio", path = Path.fromList $ NameSegment <$> ["public", "internal", "trunk"] } diff --git a/unison-cli/src/Unison/Codebase/Editor/UriParser.hs b/unison-cli/src/Unison/Codebase/Editor/UriParser.hs index ee11eef6e..76619a59d 100644 --- a/unison-cli/src/Unison/Codebase/Editor/UriParser.hs +++ b/unison-cli/src/Unison/Codebase/Editor/UriParser.hs @@ -22,6 +22,7 @@ import Unison.Codebase.Editor.RemoteRepo ReadRemoteNamespace (..), ReadShareRemoteNamespace (..), ShareCodeserver (DefaultCodeserver), + ShareUserHandle (..), WriteGitRemotePath (..), WriteGitRepo (..), WriteRemotePath (..), @@ -31,7 +32,6 @@ import Unison.Codebase.Path (Path (..)) import qualified Unison.Codebase.Path as Path import Unison.Codebase.ShortCausalHash (ShortCausalHash (..)) import Unison.NameSegment (NameSegment (..)) -import qualified Unison.NameSegment as NameSegment import Unison.Prelude import qualified Unison.Syntax.Lexer import qualified Unison.Util.Pretty as P @@ -89,7 +89,7 @@ writeShareRemotePath = P.label "write share remote path" $ WriteShareRemotePath <$> pure DefaultCodeserver - <*> (NameSegment.toText <$> nameSegment) + <*> shareUserHandle <*> (Path.fromList <$> P.many (C.char '.' *> nameSegment)) -- >>> P.parseMaybe readShareRemoteNamespace ".unisonweb.base._releases.M4" @@ -102,9 +102,21 @@ readShareRemoteNamespace = do ReadShareRemoteNamespace <$> pure DefaultCodeserver -- <*> sch <- P.optional shortBranchHash - <*> (NameSegment.toText <$> nameSegment) + <*> shareUserHandle <*> (Path.fromList <$> P.many (C.char '.' *> nameSegment)) +-- | We're lax in our share user rules here, Share is the source of truth +-- for this stuff and can provide better error messages if required. +-- +-- >>> P.parseMaybe shareUserHandle "unison" +-- Just (ShareUserHandle {shareUserHandleToText = "unison"}) +-- +-- >>> P.parseMaybe shareUserHandle "unison-1337" +-- Just (ShareUserHandle {shareUserHandleToText = "unison-1337"}) +shareUserHandle :: P ShareUserHandle +shareUserHandle = do + ShareUserHandle . Text.pack <$> P.some (P.satisfy \c -> isAlphaNum c || c == '-' || c == '_') + -- >>> P.parseMaybe readGitRemoteNamespace "git(user@server:project.git:branch)#asdf" -- >>> P.parseMaybe readGitRemoteNamespace "git(user@server:project.git:branch)#asdf." -- >>> P.parseMaybe readGitRemoteNamespace "git(user@server:project.git:branch)" diff --git a/unison-cli/src/Unison/Codebase/Editor/VersionParser.hs b/unison-cli/src/Unison/Codebase/Editor/VersionParser.hs index fc1c935e3..62d3d0e1a 100644 --- a/unison-cli/src/Unison/Codebase/Editor/VersionParser.hs +++ b/unison-cli/src/Unison/Codebase/Editor/VersionParser.hs @@ -42,6 +42,6 @@ defaultBaseLib = fmap makeNS $ release <|> unknown makeNS t = ReadShareRemoteNamespace { server = DefaultCodeserver, - repo = "unison", + repo = ShareUserHandle "unison", path = "public" Path.:< "base" Path.:< Path.fromText t } diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index dd56aaac8..edf39a969 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -55,9 +55,11 @@ import qualified Unison.Codebase.Editor.Output.PushPull as PushPull import Unison.Codebase.Editor.RemoteRepo ( ReadGitRepo, ReadRemoteNamespace, + ShareUserHandle (..), WriteGitRepo, WriteRemotePath (..), WriteShareRemotePath (..), + shareUserHandleToText, ) import qualified Unison.Codebase.Editor.RemoteRepo as RemoteRepo import qualified Unison.Codebase.Editor.SlurpResult as SlurpResult @@ -1872,7 +1874,7 @@ notifyUser dir o = case o of ( WriteRemotePathShare WriteShareRemotePath { server = RemoteRepo.DefaultCodeserver, - repo = Share.unRepoName (Share.pathRepoName sharePath), + repo = ShareUserHandle $ Share.unRepoName (Share.pathRepoName sharePath), path = Path.fromList (coerce @[Text] @[NameSegment] (Share.pathCodebasePath sharePath)) } ) @@ -1913,7 +1915,7 @@ prettyShareLink WriteShareRemotePath {repo, path} = Path.toList path & fmap (URI.encodeText . NameSegment.toText) & Text.intercalate "/" - in P.green . P.text $ shareOrigin <> "/@" <> repo <> "/p/code/latest/namespaces/" <> encodedPath + in P.green . P.text $ shareOrigin <> "/@" <> shareUserHandleToText repo <> "/p/code/latest/namespaces/" <> encodedPath prettyFilePath :: FilePath -> Pretty prettyFilePath fp = diff --git a/unison-cli/tests/Unison/Test/UriParser.hs b/unison-cli/tests/Unison/Test/UriParser.hs index e0133b7ff..30dbb1c0f 100644 --- a/unison-cli/tests/Unison/Test/UriParser.hs +++ b/unison-cli/tests/Unison/Test/UriParser.hs @@ -9,13 +9,7 @@ import Data.Text (Text) import qualified Data.Text as Text import EasyTest import qualified Text.Megaparsec as P -import Unison.Codebase.Editor.RemoteRepo - ( ReadGitRepo (..), - ReadRemoteNamespace (..), - ShareCodeserver(..), - pattern ReadGitRemoteNamespace, - pattern ReadShareRemoteNamespace, - ) +import Unison.Codebase.Editor.RemoteRepo (ReadGitRepo (..), ReadRemoteNamespace (..), ShareCodeserver (..), ShareUserHandle (..), pattern ReadGitRemoteNamespace, pattern ReadShareRemoteNamespace) import qualified Unison.Codebase.Editor.UriParser as UriParser import Unison.Codebase.Path (Path (..)) import qualified Unison.Codebase.Path as Path @@ -33,7 +27,7 @@ testShare = scope "share" . tests $ [ parseAugmented ( "unisonweb.base._releases.M4", - ReadRemoteNamespaceShare (ReadShareRemoteNamespace DefaultCodeserver "unisonweb" (path ["base", "_releases", "M4"])) + ReadRemoteNamespaceShare (ReadShareRemoteNamespace DefaultCodeserver (ShareUserHandle "unisonweb") (path ["base", "_releases", "M4"])) ), expectParseFailure ".unisonweb.base" ] diff --git a/unison-cli/tests/Unison/Test/VersionParser.hs b/unison-cli/tests/Unison/Test/VersionParser.hs index 41eaec9dc..5e32c8009 100644 --- a/unison-cli/tests/Unison/Test/VersionParser.hs +++ b/unison-cli/tests/Unison/Test/VersionParser.hs @@ -30,7 +30,7 @@ makeTest (version, path) = ( Just ( ReadShareRemoteNamespace { server = DefaultCodeserver, - repo = "unison", + repo = ShareUserHandle "unison", path = Path.fromList ["public", "base"] <> Path.fromText path } ) From 31d03fd987adf1e869d7c642ce2ad6e1c6c06eb7 Mon Sep 17 00:00:00 2001 From: zetashift Date: Tue, 10 Jan 2023 03:57:29 +0100 Subject: [PATCH 057/467] Add neovim notes about installing the vim plugin --- docs/language-server.markdown | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/language-server.markdown b/docs/language-server.markdown index d503d1780..3c6c2b91a 100644 --- a/docs/language-server.markdown +++ b/docs/language-server.markdown @@ -23,6 +23,24 @@ By default the LSP is hosted at `127.0.0.1:5757`, but you can change the port us ### NeoVim +Before configuring the LSP, install the Vim plugin for filetype detection and syntax highlighting. +For [Packer](https://github.com/wbthomason/packer.nvim) you can install the package as follow: + +```lua +-- You may need to increase the git clone timeout setting in Packer! +use { + "unisonweb/unison", + branch = "trunk", + rtp = "/editor-support/vim" +} +``` + +or [Plug](https://github.com/junegunn/vim-plug): + +```vim +Plug 'unisonweb/unison', { 'branch': 'trunk', 'rtp': 'editor-support/vim' } +``` + Configuration for [coc-nvim](https://github.com/neoclide/coc.nvim), enter the following in the relevant place of your CocConfig ``` @@ -36,6 +54,12 @@ Configuration for [coc-nvim](https://github.com/neoclide/coc.nvim), enter the fo } ``` +For [lspconfig](https://github.com/neovim/nvim-lspconfig), you can use the following setup function: + +```lua +require('lspconfig').unison.setup({}) +``` + Note that you'll need to start UCM _before_ you try connecting to it in your editor or your editor might give up. ### VSCode From cf5c59ceb67585b630b0a774a785a571dec33451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Mon, 9 Jan 2023 23:38:04 -0500 Subject: [PATCH 058/467] Improve syntax highlighting --- editor-support/vim/syntax/unison.vim | 93 ++++++++++++++++------------ 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/editor-support/vim/syntax/unison.vim b/editor-support/vim/syntax/unison.vim index b43c4119a..b7834b142 100644 --- a/editor-support/vim/syntax/unison.vim +++ b/editor-support/vim/syntax/unison.vim @@ -34,9 +34,12 @@ elseif exists("b:current_syntax") finish endif +syntax include @markdown $VIMRUNTIME/syntax/markdown.vim + +syn cluster markdownLikeDocs contains=markdownBold,markdownItalic,markdownLinkText,markdownListMarker,markdownOrderedListMarker,markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6 syn match uOperator "[-!#$%&\*\+/<=>\?@\\^|~]" -syn match uDelimiter "[\[\[(){},.]" +syn match uDelimiter "[\[\](){},.]" " Strings and constants syn match uSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" @@ -51,7 +54,7 @@ syn match uFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" " Keyword definitions. These must be patterns instead of keywords " because otherwise they would match as keywords at the start of a " "literate" comment (see lu.vim). -syn match uModule "\" +syn match uModule "\" syn match uImport "\" syn match uTypedef "\<\(unique\|structural\|∀\|forall\)\>" syn match uStatement "\<\(ability\|do\|type\|where\|match\|cases\|;\|let\|with\|handle\)\>" @@ -59,20 +62,26 @@ syn match uConditional "\<\(if\|else\|then\)\>" syn match uBoolean "\<\(true\|false\)\>" -syn match uType "\<[A-Z_][A-Za-z_'!]*\>" -syn match uName "\<[a-z_][A-Za-z_'!]*\>" +syn match uType "\<[A-Z_][0-9A-Za-z_'!]*\>" +syn match uName "\<[a-z_][0-9A-Za-z_'!]*\>" " Comments syn match uLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" syn region uBlockComment start="{-" end="-}" contains=uBlockComment -syn region uPragma start="{-#" end="#-}" -syn region uBelowFold start="^---" skip="." end="." contains=uBelowFold +syn region uPragma start="{-#" end="#-}" +syn region uBelowFold start="^---" skip="." end="." contains=uBelowFold " Docs -syn region uDocBlock start="{{" end="}}" contains=uLink,uDocDirective,uDocIncluded -syn match uLink contained "{[A-Z][a-zA-Z0-9_']*\.[a-z][a-zA-Z0-9_'.]*}" -syn match uDocDirective contained "@\[\([A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>] \(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_'.]*\>" -syn match uDocIncluded contained "{{[^}]+}}" +syn region uDocBlock matchgroup=unisonDoc start="{{" end="}}" contains=uDocTypecheck,uDocQuasiquote,uDocDirective,uDocCode,uDocCodeInline,uDocCodeRaw,uDocMono,@markdownLikeDocs +syn region uDocQuasiquote contained matchgroup=unisonDocQuote start="{{" end= "}}" contains=TOP +syn region uDocCode contained matchgroup=unisonDocCode start="^\s*```\s*$" end="^\s*```\s*$" contains=TOP +syn region uDocTypecheck contained matchgroup=unisonDocCode start="^\s*@typecheck\s*```\s*$" end="^\s*```\s*$" contains=TOP +syn region uDocCodeRaw contained matchgroup=unisonDocCode start="^\s*```\s*raw\s*$" end="^\s*```\s*$" contains=NoSyntax +syn region uDocCodeInline contained matchgroup=unisonDocCode start="`\@" " things like " > my_func 1 3 @@ -80,8 +89,7 @@ syn match uDocIncluded contained "{{[^}]+}}" " use Nat == + " ( 99, 100 ) === (withInitialValue 0 do " : : : - -syn match uDebug "^[A-Za-z]*>.*\(\_s\s*\S[^\n]*\)*" +syn match uWatch "^[A-Za-z]*>" " Define the default highlighting. " For version 5.7 and earlier: only when not done already @@ -93,34 +101,41 @@ if version >= 508 || !exists("did_u_syntax_inits") else command -nargs=+ HiLink hi def link endif + + HiLink uWatch Debug + HiLink uDocMono uDelimiter + HiLink unisonDocDirective uImport + HiLink unisonDocQuote uDelimiter + HiLink unisonDocCode uDelimiter + HiLink unisonDoc String + HiLink uBelowFold Comment + HiLink uBlockComment uComment + HiLink uBoolean Boolean + HiLink uCharacter Character + HiLink uComment Comment + HiLink uConditional Conditional + HiLink uConditional Conditional + HiLink uDebug Debug + HiLink uDelimiter Delimiter + HiLink uDocBlock String + HiLink uDocDirective uImport + HiLink uDocIncluded uImport + HiLink uFloat Float + HiLink uImport Include + HiLink uLineComment uComment + HiLink uLink uType + HiLink uName Identifier + HiLink uNumber Number + HiLink uOperator Operator + HiLink uPragma SpecialComment + HiLink uSpecialChar SpecialChar + HiLink uSpecialCharError Error + HiLink uStatement Statement + HiLink uString String + HiLink uType Type + HiLink uTypedef Typedef - HiLink uBelowFold Comment - HiLink uBlockComment uComment - HiLink uBoolean Boolean - HiLink uCharacter Character - HiLink uComment Comment - HiLink uConditional Conditional - HiLink uConditional Conditional - HiLink uDebug Debug - HiLink uDelimiter Delimiter - HiLink uDocBlock String - HiLink uDocDirective uImport - HiLink uDocIncluded uImport - HiLink uFloat Float - HiLink uImport Include - HiLink uLineComment uComment - HiLink uLink uType - HiLink uName Identifier - HiLink uNumber Number - HiLink uOperator Operator - HiLink uPragma SpecialComment - HiLink uSpecialChar SpecialChar - HiLink uSpecialCharError Error - HiLink uStatement Statement - HiLink uString String - HiLink uType Type - HiLink uTypedef Typedef - delcommand HiLink + delcommand HiLink endif From ff5c4ae8b62e4389b78fb1dadcbb3d9bba293264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Tue, 10 Jan 2023 00:01:26 -0500 Subject: [PATCH 059/467] Matching should be case-sensitive --- editor-support/vim/syntax/unison.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor-support/vim/syntax/unison.vim b/editor-support/vim/syntax/unison.vim index b7834b142..467e985e2 100644 --- a/editor-support/vim/syntax/unison.vim +++ b/editor-support/vim/syntax/unison.vim @@ -62,8 +62,8 @@ syn match uConditional "\<\(if\|else\|then\)\>" syn match uBoolean "\<\(true\|false\)\>" -syn match uType "\<[A-Z_][0-9A-Za-z_'!]*\>" -syn match uName "\<[a-z_][0-9A-Za-z_'!]*\>" +syn match uType "\<\C[A-Z][0-9A-Za-z_'!]*\>" +syn match uName "\<\C[a-z_][0-9A-Za-z_'!]*\>" " Comments syn match uLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" From e56a6b2f5331c92e5545dc1f5117e8cb865c283b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Tue, 10 Jan 2023 00:46:56 -0500 Subject: [PATCH 060/467] Fix a couple of bugs --- editor-support/vim/syntax/unison.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/editor-support/vim/syntax/unison.vim b/editor-support/vim/syntax/unison.vim index 467e985e2..ec193723a 100644 --- a/editor-support/vim/syntax/unison.vim +++ b/editor-support/vim/syntax/unison.vim @@ -103,13 +103,13 @@ if version >= 508 || !exists("did_u_syntax_inits") endif HiLink uWatch Debug - HiLink uDocMono uDelimiter - HiLink unisonDocDirective uImport - HiLink unisonDocQuote uDelimiter - HiLink unisonDocCode uDelimiter + HiLink uDocMono Delimiter + HiLink unisonDocDirective Import + HiLink unisonDocQuote Delimiter + HiLink unisonDocCode Delimiter HiLink unisonDoc String HiLink uBelowFold Comment - HiLink uBlockComment uComment + HiLink uBlockComment Comment HiLink uBoolean Boolean HiLink uCharacter Character HiLink uComment Comment @@ -118,12 +118,12 @@ if version >= 508 || !exists("did_u_syntax_inits") HiLink uDebug Debug HiLink uDelimiter Delimiter HiLink uDocBlock String - HiLink uDocDirective uImport - HiLink uDocIncluded uImport + HiLink uDocDirective Import + HiLink uDocIncluded Import HiLink uFloat Float HiLink uImport Include - HiLink uLineComment uComment - HiLink uLink uType + HiLink uLineComment Comment + HiLink uLink Type HiLink uName Identifier HiLink uNumber Number HiLink uOperator Operator From 59e8a256934b39ae50c8e15e259e66dc00c217c1 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 10 Jan 2023 11:12:51 -0600 Subject: [PATCH 061/467] Fix annotations for bindings and blocks (#3689) * WIP: fix up anns for bindings, blocks, etc. * Working annotations for lets * Add nesting tests * Fix nesting tests * Fix annotations on let-rec blocks * Fix bad test src * Skip destructuring binds test for now. * Remove debugging * Better fallbacks for finding ref nodes * Transcript updates * Fix bad 'contains' * Rewrite letrec and let combinators to avoid requiring semigroup * Don't include block openers in the block itself. We don't want things like '=' or '->' to be part of a block * Re-run transcripts * Remove redundant constraint --- codebase2/core/U/Core/ABT.hs | 18 ++- codebase2/core/package.yaml | 1 + codebase2/core/unison-core.cabal | 1 + lib/unison-prelude/src/Unison/Debug.hs | 8 + parser-typechecker/src/Unison/Runtime/ANF.hs | 4 +- .../src/Unison/Syntax/TermParser.hs | 72 +++++---- .../src/Unison/Typechecker/Components.hs | 16 +- .../src/Unison/Typechecker/Context.hs | 10 +- unison-cli/src/Unison/LSP/Queries.hs | 104 +++++++------ unison-cli/tests/Unison/Test/LSP.hs | 147 ++++++++++++++++-- unison-core/src/Unison/Term.hs | 34 ++-- unison-syntax/src/Unison/Parser/Ann.hs | 23 +++ 12 files changed, 316 insertions(+), 122 deletions(-) diff --git a/codebase2/core/U/Core/ABT.hs b/codebase2/core/U/Core/ABT.hs index cb9dc011d..01252401a 100644 --- a/codebase2/core/U/Core/ABT.hs +++ b/codebase2/core/U/Core/ABT.hs @@ -8,8 +8,10 @@ import Data.Functor.Identity (Identity (runIdentity)) import Data.Maybe (fromMaybe) import Data.Set (Set) import qualified Data.Set as Set +import qualified Debug.RecoverRTTI as RTTI import GHC.Generics (Generic) import U.Core.ABT.Var (Var (freshIn)) +import qualified Unison.Debug as Debug import Prelude hiding (abs, cycle) data ABT f v r @@ -69,12 +71,16 @@ instance tag (Cycle _) = 3 instance (forall a. Show a => Show (f a), Show v) => Show (Term f v a) where - -- annotations not shown - showsPrec p (Term _ _ out) = case out of - Var v -> showParen (p >= 9) $ \x -> "Var " ++ show v ++ x - Cycle body -> ("Cycle " ++) . showsPrec p body - Abs v body -> showParen True $ (show v ++) . showString ". " . showsPrec p body - Tm f -> showsPrec p f + showsPrec p (Term _ ann out) = case out of + Var v -> showParen (p >= 9) $ \x -> showAnn ++ "Var " ++ show v ++ x + Cycle body -> (\s -> showAnn ++ "Cycle " ++ s) . showsPrec p body + Abs v body -> showParen True $ (\s -> showAnn ++ show v ++ s) . showString ". " . showsPrec p body + Tm f -> (showAnn ++) . showsPrec p f + where + showAnn = + if Debug.shouldDebug Debug.Annotations + then "(" ++ RTTI.anythingToString ann ++ ")" + else "" amap :: Functor f => (a -> a') -> Term f v a -> Term f v a' amap = fmap diff --git a/codebase2/core/package.yaml b/codebase2/core/package.yaml index d2a85fc13..9fa017ef9 100644 --- a/codebase2/core/package.yaml +++ b/codebase2/core/package.yaml @@ -13,6 +13,7 @@ dependencies: - rfc5051 - text - vector + - recover-rtti - unison-hash - unison-prelude - unison-util-base32hex diff --git a/codebase2/core/unison-core.cabal b/codebase2/core/unison-core.cabal index 45a316552..93d6455d4 100644 --- a/codebase2/core/unison-core.cabal +++ b/codebase2/core/unison-core.cabal @@ -52,6 +52,7 @@ library build-depends: base , containers + , recover-rtti , rfc5051 , text , unison-hash diff --git a/lib/unison-prelude/src/Unison/Debug.hs b/lib/unison-prelude/src/Unison/Debug.hs index 9c7e03c00..94efac5bd 100644 --- a/lib/unison-prelude/src/Unison/Debug.hs +++ b/lib/unison-prelude/src/Unison/Debug.hs @@ -37,6 +37,8 @@ data DebugFlag | -- | Useful for adding temporary debugging statements during development. -- Remove uses of Debug.Temp before merging to keep things clean for the next person :) Temp + | -- | Shows Annotations when printing terms + Annotations deriving (Eq, Ord, Show, Bounded, Enum) debugFlags :: Set DebugFlag @@ -58,6 +60,7 @@ debugFlags = case (unsafePerformIO (lookupEnv "UNISON_DEBUG")) of "LSP" -> pure LSP "TIMING" -> pure Timing "TEMP" -> pure Temp + "ANNOTATIONS" -> pure Annotations _ -> empty {-# NOINLINE debugFlags #-} @@ -101,6 +104,10 @@ debugTemp :: Bool debugTemp = Temp `Set.member` debugFlags {-# NOINLINE debugTemp #-} +debugAnnotations :: Bool +debugAnnotations = Annotations `Set.member` debugFlags +{-# NOINLINE debugAnnotations #-} + -- | Use for trace-style selective debugging. -- E.g. 1 + (debug Git "The second number" 2) -- @@ -151,3 +158,4 @@ shouldDebug = \case LSP -> debugLSP Timing -> debugTiming Temp -> debugTemp + Annotations -> debugAnnotations diff --git a/parser-typechecker/src/Unison/Runtime/ANF.hs b/parser-typechecker/src/Unison/Runtime/ANF.hs index 9c0c3b9cc..52f3aafb3 100644 --- a/parser-typechecker/src/Unison/Runtime/ANF.hs +++ b/parser-typechecker/src/Unison/Runtime/ANF.hs @@ -1515,7 +1515,9 @@ tru = TCon Ty.booleanRef 1 [] renameCtx :: Var v => v -> v -> Ctx v -> (Ctx v, Bool) renameCtx v u (d, ctx) | (ctx, b) <- rn [] ctx = ((d, ctx), b) where - swap w | w == v = u | otherwise = w + swap w + | w == v = u + | otherwise = w rn acc [] = (reverse acc, False) rn acc (ST d vs ccs b : es) diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index 7f69cb125..c547d6923 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -1,5 +1,4 @@ {-# LANGUAGE PartialTypeSignatures #-} -{-# OPTIONS_GHC -Wno-partial-type-signatures #-} module Unison.Syntax.TermParser where @@ -8,7 +7,7 @@ import qualified Data.Char as Char import Data.Foldable (foldrM) import qualified Data.List as List import qualified Data.List.Extra as List.Extra -import Data.List.NonEmpty (NonEmpty) +import Data.List.NonEmpty (NonEmpty ((:|))) import qualified Data.List.NonEmpty as NonEmpty import qualified Data.Maybe as Maybe import qualified Data.Sequence as Sequence @@ -234,7 +233,7 @@ parsePattern = root else pure (Pattern.Var (ann v), [tokenToPair v]) unbound :: P v (Pattern Ann, [(Ann, v)]) unbound = (\tok -> (Pattern.Unbound (ann tok), [])) <$> blank - ctor :: CT.ConstructorType -> _ -> P v (L.Token ConstructorReference) + ctor :: CT.ConstructorType -> (L.Token (HQ.HashQualified Name) -> Set ConstructorReference -> Error v) -> P v (L.Token ConstructorReference) ctor ct err = do -- this might be a var, so we avoid consuming it at first tok <- P.try (P.lookAhead hqPrefixId) @@ -995,8 +994,15 @@ destructuringBind = do in Term.match a scrute [thecase t] ) +-- | Rules for the annotation of the resulting binding is as follows: +-- * If the binding has a type signature, the top level scope of the annotation for the type +-- Ann node will contain the _entire_ binding, including the type signature. +-- * The body expression of the binding contains the entire lhs (including the name of the +-- binding) and the entire body. +-- * If the binding is a lambda, the lambda node includes the entire LHS of the binding, +-- including the name as well. binding :: forall v. Var v => P v ((Ann, v), Term v Ann) -binding = label "binding" $ do +binding = label "binding" do typ <- optional typedecl -- a ++ b = ... let infixLhs = do @@ -1014,12 +1020,12 @@ binding = label "binding" $ do case typ of Nothing -> do -- we haven't seen a type annotation, so lookahead to '=' before commit - (loc, name, args) <- P.try (lhs <* P.lookAhead (openBlockWith "=")) + (lhsLoc, name, args) <- P.try (lhs <* P.lookAhead (openBlockWith "=")) body <- block "=" verifyRelativeName' (fmap Name.unsafeFromVar name) - pure $ mkBinding loc (L.payload name) args body + pure $ mkBinding (lhsLoc <> ann body) (L.payload name) args body Just (nameT, typ) -> do - (_, name, args) <- lhs + (lhsLoc, name, args) <- lhs verifyRelativeName' (fmap Name.unsafeFromVar name) when (L.payload name /= L.payload nameT) $ customFailure $ SignatureNeedsAccompanyingBody nameT @@ -1027,7 +1033,7 @@ binding = label "binding" $ do pure $ fmap (\e -> Term.ann (ann nameT <> ann e) e typ) - (mkBinding (ann nameT) (L.payload name) args body) + (mkBinding (ann lhsLoc <> ann body) (L.payload name) args body) where mkBinding loc f [] body = ((loc, f), body) mkBinding loc f args body = @@ -1106,7 +1112,7 @@ substImports ns imports = NamesWithHistory.hasTypeNamed (Name.unsafeFromVar full) ns ] -block' :: Var v => IsTop -> String -> P v (L.Token ()) -> P v b -> TermP v +block' :: Var v => IsTop -> String -> P v (L.Token ()) -> P v (L.Token ()) -> TermP v block' isTop = block'' isTop False block'' :: @@ -1129,43 +1135,45 @@ block'' isTop implicitUnitAtEnd s openBlock closeBlock = do statement = asum [Binding <$> binding, DestructuringBind <$> destructuringBind, Action <$> blockTerm] go :: L.Token () -> [BlockElement v] -> P v (Term v Ann) go open bs = - let finish tm = case Components.minimize' tm of + let finish :: Term.Term v Ann -> TermP v + finish tm = case Components.minimize' tm of Left dups -> customFailure $ DuplicateTermNames (toList dups) Right tm -> pure tm - toTm bs = do - (bs, body) <- body bs - finish =<< foldrM step body bs + toTm :: [BlockElement v] -> TermP v + toTm [] = customFailure $ EmptyBlock (const s <$> open) + toTm (be : bes) = do + let (bs, blockResult) = determineBlockResult (be :| bes) + finish =<< foldrM step blockResult bs where - step elem body = case elem of + step :: BlockElement v -> Term v Ann -> TermP v + step elem result = case elem of Binding ((a, v), tm) -> pure $ Term.consLetRec isTop - (ann a <> ann body) + (ann a <> ann result) (a, v, tm) - body + result Action tm -> pure $ Term.consLetRec isTop - (ann tm <> ann body) + (ann tm <> ann result) (ann tm, positionalVar (ann tm) (Var.named "_"), tm) - body + result DestructuringBind (_, f) -> - f <$> finish body - body bs = case reverse bs of - Binding ((a, _v), _) : _ -> - pure $ - if implicitUnitAtEnd - then (bs, DD.unitTerm a) - else (bs, Term.var a (positionalVar a Var.missingResult)) - Action e : bs -> pure (reverse bs, e) - DestructuringBind (a, _) : _ -> - pure $ - if implicitUnitAtEnd - then (bs, DD.unitTerm a) - else (bs, Term.var a (positionalVar a Var.missingResult)) - [] -> customFailure $ EmptyBlock (const s <$> open) + f <$> finish result + determineBlockResult :: NonEmpty (BlockElement v) -> ([BlockElement v], Term v Ann) + determineBlockResult bs = case NonEmpty.reverse bs of + Binding ((a, _v), _) :| _ -> + if implicitUnitAtEnd + then (toList bs, DD.unitTerm a) + else (toList bs, Term.var a (positionalVar a Var.missingResult)) + Action e :| bs -> (reverse (toList bs), e) + DestructuringBind (a, _) :| _ -> + if implicitUnitAtEnd + then (toList bs, DD.unitTerm a) + else (toList bs, Term.var a (positionalVar a Var.missingResult)) in toTm bs number :: Var v => TermP v diff --git a/parser-typechecker/src/Unison/Typechecker/Components.hs b/parser-typechecker/src/Unison/Typechecker/Components.hs index 9984b2510..33e25a0db 100644 --- a/parser-typechecker/src/Unison/Typechecker/Components.hs +++ b/parser-typechecker/src/Unison/Typechecker/Components.hs @@ -35,10 +35,10 @@ ordered = ABT.orderedComponents -- -- Fails on the left if there are duplicate definitions. minimize :: - Var v => + (Var v) => Term' vt v a -> Either (NonEmpty (v, [a])) (Maybe (Term' vt v a)) -minimize (Term.LetRecNamedAnnotatedTop' isTop ann bs e) = +minimize (Term.LetRecNamedAnnotatedTop' isTop blockAnn bs e) = let bindings = first snd <$> bs group = map (fst . head &&& map (ABT.annotation . snd)) . groupBy ((==) `on` fst) @@ -70,23 +70,23 @@ minimize (Term.LetRecNamedAnnotatedTop' isTop ann bs e) = | Set.member hdv (ABT.freeVars hdb) = Term.letRec isTop - (annotationFor hdv) + blockAnn [(annotatedVar hdv, hdb)] e - | otherwise = Term.let1 isTop [(annotatedVar hdv, hdb)] e - mklet cycle@((hdv, _) : _) e = + | otherwise = Term.singleLet isTop blockAnn (hdv, hdb) e + mklet cycle@((_, _) : _) e = Term.letRec isTop - (annotationFor hdv) + blockAnn (first annotatedVar <$> cycle) e mklet [] e = e in -- The outer annotation is going to be meaningful, so we make -- sure to preserve it, whereas the annotations at intermediate Abs -- nodes aren't necessarily meaningful - Right . Just . ABT.annotate ann . foldr mklet e $ cs + Right . Just . ABT.annotate blockAnn . foldr mklet e $ cs minimize _ = Right Nothing minimize' :: - Var v => Term' vt v a -> Either (NonEmpty (v, [a])) (Term' vt v a) + (Var v) => Term' vt v a -> Either (NonEmpty (v, [a])) (Term' vt v a) minimize' term = fromMaybe term <$> minimize term diff --git a/parser-typechecker/src/Unison/Typechecker/Context.hs b/parser-typechecker/src/Unison/Typechecker/Context.hs index 7541f3c49..ce92c55e1 100644 --- a/parser-typechecker/src/Unison/Typechecker/Context.hs +++ b/parser-typechecker/src/Unison/Typechecker/Context.hs @@ -67,6 +67,7 @@ import qualified Data.Set as Set import qualified Data.Text as Text import qualified Unison.ABT as ABT import qualified Unison.Blank as B +import qualified Unison.Builtin.Decls as DDB import Unison.ConstructorReference ( ConstructorReference, GConstructorReference (..), @@ -77,7 +78,6 @@ import Unison.DataDeclaration EffectDeclaration, ) import qualified Unison.DataDeclaration as DD -import qualified Unison.Builtin.Decls as DDB import Unison.DataDeclaration.ConstructorId (ConstructorId) import Unison.Pattern (Pattern) import qualified Unison.Pattern as Pattern @@ -1087,9 +1087,9 @@ synthesizeWanted (Term.Let1Top' top binding e) = do then pure $ generalizeExistentials ctx2 tb else applyM . applyCtx ctx2 $ tb v' <- ABT.freshen e freshenVar - when (Var.isAction (ABT.variable e)) $ + when (Var.isAction (ABT.variable e)) $ -- enforce that actions in a block have type () - subtype tbinding (DDB.unitType (ABT.annotation binding)) + subtype tbinding (DDB.unitType (ABT.annotation binding)) appendContext [Ann v' tbinding] (t, w) <- synthesize (ABT.bindInheritAnnotation e (Term.var () v')) t <- applyM t @@ -1571,7 +1571,7 @@ annotateLetRecBindings isTop letrec = -- note: elements of a cycle have to be pure, otherwise order of effects -- is unclear and chaos ensues -- ensure actions in blocks have type () - when (Var.isAction v) $ subtype t (DDB.unitType (ABT.annotation b)) + when (Var.isAction v) $ subtype t (DDB.unitType (ABT.annotation b)) checkScopedWith b t [] ensureGuardedCycle (vs `zip` bindings) pure (bindings, bindingTypes) @@ -2124,7 +2124,7 @@ checkWanted want (Term.Let1' binding m) t = do (tbinding, wbinding) <- synthesize binding want <- coalesceWanted wbinding want markThenRetractWanted v $ do - when (Var.isAction (ABT.variable m)) $ + when (Var.isAction (ABT.variable m)) $ -- enforce that actions in a block have type () subtype tbinding (DDB.unitType (ABT.annotation binding)) extendContext (Ann v tbinding) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 4e855f450..cf680c191 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -127,38 +127,40 @@ refInType typ = case ABT.out typ of -- children contain that position. findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (Either (Term Symbol Ann) (Type Symbol Ann)) findSmallestEnclosingNode pos term - | not (ABT.annotation term `Ann.contains` pos) = Nothing - | otherwise = (<|> Just (Left term)) $ do - case ABT.out term of - ABT.Tm f -> case f of - Term.Int {} -> Just (Left term) - Term.Nat {} -> Just (Left term) - Term.Float {} -> Just (Left term) - Term.Boolean {} -> Just (Left term) - Term.Text {} -> Just (Left term) - Term.Char {} -> Just (Left term) - Term.Blank {} -> Just (Left term) - Term.Ref {} -> Just (Left term) - Term.Constructor {} -> Just (Left term) - Term.Request {} -> Just (Left term) - Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.App a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (Right <$> findSmallestEnclosingType pos typ) - Term.List xs -> altSum (findSmallestEnclosingNode pos <$> xs) - Term.If cond a b -> findSmallestEnclosingNode pos cond <|> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.And l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r - Term.Or l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r - Term.Lam a -> findSmallestEnclosingNode pos a - Term.LetRec _isTop xs y -> altSum (findSmallestEnclosingNode pos <$> xs) <|> findSmallestEnclosingNode pos y - Term.Let _isTop a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.Match a cases -> - findSmallestEnclosingNode pos a - <|> altSum (cases <&> \(MatchCase _pat grd body) -> altSum (findSmallestEnclosingNode pos <$> grd) <|> findSmallestEnclosingNode pos body) - Term.TermLink {} -> Just (Left term) - Term.TypeLink {} -> Just (Left term) - ABT.Var _v -> Just (Left term) - ABT.Cycle r -> findSmallestEnclosingNode pos r - ABT.Abs _v r -> findSmallestEnclosingNode pos r + | annIsFilePosition (ABT.annotation term) && not (ABT.annotation term `Ann.contains` pos) = Nothing + | otherwise = do + let bestChild = case ABT.out term of + ABT.Tm f -> case f of + Term.Int {} -> Just (Left term) + Term.Nat {} -> Just (Left term) + Term.Float {} -> Just (Left term) + Term.Boolean {} -> Just (Left term) + Term.Text {} -> Just (Left term) + Term.Char {} -> Just (Left term) + Term.Blank {} -> Just (Left term) + Term.Ref {} -> Just (Left term) + Term.Constructor {} -> Just (Left term) + Term.Request {} -> Just (Left term) + Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.App a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (Right <$> findSmallestEnclosingType pos typ) + Term.List xs -> altSum (findSmallestEnclosingNode pos <$> xs) + Term.If cond a b -> findSmallestEnclosingNode pos cond <|> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.And l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r + Term.Or l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r + Term.Lam a -> findSmallestEnclosingNode pos a + Term.LetRec _isTop xs y -> altSum (findSmallestEnclosingNode pos <$> xs) <|> findSmallestEnclosingNode pos y + Term.Let _isTop a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.Match a cases -> + findSmallestEnclosingNode pos a + <|> altSum (cases <&> \(MatchCase _pat grd body) -> altSum (findSmallestEnclosingNode pos <$> grd) <|> findSmallestEnclosingNode pos body) + Term.TermLink {} -> Just (Left term) + Term.TypeLink {} -> Just (Left term) + ABT.Var _v -> Just (Left term) + ABT.Cycle r -> findSmallestEnclosingNode pos r + ABT.Abs _v r -> findSmallestEnclosingNode pos r + let fallback = if annIsFilePosition (ABT.annotation term) then Just (Left term) else Nothing + bestChild <|> fallback -- | Find the the node in a type which contains the specified position, but none of its -- children contain that position. @@ -166,21 +168,23 @@ findSmallestEnclosingNode pos term -- that a position references. findSmallestEnclosingType :: Pos -> Type Symbol Ann -> Maybe (Type Symbol Ann) findSmallestEnclosingType pos typ - | not (ABT.annotation typ `Ann.contains` pos) = Nothing - | otherwise = (<|> Just typ) $ do - case ABT.out typ of - ABT.Tm f -> case f of - Type.Ref {} -> Just typ - Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.Forall r -> findSmallestEnclosingType pos r - Type.Ann a _kind -> findSmallestEnclosingType pos a - Type.Effects es -> altSum (findSmallestEnclosingType pos <$> es) - Type.IntroOuter a -> findSmallestEnclosingType pos a - ABT.Var _v -> Just typ - ABT.Cycle r -> findSmallestEnclosingType pos r - ABT.Abs _v r -> findSmallestEnclosingType pos r + | annIsFilePosition (ABT.annotation typ) && not (ABT.annotation typ `Ann.contains` pos) = Nothing + | otherwise = do + let bestChild = case ABT.out typ of + ABT.Tm f -> case f of + Type.Ref {} -> Just typ + Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Forall r -> findSmallestEnclosingType pos r + Type.Ann a _kind -> findSmallestEnclosingType pos a + Type.Effects es -> altSum (findSmallestEnclosingType pos <$> es) + Type.IntroOuter a -> findSmallestEnclosingType pos a + ABT.Var _v -> Just typ + ABT.Cycle r -> findSmallestEnclosingType pos r + ABT.Abs _v r -> findSmallestEnclosingType pos r + let fallback = if annIsFilePosition (ABT.annotation typ) then Just typ else Nothing + bestChild <|> fallback -- | Returns the type reference the given position applies to within a Decl, if any. -- @@ -193,3 +197,9 @@ refInDecl p (DD.asDataDecl -> dd) = typeNode <- findSmallestEnclosingType p typ ref <- refInType typeNode pure ref + +annIsFilePosition :: Ann -> Bool +annIsFilePosition = \case + Ann.Intrinsic -> False + Ann.External -> False + Ann.Ann {} -> True diff --git a/unison-cli/tests/Unison/Test/LSP.hs b/unison-cli/tests/Unison/Test/LSP.hs index 48dc236f4..ef791497d 100644 --- a/unison-cli/tests/Unison/Test/LSP.hs +++ b/unison-cli/tests/Unison/Test/LSP.hs @@ -19,6 +19,7 @@ import qualified Unison.Codebase.SqliteCodebase as SC import qualified Unison.LSP.Queries as LSPQ import qualified Unison.Lexer.Pos as Lexer import Unison.Parser.Ann (Ann (..)) +import qualified Unison.Parser.Ann as Ann import Unison.Prelude import qualified Unison.Reference as Reference import qualified Unison.Result as Result @@ -30,10 +31,20 @@ import qualified Unison.Term as Term import Unison.Type (Type) import qualified Unison.Type as Type import qualified Unison.UnisonFile as UF +import Unison.Util.Monoid (foldMapM) test :: Test () -test = - scope "annotations" . tests . fmap makeNodeSelectionTest $ +test = do + scope "annotations" $ + tests + [ refFinding, + annotationNesting + ] + +-- | Test that we can find the correct reference for a given cursor position. +refFinding :: Test () +refFinding = + scope "refs" . tests . fmap makeNodeSelectionTest $ [ ( "Binary Op lhs", [here|term = tr^ue && false|], True, @@ -69,6 +80,55 @@ term = This |], True, Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) + ), + ( "Test annotations within bindings for do-block elements", + [here| +term = do + first = false + second = tr^ue + first && second + |], + True, + Left (Term.Boolean True) + ), + ( "Test annotations within bindings for let-block elements", + [here| +term = let + first = false + second = tr^ue + first && second + |], + True, + Left (Term.Boolean True) + ), + ( "Test annotations within actions for let-block elements", + [here| +term = let + first = false + first && tr^ue + |], + True, + Left (Term.Boolean True) + ), + -- ( "Test annotations for blocks with destructuring binds", + -- [here| + -- term = let + -- (first, second) = (false, true) + -- (third, fourth) = (false, tr^ue) + -- first && second && third && fourth + -- |], + -- True, + -- Left (Term.Boolean True) + -- ), + ( "Test annotations for blocks recursive binds", + [here| +term = let + f x = g true && x + g y = f fal^se && y + f true + |], + True, + Left (Term.Boolean False) ) ] @@ -85,18 +145,7 @@ extractCursor txt = makeNodeSelectionTest :: (String, Text, Bool, Either ((Term.F Symbol Ann Ann (Term Symbol Ann))) (Type.F (Type Symbol Ann))) -> Test () makeNodeSelectionTest (name, testSrc, testTypechecked, expected) = scope name $ do (pos, src) <- extractCursor testSrc - (notes, mayParsedFile, mayTypecheckedFile) <- withTestCodebase \codebase -> do - let generateUniqueName = Parser.uniqueBase32Namegen <$> Random.getSystemDRG - let ambientAbilities = [] - let parseNames = mempty - let lexedSource = (src, L.lexer name (Text.unpack src)) - r <- Typecheck.typecheckHelper codebase generateUniqueName ambientAbilities parseNames (Text.pack name) lexedSource - let Result.Result notes mayResult = r - let (parsedFile, typecheckedFile) = case mayResult of - Nothing -> (Nothing, Nothing) - Just (Left uf) -> (Just uf, Nothing) - Just (Right tf) -> (Just $ UF.discardTypes tf, Just tf) - pure (notes, parsedFile, typecheckedFile) + (notes, mayParsedFile, mayTypecheckedFile) <- typecheckSrc name src scope "parsed file" $ do pf <- maybe (crash (show ("Failed to parse" :: String, notes))) pure mayParsedFile let pfResult = @@ -115,6 +164,76 @@ makeNodeSelectionTest (name, testSrc, testTypechecked, expected) = scope name $ LSPQ.findSmallestEnclosingNode pos trm expectEqual (Just $ bimap ABT.Tm ABT.Tm expected) (bimap ABT.out ABT.out <$> tfResult) +-- | Tests which assert that the annotation for each ABT node spans at least the span of +-- its children, i.e. all child annotations are contained within the annotation of their parent. +annotationNesting :: Test () +annotationNesting = + scope "nesting" . tests . fmap annotationNestingTest $ + [ ( "let blocks", + [here| +term = let + x = true + y = false + true && false +|] + ), + ( "let-rec blocks", + [here| +term = let + x a = a && y true + y b = b && x true + x true && y true +|] + ), + ( "function bindings", + [here| +term x y = x && y +|] + ) + ] + +annotationNestingTest :: (String, Text) -> Test () +annotationNestingTest (name, src) = scope name do + (_notes, _pf, maytf) <- typecheckSrc name src + tf <- maybe (crash "Failed to typecheck") pure maytf + UF.hashTermsId tf + & toList + & traverse_ \(_refId, _wk, trm, _typ) -> + assertAnnotationsAreNested trm + +-- | Asserts that for all nodes in the provided ABT, the annotations of all child nodes are +-- within the span of the parent node. +assertAnnotationsAreNested :: forall f. (Foldable f, Functor f, Show (f (Either String Ann))) => ABT.Term f Symbol Ann -> Test () +assertAnnotationsAreNested term = do + case ABT.cata alg term of + Right _ -> pure () + Left err -> crash err + where + alg :: Ann -> ABT.ABT f Symbol (Either String Ann) -> Either String Ann + alg ann abt = do + childSpan <- abt & foldMapM id + case ann `Ann.encompasses` childSpan of + -- one of the annotations isn't in the file, don't bother checking. + Nothing -> pure (ann <> childSpan) + Just isInFile + | isInFile -> pure ann + | otherwise -> Left $ "Containment breach: children aren't contained with the parent:" <> show (ann, abt) + +typecheckSrc :: String -> Text -> Test (Seq (Result.Note Symbol Ann), Maybe (UF.UnisonFile Symbol Ann), Maybe (UF.TypecheckedUnisonFile Symbol Ann)) +typecheckSrc name src = do + withTestCodebase \codebase -> do + let generateUniqueName = Parser.uniqueBase32Namegen <$> Random.getSystemDRG + let ambientAbilities = [] + let parseNames = mempty + let lexedSource = (src, L.lexer name (Text.unpack src)) + r <- Typecheck.typecheckHelper codebase generateUniqueName ambientAbilities parseNames (Text.pack name) lexedSource + let Result.Result notes mayResult = r + let (parsedFile, typecheckedFile) = case mayResult of + Nothing -> (Nothing, Nothing) + Just (Left uf) -> (Just uf, Nothing) + Just (Right tf) -> (Just $ UF.discardTypes tf, Just tf) + pure (notes, parsedFile, typecheckedFile) + withTestCodebase :: (Codebase IO Symbol Ann -> IO r) -> Test r withTestCodebase action = do diff --git a/unison-core/src/Unison/Term.hs b/unison-core/src/Unison/Term.hs index 204f7d558..dc4cd33b6 100644 --- a/unison-core/src/Unison/Term.hs +++ b/unison-core/src/Unison/Term.hs @@ -916,7 +916,7 @@ letRec' isTop bindings body = -- => -- let rec x = 42; y = "hi" in (x,y) consLetRec :: - Ord v => + (Ord v, Semigroup a) => Bool -> -- isTop parameter a -> -- annotation for overall let rec (a, v, Term' vt v a) -> -- the binding @@ -927,19 +927,24 @@ consLetRec isTop a (ab, vb, b) body = case body of _ -> letRec isTop a [((ab, vb), b)] body letRec :: - Ord v => + forall v vt a. + (Ord v) => Bool -> + -- Annotation spanning the full let rec a -> [((a, v), Term' vt v a)] -> Term' vt v a -> Term' vt v a letRec _ _ [] e = e -letRec isTop a bindings e = +letRec isTop blockAnn bindings e = ABT.cycle' - a - (foldr (uncurry ABT.abs' . fst) z bindings) + blockAnn + (foldr addAbs body bindings) where - z = ABT.tm' a (LetRec isTop (map snd bindings) e) + addAbs :: ((a, v), b) -> ABT.Term f v a -> ABT.Term f v a + addAbs ((_a, v), _b) t = ABT.abs' blockAnn v t + body :: Term' vt v a + body = ABT.tm' blockAnn (LetRec isTop (map snd bindings) e) -- | Smart constructor for let rec blocks. Each binding in the block may -- reference any other binding in the block in its body (including itself), @@ -961,14 +966,14 @@ let1_ isTop bindings e = foldr f e bindings -- | annotations are applied to each nested Let expression let1 :: - Ord v => + (Ord v, Semigroup a) => IsTop -> [((a, v), Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a let1 isTop bindings e = foldr f e bindings where - f ((ann, v), b) body = ABT.tm' ann (Let isTop b (ABT.abs' ann v body)) + f ((ann, v), b) body = ABT.tm' (ann <> ABT.annotation body) (Let isTop b (ABT.abs' (ABT.annotation body) v body)) let1' :: (Semigroup a, Ord v) => @@ -979,10 +984,21 @@ let1' :: let1' isTop bindings e = foldr f e bindings where ann = ABT.annotation - f (v, b) body = ABT.tm' a (Let isTop b (ABT.abs' a v body)) + f (v, b) body = ABT.tm' (a <> ABT.annotation body) (Let isTop b (ABT.abs' (ABT.annotation body) v body)) where a = ann b <> ann body +-- | Like 'let1', but for a single binding, avoiding the Semigroup constraint. +singleLet :: + Ord v => + IsTop -> + -- Annotation spanning the whole let-binding + a -> + (v, Term2 vt at ap v a) -> + Term2 vt at ap v a -> + Term2 vt at ap v a +singleLet isTop a (v, body) e = ABT.tm' a (Let isTop body (ABT.abs' a v e)) + -- let1' :: Var v => [(Text, Term0 vt v)] -> Term0 vt v -> Term0 vt v -- let1' bs e = let1 [(ABT.v' name, b) | (name,b) <- bs ] e diff --git a/unison-syntax/src/Unison/Parser/Ann.hs b/unison-syntax/src/Unison/Parser/Ann.hs index 7b721b02e..ccb254237 100644 --- a/unison-syntax/src/Unison/Parser/Ann.hs +++ b/unison-syntax/src/Unison/Parser/Ann.hs @@ -45,3 +45,26 @@ contains :: Ann -> L.Pos -> Bool contains Intrinsic _ = False contains External _ = False contains (Ann start end) p = start <= p && p < end + +-- | Checks whether an annotation contains another annotation. +-- +-- i.e. pos ∈ [start, end) +-- +-- >>> Intrinsic `encompasses` Ann (L.Pos 1 1) (L.Pos 2 1) +-- Nothing +-- +-- >>> External `encompasses` Ann (L.Pos 1 1) (L.Pos 2 1) +-- Nothing +-- +-- >>> Ann (L.Pos 0 0) (L.Pos 0 10) `encompasses` Ann (L.Pos 0 1) (L.Pos 0 5) +-- Just True +-- +-- >>> Ann (L.Pos 1 0) (L.Pos 1 10) `encompasses` Ann (L.Pos 0 0) (L.Pos 2 0) +-- Just False +encompasses :: Ann -> Ann -> Maybe Bool +encompasses Intrinsic _ = Nothing +encompasses External _ = Nothing +encompasses _ Intrinsic = Nothing +encompasses _ External = Nothing +encompasses (Ann start1 end1) (Ann start2 end2) = + Just $ start1 <= start2 && end1 >= end2 From 6f4fce913fc2612fc11ccc13a4b60c336cad9df3 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 10 Jan 2023 12:45:31 -0600 Subject: [PATCH 062/467] Require that each pattern have at least one RHS. --- parser-typechecker/src/Unison/Syntax/TermParser.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index c547d6923..f206c2d1b 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -168,7 +168,7 @@ matchCase = do pats -> foldr pair (unit (ann . last $ pats)) pats unit ann = Pattern.Constructor ann (ConstructorReference DD.unitRef 0) [] pair p1 p2 = Pattern.Constructor (ann p1 <> ann p2) (ConstructorReference DD.pairRef 0) [p1, p2] - guardsAndBlocks <- many $ do + guardsAndBlocks <- some $ do guard <- asum [ Nothing <$ P.try (reserved "|" *> quasikeyword "otherwise"), From d318f9f593c9f64a62eaea545f570b4f8554f0df Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 10 Jan 2023 13:34:50 -0600 Subject: [PATCH 063/467] Fix parsing rules for pattern blocks --- parser-typechecker/src/Unison/PrintError.hs | 27 ++++++++++--------- .../src/Unison/Syntax/TermParser.hs | 24 ++++++++++------- unison-syntax/src/Unison/Syntax/Parser.hs | 3 ++- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/parser-typechecker/src/Unison/PrintError.hs b/parser-typechecker/src/Unison/PrintError.hs index 6b33c546d..ce2c1d175 100644 --- a/parser-typechecker/src/Unison/PrintError.hs +++ b/parser-typechecker/src/Unison/PrintError.hs @@ -17,7 +17,7 @@ import qualified Data.Text as Text import Data.Void (Void) import qualified Text.Megaparsec as P import qualified Unison.ABT as ABT -import Unison.Builtin.Decls (pattern TupleType', unitRef) +import Unison.Builtin.Decls (unitRef, pattern TupleType') import qualified Unison.Codebase.Path as Path import Unison.ConstructorReference (ConstructorReference, GConstructorReference (..)) import Unison.HashQualified (HashQualified) @@ -400,17 +400,20 @@ renderTypeError e env src curPath = case e of ], debugSummary note ] - where - unitHintMsg = - "\nHint: Actions within a block must have type " <> - style Type2 (renderType' env expectedLeaf) <> ".\n" <> - " Use " <> style Type1 "_ = " <> " to ignore a result." - unitHint = if giveUnitHint then unitHintMsg else "" - giveUnitHint = case expectedType of - Type.Ref' u | u == unitRef -> case mismatchSite of - Term.Let1Named' v _ _ -> Var.isAction v - _ -> False + where + unitHintMsg = + "\nHint: Actions within a block must have type " + <> style Type2 (renderType' env expectedLeaf) + <> ".\n" + <> " Use " + <> style Type1 "_ = " + <> " to ignore a result." + unitHint = if giveUnitHint then unitHintMsg else "" + giveUnitHint = case expectedType of + Type.Ref' u | u == unitRef -> case mismatchSite of + Term.Let1Named' v _ _ -> Var.isAction v _ -> False + _ -> False AbilityCheckFailure {..} | [tv@(Type.Var' ev)] <- ambient, ev `Set.member` foldMap Type.freeVars requested -> @@ -1637,7 +1640,7 @@ renderParseErrors s = \case <> style ErrorSite "match" <> "/" <> style ErrorSite "with" - <> " but I didn't find any." + <> " or cases but I didn't find any." ), "", tokenAsErrorSite s tok diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index f206c2d1b..52c025f3e 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -143,7 +143,7 @@ match = do matchCases1 :: Var v => L.Token () -> P v (NonEmpty (Int, Term.MatchCase Ann (Term v Ann))) matchCases1 start = do cases <- - sepBy1 semi matchCase + sepBy semi matchCase <&> \cases -> [(n, c) | (n, cs) <- cases, c <- cs] case cases of [] -> P.customFailure (EmptyMatch start) @@ -168,14 +168,20 @@ matchCase = do pats -> foldr pair (unit (ann . last $ pats)) pats unit ann = Pattern.Constructor ann (ConstructorReference DD.unitRef 0) [] pair p1 p2 = Pattern.Constructor (ann p1 <> ann p2) (ConstructorReference DD.pairRef 0) [p1, p2] - guardsAndBlocks <- some $ do - guard <- - asum - [ Nothing <$ P.try (reserved "|" *> quasikeyword "otherwise"), - optional $ reserved "|" *> infixAppOrBooleanOp - ] - t <- block "->" - pure (guard, t) + let guardedBlocks = some $ do + reserved "|" + guard <- + asum + [ Nothing <$ P.try (quasikeyword "otherwise"), + Just <$> infixAppOrBooleanOp + ] + t <- block "->" + pure (guard, t) + let unguardedBlock = do + t <- block "->" + pure (Nothing, t) + -- a pattern's RHS is either one or more guards, or a single unguarded block. + guardsAndBlocks <- guardedBlocks <|> (pure @[] <$> unguardedBlock) let absChain vs t = foldr (\v t -> ABT.abs' (ann t) v t) t vs let mk (guard, t) = Term.MatchCase pat (fmap (absChain boundVars') guard) (absChain boundVars' t) pure $ (length pats, mk <$> guardsAndBlocks) diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index 7de7bcdcd..17cd3e098 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -108,7 +108,8 @@ data Error v | UnknownType (L.Token (HQ.HashQualified Name)) (Set Reference) | UnknownId (L.Token (HQ.HashQualified Name)) (Set Referent) (Set Reference) | ExpectedBlockOpen String (L.Token L.Lexeme) - | EmptyMatch (L.Token ()) + | -- Indicates a cases or match/with which doesn't have any patterns + EmptyMatch (L.Token ()) | EmptyWatch Ann | UseInvalidPrefixSuffix (Either (L.Token Name) (L.Token Name)) (Maybe [L.Token Name]) | UseEmpty (L.Token String) -- an empty `use` statement From ac9334f6070f07394bdc8586110f8536bd0ca1d2 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 10 Jan 2023 13:44:25 -0600 Subject: [PATCH 064/467] Add case-match error transcripts --- unison-src/transcripts/case-matches.md | 38 ++++++++++ unison-src/transcripts/case-matches.output.md | 70 +++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 unison-src/transcripts/case-matches.md create mode 100644 unison-src/transcripts/case-matches.output.md diff --git a/unison-src/transcripts/case-matches.md b/unison-src/transcripts/case-matches.md new file mode 100644 index 000000000..f23c2252c --- /dev/null +++ b/unison-src/transcripts/case-matches.md @@ -0,0 +1,38 @@ +```unison:hide +structural type Optional a = Some a | None +``` + +```ucm:hide +.> add +``` + +## Common syntax errors should fail to parse + +```unison:error +x = match Some a with + None -> + 1 + Some _ + 2 +``` + +```unison:error +x = match Some a with + None -> 1 + -> 2 + -> 3 +``` + +Can't have guards following an unguarded expression + +```unison:error +x = match Some a with + None -> 1 + | true -> 2 +``` + +Must have at least one pattern case. + +```unison:error +x = match Some a with +``` diff --git a/unison-src/transcripts/case-matches.output.md b/unison-src/transcripts/case-matches.output.md new file mode 100644 index 000000000..f4d529fb7 --- /dev/null +++ b/unison-src/transcripts/case-matches.output.md @@ -0,0 +1,70 @@ +```unison +structural type Optional a = Some a | None +``` + +## Common syntax errors should fail to parse + +```unison +x = match Some a with + None -> + 1 + Some _ + 2 +``` + +```ucm + + offset=16: + unexpected + expecting ,, blank, false, true, or | + 6 | + +``` +```unison +x = match Some a with + None -> 1 + -> 2 + -> 3 +``` + +```ucm + + offset=12: + unexpected -> + 3 | -> 2 + + +``` +Can't have guards following an unguarded expression + +```unison +x = match Some a with + None -> 1 + | true -> 2 +``` + +```ucm + + offset=12: + unexpected | + 3 | | true -> 2 + + +``` +Must have at least one pattern case. + +```unison +x = match Some a with +``` + +```ucm + + 😶 + + I expected some patterns after a match / with or cases but I + didn't find any. + + 1 | x = match Some a with + + +``` From 75c99b5c769fa156cd93d3d2ed7def4e82a871f5 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 10 Jan 2023 13:50:02 -0600 Subject: [PATCH 065/467] Update labels --- parser-typechecker/src/Unison/Syntax/TermParser.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index 52c025f3e..4335ab95b 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -168,7 +168,7 @@ matchCase = do pats -> foldr pair (unit (ann . last $ pats)) pats unit ann = Pattern.Constructor ann (ConstructorReference DD.unitRef 0) [] pair p1 p2 = Pattern.Constructor (ann p1 <> ann p2) (ConstructorReference DD.pairRef 0) [p1, p2] - let guardedBlocks = some $ do + let guardedBlocks = label "pattern guard" . some $ do reserved "|" guard <- asum @@ -177,7 +177,7 @@ matchCase = do ] t <- block "->" pure (guard, t) - let unguardedBlock = do + let unguardedBlock = label "case match" $ do t <- block "->" pure (Nothing, t) -- a pattern's RHS is either one or more guards, or a single unguarded block. From a885d688343681eb3ee2e374c2cdfba213041f7a Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 10 Jan 2023 14:33:42 -0600 Subject: [PATCH 066/467] Slightly better error messages --- .../src/Unison/Syntax/TermParser.hs | 6 +- unison-src/transcripts/case-matches.md | 38 ---------- unison-src/transcripts/case-matches.output.md | 70 ------------------ unison-src/transcripts/error-messages.md | 28 ++++++++ .../transcripts/error-messages.output.md | 71 +++++++++++++++++-- unison-syntax/src/Unison/Syntax/Parser.hs | 2 +- 6 files changed, 99 insertions(+), 116 deletions(-) delete mode 100644 unison-src/transcripts/case-matches.md delete mode 100644 unison-src/transcripts/case-matches.output.md diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index 4335ab95b..c007488f9 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -143,7 +143,7 @@ match = do matchCases1 :: Var v => L.Token () -> P v (NonEmpty (Int, Term.MatchCase Ann (Term v Ann))) matchCases1 start = do cases <- - sepBy semi matchCase + (sepBy semi matchCase) <&> \cases -> [(n, c) | (n, cs) <- cases, c <- cs] case cases of [] -> P.customFailure (EmptyMatch start) @@ -161,7 +161,7 @@ matchCases1 start = do -- (42, x) -> ... matchCase :: Var v => P v (Int, [Term.MatchCase Ann (Term v Ann)]) matchCase = do - pats <- sepBy1 (reserved ",") parsePattern + pats <- sepBy1 (label "\",\"" $ reserved ",") parsePattern let boundVars' = [v | (_, vs) <- pats, (_ann, v) <- vs] pat = case fst <$> pats of [p] -> p @@ -187,7 +187,7 @@ matchCase = do pure $ (length pats, mk <$> guardsAndBlocks) parsePattern :: forall v. Var v => P v (Pattern Ann, [(Ann, v)]) -parsePattern = root +parsePattern = label "pattern" root where root = chainl1 patternCandidates patternInfixApp patternCandidates = constructor <|> leaf diff --git a/unison-src/transcripts/case-matches.md b/unison-src/transcripts/case-matches.md deleted file mode 100644 index f23c2252c..000000000 --- a/unison-src/transcripts/case-matches.md +++ /dev/null @@ -1,38 +0,0 @@ -```unison:hide -structural type Optional a = Some a | None -``` - -```ucm:hide -.> add -``` - -## Common syntax errors should fail to parse - -```unison:error -x = match Some a with - None -> - 1 - Some _ - 2 -``` - -```unison:error -x = match Some a with - None -> 1 - -> 2 - -> 3 -``` - -Can't have guards following an unguarded expression - -```unison:error -x = match Some a with - None -> 1 - | true -> 2 -``` - -Must have at least one pattern case. - -```unison:error -x = match Some a with -``` diff --git a/unison-src/transcripts/case-matches.output.md b/unison-src/transcripts/case-matches.output.md deleted file mode 100644 index f4d529fb7..000000000 --- a/unison-src/transcripts/case-matches.output.md +++ /dev/null @@ -1,70 +0,0 @@ -```unison -structural type Optional a = Some a | None -``` - -## Common syntax errors should fail to parse - -```unison -x = match Some a with - None -> - 1 - Some _ - 2 -``` - -```ucm - - offset=16: - unexpected - expecting ,, blank, false, true, or | - 6 | - -``` -```unison -x = match Some a with - None -> 1 - -> 2 - -> 3 -``` - -```ucm - - offset=12: - unexpected -> - 3 | -> 2 - - -``` -Can't have guards following an unguarded expression - -```unison -x = match Some a with - None -> 1 - | true -> 2 -``` - -```ucm - - offset=12: - unexpected | - 3 | | true -> 2 - - -``` -Must have at least one pattern case. - -```unison -x = match Some a with -``` - -```ucm - - 😶 - - I expected some patterns after a match / with or cases but I - didn't find any. - - 1 | x = match Some a with - - -``` diff --git a/unison-src/transcripts/error-messages.md b/unison-src/transcripts/error-messages.md index 1f11e0de8..de58eb43b 100644 --- a/unison-src/transcripts/error-messages.md +++ b/unison-src/transcripts/error-messages.md @@ -61,6 +61,11 @@ foo = with -- unclosed ### Matching +```unison:error +-- No cases +foo = match 1 with +``` + ```unison:error foo = match 1 with 2 -- no right-hand-side @@ -73,6 +78,29 @@ foo = cases 3 -> () ``` +```unison:error +-- Missing a '->' +x = match Some a with + None -> + 1 + Some _ + 2 +``` + +```unison:error +-- Missing patterns +x = match Some a with + None -> 1 + -> 2 + -> 3 +``` + +```unison:error +-- Guards following an unguarded case +x = match Some a with + None -> 1 + | true -> 2 +``` ### Watches diff --git a/unison-src/transcripts/error-messages.output.md b/unison-src/transcripts/error-messages.output.md index 2fc4bb092..ee9b7c08d 100644 --- a/unison-src/transcripts/error-messages.output.md +++ b/unison-src/transcripts/error-messages.output.md @@ -162,20 +162,33 @@ foo = with -- unclosed ### Matching ```unison +-- No cases foo = match 1 with - 2 -- no right-hand-side ``` ```ucm 😶 - I expected some patterns after a match / with but I didn't - find any. + I expected some patterns after a match / with or cases but I + didn't find any. - 1 | foo = match 1 with + 2 | foo = match 1 with +``` +```unison +foo = match 1 with + 2 -- no right-hand-side +``` + +```ucm + + offset=8: + unexpected + expecting ",", case match, or pattern guard + 3 | + ``` ```unison -- Mismatched arities @@ -195,6 +208,56 @@ foo = cases 4 | 3 -> () +``` +```unison +-- Missing a '->' +x = match Some a with + None -> + 1 + Some _ + 2 +``` + +```ucm + + offset=16: + unexpected + expecting ",", blank, case match, false, pattern guard, or true + 7 | + +``` +```unison +-- Missing patterns +x = match Some a with + None -> 1 + -> 2 + -> 3 +``` + +```ucm + + offset=12: + unexpected -> + expecting newline or semicolon + 4 | -> 2 + + +``` +```unison +-- Guards following an unguarded case +x = match Some a with + None -> 1 + | true -> 2 +``` + +```ucm + + offset=12: + unexpected | + expecting newline or semicolon + 4 | | true -> 2 + + ``` ### Watches diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index 17cd3e098..76a98054e 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -239,7 +239,7 @@ importDotId = queryToken go -- Consume a virtual semicolon semi :: Ord v => P v (L.Token ()) -semi = queryToken go +semi = label "newline or semicolon" $ queryToken go where go (L.Semi _) = Just () go _ = Nothing From c2c37a8ae0306b3377dea1141be05c48e2a04a58 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 10 Jan 2023 15:53:50 -0500 Subject: [PATCH 067/467] Define a macro for reserving virtual registers --- chez-libs/unison/core.ss | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/chez-libs/unison/core.ss b/chez-libs/unison/core.ss index 0a8d83c7c..4f0b08e66 100644 --- a/chez-libs/unison/core.ss +++ b/chez-libs/unison/core.ss @@ -1,5 +1,8 @@ (library (unison core) (export + define-virtual-register + define-init-registers + identity describe-value @@ -9,6 +12,50 @@ (import (chezscheme)) + ; Wrapper for chez scheme's virtual registers, which are top-level + ; variables that may perform better than normal variables. They are + ; limited in number, and referenced by an integer. + ; + ; This macro allows the definition of names for the virtual registers, + ; and keeps track of how many have been declared, so that a static + ; error is thrown if more are declared than are available. + ; + ; Virtual registers are thread local + (meta define virtual-register-inits '()) + + (define-syntax (define-virtual-register stx) + (syntax-case stx () + [(define-virtual-register name init) + (let ([n (length virtual-register-inits)]) + (with-syntax ([reg (datum->syntax #'define-virtual-register n)]) + (cond + [(>= n (virtual-register-count)) + (syntax-error stx + "Could not allocate a virtual register:")] + [else + (set! virtual-register-inits + (cons #'init virtual-register-inits)) + #`(define-syntax name + (identifier-syntax + [id (virtual-register reg)] + [(set! id e) (set-virtual-register! reg e)]))])))])) + + (define-syntax (define-init-registers stx) + (syntax-case stx () + [(_ name) + (with-syntax + ([(set ...) + (let rec ([l (reverse virtual-register-inits)] + [n 0]) + (cond + [(null? l) '()] + [else + (with-syntax ([reg (datum->syntax #'name n)] + [val (car l)]) + (cons #'(set-virtual-register! reg val) + (rec (cdr l) (+ 1 n))))]))]) + #'(define (name) set ... #t))])) + (define (identity x) x) ; Recovers the original function name from the partial From 4c62d73b8ae339aa9ede84f73b820c59e18dbac1 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 10 Jan 2023 16:08:39 -0500 Subject: [PATCH 068/467] Indicate execution mode to the scheme code generator - The handling of command line arguments varies somewhat between different ways of evaluating scheme code, so some different wrappers need to be generated to run as a standalone output vs. running immediately like a script. The in-unison code generator needs an indication of which mode it should generate code for. --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index ba4755f72..a4696b2dc 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2762,15 +2762,15 @@ buildScheme main file = do doRunAsScheme :: HQ.HashQualified Name -> [String] -> Cli () doRunAsScheme main args = do - fullpath <- generateSchemeFile (HQ.toString main) main + fullpath <- generateSchemeFile True (HQ.toString main) main runScheme fullpath args doCompileScheme :: String -> HQ.HashQualified Name -> Cli () doCompileScheme out main = - generateSchemeFile out main >>= buildScheme out + generateSchemeFile False out main >>= buildScheme out -generateSchemeFile :: String -> HQ.HashQualified Name -> Cli String -generateSchemeFile out main = do +generateSchemeFile :: Bool -> String -> HQ.HashQualified Name -> Cli String +generateSchemeFile exec out main = do (comp, ppe) <- resolveMainRef main ensureCompilerExists doGenerateSchemeBoot False $ Just ppe @@ -2786,7 +2786,7 @@ generateSchemeFile out main = do fpc = Term.constructor a fprf fp = Term.app a fpc outTm tm :: Term Symbol Ann - tm = Term.apps' sscm [toCmp, fp] + tm = Term.apps' sscm [Term.boolean a exec, toCmp, fp] typecheckAndEval ppe tm pure fullpath where From aac85fc708352fdc61fd0330af0a790173c92de9 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 10 Jan 2023 16:24:02 -0500 Subject: [PATCH 069/467] Chez lib development tip --- chez-libs/readme.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/chez-libs/readme.md b/chez-libs/readme.md index 2e242c814..1d15c0860 100644 --- a/chez-libs/readme.md +++ b/chez-libs/readme.md @@ -47,3 +47,27 @@ automatically execute the boot file with the corresponding name on start up. For more information on how to accomplish that, see: https://cisco.github.io/ChezScheme/csug9.5/use.html#./use:h8 + +--- + +A tip for working on files in this directory: + +Assuming your are doing so by creating a unison test case, it can be +faster to have scheme code for that test case generated once, and then +just work on filling out the library functionality here. To do this, +you can run the ucm command: + + run.native + +This will cause a corresponding scheme file to be created in: + + $XDG_CACHE_DIRECTORY/unisonlanguage + +This can be copied back to the unison directory, and then run directly +with something like: + + scheme --libdirs chez-libs:~/.cache/unisonlanguage/scheme-libs --script foo.scm + +Then you can test directly against any changes to chez-libs, instead +of having to copy them to a different location, restart ucm, etc. + From fa378f7601bc624aa6ec8029bf4cfb6949752f16 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 11 Jan 2023 10:04:16 -0600 Subject: [PATCH 070/467] Return an error rather than `error` on invalid base32hex in a Reference (#3728) * Improve base32hex failure error message * Improve error handling for bad hashes to not call `error` --- unison-core/src/Unison/Reference.hs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/unison-core/src/Unison/Reference.hs b/unison-core/src/Unison/Reference.hs index 9a8eec199..4a616a359 100644 --- a/unison-core/src/Unison/Reference.hs +++ b/unison-core/src/Unison/Reference.hs @@ -160,11 +160,10 @@ componentFor h as = [(Id h i, a) | (i, a) <- zip [0 ..] as] componentFromLength :: H.Hash -> CycleSize -> Set Id componentFromLength h size = Set.fromList [Id h i | i <- [0 .. size - 1]] -derivedBase32Hex :: Text -> Pos -> Reference -derivedBase32Hex b32Hex i = DerivedId (Id (fromMaybe msg h) i) +derivedBase32Hex :: Text -> Pos -> Maybe Reference +derivedBase32Hex b32Hex i = mayH <&> \h -> DerivedId (Id h i) where - msg = error $ "Reference.derivedBase32Hex " <> show h - h = H.fromBase32HexText b32Hex + mayH = H.fromBase32HexText b32Hex unsafeFromText :: Text -> Reference unsafeFromText = either error id . fromText @@ -194,18 +193,27 @@ toHash r = idToHash <$> toId r -- Right ##Text.take -- -- derived, no cycle --- >>> fromText "#2tWjVAuc7" --- Reference.derivedBase32Hex Nothing +-- >>> fromText "#dqp2oi4iderlrgp2h11sgkff6drk92omo4c84dncfhg9o0jn21cli4lhga72vlchmrb2jk0b3bdc2gie1l06sqdli8ego4q0akm3au8" +-- Right #dqp2o -- -- derived, part of cycle --- >>> fromText "#y9ycWkiC1.12345" --- Reference.derivedBase32Hex Nothing +-- >>> fromText "#dqp2oi4iderlrgp2h11sgkff6drk92omo4c84dncfhg9o0jn21cli4lhga72vlchmrb2jk0b3bdc2gie1l06sqdli8ego4q0akm3au8.12345" +-- Right #dqp2o.12345 +-- +-- Errors with 'Left' on invalid hashes +-- >>> fromText "#invalid_hash.12345" +-- Left "Invalid hash: \"invalid_hash\"" fromText :: Text -> Either String Reference fromText t = case Text.split (== '#') t of [_, "", b] -> Right (Builtin b) [_, h] -> case Text.split (== '.') h of - [hash] -> Right (derivedBase32Hex hash 0) - [hash, suffix] -> derivedBase32Hex hash <$> readSuffix suffix + [hash] -> + case derivedBase32Hex hash 0 of + Nothing -> Left $ "Invalid hash: " <> show hash + Just r -> Right r + [hash, suffix] -> do + pos <- readSuffix suffix + maybe (Left $ "Invalid hash: " <> show hash) Right (derivedBase32Hex hash pos) _ -> bail _ -> bail where From 54758e865abbb2344959e34999cb3b72e00de55c Mon Sep 17 00:00:00 2001 From: unorsk <25188+unorsk@users.noreply.github.com> Date: Thu, 12 Jan 2023 17:35:43 +0100 Subject: [PATCH 071/467] Saving current state before running anything and then falling back to it if needed --- unison-cli/src/Unison/CommandLine/Main.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unison-cli/src/Unison/CommandLine/Main.hs b/unison-cli/src/Unison/CommandLine/Main.hs index 32662a89c..670bd9592 100644 --- a/unison-cli/src/Unison/CommandLine/Main.hs +++ b/unison-cli/src/Unison/CommandLine/Main.hs @@ -15,7 +15,7 @@ import qualified Data.Text as Text import qualified Data.Text.Lazy.IO as Text.Lazy import qualified Ki import qualified System.Console.Haskeline as Line -import System.IO (hPutStrLn, stderr) +import System.IO (hPutStrLn, stderr, hGetEcho, hSetEcho, stdin) import System.IO.Error (isDoesNotExistError) import Text.Pretty.Simple (pShow) import qualified U.Codebase.Sqlite.Operations as Operations @@ -143,8 +143,12 @@ main dir welcome initialPath config initialInputs runtime sbRuntime codebase ser credentialManager <- newCredentialManager let tokenProvider = AuthN.newTokenProvider credentialManager authHTTPClient <- AuthN.newAuthenticatedHTTPClient tokenProvider ucmVersion + initialEcho <- hGetEcho stdin + let restoreEcho = (\currentEcho -> when (currentEcho /= initialEcho) $ hSetEcho stdin initialEcho) let getInput :: Cli.LoopState -> IO Input getInput loopState = do + currentEcho <- hGetEcho stdin + liftIO $ restoreEcho currentEcho getUserInput codebase authHTTPClient From a2d40107c64289e192e1a501f579a6e0807848ad Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 12 Jan 2023 15:55:03 -0600 Subject: [PATCH 072/467] Allow explicitly enabling the LSP server on Windows --- docs/configuration.md | 20 ++++++++++++++++++++ docs/language-server.markdown | 7 +++++++ unison-cli/src/Unison/LSP.hs | 34 +++++++++++++++++++++++----------- unison-cli/unison/Main.hs | 2 +- 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 95f12b6b2..791e13fbd 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -5,6 +5,7 @@ * [`UNISON_DEBUG`](#unison_debug) * [`UNISON_PAGER`](#unison_pager) * [`UNISON_LSP_PORT`](#unison_lsp_port) + * [`UNISON_LSP_ENABLED`](#unison_lsp_enabled) * [`UNISON_SHARE_HOST`](#unison_share_host) * [`UNISON_SHARE_ACCESS_TOKEN`](#unison_share_access_token) * [Local Codebase Server](#local-codebase-server) @@ -50,6 +51,25 @@ E.g. $ UNISON_LSP_PORT=8080 ucm ``` +### `UNISON_LSP_ENABLED` + +Allows explicitly enabling or disabling the LSP server. +Acceptable values are 'true' or 'false' + +Note for Windows users: Due to an outstanding issue with GHC's IO manager on Windows, the LSP is **disabled by default** on Windows machines. +Enabling the LSP on windows can cause UCM to hang on exit and may require the process to be killed by the operating system or via Ctrl-C. +Note that this doesn't pose any risk of codebase corruption or cause any known issues, it's simply an annoyance. + +If you accept this annoyance, you can enable the LSP server on Windows by exporting the `UNISON_LSP_ENABLED=true` environment variable. + +See [this issue](https://github.com/unisonweb/unison/issues/3487) for more details. + +E.g. + +```sh +$ UNISON_LSP_ENABLED=true ucm +``` + ### `UNISON_SHARE_HOST` Allows selecting the location for the default Share server. diff --git a/docs/language-server.markdown b/docs/language-server.markdown index 3c6c2b91a..b44b77da8 100644 --- a/docs/language-server.markdown +++ b/docs/language-server.markdown @@ -20,6 +20,13 @@ Currently the only supported configuration is to connect to the LSP via a specif By default the LSP is hosted at `127.0.0.1:5757`, but you can change the port using `UNISON_LSP_PORT=1234`. +Note for Windows users: Due to an outstanding issue with GHC's IO manager on Windows, the LSP is **disabled by default** on Windows machines. +Enabling the LSP on windows can cause UCM to hang on exit and may require the process to be killed by the operating system or via Ctrl-C. +Note that this doesn't pose any risk of codebase corruption or cause any known issues, it's simply an annoyance. + +If you accept this annoyance, you can enable the LSP server on Windows by exporting the `UNISON_LSP_ENABLED=true` environment variable. + +See [this issue](https://github.com/unisonweb/unison/issues/3487) for more details. ### NeoVim diff --git a/unison-cli/src/Unison/LSP.hs b/unison-cli/src/Unison/LSP.hs index 0f511ab60..eb443058c 100644 --- a/unison-cli/src/Unison/LSP.hs +++ b/unison-cli/src/Unison/LSP.hs @@ -7,7 +7,9 @@ module Unison.LSP where import Colog.Core (LogAction (LogAction)) import qualified Colog.Core as Colog +import Compat (onWindows) import Control.Monad.Reader +import Data.Char (toLower) import GHC.IO.Exception (ioe_errno) import qualified Ki import qualified Language.LSP.Logging as LSP @@ -19,6 +21,7 @@ import Language.LSP.VFS import qualified Network.Simple.TCP as TCP import Network.Socket (socketToHandle) import System.Environment (lookupEnv) +import System.IO (hPutStrLn) import Unison.Codebase import Unison.Codebase.Branch (Branch) import qualified Unison.Codebase.Path as Path @@ -49,17 +52,18 @@ getLspPort = fromMaybe "5757" <$> lookupEnv "UNISON_LSP_PORT" -- | Spawn an LSP server on the configured port. spawnLsp :: Codebase IO Symbol Ann -> Runtime Symbol -> STM (Branch IO) -> STM (Path.Absolute) -> IO () -spawnLsp codebase runtime latestBranch latestPath = TCP.withSocketsDo do - lspPort <- getLspPort - UnliftIO.handleIO (handleFailure lspPort) $ do - TCP.serve (TCP.Host "127.0.0.1") lspPort $ \(sock, _sockaddr) -> do - Ki.scoped \scope -> do - sockHandle <- socketToHandle sock ReadWriteMode - -- currently we have an independent VFS for each LSP client since each client might have - -- different un-saved state for the same file. - initVFS $ \vfs -> do - vfsVar <- newMVar vfs - void $ runServerWithHandles lspServerLogger lspClientLogger sockHandle sockHandle (serverDefinition vfsVar codebase runtime scope latestBranch latestPath) +spawnLsp codebase runtime latestBranch latestPath = + ifEnabled . TCP.withSocketsDo $ do + lspPort <- getLspPort + UnliftIO.handleIO (handleFailure lspPort) $ do + TCP.serve (TCP.Host "127.0.0.1") lspPort $ \(sock, _sockaddr) -> do + Ki.scoped \scope -> do + sockHandle <- socketToHandle sock ReadWriteMode + -- currently we have an independent VFS for each LSP client since each client might have + -- different un-saved state for the same file. + initVFS $ \vfs -> do + vfsVar <- newMVar vfs + void $ runServerWithHandles lspServerLogger lspClientLogger sockHandle sockHandle (serverDefinition vfsVar codebase runtime scope latestBranch latestPath) where handleFailure :: String -> IOException -> IO () handleFailure lspPort ioerr = @@ -75,6 +79,14 @@ spawnLsp codebase runtime latestBranch latestPath = TCP.withSocketsDo do lspServerLogger = Colog.filterBySeverity Colog.Error Colog.getSeverity $ Colog.cmap (fmap tShow) (LogAction print) -- Where to send logs that occur after a client connects lspClientLogger = Colog.cmap (fmap tShow) LSP.defaultClientLogger + ifEnabled :: IO () -> IO () + ifEnabled runServer = do + -- Default LSP to disabled on Windows unless explicitly enabled + lookupEnv "UNISON_LSP_ENABLED" >>= \case + Just (fmap toLower -> "false") -> pure () + Just (fmap toLower -> "true") -> runServer + Just x -> hPutStrLn stderr $ "Invalid value for UNISON_LSP_ENABLED, expected 'true' or 'false' but found: " <> x + Nothing -> when (not onWindows) runServer serverDefinition :: MVar VFS -> diff --git a/unison-cli/unison/Main.hs b/unison-cli/unison/Main.hs index 2bb07c19c..fceb7ef15 100644 --- a/unison-cli/unison/Main.hs +++ b/unison-cli/unison/Main.hs @@ -264,7 +264,7 @@ main = withCP65001 . runInUnboundThread . Ki.scoped $ \scope -> do -- prevent UCM from shutting down properly. Hopefully we can re-enable LSP on -- Windows when we move to GHC 9.* -- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1224 - when (not onWindows) . void . Ki.fork scope $ LSP.spawnLsp theCodebase runtime (readTMVar rootVar) (readTVar pathVar) + void . Ki.fork scope $ LSP.spawnLsp theCodebase runtime (readTMVar rootVar) (readTVar pathVar) Server.startServer (Backend.BackendEnv {Backend.useNamesIndex = False}) codebaseServerOpts sbRuntime theCodebase $ \baseUrl -> do case exitOption of DoNotExit -> do From 25835c3ab410688b338c525d6f39dcb811cbb481 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 12 Jan 2023 16:04:23 -0600 Subject: [PATCH 073/467] Include powershell settings --- docs/configuration.md | 6 ++++++ docs/language-server.markdown | 6 ++++++ unison-cli/unison/Main.hs | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index 791e13fbd..0dd770894 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -62,6 +62,12 @@ Note that this doesn't pose any risk of codebase corruption or cause any known i If you accept this annoyance, you can enable the LSP server on Windows by exporting the `UNISON_LSP_ENABLED=true` environment variable. +You can set this persistently in powershell using: + +```powershell +[System.Environment]::SetEnvironmentVariable('UNISON_LSP_ENABLED','true') +``` + See [this issue](https://github.com/unisonweb/unison/issues/3487) for more details. E.g. diff --git a/docs/language-server.markdown b/docs/language-server.markdown index b44b77da8..04f5f9af1 100644 --- a/docs/language-server.markdown +++ b/docs/language-server.markdown @@ -26,6 +26,12 @@ Note that this doesn't pose any risk of codebase corruption or cause any known i If you accept this annoyance, you can enable the LSP server on Windows by exporting the `UNISON_LSP_ENABLED=true` environment variable. +You can set this persistently in powershell using: + +```powershell +[System.Environment]::SetEnvironmentVariable('UNISON_LSP_ENABLED','true') +``` + See [this issue](https://github.com/unisonweb/unison/issues/3487) for more details. ### NeoVim diff --git a/unison-cli/unison/Main.hs b/unison-cli/unison/Main.hs index fceb7ef15..64f1c6f0b 100644 --- a/unison-cli/unison/Main.hs +++ b/unison-cli/unison/Main.hs @@ -22,7 +22,7 @@ import ArgParse UsageRenderer, parseCLIArgs, ) -import Compat (defaultInterruptHandler, onWindows, withInterruptHandler) +import Compat (defaultInterruptHandler, withInterruptHandler) import Control.Concurrent (newEmptyMVar, runInUnboundThread, takeMVar) import Control.Concurrent.STM import Control.Error.Safe (rightMay) From 661de0c380e119816abcd88c0609c00947c31492 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 13 Jan 2023 17:15:35 +0000 Subject: [PATCH 074/467] Add atomic-ops dependency --- .../unison-pretty-printer.cabal | 8 ++++---- parser-typechecker/package.yaml | 1 + parser-typechecker/unison-parser-typechecker.cabal | 8 +++++--- unison-cli/unison-cli.cabal | 12 ++++++------ unison-core/unison-core1.cabal | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/unison-pretty-printer/unison-pretty-printer.cabal b/lib/unison-pretty-printer/unison-pretty-printer.cabal index f23faeed9..813774eff 100644 --- a/lib/unison-pretty-printer/unison-pretty-printer.cabal +++ b/lib/unison-pretty-printer/unison-pretty-printer.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -68,9 +68,9 @@ library , unison-prelude , unison-syntax , unliftio + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 executable prettyprintdemo main-is: Main.hs @@ -103,9 +103,9 @@ executable prettyprintdemo , safe , text , unison-pretty-printer + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 test-suite pretty-printer-tests type: exitcode-stdio-1.0 @@ -146,6 +146,6 @@ test-suite pretty-printer-tests , raw-strings-qq , unison-pretty-printer , unison-syntax + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 diff --git a/parser-typechecker/package.yaml b/parser-typechecker/package.yaml index 6b28b0eee..6cfaf365f 100644 --- a/parser-typechecker/package.yaml +++ b/parser-typechecker/package.yaml @@ -24,6 +24,7 @@ dependencies: - aeson - ansi-terminal - async + - atomic-primops - base - base16 >= 0.2.1.0 - base64-bytestring diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 43bb9de1b..c2e6d9ab1 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -193,6 +193,7 @@ library , aeson , ansi-terminal , async + , atomic-primops , base , base16 >=0.2.1.0 , base64-bytestring @@ -305,11 +306,11 @@ library , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 test-suite parser-typechecker-tests type: exitcode-stdio-1.0 @@ -378,6 +379,7 @@ test-suite parser-typechecker-tests , aeson , ansi-terminal , async + , atomic-primops , base , base16 >=0.2.1.0 , base64-bytestring @@ -495,8 +497,8 @@ test-suite parser-typechecker-tests , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 7c59e5b8a..9573c1eca 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -203,12 +203,12 @@ library , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields if !os(windows) build-depends: unix - default-language: Haskell2010 executable cli-integration-tests main-is: Suite.hs @@ -331,9 +331,9 @@ executable cli-integration-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable transcripts main-is: Transcripts.hs @@ -453,9 +453,9 @@ executable transcripts , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable unison main-is: Main.hs @@ -582,9 +582,9 @@ executable unison , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 test-suite cli-tests type: exitcode-stdio-1.0 @@ -714,6 +714,6 @@ test-suite cli-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 diff --git a/unison-core/unison-core1.cabal b/unison-core/unison-core1.cabal index 1261b0ded..48eac1036 100644 --- a/unison-core/unison-core1.cabal +++ b/unison-core/unison-core1.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -106,6 +106,6 @@ library , unison-util-base32hex , unison-util-relation , vector + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 From c5e3766e76796b0e649d1ead5176c5c4b8bafffb Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 17 Jan 2023 02:44:59 +0000 Subject: [PATCH 075/467] Pin hpack to version 34 --- .../unison-pretty-printer.cabal | 8 ++++---- parser-typechecker/unison-parser-typechecker.cabal | 6 +++--- unison-cli/unison-cli.cabal | 12 ++++++------ unison-core/unison-core1.cabal | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/unison-pretty-printer/unison-pretty-printer.cabal b/lib/unison-pretty-printer/unison-pretty-printer.cabal index 813774eff..f23faeed9 100644 --- a/lib/unison-pretty-printer/unison-pretty-printer.cabal +++ b/lib/unison-pretty-printer/unison-pretty-printer.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0. +-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack @@ -68,9 +68,9 @@ library , unison-prelude , unison-syntax , unliftio - default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 + default-language: Haskell2010 executable prettyprintdemo main-is: Main.hs @@ -103,9 +103,9 @@ executable prettyprintdemo , safe , text , unison-pretty-printer - default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 + default-language: Haskell2010 test-suite pretty-printer-tests type: exitcode-stdio-1.0 @@ -146,6 +146,6 @@ test-suite pretty-printer-tests , raw-strings-qq , unison-pretty-printer , unison-syntax - default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 + default-language: Haskell2010 diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index c2e6d9ab1..e34f21fac 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0. +-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack @@ -306,11 +306,11 @@ library , x509-system , yaml , zlib - default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK + default-language: Haskell2010 test-suite parser-typechecker-tests type: exitcode-stdio-1.0 @@ -497,8 +497,8 @@ test-suite parser-typechecker-tests , x509-system , yaml , zlib - default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK + default-language: Haskell2010 diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 9573c1eca..7c59e5b8a 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0. +-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack @@ -203,12 +203,12 @@ library , wai , warp , witherable - default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields if !os(windows) build-depends: unix + default-language: Haskell2010 executable cli-integration-tests main-is: Suite.hs @@ -331,9 +331,9 @@ executable cli-integration-tests , wai , warp , witherable - default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields + default-language: Haskell2010 executable transcripts main-is: Transcripts.hs @@ -453,9 +453,9 @@ executable transcripts , wai , warp , witherable - default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields + default-language: Haskell2010 executable unison main-is: Main.hs @@ -582,9 +582,9 @@ executable unison , wai , warp , witherable - default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields + default-language: Haskell2010 test-suite cli-tests type: exitcode-stdio-1.0 @@ -714,6 +714,6 @@ test-suite cli-tests , wai , warp , witherable - default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields + default-language: Haskell2010 diff --git a/unison-core/unison-core1.cabal b/unison-core/unison-core1.cabal index 48eac1036..1261b0ded 100644 --- a/unison-core/unison-core1.cabal +++ b/unison-core/unison-core1.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0. +-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack @@ -106,6 +106,6 @@ library , unison-util-base32hex , unison-util-relation , vector - default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields + default-language: Haskell2010 From 77d5d1ea02f679299f73727773dfacc3aa9660bf Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 13 Jan 2023 17:24:07 +0000 Subject: [PATCH 076/467] Add type signatures for Ticket and CAS on Ref --- parser-typechecker/src/Unison/Builtin.hs | 18 +++++++++++++++++- unison-core/src/Unison/Type.hs | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index fc7ff80ac..ab77e5a26 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -234,6 +234,8 @@ builtinTypesSrc = Rename' "STM" "io2.STM", B' "Ref" CT.Data, B' "Scope" CT.Effect, + B' "Ref.Ticket" CT.Data, + Rename' "Ref.Ticket" "io2.Ref.Ticket", B' "TimeSpec" CT.Data, Rename' "TimeSpec" "io2.Clock.internals.TimeSpec", B' "ImmutableArray" CT.Data, @@ -624,7 +626,12 @@ builtinsSrc = B "Scope.bytearray" . forall1 "s" $ \s -> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)), B "Scope.bytearrayOf" . forall1 "s" $ \s -> - nat --> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)) + nat --> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)), + -- TODO make sure ordering of args in these types is |> friendly + B "Ref.Ticket.read" . forall1 "a" $ \a -> (tickett a) --> a, + B "Ref.ticket" . forall1 "a" $ \a -> reft iot a --> io (tickett a), + B "Ref.compareAndSwap" . forall1 "a" $ \a -> + (tickett a) --> a --> reft iot a --> io (tuple [boolean, tickett a]) ] ++ -- avoid name conflicts with Universal == < > <= >= @@ -836,6 +843,8 @@ codeBuiltins = ("Link.Term.toText", termLink --> text) ] + + stmBuiltins :: [(Text, Type)] stmBuiltins = [ ("TVar.new", forall1 "a" $ \a -> a --> stm (tvar a)), @@ -917,6 +926,10 @@ scopet s = Type.scopeType () `app` s reft :: Type -> Type -> Type reft s a = Type.refType () `app` s `app` a +-- TODO consider adding a ticketType to the Type module +tickett :: Type -> Type +tickett a = Type.ref () Type.ticketRef `app` a + ibytearrayt :: Type ibytearrayt = Type.ibytearrayType () @@ -972,3 +985,6 @@ pat a = Type.ref () Type.patternRef `app` a timeSpec :: Type timeSpec = Type.ref () Type.timeSpecRef + +iot :: Type +iot = (Type.effects () [Type.builtinIO ()]) diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index 6bdd79aa2..90decc858 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -275,6 +275,9 @@ mvarRef, tvarRef :: Reference mvarRef = Reference.Builtin "MVar" tvarRef = Reference.Builtin "TVar" +ticketRef :: Reference +ticketRef = Reference.Builtin "Ref.Ticket" + tlsRef :: Reference tlsRef = Reference.Builtin "Tls" From 3b7f97603d304a658b48e26ed9f0d95a179d056a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 13 Jan 2023 18:50:57 +0000 Subject: [PATCH 077/467] Add Ref and Ticket bindings --- .../src/Unison/Runtime/Builtin.hs | 23 +++++++++++++++++++ .../src/Unison/Runtime/Foreign/Function.hs | 6 +++++ 2 files changed, 29 insertions(+) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index d20b57b0f..d8a609bf8 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -38,6 +38,7 @@ import Control.Monad.Reader (ReaderT (..), ask, runReaderT) import Control.Monad.State.Strict (State, execState, modify) import qualified Crypto.Hash as Hash import qualified Crypto.MAC.HMAC as HMAC +import Data.Atomics (Ticket, peekTicket, readForCAS, casIORef) import Data.Bits (shiftL, shiftR, (.|.)) import qualified Data.ByteArray as BA import Data.ByteString (hGet, hGetSome, hPut) @@ -1174,6 +1175,7 @@ inBxIomr arg1 arg2 fm result cont instr = . unenum 4 arg2 Ty.fileModeRef fm $ TLetD result UN (TFOp instr [arg1, fm]) cont + -- Output Shape -- these will represent different ways of translating -- the result of a foreign call to a Unison Term -- @@ -1185,6 +1187,7 @@ inBxIomr arg1 arg2 fm result cont instr = -- All of these functions will take a Var named result containing the -- result of the foreign call -- + outMaybe :: forall v. Var v => v -> v -> ANormal v outMaybe maybe result = TMatch result . MatchSum $ @@ -1559,6 +1562,19 @@ boxToEFMBox = where (arg, result, stack1, stack2, stack3, stack4, fail, output) = fresh +-- a -> b -> c -> (Boolean, d) +boxBoxBoxToBoolBox :: ForeignOp +boxBoxBoxToBoolBox instr = + ([BX, BX, BX],) + . TAbss [arg1, arg2, arg3] + . TLets Direct [result1, result2] [UN, BX] (TFOp instr [arg1, arg2, arg3]) + . TLetD unit BX (TCon Ty.unitRef 0 []) + . TLetD pair BX (TCon Ty.pairRef 0 [result2, unit]) + . TLetD boolean BX (boolift result1) + $ TCon Ty.pairRef 0 [boolean, pair] + where + (arg1, arg2, arg3, result1, result2, unit, pair, boolean) = fresh + -- a -> Maybe b boxToMaybeBox :: ForeignOp boxToMaybeBox = @@ -2349,6 +2365,13 @@ declareForeigns = do declareForeign Untracked "Ref.write" boxBoxTo0 . mkForeign $ \(r :: IORef Closure, c :: Closure) -> writeIORef r c + declareForeign Tracked "Ref.ticket" boxDirect . mkForeign $ (readForCAS :: IORef Closure -> IO (Ticket Closure)) + + declareForeign Tracked "Ref.Ticket.read" boxDirect . mkForeign $ (pure . peekTicket :: Ticket Closure -> IO Closure) + + declareForeign Tracked "Ref.compareAndSwap" boxBoxBoxToBoolBox . mkForeign $ + \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> casIORef r t v + declareForeign Tracked "Tls.newClient.impl.v3" boxBoxToEFBox . mkForeignTls $ \( config :: TLS.ClientParams, socket :: SYS.Socket diff --git a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs index 39cc29e6d..a5deb9f26 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs @@ -16,6 +16,7 @@ import Control.Concurrent.MVar (MVar) import Control.Concurrent.STM (TVar) import Control.Exception (evaluate) import qualified Data.Char as Char +import Data.Atomics (Ticket) import Data.Foldable (toList) import Data.IORef (IORef) import Data.Primitive.Array as PA @@ -41,6 +42,7 @@ import Unison.Type mbytearrayRef, mvarRef, refRef, + ticketRef, tvarRef, typeLinkRef, ) @@ -430,6 +432,10 @@ instance ForeignConvention (IORef Closure) where readForeign = readForeignAs (unwrapForeign . marshalToForeign) writeForeign = writeForeignAs (Foreign . Wrap refRef) +instance ForeignConvention (Ticket Closure) where + readForeign = readForeignAs (unwrapForeign . marshalToForeign) + writeForeign = writeForeignAs (Foreign . Wrap ticketRef) + instance ForeignConvention (SuperGroup Symbol) where readForeign = readForeignBuiltin writeForeign = writeForeignBuiltin From 22617a433051171475c9b5ec3c2c8395cb46e7a5 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 14 Jan 2023 16:24:18 +0000 Subject: [PATCH 078/467] Add TODOs --- docs/adding-builtins.markdown | 12 +++++++++--- parser-typechecker/src/Unison/Builtin.hs | 17 ++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/adding-builtins.markdown b/docs/adding-builtins.markdown index b3e52b1c4..eccd39b05 100644 --- a/docs/adding-builtins.markdown +++ b/docs/adding-builtins.markdown @@ -44,7 +44,7 @@ namespace. However, we will also add the value: ```haskell Rename' "MVar" "io2.MVar" ``` - + because this is a type to be used with the new IO functions, which are currently nested under the `io2` namespace. With both of these added to the list, running `builtins.merge` should have a `builtin.io2.MVar` @@ -73,6 +73,8 @@ Builtin functions also have an associated type as part of the initial declaration. So for the complete specification of a function, we will add declarations similar to: + + ```haskell B "MVar.new" $ forall1 "a" (\a -> a --> io (mvar a)) Rename "MVar.new" "io2.MVar.new" @@ -80,12 +82,15 @@ B "MVar.take" $ forall1 "a" (\a -> mvar a --> ioe a) Rename "MVar.take" "io2.MVar.take" ``` + + The `forall1`, `io`, `ioe` and `-->` functions are local definitions in `Unison.Builtin` for assistance in writing the types. `ioe` indicates that an error result may be returned, while `io` should always succeed. `mvar` can be defined locally using some other helpers in scope: + ```haskell mvar :: Var v => Type v -> Type v mvar a = Type.ref () Type.mvarRef `app` a @@ -94,7 +99,7 @@ mvar a = Type.ref () Type.mvarRef `app` a For the actual `MVar` implementation, we'll be doing many definitions followed by renames, so it'll be factored into a list of the name and type, together with a function that generates the declaration and the -rename. +rename. ## Builtin function implementation -- new runtime @@ -128,7 +133,8 @@ than 'any Haskell function,' so the `mkForeign` and `mkForeignIOE` helpers assist in wrapping Haskell functions correctly. The latter will catch some exceptions and yield them as explicit results. -The wrapper code for these two operations looks like: + +The wrapper code for these two operations looks like: ```haskell mvar'new :: ForeignOp diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index ab77e5a26..797b77649 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -628,6 +628,8 @@ builtinsSrc = B "Scope.bytearrayOf" . forall1 "s" $ \s -> nat --> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)), -- TODO make sure ordering of args in these types is |> friendly + -- TODO these aren't renamed, look at `moveUnder` at the end + -- TODO create refPromiseBuiltins B "Ref.Ticket.read" . forall1 "a" $ \a -> (tickett a) --> a, B "Ref.ticket" . forall1 "a" $ \a -> reft iot a --> io (tickett a), B "Ref.compareAndSwap" . forall1 "a" $ \a -> @@ -756,7 +758,7 @@ ioBuiltins = ("IO.delay.impl.v3", nat --> iof unit), ("IO.kill.impl.v3", threadId --> iof unit), ( "IO.ref", - forall1 "a" $ \a -> + forall1 "a" $ \a -> -- use iot a --> io (reft (Type.effects () [Type.builtinIO ()]) a) ), ( "validateSandboxed", @@ -787,21 +789,21 @@ ioBuiltins = ("Clock.internals.sec.v1", timeSpec --> int), ("Clock.internals.nsec.v1", timeSpec --> nat), ( "IO.array", - forall1 "a" $ \a -> + forall1 "a" $ \a -> -- TODO use iot nat --> io (marrayt (Type.effects () [Type.builtinIO ()]) a) ), ( "IO.arrayOf", - forall1 "a" $ \a -> + forall1 "a" $ \a -> -- TODO use iot a --> nat --> io (marrayt (Type.effects () [Type.builtinIO ()]) a) ), - ( "IO.bytearray", + ( "IO.bytearray", -- TODO use iot nat --> io (mbytearrayt (Type.effects () [Type.builtinIO ()])) ), - ( "IO.bytearrayOf", + ( "IO.bytearrayOf", -- TODO iot nat --> nat --> io (mbytearrayt (Type.effects () [Type.builtinIO ()])) ), ( "IO.tryEval", - forall1 "a" $ \a -> + forall1 "a" $ \a -> -- TODO use iof? or is it different (unit --> io a) --> Type.effect () [Type.builtinIO (), DD.exceptionType ()] a ) ] @@ -910,6 +912,7 @@ a --> b = Type.arrow () a b infixr 9 --> +-- TODO add iot here io, iof :: Type -> Type io = Type.effect1 () (Type.builtinIO ()) iof = io . eithert failure @@ -926,7 +929,7 @@ scopet s = Type.scopeType () `app` s reft :: Type -> Type -> Type reft s a = Type.refType () `app` s `app` a --- TODO consider adding a ticketType to the Type module +-- TODO consider adding a ticketType to the Type module: not really needed, look at how mvar builtins does it tickett :: Type -> Type tickett a = Type.ref () Type.ticketRef `app` a From 4806735355ae9b9cd852b0a5fb0d2cd49a512132 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 14 Jan 2023 23:42:06 +0000 Subject: [PATCH 079/467] Identify bug --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index d8a609bf8..bc815c660 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -1567,7 +1567,7 @@ boxBoxBoxToBoolBox :: ForeignOp boxBoxBoxToBoolBox instr = ([BX, BX, BX],) . TAbss [arg1, arg2, arg3] - . TLets Direct [result1, result2] [UN, BX] (TFOp instr [arg1, arg2, arg3]) + . TLets Direct [result1, result2] [UN, BX] (TFOp instr [arg1, arg2, arg3]) -- TODO Results in a direct compound let and crashes ucm . TLetD unit BX (TCon Ty.unitRef 0 []) . TLetD pair BX (TCon Ty.pairRef 0 [result2, unit]) . TLetD boolean BX (boolift result1) From a870a5a22b8e5aaa8b7c36d86a47da94191655c7 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 08:15:01 +0000 Subject: [PATCH 080/467] Only return a Boolean from CAS on IORef In GHC, CAS returns both a Boolean and the current value of the IORef, which can be used to retry a failed CAS. This strategy is more efficient than returning a Boolean only because it uses a single call to cmpxchg in assembly (see [1]) to avoid an extra read per CAS iteration, however it's not supported in Scheme. Therefore, we adopt the more common signature that only returns a Boolean, which doesn't even suffer from spurious failures because GHC issues loads of mutable variables with memory_order_acquire (see [2]) Incidentally, this also works around the lack of support for compound direct lets in our interpreter. [1]: https://github.com/ghc/ghc/blob/master/rts/PrimOps.cmm#L697 [2]: https://github.com/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prim.hs#L285 --- parser-typechecker/src/Unison/Builtin.hs | 3 +- .../src/Unison/Runtime/Builtin.hs | 37 ++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index 797b77649..ec9356f12 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -630,10 +630,11 @@ builtinsSrc = -- TODO make sure ordering of args in these types is |> friendly -- TODO these aren't renamed, look at `moveUnder` at the end -- TODO create refPromiseBuiltins + -- TODO rename them B "Ref.Ticket.read" . forall1 "a" $ \a -> (tickett a) --> a, B "Ref.ticket" . forall1 "a" $ \a -> reft iot a --> io (tickett a), B "Ref.compareAndSwap" . forall1 "a" $ \a -> - (tickett a) --> a --> reft iot a --> io (tuple [boolean, tickett a]) + (tickett a) --> a --> reft iot a --> io boolean ] ++ -- avoid name conflicts with Universal == < > <= >= diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index bc815c660..b3ac386cd 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -1133,6 +1133,13 @@ inBxBx arg1 arg2 result cont instr = . TAbss [arg1, arg2] $ TLetD result UN (TFOp instr [arg1, arg2]) cont +-- a -> b -> c -> ... +inBxBxBx :: forall v. Var v => v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inBxBxBx arg1 arg2 arg3 result cont instr = + ([BX, BX, BX],) + . TAbss [arg1, arg2, arg3] + $ TLetD result UN (TFOp instr [arg1, arg2, arg3]) cont + set'echo :: ForeignOp set'echo instr = ([BX, BX],) @@ -1472,6 +1479,13 @@ boxBoxToBool = where (arg1, arg2, result) = fresh +-- a -> b -> c -> Bool +boxBoxBoxToBool :: ForeignOp +boxBoxBoxToBool = + inBxBxBx arg1 arg2 arg3 result $ boolift result + where + (arg1, arg2, arg3, result) = fresh + -- Nat -> c -- Works for an type that's packed into a word, just -- pass `wordDirect Ty.natRef`, `wordDirect Ty.floatRef` @@ -1562,19 +1576,6 @@ boxToEFMBox = where (arg, result, stack1, stack2, stack3, stack4, fail, output) = fresh --- a -> b -> c -> (Boolean, d) -boxBoxBoxToBoolBox :: ForeignOp -boxBoxBoxToBoolBox instr = - ([BX, BX, BX],) - . TAbss [arg1, arg2, arg3] - . TLets Direct [result1, result2] [UN, BX] (TFOp instr [arg1, arg2, arg3]) -- TODO Results in a direct compound let and crashes ucm - . TLetD unit BX (TCon Ty.unitRef 0 []) - . TLetD pair BX (TCon Ty.pairRef 0 [result2, unit]) - . TLetD boolean BX (boolift result1) - $ TCon Ty.pairRef 0 [boolean, pair] - where - (arg1, arg2, arg3, result1, result2, unit, pair, boolean) = fresh - -- a -> Maybe b boxToMaybeBox :: ForeignOp boxToMaybeBox = @@ -2365,12 +2366,14 @@ declareForeigns = do declareForeign Untracked "Ref.write" boxBoxTo0 . mkForeign $ \(r :: IORef Closure, c :: Closure) -> writeIORef r c - declareForeign Tracked "Ref.ticket" boxDirect . mkForeign $ (readForCAS :: IORef Closure -> IO (Ticket Closure)) + declareForeign Tracked "Ref.ticket" boxDirect . mkForeign $ + \(r :: IORef Closure) -> readForCAS r - declareForeign Tracked "Ref.Ticket.read" boxDirect . mkForeign $ (pure . peekTicket :: Ticket Closure -> IO Closure) + declareForeign Tracked "Ref.Ticket.read" boxDirect . mkForeign $ + \(t :: Ticket Closure) -> pure $ peekTicket t - declareForeign Tracked "Ref.compareAndSwap" boxBoxBoxToBoolBox . mkForeign $ - \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> casIORef r t v + declareForeign Tracked "Ref.compareAndSwap" boxBoxBoxToBool . mkForeign $ + \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> fmap fst $ casIORef r t v declareForeign Tracked "Tls.newClient.impl.v3" boxBoxToEFBox . mkForeignTls $ \( config :: TLS.ClientParams, From 0cb26fb80f68eb99fc47dd14a8422b10d27d2299 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 08:51:07 +0000 Subject: [PATCH 081/467] Make sure the ref+promise builtins are under the right namespace --- parser-typechecker/src/Unison/Builtin.hs | 29 ++++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index ec9356f12..7ec3f7f82 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -626,15 +626,7 @@ builtinsSrc = B "Scope.bytearray" . forall1 "s" $ \s -> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)), B "Scope.bytearrayOf" . forall1 "s" $ \s -> - nat --> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)), - -- TODO make sure ordering of args in these types is |> friendly - -- TODO these aren't renamed, look at `moveUnder` at the end - -- TODO create refPromiseBuiltins - -- TODO rename them - B "Ref.Ticket.read" . forall1 "a" $ \a -> (tickett a) --> a, - B "Ref.ticket" . forall1 "a" $ \a -> reft iot a --> io (tickett a), - B "Ref.compareAndSwap" . forall1 "a" $ \a -> - (tickett a) --> a --> reft iot a --> io boolean + nat --> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)) ] ++ -- avoid name conflicts with Universal == < > <= >= @@ -651,6 +643,7 @@ builtinsSrc = ++ moveUnder "io2" ioBuiltins ++ moveUnder "io2" mvarBuiltins ++ moveUnder "io2" stmBuiltins + ++ moveUnder "io2" refPromiseBuiltins ++ hashBuiltins ++ fmap (uncurry B) codeBuiltins @@ -846,8 +839,6 @@ codeBuiltins = ("Link.Term.toText", termLink --> text) ] - - stmBuiltins :: [(Text, Type)] stmBuiltins = [ ("TVar.new", forall1 "a" $ \a -> a --> stm (tvar a)), @@ -860,6 +851,18 @@ stmBuiltins = ("STM.atomically", forall1 "a" $ \a -> (unit --> stm a) --> io a) ] +-- TODO make sure ordering of args in these types is |> friendly +-- TODO rename cas operations +refPromiseBuiltins :: [(Text, Type)] +refPromiseBuiltins = + [ ("Ref.Ticket.read", forall1 "a" $ \a -> (ticket a) --> a), + ("Ref.ticket", forall1 "a" $ \a -> reft iot a --> io (ticket a)), + ("Ref.compareAndSwap", forall1 "a" $ \a -> (ticket a) --> a --> reft iot a --> io boolean) + ] + where + ticket :: Type -> Type + ticket a = Type.ref () Type.ticketRef `app` a + forall1 :: Text -> (Type -> Type) -> Type forall1 name body = let a = Var.named name @@ -930,10 +933,6 @@ scopet s = Type.scopeType () `app` s reft :: Type -> Type -> Type reft s a = Type.refType () `app` s `app` a --- TODO consider adding a ticketType to the Type module: not really needed, look at how mvar builtins does it -tickett :: Type -> Type -tickett a = Type.ref () Type.ticketRef `app` a - ibytearrayt :: Type ibytearrayt = Type.ibytearrayType () From 0e8d714ebd9fb0aecd5c39ecc37941626e459e84 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 08:57:18 +0000 Subject: [PATCH 082/467] Add helper type for IO ability list --- parser-typechecker/src/Unison/Builtin.hs | 28 +++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index 7ec3f7f82..4450e4256 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -752,8 +752,8 @@ ioBuiltins = ("IO.delay.impl.v3", nat --> iof unit), ("IO.kill.impl.v3", threadId --> iof unit), ( "IO.ref", - forall1 "a" $ \a -> -- use iot - a --> io (reft (Type.effects () [Type.builtinIO ()]) a) + forall1 "a" $ \a -> + a --> io (reft iot a) ), ( "validateSandboxed", forall1 "a" $ \a -> list termLink --> a --> boolean @@ -783,21 +783,21 @@ ioBuiltins = ("Clock.internals.sec.v1", timeSpec --> int), ("Clock.internals.nsec.v1", timeSpec --> nat), ( "IO.array", - forall1 "a" $ \a -> -- TODO use iot - nat --> io (marrayt (Type.effects () [Type.builtinIO ()]) a) + forall1 "a" $ \a -> + nat --> io (marrayt iot a) ), ( "IO.arrayOf", - forall1 "a" $ \a -> -- TODO use iot - a --> nat --> io (marrayt (Type.effects () [Type.builtinIO ()]) a) + forall1 "a" $ \a -> + a --> nat --> io (marrayt iot a) ), - ( "IO.bytearray", -- TODO use iot - nat --> io (mbytearrayt (Type.effects () [Type.builtinIO ()])) + ( "IO.bytearray", + nat --> io (mbytearrayt iot) ), - ( "IO.bytearrayOf", -- TODO iot - nat --> nat --> io (mbytearrayt (Type.effects () [Type.builtinIO ()])) + ( "IO.bytearrayOf", + nat --> nat --> io (mbytearrayt iot) ), ( "IO.tryEval", - forall1 "a" $ \a -> -- TODO use iof? or is it different + forall1 "a" $ \a -> (unit --> io a) --> Type.effect () [Type.builtinIO (), DD.exceptionType ()] a ) ] @@ -916,10 +916,11 @@ a --> b = Type.arrow () a b infixr 9 --> --- TODO add iot here io, iof :: Type -> Type io = Type.effect1 () (Type.builtinIO ()) iof = io . eithert failure +iot :: Type +iot = (Type.effects () [Type.builtinIO ()]) failure :: Type failure = DD.failureType () @@ -988,6 +989,3 @@ pat a = Type.ref () Type.patternRef `app` a timeSpec :: Type timeSpec = Type.ref () Type.timeSpecRef - -iot :: Type -iot = (Type.effects () [Type.builtinIO ()]) From aab311ac4f0b76a47af6c9a733a441dafa8716af Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 09:02:15 +0000 Subject: [PATCH 083/467] Abbreviate compareAndSwap --- parser-typechecker/src/Unison/Builtin.hs | 2 +- parser-typechecker/src/Unison/Runtime/Builtin.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index 4450e4256..25b5277bc 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -857,7 +857,7 @@ refPromiseBuiltins :: [(Text, Type)] refPromiseBuiltins = [ ("Ref.Ticket.read", forall1 "a" $ \a -> (ticket a) --> a), ("Ref.ticket", forall1 "a" $ \a -> reft iot a --> io (ticket a)), - ("Ref.compareAndSwap", forall1 "a" $ \a -> (ticket a) --> a --> reft iot a --> io boolean) + ("Ref.cas", forall1 "a" $ \a -> (ticket a) --> a --> reft iot a --> io boolean) ] where ticket :: Type -> Type diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index b3ac386cd..b2a9d2940 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2372,7 +2372,7 @@ declareForeigns = do declareForeign Tracked "Ref.Ticket.read" boxDirect . mkForeign $ \(t :: Ticket Closure) -> pure $ peekTicket t - declareForeign Tracked "Ref.compareAndSwap" boxBoxBoxToBool . mkForeign $ + declareForeign Tracked "Ref.cas" boxBoxBoxToBool . mkForeign $ \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> fmap fst $ casIORef r t v declareForeign Tracked "Tls.newClient.impl.v3" boxBoxToEFBox . mkForeignTls $ From 2f5bc1f80c075bf77afa0a4a7986b36ba4f80d80 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 09:42:52 +0000 Subject: [PATCH 084/467] Add comments on memory model for IORefs --- .../src/Unison/Runtime/Builtin.hs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index b2a9d2940..7718a71d7 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2360,6 +2360,13 @@ declareForeigns = do . mkForeign $ \(c :: Closure) -> newIORef c + -- The docs for IORef state that IORef operations can be observed + -- out of order ([1]) but actually GHC does emit the appropriate + -- load and store barriers nowadays ([2], [3]). + -- + -- [1] https://hackage.haskell.org/package/base-4.17.0.0/docs/Data-IORef.html#g:2 + -- [2] https://github.com/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prim.hs#L286 + -- [3] https://github.com/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prim.hs#L298 declareForeign Untracked "Ref.read" boxDirect . mkForeign $ \(r :: IORef Closure) -> readIORef r @@ -2372,6 +2379,19 @@ declareForeigns = do declareForeign Tracked "Ref.Ticket.read" boxDirect . mkForeign $ \(t :: Ticket Closure) -> pure $ peekTicket t + -- In GHC, CAS returns both a Boolean and the current value of the + -- IORef, which can be used to retry a failed CAS. + -- This strategy is more efficient than returning a Boolean only + -- because it uses a single call to cmpxchg in assembly (see [1]) to + -- avoid an extra read per CAS iteration, however it's not supported + -- in Scheme. + -- Therefore, we adopt the more common signature that only returns a + -- Boolean, which doesn't even suffer from spurious failures because + -- GHC issues loads of mutable variables with memory_order_acquire + -- (see [2]) + -- + -- [1]: https://github.com/ghc/ghc/blob/master/rts/PrimOps.cmm#L697 + -- [2]: https://github.com/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prim.hs#L285 declareForeign Tracked "Ref.cas" boxBoxBoxToBool . mkForeign $ \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> fmap fst $ casIORef r t v From 460c124778f7c08fcbd789fa5855afbbd7750a99 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 15:32:46 +0000 Subject: [PATCH 085/467] Add single-shot promise type --- parser-typechecker/src/Unison/Util/Promise.hs | 24 +++++++++++++++++++ .../unison-parser-typechecker.cabal | 1 + 2 files changed, 25 insertions(+) create mode 100644 parser-typechecker/src/Unison/Util/Promise.hs diff --git a/parser-typechecker/src/Unison/Util/Promise.hs b/parser-typechecker/src/Unison/Util/Promise.hs new file mode 100644 index 000000000..5e7eb7dee --- /dev/null +++ b/parser-typechecker/src/Unison/Util/Promise.hs @@ -0,0 +1,24 @@ +module Unison.Util.Promise where + +import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, tryReadMVar, tryPutMVar) + +newtype Promise a = Promise { state :: MVar a} + +-- create an empty promise +new :: IO (Promise a) +new = fmap Promise newEmptyMVar + +-- readsthe value of the promise +-- return immediately if the promise if full, block if empty +read :: Promise a -> IO a +read Promise { state } = readMVar state + +-- try to read the value of the promise +-- immediately return Nothing if the promise is empty +tryRead :: Promise a -> IO (Maybe a) +tryRead Promise { state } = tryReadMVar state + +-- if the promise is empty, write the value, awake all readers and return True +-- if full, ignore the write and return False +write :: a -> Promise a -> IO Bool +write value Promise { state } = tryPutMVar state value diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index e34f21fac..1debfc53d 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -152,6 +152,7 @@ library Unison.Util.Logger Unison.Util.PinBoard Unison.Util.Pretty.MegaParsec + Unison.Util.Promise Unison.Util.Star3 Unison.Util.Text Unison.Util.Text.Pattern From 34f113647f627098b8c4691e679a3b4e49277fe1 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 18:52:52 +0000 Subject: [PATCH 086/467] Add type signatures for Promise --- parser-typechecker/src/Unison/Builtin.hs | 14 ++++++++++---- unison-core/src/Unison/Type.hs | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index 25b5277bc..75f9789c9 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -236,6 +236,8 @@ builtinTypesSrc = B' "Scope" CT.Effect, B' "Ref.Ticket" CT.Data, Rename' "Ref.Ticket" "io2.Ref.Ticket", + B' "Promise" CT.Data, + Rename' "Promise" "io2.Promise", B' "TimeSpec" CT.Data, Rename' "TimeSpec" "io2.Clock.internals.TimeSpec", B' "ImmutableArray" CT.Data, @@ -851,17 +853,21 @@ stmBuiltins = ("STM.atomically", forall1 "a" $ \a -> (unit --> stm a) --> io a) ] --- TODO make sure ordering of args in these types is |> friendly --- TODO rename cas operations refPromiseBuiltins :: [(Text, Type)] refPromiseBuiltins = - [ ("Ref.Ticket.read", forall1 "a" $ \a -> (ticket a) --> a), + [ ("Ref.Ticket.read", forall1 "a" $ \a -> ticket a --> a), ("Ref.ticket", forall1 "a" $ \a -> reft iot a --> io (ticket a)), - ("Ref.cas", forall1 "a" $ \a -> (ticket a) --> a --> reft iot a --> io boolean) + ("Ref.cas", forall1 "a" $ \a -> ticket a --> a --> reft iot a --> io boolean), + ("Promise.new", forall1 "a" $ \a -> unit --> io (promise a)), + ("Promise.read", forall1 "a" $ \a -> promise a --> io a), + ("Promise.tryRead", forall1 "a" $ \a -> promise a --> io (optionalt a)), + ("Promise.write", forall1 "a" $ \a -> a --> promise a --> io boolean) ] where ticket :: Type -> Type ticket a = Type.ref () Type.ticketRef `app` a + promise :: Type -> Type + promise a = Type.ref () Type.promiseRef `app` a forall1 :: Text -> (Type -> Type) -> Type forall1 name body = diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index 90decc858..519a664f9 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -278,6 +278,9 @@ tvarRef = Reference.Builtin "TVar" ticketRef :: Reference ticketRef = Reference.Builtin "Ref.Ticket" +promiseRef :: Reference +promiseRef = Reference.Builtin "Promise" + tlsRef :: Reference tlsRef = Reference.Builtin "Tls" From b408907bf9feecd12fc679142e082511a6021f9a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 15 Jan 2023 22:33:38 +0000 Subject: [PATCH 087/467] Add bindings for Promise --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 15 +++++++++++++++ .../src/Unison/Runtime/Foreign/Function.hs | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 7718a71d7..8d2a7b652 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -150,6 +150,8 @@ import Unison.Util.EnumContainers as EC import Unison.Util.Text (Text) import qualified Unison.Util.Text as Util.Text import qualified Unison.Util.Text.Pattern as TPat +import Unison.Util.Promise (Promise) +import qualified Unison.Util.Promise as Promise import Unison.Var type Failure = F.Failure Closure @@ -2395,6 +2397,19 @@ declareForeigns = do declareForeign Tracked "Ref.cas" boxBoxBoxToBool . mkForeign $ \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> fmap fst $ casIORef r t v + declareForeign Tracked "Promise.new" unitDirect . mkForeign $ + \() -> Promise.new @Closure + + -- the only exceptions from Promise.read are async and shouldn't be caught + declareForeign Tracked "Promise.read" boxDirect . mkForeign $ + \(p :: Promise Closure) -> Promise.read p + + declareForeign Tracked "Promise.tryRead" boxToMaybeBox . mkForeign $ + \(p :: Promise Closure) -> Promise.tryRead p + + declareForeign Tracked "Promise.write" boxBoxToBool . mkForeign $ + \(a :: Closure, p :: Promise Closure) -> Promise.write a p + declareForeign Tracked "Tls.newClient.impl.v3" boxBoxToEFBox . mkForeignTls $ \( config :: TLS.ClientParams, socket :: SYS.Socket diff --git a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs index a5deb9f26..d56981374 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs @@ -41,6 +41,7 @@ import Unison.Type marrayRef, mbytearrayRef, mvarRef, + promiseRef, refRef, ticketRef, tvarRef, @@ -48,6 +49,7 @@ import Unison.Type ) import Unison.Util.Bytes (Bytes) import Unison.Util.Text (Text, pack, unpack) +import Unison.Util.Promise (Promise) -- Foreign functions operating on stacks data ForeignFunc where @@ -436,6 +438,10 @@ instance ForeignConvention (Ticket Closure) where readForeign = readForeignAs (unwrapForeign . marshalToForeign) writeForeign = writeForeignAs (Foreign . Wrap ticketRef) +instance ForeignConvention (Promise Closure) where + readForeign = readForeignAs (unwrapForeign . marshalToForeign) + writeForeign = writeForeignAs (Foreign . Wrap promiseRef) + instance ForeignConvention (SuperGroup Symbol) where readForeign = readForeignBuiltin writeForeign = writeForeignBuiltin From c0ef6e254de821d134654c6dada54ab1c6461795 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 17 Jan 2023 11:24:56 -0600 Subject: [PATCH 088/467] Return 'null' instead of an empty hover result --- unison-cli/src/Unison/LSP/Hover.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index bdf09dac1..c2893f63c 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -31,6 +31,7 @@ hoverHandler m respond = results <- MaybeT . fmap eitherToMaybe $ (lspBackend $ Backend.prettyDefinitionsForHQName Path.empty Nothing Nothing (Backend.Suffixify True) rt cb hqIdentifier) let termResults = formatTermDefinition <$> toList (Backend.termDefinitions results) let typeResults = formatTypeDefinition <$> toList (Backend.typeDefinitions results) + guard (not . null $ termResults <> typeResults) let markup = Text.intercalate "\n\n---\n\n" $ termResults <> typeResults pure $ Hover From 86e70f25b49124b877ccd39a93815ca61a5ad7b2 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 18 Jan 2023 00:07:28 +0000 Subject: [PATCH 089/467] Update documentation for adding builtins --- docs/adding-builtins.markdown | 106 +++++++++++++++++----------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/docs/adding-builtins.markdown b/docs/adding-builtins.markdown index eccd39b05..56cea13e9 100644 --- a/docs/adding-builtins.markdown +++ b/docs/adding-builtins.markdown @@ -44,7 +44,6 @@ namespace. However, we will also add the value: ```haskell Rename' "MVar" "io2.MVar" ``` - because this is a type to be used with the new IO functions, which are currently nested under the `io2` namespace. With both of these added to the list, running `builtins.merge` should have a `builtin.io2.MVar` @@ -73,33 +72,31 @@ Builtin functions also have an associated type as part of the initial declaration. So for the complete specification of a function, we will add declarations similar to: - - ```haskell B "MVar.new" $ forall1 "a" (\a -> a --> io (mvar a)) Rename "MVar.new" "io2.MVar.new" -B "MVar.take" $ forall1 "a" (\a -> mvar a --> ioe a) +B "MVar.take" $ forall1 "a" (\a -> mvar a --> iof a) Rename "MVar.take" "io2.MVar.take" ``` - - -The `forall1`, `io`, `ioe` and `-->` functions are local definitions -in `Unison.Builtin` for assistance in writing the types. `ioe` +The `forall1`, `io`, `iof` and `-->` functions are local definitions +in `Unison.Builtin` for assistance in writing the types. `iof` indicates that an error result may be returned, while `io` should -always succeed. `mvar` can be defined locally using some other +always succeed. Note that when the `{IO}` ability appears as a type +parameter rather than the return type of a function, you will need to +use `iot` instead. +`mvar` can be defined locally using some other helpers in scope: - ```haskell -mvar :: Var v => Type v -> Type v +mvar :: Type -> Type mvar a = Type.ref () Type.mvarRef `app` a ``` For the actual `MVar` implementation, we'll be doing many definitions followed by renames, so it'll be factored into a list of the name and -type, together with a function that generates the declaration and the -rename. +type, and we can then call the `moveUnder` helper to generate the `B` +declaration and the `Rename`. ## Builtin function implementation -- new runtime @@ -116,42 +113,45 @@ in `Unison.Runtime.Builtin`, in a definition `declareForeigns`. We can declare our builtins there by adding: ```haskell - declareForeign "MVar.new" mvar'new + declareForeign Tracked "MVar.new" boxDirect . mkForeign $ \(c :: Closure) -> newMVar c - declareForeign "MVar.take" mvar'take - . mkForeignIOE $ \(mv :: MVar Closure) -> takeMVar mv + declareForeign Tracked "MVar.take" boxToEFBox + . mkForeignIOF $ \(mv :: MVar Closure) -> takeMVar mv ``` These lines do multiple things at once. The first argument to -`declareForeign` must match the name from `Unison.Builtin`, as this -is how they are associated. The second argument is wrapper code -that actually defines the unison function that will be called, and -the definitions for these two cases will be shown later. The last -argument is the actual Haskell implementation of the operation. -However, the format for foreign functions is somewhat more limited -than 'any Haskell function,' so the `mkForeign` and `mkForeignIOE` -helpers assist in wrapping Haskell functions correctly. The latter -will catch some exceptions and yield them as explicit results. - - -The wrapper code for these two operations looks like: +`declareForeign` determines whether the function should be explicitly +tracked by the Unison Cloud sandboxing functionality or not. As a +general guideline, functions in `{IO}` are `Tracked`, and pure +functions are `Untracked`. The second argument must match the name +from `Unison.Builtin`, as this is how they are associated. The third +argument is wrapper code that defines the conversion from the Haskell +runtim calling convention into Unison, and the definitions for these +two cases will be shown later. The last argument is the actual Haskell +implementation of the operation. However, the format for foreign +functions is somewhat more limited than 'any Haskell function,' so the +`mkForeign` and `mkForeignIOF` helpers assist in wrapping Haskell +functions correctly. The latter will catch some exceptions and yield +them as explicit results. +The wrapper code for these two operations looks like: ```haskell -mvar'new :: ForeignOp -mvar'new instr - = ([BX],) - . TAbs init - $ TFOp instr [init] +-- a -> b +boxDirect :: ForeignOp +boxDirect instr = + ([BX],) + . TAbs arg + $ TFOp instr [arg] where - [init] = freshes 1 + arg = fresh1 -mvar'take :: ForeignOp -mvar'take instr - = ([BX],) - . TAbs mv - $ io'error'result'direct instr [mv] ior e r +-- a -> Either Failure b +boxToEFBox :: ForeignOp +boxToEFBox = + inBx arg result $ + outIoFailBox stack1 stack2 stack3 any fail result where - [mv,ior,e,r] = freshes 4 + (arg, result, stack1, stack2, stack3, any, fail) = fresh ``` The breakdown of what is happening here is as follows: @@ -167,23 +167,25 @@ The breakdown of what is happening here is as follows: currently be taking all boxed arguments, because there is no way to talk about unboxed values in the surface syntax where they are called. -- `TAbs init` abstracts the argument variable, which we got from - `freshes'` at the bottom. Multiple arguments may be abstracted with - e.g. `TAbss [x,y,z]` -- `io'error'result'direct` is a helper function for calling the - instruction and wrapping up a possible error result. The first - argument is the identifier to call, the list is the arguments, - and the last three arguments are variables used in the common - result handling code. +- `TAbs arg` abstracts the argument variable, which we got from + `fresh1'` at the bottom. Multiple arguments may be abstracted with + e.g. `TAbss [x,y,z]`. You can call `fresh` to instantiate a tuple of + fresh variables of a certain arity. +- `inBx` and `outIoFailBox` are helper functions for calling the + instruction and wrapping up a possible error result. - `TFOp` simply calls the instruction with the assumption that the result value is acceptable for directly returning. `MVar` values will be represented directly by their Haskell values wrapped into - a closure, so the `mvar'new` code doesn't need to do any + a closure, so the `boxDirect` code doesn't need to do any processing of the results of its foreign function. -Other builtins use slightly different implementations, so looking at -other parts of the file may be instructive, depending on what is being -added. +The names of the helpers generally follow a form of form of Hungarian +notation, e.g. `boxToEFBox` means "boxed value to either a failure or +a boxed value", i.e. `a -> Either a b`. +However, not all helpers are named consistently at the moment, and +different builtins use slightly different implementations, so looking +at other parts of the file may be instructive, depending on what is +being added. At first, our declarations will cause an error, because some of the automatic machinery for creating builtin 'foreign' functions does not From 743d2018e27accae0c906429161655685d64843c Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 18 Jan 2023 02:09:46 +0000 Subject: [PATCH 090/467] Regenerate transcripts --- .../all-base-hashes.output.md | 810 ++++++++------- unison-src/transcripts/alias-many.output.md | 417 ++++---- .../transcripts/builtins-merge.output.md | 2 +- .../transcripts/emptyCodebase.output.md | 4 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 28 +- .../transcripts/name-selection.output.md | 970 +++++++++--------- unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 +- 9 files changed, 1170 insertions(+), 1103 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index 3bcdd2a8a..f7971f599 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -1323,312 +1323,342 @@ This transcript is intended to make visible accidental changes to the hashing al 377. -- ##MVar.tryTake builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 378. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 + 378. -- ##Promise + builtin type builtin.io2.Promise + + 379. -- ##Promise.new + builtin.io2.Promise.new : '{IO} Promise a + + 380. -- ##Promise.read + builtin.io2.Promise.read : Promise a ->{IO} a + + 381. -- ##Promise.tryRead + builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a + + 382. -- ##Promise.write + builtin.io2.Promise.write : a -> Promise a ->{IO} Boolean + + 383. -- ##Ref.cas + builtin.io2.Ref.cas : Ticket a + -> a + -> Ref {IO} a + ->{IO} Boolean + + 384. -- ##Ref.Ticket + builtin type builtin.io2.Ref.Ticket + + 385. -- ##Ref.ticket + builtin.io2.Ref.ticket : Ref {IO} a ->{IO} Ticket a + + 386. -- ##Ref.Ticket.read + builtin.io2.Ref.Ticket.read : Ticket a -> a + + 387. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 unique type builtin.io2.RuntimeFailure - 379. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 + 388. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 unique type builtin.io2.SeekMode - 380. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 + 389. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 381. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 + 390. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 builtin.io2.SeekMode.RelativeSeek : SeekMode - 382. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 + 391. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 builtin.io2.SeekMode.SeekFromEnd : SeekMode - 383. -- ##Socket + 392. -- ##Socket builtin type builtin.io2.Socket - 384. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 + 393. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 unique type builtin.io2.StdHandle - 385. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 + 394. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 builtin.io2.StdHandle.StdErr : StdHandle - 386. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 + 395. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 builtin.io2.StdHandle.StdIn : StdHandle - 387. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 + 396. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 builtin.io2.StdHandle.StdOut : StdHandle - 388. -- ##STM + 397. -- ##STM builtin type builtin.io2.STM - 389. -- ##STM.atomically + 398. -- ##STM.atomically builtin.io2.STM.atomically : '{STM} a ->{IO} a - 390. -- ##STM.retry + 399. -- ##STM.retry builtin.io2.STM.retry : '{STM} a - 391. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g + 400. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g unique type builtin.io2.STMFailure - 392. -- ##ThreadId + 401. -- ##ThreadId builtin type builtin.io2.ThreadId - 393. -- ##Tls + 402. -- ##Tls builtin type builtin.io2.Tls - 394. -- ##Tls.Cipher + 403. -- ##Tls.Cipher builtin type builtin.io2.Tls.Cipher - 395. -- ##Tls.ClientConfig + 404. -- ##Tls.ClientConfig builtin type builtin.io2.Tls.ClientConfig - 396. -- ##Tls.ClientConfig.certificates.set + 405. -- ##Tls.ClientConfig.certificates.set builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 397. -- ##TLS.ClientConfig.ciphers.set + 406. -- ##TLS.ClientConfig.ciphers.set builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 398. -- ##Tls.ClientConfig.default + 407. -- ##Tls.ClientConfig.default builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 399. -- ##Tls.ClientConfig.versions.set + 408. -- ##Tls.ClientConfig.versions.set builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 400. -- ##Tls.decodeCert.impl.v3 + 409. -- ##Tls.decodeCert.impl.v3 builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 401. -- ##Tls.decodePrivateKey + 410. -- ##Tls.decodePrivateKey builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 402. -- ##Tls.encodeCert + 411. -- ##Tls.encodeCert builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 403. -- ##Tls.encodePrivateKey + 412. -- ##Tls.encodePrivateKey builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 404. -- ##Tls.handshake.impl.v3 + 413. -- ##Tls.handshake.impl.v3 builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 405. -- ##Tls.newClient.impl.v3 + 414. -- ##Tls.newClient.impl.v3 builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 406. -- ##Tls.newServer.impl.v3 + 415. -- ##Tls.newServer.impl.v3 builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 407. -- ##Tls.PrivateKey + 416. -- ##Tls.PrivateKey builtin type builtin.io2.Tls.PrivateKey - 408. -- ##Tls.receive.impl.v3 + 417. -- ##Tls.receive.impl.v3 builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 409. -- ##Tls.send.impl.v3 + 418. -- ##Tls.send.impl.v3 builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 410. -- ##Tls.ServerConfig + 419. -- ##Tls.ServerConfig builtin type builtin.io2.Tls.ServerConfig - 411. -- ##Tls.ServerConfig.certificates.set + 420. -- ##Tls.ServerConfig.certificates.set builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 412. -- ##Tls.ServerConfig.ciphers.set + 421. -- ##Tls.ServerConfig.ciphers.set builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 413. -- ##Tls.ServerConfig.default + 422. -- ##Tls.ServerConfig.default builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 414. -- ##Tls.ServerConfig.versions.set + 423. -- ##Tls.ServerConfig.versions.set builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 415. -- ##Tls.SignedCert + 424. -- ##Tls.SignedCert builtin type builtin.io2.Tls.SignedCert - 416. -- ##Tls.terminate.impl.v3 + 425. -- ##Tls.terminate.impl.v3 builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 417. -- ##Tls.Version + 426. -- ##Tls.Version builtin type builtin.io2.Tls.Version - 418. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + 427. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 unique type builtin.io2.TlsFailure - 419. -- ##TVar + 428. -- ##TVar builtin type builtin.io2.TVar - 420. -- ##TVar.new + 429. -- ##TVar.new builtin.io2.TVar.new : a ->{STM} TVar a - 421. -- ##TVar.newIO + 430. -- ##TVar.newIO builtin.io2.TVar.newIO : a ->{IO} TVar a - 422. -- ##TVar.read + 431. -- ##TVar.read builtin.io2.TVar.read : TVar a ->{STM} a - 423. -- ##TVar.readIO + 432. -- ##TVar.readIO builtin.io2.TVar.readIO : TVar a ->{IO} a - 424. -- ##TVar.swap + 433. -- ##TVar.swap builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 425. -- ##TVar.write + 434. -- ##TVar.write builtin.io2.TVar.write : TVar a -> a ->{STM} () - 426. -- ##validateSandboxed + 435. -- ##validateSandboxed builtin.io2.validateSandboxed : [Link.Term] -> a -> Boolean - 427. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + 436. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 unique type builtin.IsPropagated - 428. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + 437. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 builtin.IsPropagated.IsPropagated : IsPropagated - 429. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + 438. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 unique type builtin.IsTest - 430. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + 439. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 builtin.IsTest.IsTest : IsTest - 431. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + 440. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g unique type builtin.License - 432. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + 441. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 builtin.License.copyrightHolders : License -> [CopyrightHolder] - 433. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + 442. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo builtin.License.copyrightHolders.modify : ([CopyrightHolder] ->{g} [CopyrightHolder]) -> License ->{g} License - 434. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + 443. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro builtin.License.copyrightHolders.set : [CopyrightHolder] -> License -> License - 435. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + 444. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 builtin.License.License : [CopyrightHolder] -> [Year] -> LicenseType -> License - 436. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + 445. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g builtin.License.licenseType : License -> LicenseType - 437. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + 446. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo builtin.License.licenseType.modify : (LicenseType ->{g} LicenseType) -> License ->{g} License - 438. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + 447. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o builtin.License.licenseType.set : LicenseType -> License -> License - 439. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + 448. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig builtin.License.years : License -> [Year] - 440. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + 449. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 builtin.License.years.modify : ([Year] ->{g} [Year]) -> License ->{g} License - 441. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + 450. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo builtin.License.years.set : [Year] -> License -> License - 442. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + 451. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 unique type builtin.LicenseType - 443. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + 452. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 builtin.LicenseType.LicenseType : Doc -> LicenseType - 444. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + 453. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 unique type builtin.Link - 445. -- ##Link.Term + 454. -- ##Link.Term builtin type builtin.Link.Term - 446. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + 455. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 builtin.Link.Term : Link.Term -> Link - 447. -- ##Link.Term.toText + 456. -- ##Link.Term.toText builtin.Link.Term.toText : Link.Term -> Text - 448. -- ##Link.Type + 457. -- ##Link.Type builtin type builtin.Link.Type - 449. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + 458. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 builtin.Link.Type : Type -> Link - 450. -- ##Sequence + 459. -- ##Sequence builtin type builtin.List - 451. -- ##List.++ + 460. -- ##List.++ builtin.List.++ : [a] -> [a] -> [a] - 452. -- ##List.cons + 461. -- ##List.cons builtin.List.+:, builtin.List.cons : a -> [a] -> [a] - 453. -- ##List.snoc + 462. -- ##List.snoc builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] - 454. -- ##List.at + 463. -- ##List.at builtin.List.at : Nat -> [a] -> Optional a - 455. -- ##List.cons + 464. -- ##List.cons builtin.List.cons, builtin.List.+: : a -> [a] -> [a] - 456. -- ##List.drop + 465. -- ##List.drop builtin.List.drop : Nat -> [a] -> [a] - 457. -- ##List.empty + 466. -- ##List.empty builtin.List.empty : [a] - 458. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + 467. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] - 459. -- ##List.size + 468. -- ##List.size builtin.List.size : [a] -> Nat - 460. -- ##List.snoc + 469. -- ##List.snoc builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] - 461. -- ##List.take + 470. -- ##List.take builtin.List.take : Nat -> [a] -> [a] - 462. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + 471. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g builtin.metadata.isPropagated : IsPropagated - 463. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + 472. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko builtin.metadata.isTest : IsTest - 464. -- ##MutableArray + 473. -- ##MutableArray builtin type builtin.MutableArray - 465. -- ##MutableArray.copyTo! + 474. -- ##MutableArray.copyTo! builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a @@ -1636,34 +1666,34 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 466. -- ##MutableArray.freeze + 475. -- ##MutableArray.freeze builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 467. -- ##MutableArray.freeze! + 476. -- ##MutableArray.freeze! builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 468. -- ##MutableArray.read + 477. -- ##MutableArray.read builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 469. -- ##MutableArray.size + 478. -- ##MutableArray.size builtin.MutableArray.size : MutableArray g a -> Nat - 470. -- ##MutableArray.write + 479. -- ##MutableArray.write builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 471. -- ##MutableByteArray + 480. -- ##MutableByteArray builtin type builtin.MutableByteArray - 472. -- ##MutableByteArray.copyTo! + 481. -- ##MutableByteArray.copyTo! builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g @@ -1671,682 +1701,682 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 473. -- ##MutableByteArray.freeze + 482. -- ##MutableByteArray.freeze builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 474. -- ##MutableByteArray.freeze! + 483. -- ##MutableByteArray.freeze! builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 475. -- ##MutableByteArray.read16be + 484. -- ##MutableByteArray.read16be builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 476. -- ##MutableByteArray.read24be + 485. -- ##MutableByteArray.read24be builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 477. -- ##MutableByteArray.read32be + 486. -- ##MutableByteArray.read32be builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 478. -- ##MutableByteArray.read40be + 487. -- ##MutableByteArray.read40be builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 479. -- ##MutableByteArray.read64be + 488. -- ##MutableByteArray.read64be builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 480. -- ##MutableByteArray.read8 + 489. -- ##MutableByteArray.read8 builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 481. -- ##MutableByteArray.size + 490. -- ##MutableByteArray.size builtin.MutableByteArray.size : MutableByteArray g -> Nat - 482. -- ##MutableByteArray.write16be + 491. -- ##MutableByteArray.write16be builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 483. -- ##MutableByteArray.write32be + 492. -- ##MutableByteArray.write32be builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 484. -- ##MutableByteArray.write64be + 493. -- ##MutableByteArray.write64be builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 485. -- ##MutableByteArray.write8 + 494. -- ##MutableByteArray.write8 builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 486. -- ##Nat + 495. -- ##Nat builtin type builtin.Nat - 487. -- ##Nat.* + 496. -- ##Nat.* builtin.Nat.* : Nat -> Nat -> Nat - 488. -- ##Nat.+ + 497. -- ##Nat.+ builtin.Nat.+ : Nat -> Nat -> Nat - 489. -- ##Nat./ + 498. -- ##Nat./ builtin.Nat./ : Nat -> Nat -> Nat - 490. -- ##Nat.and + 499. -- ##Nat.and builtin.Nat.and : Nat -> Nat -> Nat - 491. -- ##Nat.complement + 500. -- ##Nat.complement builtin.Nat.complement : Nat -> Nat - 492. -- ##Nat.drop + 501. -- ##Nat.drop builtin.Nat.drop : Nat -> Nat -> Nat - 493. -- ##Nat.== + 502. -- ##Nat.== builtin.Nat.eq : Nat -> Nat -> Boolean - 494. -- ##Nat.fromText + 503. -- ##Nat.fromText builtin.Nat.fromText : Text -> Optional Nat - 495. -- ##Nat.> + 504. -- ##Nat.> builtin.Nat.gt : Nat -> Nat -> Boolean - 496. -- ##Nat.>= + 505. -- ##Nat.>= builtin.Nat.gteq : Nat -> Nat -> Boolean - 497. -- ##Nat.increment + 506. -- ##Nat.increment builtin.Nat.increment : Nat -> Nat - 498. -- ##Nat.isEven + 507. -- ##Nat.isEven builtin.Nat.isEven : Nat -> Boolean - 499. -- ##Nat.isOdd + 508. -- ##Nat.isOdd builtin.Nat.isOdd : Nat -> Boolean - 500. -- ##Nat.leadingZeros + 509. -- ##Nat.leadingZeros builtin.Nat.leadingZeros : Nat -> Nat - 501. -- ##Nat.< + 510. -- ##Nat.< builtin.Nat.lt : Nat -> Nat -> Boolean - 502. -- ##Nat.<= + 511. -- ##Nat.<= builtin.Nat.lteq : Nat -> Nat -> Boolean - 503. -- ##Nat.mod + 512. -- ##Nat.mod builtin.Nat.mod : Nat -> Nat -> Nat - 504. -- ##Nat.or + 513. -- ##Nat.or builtin.Nat.or : Nat -> Nat -> Nat - 505. -- ##Nat.popCount + 514. -- ##Nat.popCount builtin.Nat.popCount : Nat -> Nat - 506. -- ##Nat.pow + 515. -- ##Nat.pow builtin.Nat.pow : Nat -> Nat -> Nat - 507. -- ##Nat.shiftLeft + 516. -- ##Nat.shiftLeft builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 508. -- ##Nat.shiftRight + 517. -- ##Nat.shiftRight builtin.Nat.shiftRight : Nat -> Nat -> Nat - 509. -- ##Nat.sub + 518. -- ##Nat.sub builtin.Nat.sub : Nat -> Nat -> Int - 510. -- ##Nat.toFloat + 519. -- ##Nat.toFloat builtin.Nat.toFloat : Nat -> Float - 511. -- ##Nat.toInt + 520. -- ##Nat.toInt builtin.Nat.toInt : Nat -> Int - 512. -- ##Nat.toText + 521. -- ##Nat.toText builtin.Nat.toText : Nat -> Text - 513. -- ##Nat.trailingZeros + 522. -- ##Nat.trailingZeros builtin.Nat.trailingZeros : Nat -> Nat - 514. -- ##Nat.xor + 523. -- ##Nat.xor builtin.Nat.xor : Nat -> Nat -> Nat - 515. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + 524. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg structural type builtin.Optional a - 516. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + 525. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 builtin.Optional.None : Optional a - 517. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + 526. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 builtin.Optional.Some : a -> Optional a - 518. -- ##Pattern + 527. -- ##Pattern builtin type builtin.Pattern - 519. -- ##Pattern.capture + 528. -- ##Pattern.capture builtin.Pattern.capture : Pattern a -> Pattern a - 520. -- ##Pattern.isMatch + 529. -- ##Pattern.isMatch builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 521. -- ##Pattern.join + 530. -- ##Pattern.join builtin.Pattern.join : [Pattern a] -> Pattern a - 522. -- ##Pattern.many + 531. -- ##Pattern.many builtin.Pattern.many : Pattern a -> Pattern a - 523. -- ##Pattern.or + 532. -- ##Pattern.or builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 524. -- ##Pattern.replicate + 533. -- ##Pattern.replicate builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 525. -- ##Pattern.run + 534. -- ##Pattern.run builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) - 526. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + 535. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg structural type builtin.Pretty txt - 527. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + 536. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 unique type builtin.Pretty.Annotated w txt - 528. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + 537. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 builtin.Pretty.Annotated.Append : w -> [Annotated w txt] -> Annotated w txt - 529. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + 538. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 builtin.Pretty.Annotated.Empty : Annotated w txt - 530. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + 539. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 builtin.Pretty.Annotated.Group : w -> Annotated w txt -> Annotated w txt - 531. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + 540. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 builtin.Pretty.Annotated.Indent : w -> Annotated w txt -> Annotated w txt -> Annotated w txt -> Annotated w txt - 532. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + 541. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 builtin.Pretty.Annotated.Lit : w -> txt -> Annotated w txt - 533. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + 542. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 builtin.Pretty.Annotated.OrElse : w -> Annotated w txt -> Annotated w txt -> Annotated w txt - 534. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + 543. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 builtin.Pretty.Annotated.Table : w -> [[Annotated w txt]] -> Annotated w txt - 535. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + 544. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 builtin.Pretty.Annotated.Wrap : w -> Annotated w txt -> Annotated w txt - 536. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + 545. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg builtin.Pretty.append : Pretty txt -> Pretty txt -> Pretty txt - 537. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + 546. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 builtin.Pretty.empty : Pretty txt - 538. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + 547. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo builtin.Pretty.get : Pretty txt -> Annotated () txt - 539. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + 548. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 builtin.Pretty.group : Pretty txt -> Pretty txt - 540. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + 549. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno builtin.Pretty.indent : Pretty txt -> Pretty txt -> Pretty txt - 541. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + 550. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug builtin.Pretty.indent' : Pretty txt -> Pretty txt -> Pretty txt -> Pretty txt - 542. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + 551. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo builtin.Pretty.join : [Pretty txt] -> Pretty txt - 543. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + 552. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 544. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + 553. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 - 545. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + 554. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 builtin.Pretty.orElse : Pretty txt -> Pretty txt -> Pretty txt - 546. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + 555. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 builtin.Pretty.Pretty : Annotated () txt -> Pretty txt - 547. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + 556. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g builtin.Pretty.sepBy : Pretty txt -> [Pretty txt] -> Pretty txt - 548. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + 557. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro builtin.Pretty.table : [[Pretty txt]] -> Pretty txt - 549. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + 558. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 builtin.Pretty.wrap : Pretty txt -> Pretty txt - 550. -- ##Ref + 559. -- ##Ref builtin type builtin.Ref - 551. -- ##Ref.read + 560. -- ##Ref.read builtin.Ref.read : Ref g a ->{g} a - 552. -- ##Ref.write + 561. -- ##Ref.write builtin.Ref.write : Ref g a -> a ->{g} () - 553. -- ##Effect + 562. -- ##Effect builtin type builtin.Request - 554. -- ##Scope + 563. -- ##Scope builtin type builtin.Scope - 555. -- ##Scope.array + 564. -- ##Scope.array builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 556. -- ##Scope.arrayOf + 565. -- ##Scope.arrayOf builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 557. -- ##Scope.bytearray + 566. -- ##Scope.bytearray builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 558. -- ##Scope.bytearrayOf + 567. -- ##Scope.bytearrayOf builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 559. -- ##Scope.ref + 568. -- ##Scope.ref builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 560. -- ##Scope.run + 569. -- ##Scope.run builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 561. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + 570. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 structural type builtin.SeqView a b - 562. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + 571. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 builtin.SeqView.VElem : a -> b -> SeqView a b - 563. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + 572. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 builtin.SeqView.VEmpty : SeqView a b - 564. -- ##Socket.toText + 573. -- ##Socket.toText builtin.Socket.toText : Socket -> Text - 565. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + 574. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo builtin.syntax.docAside : Doc2 -> Doc2 - 566. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + 575. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 builtin.syntax.docBlockquote : Doc2 -> Doc2 - 567. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + 576. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 builtin.syntax.docBold : Doc2 -> Doc2 - 568. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + 577. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg builtin.syntax.docBulletedList : [Doc2] -> Doc2 - 569. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + 578. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 - 570. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + 579. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo builtin.syntax.docCode : Doc2 -> Doc2 - 571. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + 580. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 builtin.syntax.docCodeBlock : Text -> Text -> Doc2 - 572. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + 581. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 builtin.syntax.docColumn : [Doc2] -> Doc2 - 573. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + 582. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term - 574. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + 583. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg builtin.syntax.docEmbedAnnotations : tms -> tms - 575. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + 584. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 builtin.syntax.docEmbedSignatureLink : '{g} t -> Doc2.Term - 576. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + 585. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao builtin.syntax.docEmbedTermLink : '{g} t -> Either a Doc2.Term - 577. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + 586. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 builtin.syntax.docEmbedTypeLink : typ -> Either typ b - 578. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + 587. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg builtin.syntax.docEval : 'a -> Doc2 - 579. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + 588. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g builtin.syntax.docEvalInline : 'a -> Doc2 - 580. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + 589. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 builtin.syntax.docExample : Nat -> '{g} t -> Doc2 - 581. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + 590. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 - 582. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + 591. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 583. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + 592. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) - 584. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + 593. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 builtin.syntax.docGroup : Doc2 -> Doc2 - 585. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + 594. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 builtin.syntax.docItalic : Doc2 -> Doc2 - 586. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + 595. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 builtin.syntax.docJoin : [Doc2] -> Doc2 - 587. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + 596. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 - 588. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + 597. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 - 589. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + 598. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 - 590. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + 599. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 builtin.syntax.docParagraph : [Doc2] -> Doc2 - 591. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + 600. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 - 592. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + 601. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 builtin.syntax.docSignature : [Doc2.Term] -> Doc2 - 593. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + 602. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 - 594. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + 603. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 builtin.syntax.docSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 595. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + 604. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 builtin.syntax.docSourceElement : link -> annotations -> (link, annotations) - 596. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + 605. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag builtin.syntax.docStrikethrough : Doc2 -> Doc2 - 597. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + 606. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g builtin.syntax.docTable : [[Doc2]] -> Doc2 - 598. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + 607. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 - 599. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + 608. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 builtin.syntax.docTransclude : d -> d - 600. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + 609. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 builtin.syntax.docUntitledSection : [Doc2] -> Doc2 - 601. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + 610. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo builtin.syntax.docVerbatim : Doc2 -> Doc2 - 602. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + 611. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 builtin.syntax.docWord : Text -> Doc2 - 603. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + 612. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 unique type builtin.Test.Result - 604. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + 613. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 builtin.Test.Result.Fail : Text -> Result - 605. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + 614. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 builtin.Test.Result.Ok : Text -> Result - 606. -- ##Text + 615. -- ##Text builtin type builtin.Text - 607. -- ##Text.!= + 616. -- ##Text.!= builtin.Text.!= : Text -> Text -> Boolean - 608. -- ##Text.++ + 617. -- ##Text.++ builtin.Text.++ : Text -> Text -> Text - 609. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + 618. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text - 610. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + 619. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg builtin.Text.alignRightWith : Nat -> Char -> Text -> Text - 611. -- ##Text.drop + 620. -- ##Text.drop builtin.Text.drop : Nat -> Text -> Text - 612. -- ##Text.empty + 621. -- ##Text.empty builtin.Text.empty : Text - 613. -- ##Text.== + 622. -- ##Text.== builtin.Text.eq : Text -> Text -> Boolean - 614. -- ##Text.fromCharList + 623. -- ##Text.fromCharList builtin.Text.fromCharList : [Char] -> Text - 615. -- ##Text.fromUtf8.impl.v3 + 624. -- ##Text.fromUtf8.impl.v3 builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 616. -- ##Text.> + 625. -- ##Text.> builtin.Text.gt : Text -> Text -> Boolean - 617. -- ##Text.>= + 626. -- ##Text.>= builtin.Text.gteq : Text -> Text -> Boolean - 618. -- ##Text.< + 627. -- ##Text.< builtin.Text.lt : Text -> Text -> Boolean - 619. -- ##Text.<= + 628. -- ##Text.<= builtin.Text.lteq : Text -> Text -> Boolean - 620. -- ##Text.patterns.anyChar + 629. -- ##Text.patterns.anyChar builtin.Text.patterns.anyChar : Pattern Text - 621. -- ##Text.patterns.charIn + 630. -- ##Text.patterns.charIn builtin.Text.patterns.charIn : [Char] -> Pattern Text - 622. -- ##Text.patterns.charRange + 631. -- ##Text.patterns.charRange builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 623. -- ##Text.patterns.digit + 632. -- ##Text.patterns.digit builtin.Text.patterns.digit : Pattern Text - 624. -- ##Text.patterns.eof + 633. -- ##Text.patterns.eof builtin.Text.patterns.eof : Pattern Text - 625. -- ##Text.patterns.letter + 634. -- ##Text.patterns.letter builtin.Text.patterns.letter : Pattern Text - 626. -- ##Text.patterns.literal + 635. -- ##Text.patterns.literal builtin.Text.patterns.literal : Text -> Pattern Text - 627. -- ##Text.patterns.notCharIn + 636. -- ##Text.patterns.notCharIn builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 628. -- ##Text.patterns.notCharRange + 637. -- ##Text.patterns.notCharRange builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 629. -- ##Text.patterns.punctuation + 638. -- ##Text.patterns.punctuation builtin.Text.patterns.punctuation : Pattern Text - 630. -- ##Text.patterns.space + 639. -- ##Text.patterns.space builtin.Text.patterns.space : Pattern Text - 631. -- ##Text.repeat + 640. -- ##Text.repeat builtin.Text.repeat : Nat -> Text -> Text - 632. -- ##Text.reverse + 641. -- ##Text.reverse builtin.Text.reverse : Text -> Text - 633. -- ##Text.size + 642. -- ##Text.size builtin.Text.size : Text -> Nat - 634. -- ##Text.take + 643. -- ##Text.take builtin.Text.take : Nat -> Text -> Text - 635. -- ##Text.toCharList + 644. -- ##Text.toCharList builtin.Text.toCharList : Text -> [Char] - 636. -- ##Text.toLowercase + 645. -- ##Text.toLowercase builtin.Text.toLowercase : Text -> Text - 637. -- ##Text.toUppercase + 646. -- ##Text.toUppercase builtin.Text.toUppercase : Text -> Text - 638. -- ##Text.toUtf8 + 647. -- ##Text.toUtf8 builtin.Text.toUtf8 : Text -> Bytes - 639. -- ##Text.uncons + 648. -- ##Text.uncons builtin.Text.uncons : Text -> Optional (Char, Text) - 640. -- ##Text.unsnoc + 649. -- ##Text.unsnoc builtin.Text.unsnoc : Text -> Optional (Text, Char) - 641. -- ##ThreadId.toText + 650. -- ##ThreadId.toText builtin.ThreadId.toText : ThreadId -> Text - 642. -- ##todo + 651. -- ##todo builtin.todo : a -> b - 643. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + 652. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 structural type builtin.Tuple a b - 644. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + 653. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 builtin.Tuple.Cons : a -> b -> Tuple a b - 645. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + 654. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g structural type builtin.Unit - 646. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + 655. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 builtin.Unit.Unit : () - 647. -- ##Universal.< + 656. -- ##Universal.< builtin.Universal.< : a -> a -> Boolean - 648. -- ##Universal.<= + 657. -- ##Universal.<= builtin.Universal.<= : a -> a -> Boolean - 649. -- ##Universal.== + 658. -- ##Universal.== builtin.Universal.== : a -> a -> Boolean - 650. -- ##Universal.> + 659. -- ##Universal.> builtin.Universal.> : a -> a -> Boolean - 651. -- ##Universal.>= + 660. -- ##Universal.>= builtin.Universal.>= : a -> a -> Boolean - 652. -- ##Universal.compare + 661. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 653. -- ##unsafe.coerceAbilities + 662. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 654. -- ##Value + 663. -- ##Value builtin type builtin.Value - 655. -- ##Value.dependencies + 664. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 656. -- ##Value.deserialize + 665. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 657. -- ##Value.load + 666. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 658. -- ##Value.serialize + 667. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 659. -- ##Value.value + 668. -- ##Value.value builtin.Value.value : a -> Value - 660. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 669. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 661. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 670. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 662. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 671. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 663. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 672. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 664. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 673. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 665. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 674. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 666. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 675. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 667. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 676. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 668. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 677. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 669. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 678. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 670. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 679. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2354,7 +2384,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 671. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 680. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2363,318 +2393,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 672. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 681. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 673. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 682. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 674. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 683. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 675. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 684. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 676. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 685. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 677. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 686. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 678. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 687. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 679. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 688. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 680. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 689. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 681. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 690. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 682. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 691. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 683. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 692. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 684. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 693. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 685. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 694. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 686. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 695. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 687. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 696. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 688. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 697. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 689. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 698. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 690. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 699. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 691. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 700. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 692. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 701. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 693. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 702. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 694. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 703. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 695. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 704. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 696. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 705. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 697. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 706. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 698. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 707. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 699. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 708. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 700. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 709. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 701. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 710. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 702. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 711. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 703. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 712. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 704. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 713. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 705. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 714. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 706. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 715. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 707. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 716. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 708. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 717. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 709. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 718. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 710. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 719. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 711. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 720. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 712. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 721. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 713. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 722. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 714. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 723. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 715. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 724. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 716. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 725. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 717. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 726. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 718. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 727. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 719. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 728. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 720. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 729. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 721. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 730. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 722. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 731. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 723. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 732. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 724. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 733. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 725. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 734. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 726. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 735. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 727. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 736. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 728. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 737. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 729. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 738. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 730. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 739. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 731. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 740. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 732. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 741. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 733. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 742. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 734. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 743. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 735. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 744. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 736. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 745. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o saveSelfContained : a -> Text ->{IO, Exception} () - 737. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 746. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 738. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 747. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 739. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 748. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 740. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 749. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 741. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 750. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 742. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 751. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 743. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 752. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 744. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 753. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 745. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 754. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 746. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 755. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 747. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 756. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 748. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 757. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 749. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 758. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 750. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 759. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 751. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 760. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 752. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 761. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 753. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 762. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 754. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 763. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 755. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 764. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 756. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 765. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 757. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 766. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 758. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 767. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 759. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 768. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 760. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 769. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 761. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 770. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 762. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 771. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 763. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 772. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 764. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 773. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 765. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 774. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 766. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 775. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 767. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 776. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index 763978588..37025af48 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -365,284 +365,293 @@ Let's try it! ->{IO} Either Failure (Optional a) 263. io2.MVar.tryTake : MVar a ->{IO} Optional a - 264. unique type io2.RuntimeFailure - 265. unique type io2.SeekMode - 266. io2.SeekMode.AbsoluteSeek : SeekMode - 267. io2.SeekMode.RelativeSeek : SeekMode - 268. io2.SeekMode.SeekFromEnd : SeekMode - 269. builtin type io2.Socket - 270. unique type io2.StdHandle - 271. io2.StdHandle.StdErr : StdHandle - 272. io2.StdHandle.StdIn : StdHandle - 273. io2.StdHandle.StdOut : StdHandle - 274. builtin type io2.STM - 275. io2.STM.atomically : '{STM} a ->{IO} a - 276. io2.STM.retry : '{STM} a - 277. unique type io2.STMFailure - 278. builtin type io2.ThreadId - 279. builtin type io2.Tls - 280. builtin type io2.Tls.Cipher - 281. builtin type io2.Tls.ClientConfig - 282. io2.Tls.ClientConfig.certificates.set : [SignedCert] + 264. builtin type io2.Promise + 265. io2.Promise.new : '{IO} Promise a + 266. io2.Promise.read : Promise a ->{IO} a + 267. io2.Promise.tryRead : Promise a ->{IO} Optional a + 268. io2.Promise.write : a -> Promise a ->{IO} Boolean + 269. io2.Ref.cas : Ticket a -> a -> Ref {IO} a ->{IO} Boolean + 270. builtin type io2.Ref.Ticket + 271. io2.Ref.ticket : Ref {IO} a ->{IO} Ticket a + 272. io2.Ref.Ticket.read : Ticket a -> a + 273. unique type io2.RuntimeFailure + 274. unique type io2.SeekMode + 275. io2.SeekMode.AbsoluteSeek : SeekMode + 276. io2.SeekMode.RelativeSeek : SeekMode + 277. io2.SeekMode.SeekFromEnd : SeekMode + 278. builtin type io2.Socket + 279. unique type io2.StdHandle + 280. io2.StdHandle.StdErr : StdHandle + 281. io2.StdHandle.StdIn : StdHandle + 282. io2.StdHandle.StdOut : StdHandle + 283. builtin type io2.STM + 284. io2.STM.atomically : '{STM} a ->{IO} a + 285. io2.STM.retry : '{STM} a + 286. unique type io2.STMFailure + 287. builtin type io2.ThreadId + 288. builtin type io2.Tls + 289. builtin type io2.Tls.Cipher + 290. builtin type io2.Tls.ClientConfig + 291. io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 283. io2.TLS.ClientConfig.ciphers.set : [Cipher] + 292. io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 284. io2.Tls.ClientConfig.default : Text + 293. io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 285. io2.Tls.ClientConfig.versions.set : [Version] + 294. io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 286. io2.Tls.decodeCert.impl : Bytes + 295. io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 287. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 288. io2.Tls.encodeCert : SignedCert -> Bytes - 289. io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 290. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 291. io2.Tls.newClient.impl : ClientConfig + 296. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] + 297. io2.Tls.encodeCert : SignedCert -> Bytes + 298. io2.Tls.encodePrivateKey : PrivateKey -> Bytes + 299. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () + 300. io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 292. io2.Tls.newServer.impl : ServerConfig + 301. io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 293. builtin type io2.Tls.PrivateKey - 294. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 295. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 296. builtin type io2.Tls.ServerConfig - 297. io2.Tls.ServerConfig.certificates.set : [SignedCert] + 302. builtin type io2.Tls.PrivateKey + 303. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes + 304. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () + 305. builtin type io2.Tls.ServerConfig + 306. io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 298. io2.Tls.ServerConfig.ciphers.set : [Cipher] + 307. io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 299. io2.Tls.ServerConfig.default : [SignedCert] + 308. io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 300. io2.Tls.ServerConfig.versions.set : [Version] + 309. io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 301. builtin type io2.Tls.SignedCert - 302. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 303. builtin type io2.Tls.Version - 304. unique type io2.TlsFailure - 305. builtin type io2.TVar - 306. io2.TVar.new : a ->{STM} TVar a - 307. io2.TVar.newIO : a ->{IO} TVar a - 308. io2.TVar.read : TVar a ->{STM} a - 309. io2.TVar.readIO : TVar a ->{IO} a - 310. io2.TVar.swap : TVar a -> a ->{STM} a - 311. io2.TVar.write : TVar a -> a ->{STM} () - 312. io2.validateSandboxed : [Term] -> a -> Boolean - 313. unique type IsPropagated - 314. IsPropagated.IsPropagated : IsPropagated - 315. unique type IsTest - 316. IsTest.IsTest : IsTest - 317. unique type Link - 318. builtin type Link.Term - 319. Link.Term : Term -> Link - 320. Link.Term.toText : Term -> Text - 321. builtin type Link.Type - 322. Link.Type : Type -> Link - 323. builtin type List - 324. List.++ : [a] -> [a] -> [a] - 325. List.+: : a -> [a] -> [a] - 326. List.:+ : [a] -> a -> [a] - 327. List.at : Nat -> [a] -> Optional a - 328. List.cons : a -> [a] -> [a] - 329. List.drop : Nat -> [a] -> [a] - 330. List.empty : [a] - 331. List.size : [a] -> Nat - 332. List.snoc : [a] -> a -> [a] - 333. List.take : Nat -> [a] -> [a] - 334. metadata.isPropagated : IsPropagated - 335. metadata.isTest : IsTest - 336. builtin type MutableArray - 337. MutableArray.copyTo! : MutableArray g a + 310. builtin type io2.Tls.SignedCert + 311. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () + 312. builtin type io2.Tls.Version + 313. unique type io2.TlsFailure + 314. builtin type io2.TVar + 315. io2.TVar.new : a ->{STM} TVar a + 316. io2.TVar.newIO : a ->{IO} TVar a + 317. io2.TVar.read : TVar a ->{STM} a + 318. io2.TVar.readIO : TVar a ->{IO} a + 319. io2.TVar.swap : TVar a -> a ->{STM} a + 320. io2.TVar.write : TVar a -> a ->{STM} () + 321. io2.validateSandboxed : [Term] -> a -> Boolean + 322. unique type IsPropagated + 323. IsPropagated.IsPropagated : IsPropagated + 324. unique type IsTest + 325. IsTest.IsTest : IsTest + 326. unique type Link + 327. builtin type Link.Term + 328. Link.Term : Term -> Link + 329. Link.Term.toText : Term -> Text + 330. builtin type Link.Type + 331. Link.Type : Type -> Link + 332. builtin type List + 333. List.++ : [a] -> [a] -> [a] + 334. List.+: : a -> [a] -> [a] + 335. List.:+ : [a] -> a -> [a] + 336. List.at : Nat -> [a] -> Optional a + 337. List.cons : a -> [a] -> [a] + 338. List.drop : Nat -> [a] -> [a] + 339. List.empty : [a] + 340. List.size : [a] -> Nat + 341. List.snoc : [a] -> a -> [a] + 342. List.take : Nat -> [a] -> [a] + 343. metadata.isPropagated : IsPropagated + 344. metadata.isTest : IsTest + 345. builtin type MutableArray + 346. MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a -> Nat -> Nat ->{g, Exception} () - 338. MutableArray.freeze : MutableArray g a + 347. MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 339. MutableArray.freeze! : MutableArray g a + 348. MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 340. MutableArray.read : MutableArray g a + 349. MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 341. MutableArray.size : MutableArray g a -> Nat - 342. MutableArray.write : MutableArray g a + 350. MutableArray.size : MutableArray g a -> Nat + 351. MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 343. builtin type MutableByteArray - 344. MutableByteArray.copyTo! : MutableByteArray g + 352. builtin type MutableByteArray + 353. MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 345. MutableByteArray.freeze : MutableByteArray g + 354. MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 346. MutableByteArray.freeze! : MutableByteArray g + 355. MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 347. MutableByteArray.read16be : MutableByteArray g + 356. MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 348. MutableByteArray.read24be : MutableByteArray g + 357. MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 349. MutableByteArray.read32be : MutableByteArray g + 358. MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 350. MutableByteArray.read40be : MutableByteArray g + 359. MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 351. MutableByteArray.read64be : MutableByteArray g + 360. MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 352. MutableByteArray.read8 : MutableByteArray g + 361. MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 353. MutableByteArray.size : MutableByteArray g -> Nat - 354. MutableByteArray.write16be : MutableByteArray g + 362. MutableByteArray.size : MutableByteArray g -> Nat + 363. MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 355. MutableByteArray.write32be : MutableByteArray g + 364. MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 356. MutableByteArray.write64be : MutableByteArray g + 365. MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 357. MutableByteArray.write8 : MutableByteArray g + 366. MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 358. builtin type Nat - 359. Nat.* : Nat -> Nat -> Nat - 360. Nat.+ : Nat -> Nat -> Nat - 361. Nat./ : Nat -> Nat -> Nat - 362. Nat.and : Nat -> Nat -> Nat - 363. Nat.complement : Nat -> Nat - 364. Nat.drop : Nat -> Nat -> Nat - 365. Nat.eq : Nat -> Nat -> Boolean - 366. Nat.fromText : Text -> Optional Nat - 367. Nat.gt : Nat -> Nat -> Boolean - 368. Nat.gteq : Nat -> Nat -> Boolean - 369. Nat.increment : Nat -> Nat - 370. Nat.isEven : Nat -> Boolean - 371. Nat.isOdd : Nat -> Boolean - 372. Nat.leadingZeros : Nat -> Nat - 373. Nat.lt : Nat -> Nat -> Boolean - 374. Nat.lteq : Nat -> Nat -> Boolean - 375. Nat.mod : Nat -> Nat -> Nat - 376. Nat.or : Nat -> Nat -> Nat - 377. Nat.popCount : Nat -> Nat - 378. Nat.pow : Nat -> Nat -> Nat - 379. Nat.shiftLeft : Nat -> Nat -> Nat - 380. Nat.shiftRight : Nat -> Nat -> Nat - 381. Nat.sub : Nat -> Nat -> Int - 382. Nat.toFloat : Nat -> Float - 383. Nat.toInt : Nat -> Int - 384. Nat.toText : Nat -> Text - 385. Nat.trailingZeros : Nat -> Nat - 386. Nat.xor : Nat -> Nat -> Nat - 387. structural type Optional a - 388. Optional.None : Optional a - 389. Optional.Some : a -> Optional a - 390. builtin type Pattern - 391. Pattern.capture : Pattern a -> Pattern a - 392. Pattern.isMatch : Pattern a -> a -> Boolean - 393. Pattern.join : [Pattern a] -> Pattern a - 394. Pattern.many : Pattern a -> Pattern a - 395. Pattern.or : Pattern a -> Pattern a -> Pattern a - 396. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 397. Pattern.run : Pattern a -> a -> Optional ([a], a) - 398. builtin type Ref - 399. Ref.read : Ref g a ->{g} a - 400. Ref.write : Ref g a -> a ->{g} () - 401. builtin type Request - 402. builtin type Scope - 403. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 404. Scope.arrayOf : a + 367. builtin type Nat + 368. Nat.* : Nat -> Nat -> Nat + 369. Nat.+ : Nat -> Nat -> Nat + 370. Nat./ : Nat -> Nat -> Nat + 371. Nat.and : Nat -> Nat -> Nat + 372. Nat.complement : Nat -> Nat + 373. Nat.drop : Nat -> Nat -> Nat + 374. Nat.eq : Nat -> Nat -> Boolean + 375. Nat.fromText : Text -> Optional Nat + 376. Nat.gt : Nat -> Nat -> Boolean + 377. Nat.gteq : Nat -> Nat -> Boolean + 378. Nat.increment : Nat -> Nat + 379. Nat.isEven : Nat -> Boolean + 380. Nat.isOdd : Nat -> Boolean + 381. Nat.leadingZeros : Nat -> Nat + 382. Nat.lt : Nat -> Nat -> Boolean + 383. Nat.lteq : Nat -> Nat -> Boolean + 384. Nat.mod : Nat -> Nat -> Nat + 385. Nat.or : Nat -> Nat -> Nat + 386. Nat.popCount : Nat -> Nat + 387. Nat.pow : Nat -> Nat -> Nat + 388. Nat.shiftLeft : Nat -> Nat -> Nat + 389. Nat.shiftRight : Nat -> Nat -> Nat + 390. Nat.sub : Nat -> Nat -> Int + 391. Nat.toFloat : Nat -> Float + 392. Nat.toInt : Nat -> Int + 393. Nat.toText : Nat -> Text + 394. Nat.trailingZeros : Nat -> Nat + 395. Nat.xor : Nat -> Nat -> Nat + 396. structural type Optional a + 397. Optional.None : Optional a + 398. Optional.Some : a -> Optional a + 399. builtin type Pattern + 400. Pattern.capture : Pattern a -> Pattern a + 401. Pattern.isMatch : Pattern a -> a -> Boolean + 402. Pattern.join : [Pattern a] -> Pattern a + 403. Pattern.many : Pattern a -> Pattern a + 404. Pattern.or : Pattern a -> Pattern a -> Pattern a + 405. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a + 406. Pattern.run : Pattern a -> a -> Optional ([a], a) + 407. builtin type Ref + 408. Ref.read : Ref g a ->{g} a + 409. Ref.write : Ref g a -> a ->{g} () + 410. builtin type Request + 411. builtin type Scope + 412. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a + 413. Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 405. Scope.bytearray : Nat + 414. Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 406. Scope.bytearrayOf : Nat + 415. Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 407. Scope.ref : a ->{Scope s} Ref {Scope s} a - 408. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 409. structural type SeqView a b - 410. SeqView.VElem : a -> b -> SeqView a b - 411. SeqView.VEmpty : SeqView a b - 412. Socket.toText : Socket -> Text - 413. unique type Test.Result - 414. Test.Result.Fail : Text -> Result - 415. Test.Result.Ok : Text -> Result - 416. builtin type Text - 417. Text.!= : Text -> Text -> Boolean - 418. Text.++ : Text -> Text -> Text - 419. Text.drop : Nat -> Text -> Text - 420. Text.empty : Text - 421. Text.eq : Text -> Text -> Boolean - 422. Text.fromCharList : [Char] -> Text - 423. Text.fromUtf8.impl : Bytes -> Either Failure Text - 424. Text.gt : Text -> Text -> Boolean - 425. Text.gteq : Text -> Text -> Boolean - 426. Text.lt : Text -> Text -> Boolean - 427. Text.lteq : Text -> Text -> Boolean - 428. Text.patterns.anyChar : Pattern Text - 429. Text.patterns.charIn : [Char] -> Pattern Text - 430. Text.patterns.charRange : Char -> Char -> Pattern Text - 431. Text.patterns.digit : Pattern Text - 432. Text.patterns.eof : Pattern Text - 433. Text.patterns.letter : Pattern Text - 434. Text.patterns.literal : Text -> Pattern Text - 435. Text.patterns.notCharIn : [Char] -> Pattern Text - 436. Text.patterns.notCharRange : Char -> Char -> Pattern Text - 437. Text.patterns.punctuation : Pattern Text - 438. Text.patterns.space : Pattern Text - 439. Text.repeat : Nat -> Text -> Text - 440. Text.reverse : Text -> Text - 441. Text.size : Text -> Nat - 442. Text.take : Nat -> Text -> Text - 443. Text.toCharList : Text -> [Char] - 444. Text.toLowercase : Text -> Text - 445. Text.toUppercase : Text -> Text - 446. Text.toUtf8 : Text -> Bytes - 447. Text.uncons : Text -> Optional (Char, Text) - 448. Text.unsnoc : Text -> Optional (Text, Char) - 449. ThreadId.toText : ThreadId -> Text - 450. todo : a -> b - 451. structural type Tuple a b - 452. Tuple.Cons : a -> b -> Tuple a b - 453. structural type Unit - 454. Unit.Unit : () - 455. Universal.< : a -> a -> Boolean - 456. Universal.<= : a -> a -> Boolean - 457. Universal.== : a -> a -> Boolean - 458. Universal.> : a -> a -> Boolean - 459. Universal.>= : a -> a -> Boolean - 460. Universal.compare : a -> a -> Int - 461. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 462. builtin type Value - 463. Value.dependencies : Value -> [Term] - 464. Value.deserialize : Bytes -> Either Text Value - 465. Value.load : Value ->{IO} Either [Term] a - 466. Value.serialize : Value -> Bytes - 467. Value.value : a -> Value + 416. Scope.ref : a ->{Scope s} Ref {Scope s} a + 417. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r + 418. structural type SeqView a b + 419. SeqView.VElem : a -> b -> SeqView a b + 420. SeqView.VEmpty : SeqView a b + 421. Socket.toText : Socket -> Text + 422. unique type Test.Result + 423. Test.Result.Fail : Text -> Result + 424. Test.Result.Ok : Text -> Result + 425. builtin type Text + 426. Text.!= : Text -> Text -> Boolean + 427. Text.++ : Text -> Text -> Text + 428. Text.drop : Nat -> Text -> Text + 429. Text.empty : Text + 430. Text.eq : Text -> Text -> Boolean + 431. Text.fromCharList : [Char] -> Text + 432. Text.fromUtf8.impl : Bytes -> Either Failure Text + 433. Text.gt : Text -> Text -> Boolean + 434. Text.gteq : Text -> Text -> Boolean + 435. Text.lt : Text -> Text -> Boolean + 436. Text.lteq : Text -> Text -> Boolean + 437. Text.patterns.anyChar : Pattern Text + 438. Text.patterns.charIn : [Char] -> Pattern Text + 439. Text.patterns.charRange : Char -> Char -> Pattern Text + 440. Text.patterns.digit : Pattern Text + 441. Text.patterns.eof : Pattern Text + 442. Text.patterns.letter : Pattern Text + 443. Text.patterns.literal : Text -> Pattern Text + 444. Text.patterns.notCharIn : [Char] -> Pattern Text + 445. Text.patterns.notCharRange : Char -> Char -> Pattern Text + 446. Text.patterns.punctuation : Pattern Text + 447. Text.patterns.space : Pattern Text + 448. Text.repeat : Nat -> Text -> Text + 449. Text.reverse : Text -> Text + 450. Text.size : Text -> Nat + 451. Text.take : Nat -> Text -> Text + 452. Text.toCharList : Text -> [Char] + 453. Text.toLowercase : Text -> Text + 454. Text.toUppercase : Text -> Text + 455. Text.toUtf8 : Text -> Bytes + 456. Text.uncons : Text -> Optional (Char, Text) + 457. Text.unsnoc : Text -> Optional (Text, Char) + 458. ThreadId.toText : ThreadId -> Text + 459. todo : a -> b + 460. structural type Tuple a b + 461. Tuple.Cons : a -> b -> Tuple a b + 462. structural type Unit + 463. Unit.Unit : () + 464. Universal.< : a -> a -> Boolean + 465. Universal.<= : a -> a -> Boolean + 466. Universal.== : a -> a -> Boolean + 467. Universal.> : a -> a -> Boolean + 468. Universal.>= : a -> a -> Boolean + 469. Universal.compare : a -> a -> Int + 470. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b + 471. builtin type Value + 472. Value.dependencies : Value -> [Term] + 473. Value.deserialize : Bytes -> Either Text Value + 474. Value.load : Value ->{IO} Either [Term] a + 475. Value.serialize : Value -> Bytes + 476. Value.value : a -> Value .builtin> alias.many 94-104 .mylib diff --git a/unison-src/transcripts/builtins-merge.output.md b/unison-src/transcripts/builtins-merge.output.md index 98ad8a0e1..beb90e56d 100644 --- a/unison-src/transcripts/builtins-merge.output.md +++ b/unison-src/transcripts/builtins-merge.output.md @@ -74,7 +74,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 63. Value/ (5 terms) 64. bug (a -> b) 65. crypto/ (12 terms, 1 type) - 66. io2/ (119 terms, 28 types) + 66. io2/ (126 terms, 30 types) 67. metadata/ (2 terms) 68. todo (a -> b) 69. unsafe/ (1 term) diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index 4fb8635fc..af0e59a94 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge` .foo> ls - 1. builtin/ (406 terms, 61 types) + 1. builtin/ (413 terms, 63 types) ``` And for a limited time, you can get even more builtin goodies: @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (576 terms, 77 types) + 1. builtin/ (583 terms, 79 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index 9c38043f5..1ffe88e15 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -121,13 +121,13 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #jvvtvqg91i + ⊙ 1. #g3hv60fa4j - Deletes: feature1.y - ⊙ 2. #pdn0nrdikc + ⊙ 2. #5ioveomplb + Adds / updates: @@ -138,26 +138,26 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Original name New name(s) feature1.y master.y - ⊙ 3. #j275561d72 + ⊙ 3. #5k7c2ue0no + Adds / updates: feature1.y - ⊙ 4. #aib93cgn8r + ⊙ 4. #3pt0eqssrl > Moves: Original name New name x master.x - ⊙ 5. #22gtrovg7e + ⊙ 5. #34qqtet8ac + Adds / updates: x - □ 6. #qehn7jqmaf (start of history) + □ 6. #fqlej014a3 (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 0b2db3295..3f208c90f 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -267,7 +267,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (581 terms, 78 types) + 1. root/ (588 terms, 80 types) .> history @@ -276,13 +276,13 @@ I should be able to move the root into a sub-namespace - □ 1. #q3966917gb (start of history) + □ 1. #tujeu0r55u (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (576 terms, 77 types) + 1. builtin/ (583 terms, 79 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -292,7 +292,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #k5qut7l83d + ⊙ 1. #gqhjapum9q - Deletes: @@ -303,7 +303,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #ufgblvn6fs + ⊙ 2. #24ip3jvv9k + Adds / updates: @@ -315,26 +315,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #4jti34auic + ⊙ 3. #e1l67kkplo + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #c3arv0etko + ⊙ 4. #dmv7lfm9ju > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #hpqjvcomfm + ⊙ 5. #clpfvahr82 - Deletes: history.b.termInB - ⊙ 6. #i22kafeklo + ⊙ 6. #r7qu4pdbf1 + Adds / updates: @@ -345,13 +345,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #itf9pe81hk + ⊙ 7. #i48lbjjaqf + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #e40v255vc3 + ⊙ 8. #euu4nd59ph > Moves: @@ -361,7 +361,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #n19k3oti8l + ⊙ 9. #5bifukns3a + Adds / updates: @@ -371,7 +371,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #42rrfc9heu + ⊙ 10. #c862sqlm60 + Adds / updates: @@ -383,7 +383,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #l7cnk7raag + ⊙ 11. #8pjud6lv7q ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index f65b342f8..a487d6d4f 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -128,294 +128,302 @@ d = c + 10 40. structural type builtin.Optional a 41. builtin type builtin.Pattern 42. builtin type builtin.io2.Tls.PrivateKey - 43. builtin type builtin.Ref - 44. builtin type builtin.Request - 45. unique type builtin.Test.Result - 46. unique type builtin.io2.RuntimeFailure - 47. builtin ability builtin.io2.STM - 48. unique type builtin.io2.STMFailure - 49. builtin ability builtin.Scope - 50. unique type builtin.io2.SeekMode - 51. structural type builtin.SeqView a b - 52. builtin type builtin.io2.Tls.ServerConfig - 53. builtin type builtin.io2.Tls.SignedCert - 54. builtin type builtin.io2.Socket - 55. unique type builtin.io2.StdHandle - 56. builtin type builtin.io2.TVar - 57. builtin type builtin.Link.Term - 58. builtin type builtin.Text - 59. builtin type builtin.io2.ThreadId - 60. builtin type builtin.io2.Clock.internals.TimeSpec - 61. builtin type builtin.io2.Tls - 62. unique type builtin.io2.TlsFailure - 63. structural type builtin.Tuple a b - 64. builtin type builtin.Link.Type - 65. structural type builtin.Unit - 66. builtin type builtin.Value - 67. builtin type builtin.io2.Tls.Version - 68. builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 69. builtin.io2.IOError.AlreadyExists : IOError - 70. builtin.io2.FileMode.Append : FileMode - 71. builtin.Doc.Blob : Text + 43. builtin type builtin.io2.Promise + 44. builtin type builtin.Ref + 45. builtin type builtin.Request + 46. unique type builtin.Test.Result + 47. unique type builtin.io2.RuntimeFailure + 48. builtin ability builtin.io2.STM + 49. unique type builtin.io2.STMFailure + 50. builtin ability builtin.Scope + 51. unique type builtin.io2.SeekMode + 52. structural type builtin.SeqView a b + 53. builtin type builtin.io2.Tls.ServerConfig + 54. builtin type builtin.io2.Tls.SignedCert + 55. builtin type builtin.io2.Socket + 56. unique type builtin.io2.StdHandle + 57. builtin type builtin.io2.TVar + 58. builtin type builtin.Link.Term + 59. builtin type builtin.Text + 60. builtin type builtin.io2.ThreadId + 61. builtin type builtin.io2.Ref.Ticket + 62. builtin type builtin.io2.Clock.internals.TimeSpec + 63. builtin type builtin.io2.Tls + 64. unique type builtin.io2.TlsFailure + 65. structural type builtin.Tuple a b + 66. builtin type builtin.Link.Type + 67. structural type builtin.Unit + 68. builtin type builtin.Value + 69. builtin type builtin.io2.Tls.Version + 70. builtin.io2.SeekMode.AbsoluteSeek : SeekMode + 71. builtin.io2.IOError.AlreadyExists : IOError + 72. builtin.io2.FileMode.Append : FileMode + 73. builtin.Doc.Blob : Text -> Doc - 72. builtin.io2.BufferMode.BlockBuffering : BufferMode - 73. builtin.Tuple.Cons : a + 74. builtin.io2.BufferMode.BlockBuffering : BufferMode + 75. builtin.Tuple.Cons : a -> b -> Tuple a b - 74. builtin.io2.IOError.EOF : IOError - 75. builtin.Doc.Evaluate : Term + 76. builtin.io2.IOError.EOF : IOError + 77. builtin.Doc.Evaluate : Term -> Doc - 76. builtin.Test.Result.Fail : Text + 78. builtin.Test.Result.Fail : Text -> Result - 77. builtin.io2.Failure.Failure : Type + 79. builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 78. builtin.io2.IOError.IllegalOperation : IOError - 79. builtin.IsPropagated.IsPropagated : IsPropagated - 80. builtin.IsTest.IsTest : IsTest - 81. builtin.Doc.Join : [Doc] + 80. builtin.io2.IOError.IllegalOperation : IOError + 81. builtin.IsPropagated.IsPropagated : IsPropagated + 82. builtin.IsTest.IsTest : IsTest + 83. builtin.Doc.Join : [Doc] -> Doc - 82. builtin.Either.Left : a + 84. builtin.Either.Left : a -> Either a b - 83. builtin.io2.BufferMode.LineBuffering : BufferMode - 84. builtin.Doc.Link : Link + 85. builtin.io2.BufferMode.LineBuffering : BufferMode + 86. builtin.Doc.Link : Link -> Doc - 85. builtin.io2.BufferMode.NoBuffering : BufferMode - 86. builtin.io2.IOError.NoSuchThing : IOError - 87. builtin.Optional.None : Optional + 87. builtin.io2.BufferMode.NoBuffering : BufferMode + 88. builtin.io2.IOError.NoSuchThing : IOError + 89. builtin.Optional.None : Optional a - 88. builtin.Test.Result.Ok : Text + 90. builtin.Test.Result.Ok : Text -> Result - 89. builtin.io2.IOError.PermissionDenied : IOError - 90. builtin.io2.FileMode.Read : FileMode - 91. builtin.io2.FileMode.ReadWrite : FileMode - 92. builtin.io2.SeekMode.RelativeSeek : SeekMode - 93. builtin.io2.IOError.ResourceBusy : IOError - 94. builtin.io2.IOError.ResourceExhausted : IOError - 95. builtin.Either.Right : b + 91. builtin.io2.IOError.PermissionDenied : IOError + 92. builtin.io2.FileMode.Read : FileMode + 93. builtin.io2.FileMode.ReadWrite : FileMode + 94. builtin.io2.SeekMode.RelativeSeek : SeekMode + 95. builtin.io2.IOError.ResourceBusy : IOError + 96. builtin.io2.IOError.ResourceExhausted : IOError + 97. builtin.Either.Right : b -> Either a b - 96. builtin.io2.SeekMode.SeekFromEnd : SeekMode - 97. builtin.Doc.Signature : Term + 98. builtin.io2.SeekMode.SeekFromEnd : SeekMode + 99. builtin.Doc.Signature : Term -> Doc - 98. builtin.io2.BufferMode.SizedBlockBuffering : Nat + 100. builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 99. builtin.Optional.Some : a + 101. builtin.Optional.Some : a -> Optional a - 100. builtin.Doc.Source : Link + 102. builtin.Doc.Source : Link -> Doc - 101. builtin.io2.StdHandle.StdErr : StdHandle - 102. builtin.io2.StdHandle.StdIn : StdHandle - 103. builtin.io2.StdHandle.StdOut : StdHandle - 104. builtin.Link.Term : Term + 103. builtin.io2.StdHandle.StdErr : StdHandle + 104. builtin.io2.StdHandle.StdIn : StdHandle + 105. builtin.io2.StdHandle.StdOut : StdHandle + 106. builtin.Link.Term : Term -> Link - 105. builtin.Link.Type : Type + 107. builtin.Link.Type : Type -> Link - 106. builtin.Unit.Unit : () - 107. builtin.io2.IOError.UserError : IOError - 108. builtin.SeqView.VElem : a + 108. builtin.Unit.Unit : () + 109. builtin.io2.IOError.UserError : IOError + 110. builtin.SeqView.VElem : a -> b -> SeqView a b - 109. builtin.SeqView.VEmpty : SeqView + 111. builtin.SeqView.VEmpty : SeqView a b - 110. builtin.io2.FileMode.Write : FileMode - 111. builtin.Exception.raise : Failure + 112. builtin.io2.FileMode.Write : FileMode + 113. builtin.Exception.raise : Failure ->{Exception} x - 112. builtin.Text.!= : Text + 114. builtin.Text.!= : Text -> Text -> Boolean - 113. builtin.Float.* : Float + 115. builtin.Float.* : Float -> Float -> Float - 114. builtin.Int.* : Int + 116. builtin.Int.* : Int -> Int -> Int - 115. builtin.Nat.* : Nat + 117. builtin.Nat.* : Nat -> Nat -> Nat - 116. builtin.Float.+ : Float + 118. builtin.Float.+ : Float -> Float -> Float - 117. builtin.Int.+ : Int + 119. builtin.Int.+ : Int -> Int -> Int - 118. builtin.Nat.+ : Nat + 120. builtin.Nat.+ : Nat -> Nat -> Nat - 119. builtin.Bytes.++ : Bytes + 121. builtin.Bytes.++ : Bytes -> Bytes -> Bytes - 120. builtin.List.++ : [a] + 122. builtin.List.++ : [a] -> [a] -> [a] - 121. builtin.Text.++ : Text + 123. builtin.Text.++ : Text -> Text -> Text - 122. ┌ builtin.List.+: : a + 124. ┌ builtin.List.+: : a -> [a] -> [a] - 123. └ builtin.List.cons : a + 125. └ builtin.List.cons : a -> [a] -> [a] - 124. builtin.Float.- : Float + 126. builtin.Float.- : Float -> Float -> Float - 125. builtin.Int.- : Int + 127. builtin.Int.- : Int -> Int -> Int - 126. builtin.Float./ : Float + 128. builtin.Float./ : Float -> Float -> Float - 127. builtin.Int./ : Int + 129. builtin.Int./ : Int -> Int -> Int - 128. builtin.Nat./ : Nat + 130. builtin.Nat./ : Nat -> Nat -> Nat - 129. ┌ builtin.List.:+ : [a] + 131. ┌ builtin.List.:+ : [a] -> a -> [a] - 130. └ builtin.List.snoc : [a] + 132. └ builtin.List.snoc : [a] -> a -> [a] - 131. builtin.Universal.< : a + 133. builtin.Universal.< : a -> a -> Boolean - 132. builtin.Universal.<= : a + 134. builtin.Universal.<= : a -> a -> Boolean - 133. builtin.Universal.== : a + 135. builtin.Universal.== : a -> a -> Boolean - 134. builtin.Universal.> : a + 136. builtin.Universal.> : a -> a -> Boolean - 135. builtin.Universal.>= : a + 137. builtin.Universal.>= : a -> a -> Boolean - 136. builtin.Any.Any : a + 138. builtin.Any.Any : a -> Any - 137. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm - 138. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm - 139. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 140. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm - 141. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 142. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 143. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 144. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 145. builtin.Float.abs : Float + 139. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm + 140. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm + 141. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm + 142. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm + 143. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + 144. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + 145. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + 146. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + 147. builtin.Float.abs : Float -> Float - 146. builtin.Float.acos : Float + 148. builtin.Float.acos : Float -> Float - 147. builtin.Float.acosh : Float + 149. builtin.Float.acosh : Float -> Float - 148. builtin.Int.and : Int + 150. builtin.Int.and : Int -> Int -> Int - 149. builtin.Nat.and : Nat + 151. builtin.Nat.and : Nat -> Nat -> Nat - 150. builtin.Text.patterns.anyChar : Pattern + 152. builtin.Text.patterns.anyChar : Pattern Text - 151. builtin.io2.IO.array : Nat + 153. builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 152. builtin.Scope.array : Nat + 154. builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 153. builtin.io2.IO.arrayOf : a + 155. builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 154. builtin.Scope.arrayOf : a + 156. builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 155. builtin.Float.asin : Float + 157. builtin.Float.asin : Float -> Float - 156. builtin.Float.asinh : Float + 158. builtin.Float.asinh : Float -> Float - 157. builtin.Bytes.at : Nat + 159. builtin.Bytes.at : Nat -> Bytes -> Optional Nat - 158. builtin.List.at : Nat + 160. builtin.List.at : Nat -> [a] -> Optional a - 159. builtin.Float.atan : Float + 161. builtin.Float.atan : Float -> Float - 160. builtin.Float.atan2 : Float + 162. builtin.Float.atan2 : Float -> Float -> Float - 161. builtin.Float.atanh : Float + 163. builtin.Float.atanh : Float -> Float - 162. builtin.io2.STM.atomically : '{STM} a + 164. builtin.io2.STM.atomically : '{STM} a ->{IO} a - 163. builtin.bug : a -> b - 164. builtin.io2.IO.bytearray : Nat + 165. builtin.bug : a -> b + 166. builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 165. builtin.Scope.bytearray : Nat + 167. builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 166. builtin.io2.IO.bytearrayOf : Nat + 168. builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 167. builtin.Scope.bytearrayOf : Nat + 169. builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 168. ┌ c#gjmq673r1v : Nat - 169. └ long.name.but.shortest.suffixification : Nat - 170. builtin.Code.cache_ : [( Term, + 170. ┌ c#gjmq673r1v : Nat + 171. └ long.name.but.shortest.suffixification : Nat + 172. builtin.Code.cache_ : [( Term, Code)] ->{IO} [Term] - 171. builtin.Pattern.capture : Pattern + 173. builtin.Pattern.capture : Pattern a -> Pattern a - 172. builtin.Float.ceiling : Float + 174. builtin.io2.Ref.cas : Ticket + a + -> a + -> Ref + {IO} a + ->{IO} Boolean + 175. builtin.Float.ceiling : Float -> Int - 173. builtin.Text.patterns.charIn : [Char] + 176. builtin.Text.patterns.charIn : [Char] -> Pattern Text - 174. builtin.Text.patterns.charRange : Char + 177. builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 175. builtin.unsafe.coerceAbilities : (a + 178. builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 176. builtin.Universal.compare : a + 179. builtin.Universal.compare : a -> a -> Int - 177. builtin.Int.complement : Int + 180. builtin.Int.complement : Int -> Int - 178. builtin.Nat.complement : Nat + 181. builtin.Nat.complement : Nat -> Nat - 179. builtin.Bytes.gzip.compress : Bytes + 182. builtin.Bytes.gzip.compress : Bytes -> Bytes - 180. builtin.Bytes.zlib.compress : Bytes + 183. builtin.Bytes.zlib.compress : Bytes -> Bytes - 181. builtin.ImmutableArray.copyTo! : MutableArray + 184. builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray @@ -424,7 +432,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 182. builtin.ImmutableByteArray.copyTo! : MutableByteArray + 185. builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -432,7 +440,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 183. builtin.MutableArray.copyTo! : MutableArray + 186. builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray @@ -441,7 +449,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 184. builtin.MutableByteArray.copyTo! : MutableByteArray + 187. builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray @@ -450,918 +458,938 @@ d = c + 10 -> Nat ->{g, Exception} () - 185. builtin.Float.cos : Float + 188. builtin.Float.cos : Float -> Float - 186. builtin.Float.cosh : Float + 189. builtin.Float.cosh : Float -> Float - 187. builtin.Bytes.decodeNat16be : Bytes + 190. builtin.Bytes.decodeNat16be : Bytes -> Optional ( Nat, Bytes) - 188. builtin.Bytes.decodeNat16le : Bytes + 191. builtin.Bytes.decodeNat16le : Bytes -> Optional ( Nat, Bytes) - 189. builtin.Bytes.decodeNat32be : Bytes + 192. builtin.Bytes.decodeNat32be : Bytes -> Optional ( Nat, Bytes) - 190. builtin.Bytes.decodeNat32le : Bytes + 193. builtin.Bytes.decodeNat32le : Bytes -> Optional ( Nat, Bytes) - 191. builtin.Bytes.decodeNat64be : Bytes + 194. builtin.Bytes.decodeNat64be : Bytes -> Optional ( Nat, Bytes) - 192. builtin.Bytes.decodeNat64le : Bytes + 195. builtin.Bytes.decodeNat64le : Bytes -> Optional ( Nat, Bytes) - 193. builtin.io2.Tls.decodePrivateKey : Bytes + 196. builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 194. builtin.Bytes.gzip.decompress : Bytes + 197. builtin.Bytes.gzip.decompress : Bytes -> Either Text Bytes - 195. builtin.Bytes.zlib.decompress : Bytes + 198. builtin.Bytes.zlib.decompress : Bytes -> Either Text Bytes - 196. builtin.io2.Tls.ClientConfig.default : Text + 199. builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 197. builtin.io2.Tls.ServerConfig.default : [SignedCert] + 200. builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 198. builtin.Code.dependencies : Code + 201. builtin.Code.dependencies : Code -> [Term] - 199. builtin.Value.dependencies : Value + 202. builtin.Value.dependencies : Value -> [Term] - 200. builtin.Code.deserialize : Bytes + 203. builtin.Code.deserialize : Bytes -> Either Text Code - 201. builtin.Value.deserialize : Bytes + 204. builtin.Value.deserialize : Bytes -> Either Text Value - 202. builtin.Text.patterns.digit : Pattern + 205. builtin.Text.patterns.digit : Pattern Text - 203. builtin.Code.display : Text + 206. builtin.Code.display : Text -> Code -> Text - 204. builtin.Bytes.drop : Nat + 207. builtin.Bytes.drop : Nat -> Bytes -> Bytes - 205. builtin.List.drop : Nat + 208. builtin.List.drop : Nat -> [a] -> [a] - 206. builtin.Nat.drop : Nat + 209. builtin.Nat.drop : Nat -> Nat -> Nat - 207. builtin.Text.drop : Nat + 210. builtin.Text.drop : Nat -> Text -> Text - 208. builtin.Bytes.empty : Bytes - 209. builtin.List.empty : [a] - 210. builtin.Text.empty : Text - 211. builtin.io2.Tls.encodeCert : SignedCert + 211. builtin.Bytes.empty : Bytes + 212. builtin.List.empty : [a] + 213. builtin.Text.empty : Text + 214. builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 212. builtin.Bytes.encodeNat16be : Nat + 215. builtin.Bytes.encodeNat16be : Nat -> Bytes - 213. builtin.Bytes.encodeNat16le : Nat + 216. builtin.Bytes.encodeNat16le : Nat -> Bytes - 214. builtin.Bytes.encodeNat32be : Nat + 217. builtin.Bytes.encodeNat32be : Nat -> Bytes - 215. builtin.Bytes.encodeNat32le : Nat + 218. builtin.Bytes.encodeNat32le : Nat -> Bytes - 216. builtin.Bytes.encodeNat64be : Nat + 219. builtin.Bytes.encodeNat64be : Nat -> Bytes - 217. builtin.Bytes.encodeNat64le : Nat + 220. builtin.Bytes.encodeNat64le : Nat -> Bytes - 218. builtin.io2.Tls.encodePrivateKey : PrivateKey + 221. builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 219. builtin.Text.patterns.eof : Pattern + 222. builtin.Text.patterns.eof : Pattern Text - 220. builtin.Float.eq : Float + 223. builtin.Float.eq : Float -> Float -> Boolean - 221. builtin.Int.eq : Int + 224. builtin.Int.eq : Int -> Int -> Boolean - 222. builtin.Nat.eq : Nat + 225. builtin.Nat.eq : Nat -> Nat -> Boolean - 223. builtin.Text.eq : Text + 226. builtin.Text.eq : Text -> Text -> Boolean - 224. builtin.Float.exp : Float + 227. builtin.Float.exp : Float -> Float - 225. builtin.Bytes.flatten : Bytes + 228. builtin.Bytes.flatten : Bytes -> Bytes - 226. builtin.Float.floor : Float + 229. builtin.Float.floor : Float -> Int - 227. builtin.io2.IO.forkComp : '{IO} a + 230. builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 228. builtin.MutableArray.freeze : MutableArray + 231. builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 229. builtin.MutableByteArray.freeze : MutableByteArray + 232. builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 230. builtin.MutableArray.freeze! : MutableArray + 233. builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 231. builtin.MutableByteArray.freeze! : MutableByteArray + 234. builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 232. builtin.Bytes.fromBase16 : Bytes + 235. builtin.Bytes.fromBase16 : Bytes -> Either Text Bytes - 233. builtin.Bytes.fromBase32 : Bytes + 236. builtin.Bytes.fromBase32 : Bytes -> Either Text Bytes - 234. builtin.Bytes.fromBase64 : Bytes + 237. builtin.Bytes.fromBase64 : Bytes -> Either Text Bytes - 235. builtin.Bytes.fromBase64UrlUnpadded : Bytes + 238. builtin.Bytes.fromBase64UrlUnpadded : Bytes -> Either Text Bytes - 236. builtin.Text.fromCharList : [Char] + 239. builtin.Text.fromCharList : [Char] -> Text - 237. builtin.Bytes.fromList : [Nat] + 240. builtin.Bytes.fromList : [Nat] -> Bytes - 238. builtin.Char.fromNat : Nat + 241. builtin.Char.fromNat : Nat -> Char - 239. builtin.Float.fromRepresentation : Nat + 242. builtin.Float.fromRepresentation : Nat -> Float - 240. builtin.Int.fromRepresentation : Nat + 243. builtin.Int.fromRepresentation : Nat -> Int - 241. builtin.Float.fromText : Text + 244. builtin.Float.fromText : Text -> Optional Float - 242. builtin.Int.fromText : Text + 245. builtin.Int.fromText : Text -> Optional Int - 243. builtin.Nat.fromText : Text + 246. builtin.Nat.fromText : Text -> Optional Nat - 244. builtin.Float.gt : Float + 247. builtin.Float.gt : Float -> Float -> Boolean - 245. builtin.Int.gt : Int + 248. builtin.Int.gt : Int -> Int -> Boolean - 246. builtin.Nat.gt : Nat + 249. builtin.Nat.gt : Nat -> Nat -> Boolean - 247. builtin.Text.gt : Text + 250. builtin.Text.gt : Text -> Text -> Boolean - 248. builtin.Float.gteq : Float + 251. builtin.Float.gteq : Float -> Float -> Boolean - 249. builtin.Int.gteq : Int + 252. builtin.Int.gteq : Int -> Int -> Boolean - 250. builtin.Nat.gteq : Nat + 253. builtin.Nat.gteq : Nat -> Nat -> Boolean - 251. builtin.Text.gteq : Text + 254. builtin.Text.gteq : Text -> Text -> Boolean - 252. builtin.crypto.hash : HashAlgorithm + 255. builtin.crypto.hash : HashAlgorithm -> a -> Bytes - 253. builtin.crypto.hashBytes : HashAlgorithm + 256. builtin.crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 254. builtin.crypto.hmac : HashAlgorithm + 257. builtin.crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 255. builtin.crypto.hmacBytes : HashAlgorithm + 258. builtin.crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 256. builtin.io2.IO.clientSocket.impl : Text + 259. builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 257. builtin.io2.IO.closeFile.impl : Handle + 260. builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 258. builtin.io2.IO.closeSocket.impl : Socket + 261. builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 259. builtin.io2.IO.createDirectory.impl : Text + 262. builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 260. builtin.io2.IO.createTempDirectory.impl : Text + 263. builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 261. builtin.io2.Tls.decodeCert.impl : Bytes + 264. builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 262. builtin.io2.IO.delay.impl : Nat + 265. builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 263. builtin.io2.IO.directoryContents.impl : Text + 266. builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 264. builtin.io2.IO.fileExists.impl : Text + 267. builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 265. builtin.Text.fromUtf8.impl : Bytes + 268. builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 266. builtin.io2.IO.getArgs.impl : '{IO} Either + 269. builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 267. builtin.io2.IO.getBuffering.impl : Handle + 270. builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 268. builtin.io2.IO.getBytes.impl : Handle + 271. builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 269. builtin.io2.IO.getChar.impl : Handle + 272. builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 270. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either + 273. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 271. builtin.io2.IO.getEcho.impl : Handle + 274. builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 272. builtin.io2.IO.getEnv.impl : Text + 275. builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 273. builtin.io2.IO.getFileSize.impl : Text + 276. builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 274. builtin.io2.IO.getFileTimestamp.impl : Text + 277. builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 275. builtin.io2.IO.getLine.impl : Handle + 278. builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 276. builtin.io2.IO.getSomeBytes.impl : Handle + 279. builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 277. builtin.io2.IO.getTempDirectory.impl : '{IO} Either + 280. builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 278. builtin.io2.IO.handlePosition.impl : Handle + 281. builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 279. builtin.io2.Tls.handshake.impl : Tls + 282. builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 280. builtin.io2.IO.isDirectory.impl : Text + 283. builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 281. builtin.io2.IO.isFileEOF.impl : Handle + 284. builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 282. builtin.io2.IO.isFileOpen.impl : Handle + 285. builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 283. builtin.io2.IO.isSeekable.impl : Handle + 286. builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 284. builtin.io2.IO.kill.impl : ThreadId + 287. builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 285. builtin.io2.IO.listen.impl : Socket + 288. builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 286. builtin.io2.Tls.newClient.impl : ClientConfig + 289. builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 287. builtin.io2.Tls.newServer.impl : ServerConfig + 290. builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 288. builtin.io2.IO.openFile.impl : Text + 291. builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 289. builtin.io2.MVar.put.impl : MVar a + 292. builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 290. builtin.io2.IO.putBytes.impl : Handle + 293. builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 291. builtin.io2.MVar.read.impl : MVar a + 294. builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 292. builtin.io2.IO.ready.impl : Handle + 295. builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 293. builtin.io2.Tls.receive.impl : Tls + 296. builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 294. builtin.io2.IO.removeDirectory.impl : Text + 297. builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 295. builtin.io2.IO.removeFile.impl : Text + 298. builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 296. builtin.io2.IO.renameDirectory.impl : Text + 299. builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 297. builtin.io2.IO.renameFile.impl : Text + 300. builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 298. builtin.io2.IO.seekHandle.impl : Handle + 301. builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 299. builtin.io2.Tls.send.impl : Tls + 302. builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 300. builtin.io2.IO.serverSocket.impl : Optional + 303. builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 301. builtin.io2.IO.setBuffering.impl : Handle + 304. builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 302. builtin.io2.IO.setCurrentDirectory.impl : Text + 305. builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 303. builtin.io2.IO.setEcho.impl : Handle + 306. builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 304. builtin.io2.IO.socketAccept.impl : Socket + 307. builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 305. builtin.io2.IO.socketPort.impl : Socket + 308. builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 306. builtin.io2.IO.socketReceive.impl : Socket + 309. builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 307. builtin.io2.IO.socketSend.impl : Socket + 310. builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 308. builtin.io2.MVar.swap.impl : MVar a + 311. builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 309. builtin.io2.IO.systemTime.impl : '{IO} Either + 312. builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 310. builtin.io2.MVar.take.impl : MVar a + 313. builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 311. builtin.io2.Tls.terminate.impl : Tls + 314. builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 312. builtin.io2.MVar.tryPut.impl : MVar a + 315. builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 313. builtin.io2.MVar.tryRead.impl : MVar a + 316. builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 314. builtin.Int.increment : Int + 317. builtin.Int.increment : Int -> Int - 315. builtin.Nat.increment : Nat + 318. builtin.Nat.increment : Nat -> Nat - 316. builtin.io2.MVar.isEmpty : MVar a + 319. builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 317. builtin.Int.isEven : Int + 320. builtin.Int.isEven : Int -> Boolean - 318. builtin.Nat.isEven : Nat + 321. builtin.Nat.isEven : Nat -> Boolean - 319. builtin.Pattern.isMatch : Pattern + 322. builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 320. builtin.Code.isMissing : Term + 323. builtin.Code.isMissing : Term ->{IO} Boolean - 321. builtin.Int.isOdd : Int + 324. builtin.Int.isOdd : Int -> Boolean - 322. builtin.Nat.isOdd : Nat + 325. builtin.Nat.isOdd : Nat -> Boolean - 323. builtin.metadata.isPropagated : IsPropagated - 324. builtin.metadata.isTest : IsTest - 325. builtin.Pattern.join : [Pattern + 326. builtin.metadata.isPropagated : IsPropagated + 327. builtin.metadata.isTest : IsTest + 328. builtin.Pattern.join : [Pattern a] -> Pattern a - 326. builtin.Int.leadingZeros : Int + 329. builtin.Int.leadingZeros : Int -> Nat - 327. builtin.Nat.leadingZeros : Nat + 330. builtin.Nat.leadingZeros : Nat -> Nat - 328. builtin.Text.patterns.letter : Pattern + 331. builtin.Text.patterns.letter : Pattern Text - 329. builtin.Text.patterns.literal : Text + 332. builtin.Text.patterns.literal : Text -> Pattern Text - 330. builtin.Value.load : Value + 333. builtin.Value.load : Value ->{IO} Either [Term] a - 331. builtin.Float.log : Float + 334. builtin.Float.log : Float -> Float - 332. builtin.Float.logBase : Float + 335. builtin.Float.logBase : Float -> Float -> Float - 333. builtin.Code.lookup : Term + 336. builtin.Code.lookup : Term ->{IO} Optional Code - 334. builtin.Float.lt : Float + 337. builtin.Float.lt : Float -> Float -> Boolean - 335. builtin.Int.lt : Int + 338. builtin.Int.lt : Int -> Int -> Boolean - 336. builtin.Nat.lt : Nat + 339. builtin.Nat.lt : Nat -> Nat -> Boolean - 337. builtin.Text.lt : Text + 340. builtin.Text.lt : Text -> Text -> Boolean - 338. builtin.Float.lteq : Float + 341. builtin.Float.lteq : Float -> Float -> Boolean - 339. builtin.Int.lteq : Int + 342. builtin.Int.lteq : Int -> Int -> Boolean - 340. builtin.Nat.lteq : Nat + 343. builtin.Nat.lteq : Nat -> Nat -> Boolean - 341. builtin.Text.lteq : Text + 344. builtin.Text.lteq : Text -> Text -> Boolean - 342. builtin.Pattern.many : Pattern + 345. builtin.Pattern.many : Pattern a -> Pattern a - 343. builtin.Float.max : Float + 346. builtin.Float.max : Float -> Float -> Float - 344. builtin.Float.min : Float + 347. builtin.Float.min : Float -> Float -> Float - 345. builtin.Int.mod : Int + 348. builtin.Int.mod : Int -> Int -> Int - 346. builtin.Nat.mod : Nat + 349. builtin.Nat.mod : Nat -> Nat -> Nat - 347. builtin.io2.Clock.internals.monotonic : '{IO} Either + 350. builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 348. builtin.Int.negate : Int + 351. builtin.Int.negate : Int -> Int - 349. builtin.io2.MVar.new : a + 352. builtin.io2.MVar.new : a ->{IO} MVar a - 350. builtin.io2.TVar.new : a + 353. builtin.io2.Promise.new : '{IO} Promise + a + 354. builtin.io2.TVar.new : a ->{STM} TVar a - 351. builtin.io2.MVar.newEmpty : '{IO} MVar + 355. builtin.io2.MVar.newEmpty : '{IO} MVar a - 352. builtin.io2.TVar.newIO : a + 356. builtin.io2.TVar.newIO : a ->{IO} TVar a - 353. builtin.Boolean.not : Boolean + 357. builtin.Boolean.not : Boolean -> Boolean - 354. builtin.Text.patterns.notCharIn : [Char] + 358. builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 355. builtin.Text.patterns.notCharRange : Char + 359. builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 356. builtin.io2.Clock.internals.nsec : TimeSpec + 360. builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 357. builtin.Int.or : Int + 361. builtin.Int.or : Int -> Int -> Int - 358. builtin.Nat.or : Nat + 362. builtin.Nat.or : Nat -> Nat -> Nat - 359. builtin.Pattern.or : Pattern + 363. builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 360. builtin.Int.popCount : Int + 364. builtin.Int.popCount : Int -> Nat - 361. builtin.Nat.popCount : Nat + 365. builtin.Nat.popCount : Nat -> Nat - 362. builtin.Float.pow : Float + 366. builtin.Float.pow : Float -> Float -> Float - 363. builtin.Int.pow : Int + 367. builtin.Int.pow : Int -> Nat -> Int - 364. builtin.Nat.pow : Nat + 368. builtin.Nat.pow : Nat -> Nat -> Nat - 365. builtin.io2.Clock.internals.processCPUTime : '{IO} Either + 369. builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 366. builtin.Text.patterns.punctuation : Pattern + 370. builtin.Text.patterns.punctuation : Pattern Text - 367. builtin.ImmutableArray.read : ImmutableArray + 371. builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 368. builtin.MutableArray.read : MutableArray + 372. builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 369. builtin.Ref.read : Ref g a - ->{g} a - 370. builtin.io2.TVar.read : TVar a - ->{STM} a - 371. builtin.ImmutableByteArray.read16be : ImmutableByteArray - -> Nat - ->{Exception} Nat - 372. builtin.MutableByteArray.read16be : MutableByteArray - g - -> Nat - ->{g, - Exception} Nat - 373. builtin.ImmutableByteArray.read24be : ImmutableByteArray - -> Nat - ->{Exception} Nat - 374. builtin.MutableByteArray.read24be : MutableByteArray - g - -> Nat - ->{g, - Exception} Nat - 375. builtin.ImmutableByteArray.read32be : ImmutableByteArray - -> Nat - ->{Exception} Nat - 376. builtin.MutableByteArray.read32be : MutableByteArray - g - -> Nat - ->{g, - Exception} Nat - 377. builtin.ImmutableByteArray.read40be : ImmutableByteArray - -> Nat - ->{Exception} Nat - 378. builtin.MutableByteArray.read40be : MutableByteArray - g - -> Nat - ->{g, - Exception} Nat - 379. builtin.ImmutableByteArray.read64be : ImmutableByteArray - -> Nat - ->{Exception} Nat - 380. builtin.MutableByteArray.read64be : MutableByteArray - g - -> Nat - ->{g, - Exception} Nat - 381. builtin.ImmutableByteArray.read8 : ImmutableByteArray - -> Nat - ->{Exception} Nat - 382. builtin.MutableByteArray.read8 : MutableByteArray - g - -> Nat - ->{g, - Exception} Nat - 383. builtin.io2.TVar.readIO : TVar a + 373. builtin.io2.Promise.read : Promise + a ->{IO} a - 384. builtin.io2.Clock.internals.realtime : '{IO} Either + 374. builtin.Ref.read : Ref g a + ->{g} a + 375. builtin.io2.TVar.read : TVar a + ->{STM} a + 376. builtin.io2.Ref.Ticket.read : Ticket + a + -> a + 377. builtin.ImmutableByteArray.read16be : ImmutableByteArray + -> Nat + ->{Exception} Nat + 378. builtin.MutableByteArray.read16be : MutableByteArray + g + -> Nat + ->{g, + Exception} Nat + 379. builtin.ImmutableByteArray.read24be : ImmutableByteArray + -> Nat + ->{Exception} Nat + 380. builtin.MutableByteArray.read24be : MutableByteArray + g + -> Nat + ->{g, + Exception} Nat + 381. builtin.ImmutableByteArray.read32be : ImmutableByteArray + -> Nat + ->{Exception} Nat + 382. builtin.MutableByteArray.read32be : MutableByteArray + g + -> Nat + ->{g, + Exception} Nat + 383. builtin.ImmutableByteArray.read40be : ImmutableByteArray + -> Nat + ->{Exception} Nat + 384. builtin.MutableByteArray.read40be : MutableByteArray + g + -> Nat + ->{g, + Exception} Nat + 385. builtin.ImmutableByteArray.read64be : ImmutableByteArray + -> Nat + ->{Exception} Nat + 386. builtin.MutableByteArray.read64be : MutableByteArray + g + -> Nat + ->{g, + Exception} Nat + 387. builtin.ImmutableByteArray.read8 : ImmutableByteArray + -> Nat + ->{Exception} Nat + 388. builtin.MutableByteArray.read8 : MutableByteArray + g + -> Nat + ->{g, + Exception} Nat + 389. builtin.io2.TVar.readIO : TVar a + ->{IO} a + 390. builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 385. builtin.io2.IO.ref : a + 391. builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 386. builtin.Scope.ref : a + 392. builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 387. builtin.Text.repeat : Nat + 393. builtin.Text.repeat : Nat -> Text -> Text - 388. builtin.Pattern.replicate : Nat + 394. builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 389. builtin.io2.STM.retry : '{STM} a - 390. builtin.Text.reverse : Text + 395. builtin.io2.STM.retry : '{STM} a + 396. builtin.Text.reverse : Text -> Text - 391. builtin.Float.round : Float + 397. builtin.Float.round : Float -> Int - 392. builtin.Pattern.run : Pattern + 398. builtin.Pattern.run : Pattern a -> a -> Optional ( [a], a) - 393. builtin.Scope.run : (∀ s. + 399. builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 394. builtin.io2.Clock.internals.sec : TimeSpec + 400. builtin.io2.Clock.internals.sec : TimeSpec -> Int - 395. builtin.Code.serialize : Code + 401. builtin.Code.serialize : Code -> Bytes - 396. builtin.Value.serialize : Value + 402. builtin.Value.serialize : Value -> Bytes - 397. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + 403. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 398. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + 404. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 399. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + 405. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 400. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + 406. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 401. builtin.io2.Tls.ClientConfig.versions.set : [Version] + 407. builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 402. builtin.io2.Tls.ServerConfig.versions.set : [Version] + 408. builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 403. builtin.Int.shiftLeft : Int + 409. builtin.Int.shiftLeft : Int -> Nat -> Int - 404. builtin.Nat.shiftLeft : Nat + 410. builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 405. builtin.Int.shiftRight : Int + 411. builtin.Int.shiftRight : Int -> Nat -> Int - 406. builtin.Nat.shiftRight : Nat + 412. builtin.Nat.shiftRight : Nat -> Nat -> Nat - 407. builtin.Int.signum : Int + 413. builtin.Int.signum : Int -> Int - 408. builtin.Float.sin : Float + 414. builtin.Float.sin : Float -> Float - 409. builtin.Float.sinh : Float + 415. builtin.Float.sinh : Float -> Float - 410. builtin.Bytes.size : Bytes + 416. builtin.Bytes.size : Bytes -> Nat - 411. builtin.ImmutableArray.size : ImmutableArray + 417. builtin.ImmutableArray.size : ImmutableArray a -> Nat - 412. builtin.ImmutableByteArray.size : ImmutableByteArray + 418. builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 413. builtin.List.size : [a] + 419. builtin.List.size : [a] -> Nat - 414. builtin.MutableArray.size : MutableArray + 420. builtin.MutableArray.size : MutableArray g a -> Nat - 415. builtin.MutableByteArray.size : MutableByteArray + 421. builtin.MutableByteArray.size : MutableByteArray g -> Nat - 416. builtin.Text.size : Text + 422. builtin.Text.size : Text -> Nat - 417. builtin.Text.patterns.space : Pattern + 423. builtin.Text.patterns.space : Pattern Text - 418. builtin.Float.sqrt : Float + 424. builtin.Float.sqrt : Float -> Float - 419. builtin.io2.IO.stdHandle : StdHandle + 425. builtin.io2.IO.stdHandle : StdHandle -> Handle - 420. builtin.Nat.sub : Nat + 426. builtin.Nat.sub : Nat -> Nat -> Int - 421. builtin.io2.TVar.swap : TVar a + 427. builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 422. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 423. builtin.Bytes.take : Nat + 428. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + 429. builtin.Bytes.take : Nat -> Bytes -> Bytes - 424. builtin.List.take : Nat + 430. builtin.List.take : Nat -> [a] -> [a] - 425. builtin.Text.take : Nat + 431. builtin.Text.take : Nat -> Text -> Text - 426. builtin.Float.tan : Float + 432. builtin.Float.tan : Float -> Float - 427. builtin.Float.tanh : Float + 433. builtin.Float.tanh : Float -> Float - 428. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + 434. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 429. builtin.Bytes.toBase16 : Bytes + 435. builtin.io2.Ref.ticket : Ref + {IO} a + ->{IO} Ticket + a + 436. builtin.Bytes.toBase16 : Bytes -> Bytes - 430. builtin.Bytes.toBase32 : Bytes + 437. builtin.Bytes.toBase32 : Bytes -> Bytes - 431. builtin.Bytes.toBase64 : Bytes + 438. builtin.Bytes.toBase64 : Bytes -> Bytes - 432. builtin.Bytes.toBase64UrlUnpadded : Bytes + 439. builtin.Bytes.toBase64UrlUnpadded : Bytes -> Bytes - 433. builtin.Text.toCharList : Text + 440. builtin.Text.toCharList : Text -> [Char] - 434. builtin.Int.toFloat : Int + 441. builtin.Int.toFloat : Int -> Float - 435. builtin.Nat.toFloat : Nat + 442. builtin.Nat.toFloat : Nat -> Float - 436. builtin.Nat.toInt : Nat + 443. builtin.Nat.toInt : Nat -> Int - 437. builtin.Bytes.toList : Bytes + 444. builtin.Bytes.toList : Bytes -> [Nat] - 438. builtin.Text.toLowercase : Text + 445. builtin.Text.toLowercase : Text -> Text - 439. builtin.Char.toNat : Char + 446. builtin.Char.toNat : Char -> Nat - 440. builtin.Float.toRepresentation : Float + 447. builtin.Float.toRepresentation : Float -> Nat - 441. builtin.Int.toRepresentation : Int + 448. builtin.Int.toRepresentation : Int -> Nat - 442. builtin.Char.toText : Char + 449. builtin.Char.toText : Char -> Text - 443. builtin.Float.toText : Float + 450. builtin.Float.toText : Float -> Text - 444. builtin.Handle.toText : Handle + 451. builtin.Handle.toText : Handle -> Text - 445. builtin.Int.toText : Int + 452. builtin.Int.toText : Int -> Text - 446. builtin.Nat.toText : Nat + 453. builtin.Nat.toText : Nat -> Text - 447. builtin.Socket.toText : Socket + 454. builtin.Socket.toText : Socket -> Text - 448. builtin.Link.Term.toText : Term + 455. builtin.Link.Term.toText : Term -> Text - 449. builtin.ThreadId.toText : ThreadId + 456. builtin.ThreadId.toText : ThreadId -> Text - 450. builtin.Text.toUppercase : Text + 457. builtin.Text.toUppercase : Text -> Text - 451. builtin.Text.toUtf8 : Text + 458. builtin.Text.toUtf8 : Text -> Bytes - 452. builtin.todo : a -> b - 453. builtin.Debug.trace : Text + 459. builtin.todo : a -> b + 460. builtin.Debug.trace : Text -> a -> () - 454. builtin.Int.trailingZeros : Int + 461. builtin.Int.trailingZeros : Int -> Nat - 455. builtin.Nat.trailingZeros : Nat + 462. builtin.Nat.trailingZeros : Nat -> Nat - 456. builtin.Float.truncate : Float + 463. builtin.Float.truncate : Float -> Int - 457. builtin.Int.truncate0 : Int + 464. builtin.Int.truncate0 : Int -> Nat - 458. builtin.io2.IO.tryEval : '{IO} a + 465. builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 459. builtin.io2.MVar.tryTake : MVar a + 466. builtin.io2.Promise.tryRead : Promise + a ->{IO} Optional a - 460. builtin.Text.uncons : Text + 467. builtin.io2.MVar.tryTake : MVar a + ->{IO} Optional + a + 468. builtin.Text.uncons : Text -> Optional ( Char, Text) - 461. builtin.Any.unsafeExtract : Any + 469. builtin.Any.unsafeExtract : Any -> a - 462. builtin.Text.unsnoc : Text + 470. builtin.Text.unsnoc : Text -> Optional ( Text, Char) - 463. builtin.Code.validate : [( Term, + 471. builtin.Code.validate : [( Term, Code)] ->{IO} Optional Failure - 464. builtin.io2.validateSandboxed : [Term] + 472. builtin.io2.validateSandboxed : [Term] -> a -> Boolean - 465. builtin.Value.value : a + 473. builtin.Value.value : a -> Value - 466. builtin.Debug.watch : Text + 474. builtin.Debug.watch : Text -> a -> a - 467. builtin.MutableArray.write : MutableArray + 475. builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 468. builtin.Ref.write : Ref g a + 476. builtin.io2.Promise.write : a + -> Promise + a + ->{IO} Boolean + 477. builtin.Ref.write : Ref g a -> a ->{g} () - 469. builtin.io2.TVar.write : TVar a + 478. builtin.io2.TVar.write : TVar a -> a ->{STM} () - 470. builtin.MutableByteArray.write16be : MutableByteArray + 479. builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 471. builtin.MutableByteArray.write32be : MutableByteArray + 480. builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 472. builtin.MutableByteArray.write64be : MutableByteArray + 481. builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 473. builtin.MutableByteArray.write8 : MutableByteArray + 482. builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 474. builtin.Int.xor : Int + 483. builtin.Int.xor : Int -> Int -> Int - 475. builtin.Nat.xor : Nat + 484. builtin.Nat.xor : Nat -> Nat -> Nat diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index 472829e82..ffaad8c2b 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #k4l5pp6m04 .old` to make an old namespace + `fork #7j88dp8j0a .old` to make an old namespace accessible again, - `reset-root #k4l5pp6m04` to reset the root namespace and + `reset-root #7j88dp8j0a` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #90f8seam5j add - 2. now #k4l5pp6m04 add - 3. now #v4vfn849gt builtins.merge + 1. now #2r02hj75nc add + 2. now #7j88dp8j0a add + 3. now #k3307b2im4 builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index cf59f51fa..bbb4fdc35 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #jgei2u1mk0 (start of history) + □ 1. #vvo2p0q673 (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #qf2na62l7i + ⊙ 1. #b93jorec7g > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #b3docj1m3t + ⊙ 2. #e3pk5gglvo > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #jgei2u1mk0 (start of history) + □ 3. #vvo2p0q673 (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #qf2na62l7i + ⊙ 1. #b93jorec7g > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #b3docj1m3t + ⊙ 2. #e3pk5gglvo > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #jgei2u1mk0 (start of history) + □ 3. #vvo2p0q673 (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #jgei2u1mk0 (start of history) + □ 1. #vvo2p0q673 (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #vinfl9l054 + ⊙ 1. #15nbftacqb - Deletes: Nat.* Nat.+ - □ 2. #jgei2u1mk0 (start of history) + □ 2. #vvo2p0q673 (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From 77ecc43e392c57ea5bfe04a67129a599a52e25f0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 19 Jan 2023 02:54:48 +0000 Subject: [PATCH 091/467] Centralise concurrency primitives in a single module --- .../src/Unison/Runtime/Builtin.hs | 22 ++++++++---- .../src/Unison/Runtime/Foreign/Function.hs | 2 +- parser-typechecker/src/Unison/Util/Promise.hs | 24 ------------- .../src/Unison/Util/RefPromise.hs | 36 +++++++++++++++++++ .../unison-parser-typechecker.cabal | 2 +- 5 files changed, 53 insertions(+), 33 deletions(-) delete mode 100644 parser-typechecker/src/Unison/Util/Promise.hs create mode 100644 parser-typechecker/src/Unison/Util/RefPromise.hs diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 8d2a7b652..124f80a72 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -38,7 +38,6 @@ import Control.Monad.Reader (ReaderT (..), ask, runReaderT) import Control.Monad.State.Strict (State, execState, modify) import qualified Crypto.Hash as Hash import qualified Crypto.MAC.HMAC as HMAC -import Data.Atomics (Ticket, peekTicket, readForCAS, casIORef) import Data.Bits (shiftL, shiftR, (.|.)) import qualified Data.ByteArray as BA import Data.ByteString (hGet, hGetSome, hPut) @@ -150,8 +149,17 @@ import Unison.Util.EnumContainers as EC import Unison.Util.Text (Text) import qualified Unison.Util.Text as Util.Text import qualified Unison.Util.Text.Pattern as TPat -import Unison.Util.Promise (Promise) -import qualified Unison.Util.Promise as Promise +import Unison.Util.RefPromise + ( Promise, + Ticket, + peekTicket, + readForCAS, + casIORef, + newPromise, + readPromise, + tryReadPromise, + writePromise + ) import Unison.Var type Failure = F.Failure Closure @@ -2398,17 +2406,17 @@ declareForeigns = do \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> fmap fst $ casIORef r t v declareForeign Tracked "Promise.new" unitDirect . mkForeign $ - \() -> Promise.new @Closure + \() -> newPromise @Closure -- the only exceptions from Promise.read are async and shouldn't be caught declareForeign Tracked "Promise.read" boxDirect . mkForeign $ - \(p :: Promise Closure) -> Promise.read p + \(p :: Promise Closure) -> readPromise p declareForeign Tracked "Promise.tryRead" boxToMaybeBox . mkForeign $ - \(p :: Promise Closure) -> Promise.tryRead p + \(p :: Promise Closure) -> tryReadPromise p declareForeign Tracked "Promise.write" boxBoxToBool . mkForeign $ - \(a :: Closure, p :: Promise Closure) -> Promise.write a p + \(a :: Closure, p :: Promise Closure) -> writePromise a p declareForeign Tracked "Tls.newClient.impl.v3" boxBoxToEFBox . mkForeignTls $ \( config :: TLS.ClientParams, diff --git a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs index d56981374..42b1333d1 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs @@ -49,7 +49,7 @@ import Unison.Type ) import Unison.Util.Bytes (Bytes) import Unison.Util.Text (Text, pack, unpack) -import Unison.Util.Promise (Promise) +import Unison.Util.RefPromise (Promise) -- Foreign functions operating on stacks data ForeignFunc where diff --git a/parser-typechecker/src/Unison/Util/Promise.hs b/parser-typechecker/src/Unison/Util/Promise.hs deleted file mode 100644 index 5e7eb7dee..000000000 --- a/parser-typechecker/src/Unison/Util/Promise.hs +++ /dev/null @@ -1,24 +0,0 @@ -module Unison.Util.Promise where - -import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, tryReadMVar, tryPutMVar) - -newtype Promise a = Promise { state :: MVar a} - --- create an empty promise -new :: IO (Promise a) -new = fmap Promise newEmptyMVar - --- readsthe value of the promise --- return immediately if the promise if full, block if empty -read :: Promise a -> IO a -read Promise { state } = readMVar state - --- try to read the value of the promise --- immediately return Nothing if the promise is empty -tryRead :: Promise a -> IO (Maybe a) -tryRead Promise { state } = tryReadMVar state - --- if the promise is empty, write the value, awake all readers and return True --- if full, ignore the write and return False -write :: a -> Promise a -> IO Bool -write value Promise { state } = tryPutMVar state value diff --git a/parser-typechecker/src/Unison/Util/RefPromise.hs b/parser-typechecker/src/Unison/Util/RefPromise.hs new file mode 100644 index 000000000..448148f31 --- /dev/null +++ b/parser-typechecker/src/Unison/Util/RefPromise.hs @@ -0,0 +1,36 @@ +module Unison.Util.RefPromise + ( Ticket, + peekTicket, + readForCAS, + casIORef, + Promise, + newPromise, + readPromise, + tryReadPromise, + writePromise + ) +where + +import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, tryReadMVar, tryPutMVar) +import Data.Atomics (Ticket, peekTicket, readForCAS, casIORef) + +newtype Promise a = Promise { state :: MVar a} + +-- create an empty promise +newPromise :: IO (Promise a) +newPromise = fmap Promise newEmptyMVar + +-- read the value of the promise +-- return immediately if the promise if full, block if empty +readPromise :: Promise a -> IO a +readPromise Promise { state } = readMVar state + +-- try to read the value of the promise +-- immediately return Nothing if the promise is empty +tryReadPromise :: Promise a -> IO (Maybe a) +tryReadPromise Promise { state } = tryReadMVar state + +-- if the promise is empty, write the value, awake all readers and return True +-- if full, ignore the write and return False +writePromise :: a -> Promise a -> IO Bool +writePromise value Promise { state } = tryPutMVar state value diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 1debfc53d..767837c13 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -152,7 +152,7 @@ library Unison.Util.Logger Unison.Util.PinBoard Unison.Util.Pretty.MegaParsec - Unison.Util.Promise + Unison.Util.RefPromise Unison.Util.Star3 Unison.Util.Text Unison.Util.Text.Pattern From 38e79afbe269cb87c75d7cb2718fed66c1894baa Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 19 Jan 2023 13:14:52 +0000 Subject: [PATCH 092/467] casIORef works in haskell, bus error is in the unison bindings --- parser-typechecker/src/Unison/Util/RefPromise.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Util/RefPromise.hs b/parser-typechecker/src/Unison/Util/RefPromise.hs index 448148f31..8615a8c0b 100644 --- a/parser-typechecker/src/Unison/Util/RefPromise.hs +++ b/parser-typechecker/src/Unison/Util/RefPromise.hs @@ -7,12 +7,14 @@ module Unison.Util.RefPromise newPromise, readPromise, tryReadPromise, - writePromise + writePromise, + foo -- TODO remove ) where import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, tryReadMVar, tryPutMVar) import Data.Atomics (Ticket, peekTicket, readForCAS, casIORef) +import Data.IORef -- TODO remove newtype Promise a = Promise { state :: MVar a} @@ -34,3 +36,13 @@ tryReadPromise Promise { state } = tryReadMVar state -- if full, ignore the write and return False writePromise :: a -> Promise a -> IO Bool writePromise value Promise { state } = tryPutMVar state value + +-- TODO remove +foo :: IO (Bool, Bool) +foo = do + state <- newIORef (0 :: Integer) + ticket <- readForCAS state + success <- fmap fst $ casIORef state ticket 5 + writeIORef state 10 + failure <- fmap fst $ casIORef state ticket 5 + pure (success, failure) From c643ace1b5e4916af8f88d42e075eb45233f820a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 19 Jan 2023 15:51:54 +0000 Subject: [PATCH 093/467] Ref should be the first argument --- parser-typechecker/src/Unison/Builtin.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index 75f9789c9..78decce4e 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -856,8 +856,8 @@ stmBuiltins = refPromiseBuiltins :: [(Text, Type)] refPromiseBuiltins = [ ("Ref.Ticket.read", forall1 "a" $ \a -> ticket a --> a), - ("Ref.ticket", forall1 "a" $ \a -> reft iot a --> io (ticket a)), - ("Ref.cas", forall1 "a" $ \a -> ticket a --> a --> reft iot a --> io boolean), + ("Ref.readForCas", forall1 "a" $ \a -> reft iot a --> io (ticket a)), + ("Ref.cas", forall1 "a" $ \a -> reft iot a --> ticket a --> a --> io boolean), ("Promise.new", forall1 "a" $ \a -> unit --> io (promise a)), ("Promise.read", forall1 "a" $ \a -> promise a --> io a), ("Promise.tryRead", forall1 "a" $ \a -> promise a --> io (optionalt a)), From 2b695ab4519aa8b7c0a670fa45233e64704037c7 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 19 Jan 2023 15:52:19 +0000 Subject: [PATCH 094/467] Make sure all writes to an IORef are fully evaluated If writes aren't fully evaluated, the Closure inside the IORef might contain a thunk, which then ruins pointer equality, resulting in failed CAS --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 124f80a72..8f19f3ec3 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2368,7 +2368,7 @@ declareForeigns = do declareForeign Tracked "IO.ref" boxDirect . mkForeign - $ \(c :: Closure) -> newIORef c + $ \(c :: Closure) -> evaluate c >>= newIORef -- The docs for IORef state that IORef operations can be observed -- out of order ([1]) but actually GHC does emit the appropriate @@ -2381,9 +2381,9 @@ declareForeigns = do \(r :: IORef Closure) -> readIORef r declareForeign Untracked "Ref.write" boxBoxTo0 . mkForeign $ - \(r :: IORef Closure, c :: Closure) -> writeIORef r c + \(r :: IORef Closure, c :: Closure) -> evaluate c >>= writeIORef r - declareForeign Tracked "Ref.ticket" boxDirect . mkForeign $ + declareForeign Tracked "Ref.readForCas" boxDirect . mkForeign $ \(r :: IORef Closure) -> readForCAS r declareForeign Tracked "Ref.Ticket.read" boxDirect . mkForeign $ @@ -2403,7 +2403,10 @@ declareForeigns = do -- [1]: https://github.com/ghc/ghc/blob/master/rts/PrimOps.cmm#L697 -- [2]: https://github.com/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prim.hs#L285 declareForeign Tracked "Ref.cas" boxBoxBoxToBool . mkForeign $ - \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> fmap fst $ casIORef r t v + \(r :: IORef Closure, t :: Ticket Closure, v :: Closure) -> fmap fst $ + do + t <- evaluate t + casIORef r t v declareForeign Tracked "Promise.new" unitDirect . mkForeign $ \() -> newPromise @Closure From e2f9c4b3b9c15c3a36e9618a0b957a6080477576 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 19 Jan 2023 16:15:34 +0000 Subject: [PATCH 095/467] Regenerate transcripts --- .../all-base-hashes.output.md | 12 +- .../transcripts-using-base/ref-promise.md | 19 ++++ .../ref-promise.output.md | 31 +++++ unison-src/transcripts/alias-many.output.md | 6 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 24 ++-- .../transcripts/name-selection.output.md | 106 +++++++++--------- unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 ++-- 9 files changed, 145 insertions(+), 95 deletions(-) create mode 100644 unison-src/transcripts-using-base/ref-promise.md create mode 100644 unison-src/transcripts-using-base/ref-promise.output.md diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index f7971f599..1be8e7bba 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -1339,16 +1339,16 @@ This transcript is intended to make visible accidental changes to the hashing al builtin.io2.Promise.write : a -> Promise a ->{IO} Boolean 383. -- ##Ref.cas - builtin.io2.Ref.cas : Ticket a + builtin.io2.Ref.cas : Ref {IO} a + -> Ticket a -> a - -> Ref {IO} a ->{IO} Boolean - 384. -- ##Ref.Ticket - builtin type builtin.io2.Ref.Ticket + 384. -- ##Ref.readForCas + builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 385. -- ##Ref.ticket - builtin.io2.Ref.ticket : Ref {IO} a ->{IO} Ticket a + 385. -- ##Ref.Ticket + builtin type builtin.io2.Ref.Ticket 386. -- ##Ref.Ticket.read builtin.io2.Ref.Ticket.read : Ticket a -> a diff --git a/unison-src/transcripts-using-base/ref-promise.md b/unison-src/transcripts-using-base/ref-promise.md new file mode 100644 index 000000000..3c0dd3882 --- /dev/null +++ b/unison-src/transcripts-using-base/ref-promise.md @@ -0,0 +1,19 @@ +Script to test the basic functionality of CAS and Promise. + +Ref support a CAS operation that can be used as a building block to +change state atomically without locks. + +```unison +casTest: '{io2.IO} [Result] +casTest _ = + test _ = + ref = IO.ref 0 + ticket = Ref.readForCas ref + v1 = Ref.cas ref ticket 5 + check "CAS is successful is there were no conflicting writes" v1 + Ref.write ref 10 + v2 = Ref.cas ref ticket 15 + check "CAS fails when there was an intervening write" v2 + + runTest test +``` diff --git a/unison-src/transcripts-using-base/ref-promise.output.md b/unison-src/transcripts-using-base/ref-promise.output.md new file mode 100644 index 000000000..62944959a --- /dev/null +++ b/unison-src/transcripts-using-base/ref-promise.output.md @@ -0,0 +1,31 @@ +Script to test the basic functionality of CAS and Promise. + +Ref support a CAS operation that can be used as a building block to +change state atomically without locks. + +```unison +casTest: '{io2.IO} [Result] +casTest _ = + test _ = + ref = IO.ref 0 + ticket = Ref.readForCas ref + v1 = Ref.cas ref ticket 5 + check "CAS is successful is there were no conflicting writes" v1 + Ref.write ref 10 + v2 = Ref.cas ref ticket 15 + check "CAS fails when there was an intervening write" v2 + + runTest test +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + casTest : '{IO} [Result] + +``` diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index 37025af48..90e6125aa 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -370,9 +370,9 @@ Let's try it! 266. io2.Promise.read : Promise a ->{IO} a 267. io2.Promise.tryRead : Promise a ->{IO} Optional a 268. io2.Promise.write : a -> Promise a ->{IO} Boolean - 269. io2.Ref.cas : Ticket a -> a -> Ref {IO} a ->{IO} Boolean - 270. builtin type io2.Ref.Ticket - 271. io2.Ref.ticket : Ref {IO} a ->{IO} Ticket a + 269. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean + 270. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a + 271. builtin type io2.Ref.Ticket 272. io2.Ref.Ticket.read : Ticket a -> a 273. unique type io2.RuntimeFailure 274. unique type io2.SeekMode diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index 1ffe88e15..a98df37fa 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -121,13 +121,13 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #g3hv60fa4j + ⊙ 1. #q2cb2dqvje - Deletes: feature1.y - ⊙ 2. #5ioveomplb + ⊙ 2. #lbjaubg5e9 + Adds / updates: @@ -138,26 +138,26 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Original name New name(s) feature1.y master.y - ⊙ 3. #5k7c2ue0no + ⊙ 3. #71ajvea616 + Adds / updates: feature1.y - ⊙ 4. #3pt0eqssrl + ⊙ 4. #vr2ttthg2l > Moves: Original name New name x master.x - ⊙ 5. #34qqtet8ac + ⊙ 5. #b1o80r34ce + Adds / updates: x - □ 6. #fqlej014a3 (start of history) + □ 6. #7un22ntllg (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 3f208c90f..9d5534fa3 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -276,7 +276,7 @@ I should be able to move the root into a sub-namespace - □ 1. #tujeu0r55u (start of history) + □ 1. #3rt95kasco (start of history) ``` ```ucm @@ -292,7 +292,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #gqhjapum9q + ⊙ 1. #9h5q2s97j1 - Deletes: @@ -303,7 +303,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #24ip3jvv9k + ⊙ 2. #uc76cu49n5 + Adds / updates: @@ -315,26 +315,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #e1l67kkplo + ⊙ 3. #p0i5leprku + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #dmv7lfm9ju + ⊙ 4. #6653phkspu > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #clpfvahr82 + ⊙ 5. #96s54m0o9q - Deletes: history.b.termInB - ⊙ 6. #r7qu4pdbf1 + ⊙ 6. #kdt1ubsjvc + Adds / updates: @@ -345,13 +345,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #i48lbjjaqf + ⊙ 7. #ilms0te7e9 + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #euu4nd59ph + ⊙ 8. #s4rrj4ar8p > Moves: @@ -361,7 +361,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #5bifukns3a + ⊙ 9. #neo6d1tqh5 + Adds / updates: @@ -371,7 +371,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #c862sqlm60 + ⊙ 10. #u3uo460daa + Adds / updates: @@ -383,7 +383,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #8pjud6lv7q + ⊙ 11. #bqq857tsem ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index a487d6d4f..6cf7c6d46 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -393,11 +393,11 @@ d = c + 10 a -> Pattern a - 174. builtin.io2.Ref.cas : Ticket + 174. builtin.io2.Ref.cas : Ref + {IO} a + -> Ticket a -> a - -> Ref - {IO} a ->{IO} Boolean 175. builtin.Float.ceiling : Float -> Int @@ -1126,136 +1126,136 @@ d = c + 10 -> Nat ->{g, Exception} Nat - 389. builtin.io2.TVar.readIO : TVar a + 389. builtin.io2.Ref.readForCas : Ref + {IO} a + ->{IO} Ticket + a + 390. builtin.io2.TVar.readIO : TVar a ->{IO} a - 390. builtin.io2.Clock.internals.realtime : '{IO} Either + 391. builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 391. builtin.io2.IO.ref : a + 392. builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 392. builtin.Scope.ref : a + 393. builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 393. builtin.Text.repeat : Nat + 394. builtin.Text.repeat : Nat -> Text -> Text - 394. builtin.Pattern.replicate : Nat + 395. builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 395. builtin.io2.STM.retry : '{STM} a - 396. builtin.Text.reverse : Text + 396. builtin.io2.STM.retry : '{STM} a + 397. builtin.Text.reverse : Text -> Text - 397. builtin.Float.round : Float + 398. builtin.Float.round : Float -> Int - 398. builtin.Pattern.run : Pattern + 399. builtin.Pattern.run : Pattern a -> a -> Optional ( [a], a) - 399. builtin.Scope.run : (∀ s. + 400. builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 400. builtin.io2.Clock.internals.sec : TimeSpec + 401. builtin.io2.Clock.internals.sec : TimeSpec -> Int - 401. builtin.Code.serialize : Code + 402. builtin.Code.serialize : Code -> Bytes - 402. builtin.Value.serialize : Value + 403. builtin.Value.serialize : Value -> Bytes - 403. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + 404. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 404. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + 405. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 405. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + 406. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 406. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + 407. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 407. builtin.io2.Tls.ClientConfig.versions.set : [Version] + 408. builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 408. builtin.io2.Tls.ServerConfig.versions.set : [Version] + 409. builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 409. builtin.Int.shiftLeft : Int + 410. builtin.Int.shiftLeft : Int -> Nat -> Int - 410. builtin.Nat.shiftLeft : Nat + 411. builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 411. builtin.Int.shiftRight : Int + 412. builtin.Int.shiftRight : Int -> Nat -> Int - 412. builtin.Nat.shiftRight : Nat + 413. builtin.Nat.shiftRight : Nat -> Nat -> Nat - 413. builtin.Int.signum : Int + 414. builtin.Int.signum : Int -> Int - 414. builtin.Float.sin : Float + 415. builtin.Float.sin : Float -> Float - 415. builtin.Float.sinh : Float + 416. builtin.Float.sinh : Float -> Float - 416. builtin.Bytes.size : Bytes + 417. builtin.Bytes.size : Bytes -> Nat - 417. builtin.ImmutableArray.size : ImmutableArray + 418. builtin.ImmutableArray.size : ImmutableArray a -> Nat - 418. builtin.ImmutableByteArray.size : ImmutableByteArray + 419. builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 419. builtin.List.size : [a] + 420. builtin.List.size : [a] -> Nat - 420. builtin.MutableArray.size : MutableArray + 421. builtin.MutableArray.size : MutableArray g a -> Nat - 421. builtin.MutableByteArray.size : MutableByteArray + 422. builtin.MutableByteArray.size : MutableByteArray g -> Nat - 422. builtin.Text.size : Text + 423. builtin.Text.size : Text -> Nat - 423. builtin.Text.patterns.space : Pattern + 424. builtin.Text.patterns.space : Pattern Text - 424. builtin.Float.sqrt : Float + 425. builtin.Float.sqrt : Float -> Float - 425. builtin.io2.IO.stdHandle : StdHandle + 426. builtin.io2.IO.stdHandle : StdHandle -> Handle - 426. builtin.Nat.sub : Nat + 427. builtin.Nat.sub : Nat -> Nat -> Int - 427. builtin.io2.TVar.swap : TVar a + 428. builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 428. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 429. builtin.Bytes.take : Nat + 429. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + 430. builtin.Bytes.take : Nat -> Bytes -> Bytes - 430. builtin.List.take : Nat + 431. builtin.List.take : Nat -> [a] -> [a] - 431. builtin.Text.take : Nat + 432. builtin.Text.take : Nat -> Text -> Text - 432. builtin.Float.tan : Float + 433. builtin.Float.tan : Float -> Float - 433. builtin.Float.tanh : Float + 434. builtin.Float.tanh : Float -> Float - 434. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + 435. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 435. builtin.io2.Ref.ticket : Ref - {IO} a - ->{IO} Ticket - a 436. builtin.Bytes.toBase16 : Bytes -> Bytes 437. builtin.Bytes.toBase32 : Bytes diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index ffaad8c2b..4531256c7 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #7j88dp8j0a .old` to make an old namespace + `fork #momui2psqq .old` to make an old namespace accessible again, - `reset-root #7j88dp8j0a` to reset the root namespace and + `reset-root #momui2psqq` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #2r02hj75nc add - 2. now #7j88dp8j0a add - 3. now #k3307b2im4 builtins.merge + 1. now #gea9reo4v8 add + 2. now #momui2psqq add + 3. now #5055be919q builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index bbb4fdc35..f1a48603d 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #vvo2p0q673 (start of history) + □ 1. #jj96fe1hif (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #b93jorec7g + ⊙ 1. #akqqraofi8 > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #e3pk5gglvo + ⊙ 2. #jqtt4ku7e6 > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #vvo2p0q673 (start of history) + □ 3. #jj96fe1hif (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #b93jorec7g + ⊙ 1. #akqqraofi8 > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #e3pk5gglvo + ⊙ 2. #jqtt4ku7e6 > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #vvo2p0q673 (start of history) + □ 3. #jj96fe1hif (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #vvo2p0q673 (start of history) + □ 1. #jj96fe1hif (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #15nbftacqb + ⊙ 1. #igp95kiubr - Deletes: Nat.* Nat.+ - □ 2. #vvo2p0q673 (start of history) + □ 2. #jj96fe1hif (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From 375e4351803a4227aab6491b5d2b6f88599bd869 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 19 Jan 2023 16:20:17 +0000 Subject: [PATCH 096/467] Remove repro of CAS bug --- parser-typechecker/src/Unison/Util/RefPromise.hs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/parser-typechecker/src/Unison/Util/RefPromise.hs b/parser-typechecker/src/Unison/Util/RefPromise.hs index 8615a8c0b..448148f31 100644 --- a/parser-typechecker/src/Unison/Util/RefPromise.hs +++ b/parser-typechecker/src/Unison/Util/RefPromise.hs @@ -7,14 +7,12 @@ module Unison.Util.RefPromise newPromise, readPromise, tryReadPromise, - writePromise, - foo -- TODO remove + writePromise ) where import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, tryReadMVar, tryPutMVar) import Data.Atomics (Ticket, peekTicket, readForCAS, casIORef) -import Data.IORef -- TODO remove newtype Promise a = Promise { state :: MVar a} @@ -36,13 +34,3 @@ tryReadPromise Promise { state } = tryReadMVar state -- if full, ignore the write and return False writePromise :: a -> Promise a -> IO Bool writePromise value Promise { state } = tryPutMVar state value - --- TODO remove -foo :: IO (Bool, Bool) -foo = do - state <- newIORef (0 :: Integer) - ticket <- readForCAS state - success <- fmap fst $ casIORef state ticket 5 - writeIORef state 10 - failure <- fmap fst $ casIORef state ticket 5 - pure (success, failure) From 17c0d8d5d8d9ab0b063ae78760904fa3dd3fd717 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 19 Jan 2023 16:22:53 +0000 Subject: [PATCH 097/467] Promise.write should take the Promise as its first argument --- parser-typechecker/src/Unison/Builtin.hs | 2 +- parser-typechecker/src/Unison/Runtime/Builtin.hs | 2 +- parser-typechecker/src/Unison/Util/RefPromise.hs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index 78decce4e..b6afe0b13 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -861,7 +861,7 @@ refPromiseBuiltins = ("Promise.new", forall1 "a" $ \a -> unit --> io (promise a)), ("Promise.read", forall1 "a" $ \a -> promise a --> io a), ("Promise.tryRead", forall1 "a" $ \a -> promise a --> io (optionalt a)), - ("Promise.write", forall1 "a" $ \a -> a --> promise a --> io boolean) + ("Promise.write", forall1 "a" $ \a -> promise a --> a --> io boolean) ] where ticket :: Type -> Type diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 8f19f3ec3..948c3406e 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2419,7 +2419,7 @@ declareForeigns = do \(p :: Promise Closure) -> tryReadPromise p declareForeign Tracked "Promise.write" boxBoxToBool . mkForeign $ - \(a :: Closure, p :: Promise Closure) -> writePromise a p + \(p :: Promise Closure, a :: Closure) -> writePromise p a declareForeign Tracked "Tls.newClient.impl.v3" boxBoxToEFBox . mkForeignTls $ \( config :: TLS.ClientParams, diff --git a/parser-typechecker/src/Unison/Util/RefPromise.hs b/parser-typechecker/src/Unison/Util/RefPromise.hs index 448148f31..6410c17c5 100644 --- a/parser-typechecker/src/Unison/Util/RefPromise.hs +++ b/parser-typechecker/src/Unison/Util/RefPromise.hs @@ -32,5 +32,5 @@ tryReadPromise Promise { state } = tryReadMVar state -- if the promise is empty, write the value, awake all readers and return True -- if full, ignore the write and return False -writePromise :: a -> Promise a -> IO Bool -writePromise value Promise { state } = tryPutMVar state value +writePromise :: Promise a -> a -> IO Bool +writePromise Promise { state } value = tryPutMVar state value From aeaf55b5e0837b784d303e4184d27aaf46576a92 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 20 Jan 2023 01:12:23 +0000 Subject: [PATCH 098/467] Add transcript test --- .../transcripts-using-base/ref-promise.md | 137 ++++++++- .../ref-promise.output.md | 259 +++++++++++++++++- 2 files changed, 387 insertions(+), 9 deletions(-) diff --git a/unison-src/transcripts-using-base/ref-promise.md b/unison-src/transcripts-using-base/ref-promise.md index 3c0dd3882..c30cc4df0 100644 --- a/unison-src/transcripts-using-base/ref-promise.md +++ b/unison-src/transcripts-using-base/ref-promise.md @@ -1,19 +1,148 @@ -Script to test the basic functionality of CAS and Promise. +# tests for Promise and CAS on Refs Ref support a CAS operation that can be used as a building block to change state atomically without locks. +```unison +foo = + use Nat drop + drop 6 5 + +bar = + use Nat eq + eq 3 4 +``` + ```unison casTest: '{io2.IO} [Result] -casTest _ = - test _ = +casTest = do + test = do ref = IO.ref 0 ticket = Ref.readForCas ref v1 = Ref.cas ref ticket 5 check "CAS is successful is there were no conflicting writes" v1 Ref.write ref 10 v2 = Ref.cas ref ticket 15 - check "CAS fails when there was an intervening write" v2 + check "CAS fails when there was an intervening write" (not v2) runTest test ``` + +```ucm +.> add +.> io.test casTest +``` + +Promise is a simple one-shot awaitable condition. + +```unison +promiseSequentialTest : '{IO} [Result] +promiseSequentialTest = do + test = do + use Nat eq + use Promise read write + p = !Promise.new + write p 0 |> void + v1 = read p + check "Should read a value that's been written" (eq v1 0) + write p 1 |> void + v2 = read p + check "Promise can only be written to once" (eq v2 0) + + runTest test + +promiseConcurrentTest : '{IO} [Result] +promiseConcurrentTest = do + use Nat eq + test = do + p = !Promise.new + _ = forkComp '(Promise.write p 5) + v = Promise.read p + check "Reads awaits for completion of the Promise" (eq v 5) + + runTest test +``` + +```ucm +.> add +.> io.test promiseSequentialTest +.> io.test promiseConcurrentTest +``` + +CAS can be used to write an atomic update function. + +```unison +atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () +atomicUpdate ref f = + ticket = Ref.readForCas ref + value = f (Ticket.read ticket) + if Ref.cas ref ticket value then () else atomicUpdate ref f +``` + +```ucm +.> add +``` + +Promise can be used to write an operation that spawns N concurrent +tasks and collects their results + +```unison +spawnN : Nat -> '{IO} a ->{IO} [a] +spawnN n fa = + use Nat eq drop + go i acc = + if eq i 0 + then acc + else + value = !Promise.new + _ = forkComp do Promise.write value !fa + go (drop i 1) (acc :+ value) + + map Promise.read (go n []) +``` +```ucm +.> add +``` + +We can use these primitives to write a more interesting example, where +multiple threads repeatedly update an atomic counter, we check that +the value of the counter is correct after all threads are done. + +```unison + +repeat: Nat -> '{e} a ->{e} [a] +repeat n fa = + go i acc = + if (Nat.eq i n) + then acc + else go (i + 1) (acc :+ !fa) + + go 0 [] + +fullTest : '{IO} [Result] +fullTest = do + use Nat * + eq drop + + numThreads = 100 + iterations = 100 + expected = numThreads * iterations + + test = do + state = IO.ref 0 + thread n = + if eq n 0 + then () + else + atomicUpdate state (v -> v + 1) + thread (drop n 1) + void (spawnN numThreads '(thread iterations)) + result = Ref.read state + check "The state of the counter is consistent "(eq result expected) + + runTest test +``` + +```ucm +.> add +.> io.test fullTest +``` diff --git a/unison-src/transcripts-using-base/ref-promise.output.md b/unison-src/transcripts-using-base/ref-promise.output.md index 62944959a..feaa11ce1 100644 --- a/unison-src/transcripts-using-base/ref-promise.output.md +++ b/unison-src/transcripts-using-base/ref-promise.output.md @@ -1,20 +1,42 @@ -Script to test the basic functionality of CAS and Promise. +# tests for Promise and CAS on Refs Ref support a CAS operation that can be used as a building block to change state atomically without locks. +```unison +foo = + use Nat drop + drop 6 5 + +bar = + use Nat eq + eq 3 4 +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + bar : Boolean + foo : Nat + +``` ```unison casTest: '{io2.IO} [Result] -casTest _ = - test _ = +casTest = do + test = do ref = IO.ref 0 ticket = Ref.readForCas ref v1 = Ref.cas ref ticket 5 check "CAS is successful is there were no conflicting writes" v1 Ref.write ref 10 v2 = Ref.cas ref ticket 15 - check "CAS fails when there was an intervening write" v2 - + check "CAS fails when there was an intervening write" (not v2) + runTest test ``` @@ -29,3 +51,230 @@ casTest _ = casTest : '{IO} [Result] ``` +```ucm +.> add + + ⍟ I've added these definitions: + + casTest : '{IO} [Result] + +.> io.test casTest + + New test results: + + ◉ casTest CAS is successful is there were no conflicting writes + ◉ casTest CAS fails when there was an intervening write + + ✅ 2 test(s) passing + + Tip: Use view casTest to view the source of a test. + +``` +Promise is a simple one-shot awaitable condition. + +```unison +promiseSequentialTest : '{IO} [Result] +promiseSequentialTest = do + test = do + use Nat eq + use Promise read write + p = !Promise.new + write p 0 |> void + v1 = read p + check "Should read a value that's been written" (eq v1 0) + write p 1 |> void + v2 = read p + check "Promise can only be written to once" (eq v2 0) + + runTest test + +promiseConcurrentTest : '{IO} [Result] +promiseConcurrentTest = do + use Nat eq + test = do + p = !Promise.new + _ = forkComp '(Promise.write p 5) + v = Promise.read p + check "Reads awaits for completion of the Promise" (eq v 5) + + runTest test +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + promiseConcurrentTest : '{IO} [Result] + promiseSequentialTest : '{IO} [Result] + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + promiseConcurrentTest : '{IO} [Result] + promiseSequentialTest : '{IO} [Result] + +.> io.test promiseSequentialTest + + New test results: + + ◉ promiseSequentialTest Should read a value that's been written + ◉ promiseSequentialTest Promise can only be written to once + + ✅ 2 test(s) passing + + Tip: Use view promiseSequentialTest to view the source of a + test. + +.> io.test promiseConcurrentTest + + New test results: + + ◉ promiseConcurrentTest Reads awaits for completion of the Promise + + ✅ 1 test(s) passing + + Tip: Use view promiseConcurrentTest to view the source of a + test. + +``` +CAS can be used to write an atomic update function. + +```unison +atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () +atomicUpdate ref f = + ticket = Ref.readForCas ref + value = f (Ticket.read ticket) + if Ref.cas ref ticket value then () else atomicUpdate ref f +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () + +``` +Promise can be used to write an operation that spawns N concurrent +tasks and collects their results + +```unison +spawnN : Nat -> '{IO} a ->{IO} [a] +spawnN n fa = + use Nat eq drop + go i acc = + if eq i 0 + then acc + else + value = !Promise.new + _ = forkComp do Promise.write value !fa + go (drop i 1) (acc :+ value) + + map Promise.read (go n []) +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + spawnN : Nat -> '{IO} a ->{IO} [a] + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + spawnN : Nat -> '{IO} a ->{IO} [a] + +``` +We can use these primitives to write a more interesting example, where +multiple threads repeatedly update an atomic counter, we check that +the value of the counter is correct after all threads are done. + +```unison +repeat: Nat -> '{e} a ->{e} [a] +repeat n fa = + go i acc = + if (Nat.eq i n) + then acc + else go (i + 1) (acc :+ !fa) + + go 0 [] + +fullTest : '{IO} [Result] +fullTest = do + use Nat * + eq drop + + numThreads = 100 + iterations = 100 + expected = numThreads * iterations + + test = do + state = IO.ref 0 + thread n = + if eq n 0 + then () + else + atomicUpdate state (v -> v + 1) + thread (drop n 1) + void (spawnN numThreads '(thread iterations)) + result = Ref.read state + check "The state of the counter is consistent "(eq result expected) + + runTest test +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + fullTest : '{IO} [Result] + repeat : Nat -> '{e} a ->{e} [a] + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + fullTest : '{IO} [Result] + repeat : Nat -> '{e} a ->{e} [a] + +.> io.test fullTest + + New test results: + + ◉ fullTest The state of the counter is consistent + + ✅ 1 test(s) passing + + Tip: Use view fullTest to view the source of a test. + +``` From cc0c6a2868e1026259ca4cae0036d0f4823e1f79 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 20 Jan 2023 02:07:20 +0000 Subject: [PATCH 099/467] Regenerate transcripts after Promise signature change --- unison-src/transcripts-using-base/all-base-hashes.output.md | 2 +- unison-src/transcripts/alias-many.output.md | 2 +- unison-src/transcripts/name-selection.output.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index 1be8e7bba..b14d0c4c6 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -1336,7 +1336,7 @@ This transcript is intended to make visible accidental changes to the hashing al builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a 382. -- ##Promise.write - builtin.io2.Promise.write : a -> Promise a ->{IO} Boolean + builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean 383. -- ##Ref.cas builtin.io2.Ref.cas : Ref {IO} a diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index 90e6125aa..03108f869 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -369,7 +369,7 @@ Let's try it! 265. io2.Promise.new : '{IO} Promise a 266. io2.Promise.read : Promise a ->{IO} a 267. io2.Promise.tryRead : Promise a ->{IO} Optional a - 268. io2.Promise.write : a -> Promise a ->{IO} Boolean + 268. io2.Promise.write : Promise a -> a ->{IO} Boolean 269. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean 270. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a 271. builtin type io2.Ref.Ticket diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index 6cf7c6d46..973101db9 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -1352,9 +1352,9 @@ d = c + 10 -> a ->{g, Exception} () - 476. builtin.io2.Promise.write : a - -> Promise + 476. builtin.io2.Promise.write : Promise a + -> a ->{IO} Boolean 477. builtin.Ref.write : Ref g a -> a From 4d34871d30c368e9507497d7021f54966cbdb660 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 20 Jan 2023 13:57:52 +0000 Subject: [PATCH 100/467] Remove unused code --- .../transcripts-using-base/ref-promise.md | 20 ----------- .../ref-promise.output.md | 33 ------------------- 2 files changed, 53 deletions(-) diff --git a/unison-src/transcripts-using-base/ref-promise.md b/unison-src/transcripts-using-base/ref-promise.md index c30cc4df0..dd54328ec 100644 --- a/unison-src/transcripts-using-base/ref-promise.md +++ b/unison-src/transcripts-using-base/ref-promise.md @@ -3,16 +3,6 @@ Ref support a CAS operation that can be used as a building block to change state atomically without locks. -```unison -foo = - use Nat drop - drop 6 5 - -bar = - use Nat eq - eq 3 4 -``` - ```unison casTest: '{io2.IO} [Result] casTest = do @@ -109,16 +99,6 @@ multiple threads repeatedly update an atomic counter, we check that the value of the counter is correct after all threads are done. ```unison - -repeat: Nat -> '{e} a ->{e} [a] -repeat n fa = - go i acc = - if (Nat.eq i n) - then acc - else go (i + 1) (acc :+ !fa) - - go 0 [] - fullTest : '{IO} [Result] fullTest = do use Nat * + eq drop diff --git a/unison-src/transcripts-using-base/ref-promise.output.md b/unison-src/transcripts-using-base/ref-promise.output.md index feaa11ce1..444c0dcaa 100644 --- a/unison-src/transcripts-using-base/ref-promise.output.md +++ b/unison-src/transcripts-using-base/ref-promise.output.md @@ -3,28 +3,6 @@ Ref support a CAS operation that can be used as a building block to change state atomically without locks. -```unison -foo = - use Nat drop - drop 6 5 - -bar = - use Nat eq - eq 3 4 -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - bar : Boolean - foo : Nat - -``` ```unison casTest: '{io2.IO} [Result] casTest = do @@ -215,15 +193,6 @@ multiple threads repeatedly update an atomic counter, we check that the value of the counter is correct after all threads are done. ```unison -repeat: Nat -> '{e} a ->{e} [a] -repeat n fa = - go i acc = - if (Nat.eq i n) - then acc - else go (i + 1) (acc :+ !fa) - - go 0 [] - fullTest : '{IO} [Result] fullTest = do use Nat * + eq drop @@ -256,7 +225,6 @@ fullTest = do ⍟ These new definitions are ok to `add`: fullTest : '{IO} [Result] - repeat : Nat -> '{e} a ->{e} [a] ``` ```ucm @@ -265,7 +233,6 @@ fullTest = do ⍟ I've added these definitions: fullTest : '{IO} [Result] - repeat : Nat -> '{e} a ->{e} [a] .> io.test fullTest From 52a7195b802110786c0a6b7f896d20468c608660 Mon Sep 17 00:00:00 2001 From: andrii <25188+unorsk@users.noreply.github.com> Date: Fri, 20 Jan 2023 20:48:37 +0100 Subject: [PATCH 101/467] adding @unorsk to CONTRIBUTORS.markdown --- CONTRIBUTORS.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.markdown b/CONTRIBUTORS.markdown index f9dd79b70..259c10518 100644 --- a/CONTRIBUTORS.markdown +++ b/CONTRIBUTORS.markdown @@ -72,3 +72,4 @@ The format for this list: name, GitHub handle * Emil Hotkowski (@emilhotkowski) * Jesse Looney (@jesselooney) * Vlad Posmangiu Luchian (@cstml) +* Andrii Uvarov (@unorsk) From 30c50ff911b6391816eab44a1d53a1b143ecd8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8jberg?= Date: Mon, 23 Jan 2023 10:09:38 -0500 Subject: [PATCH 102/467] Update with support for doc render vs eval --- unison-share-api/src/Unison/Server/Doc.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/unison-share-api/src/Unison/Server/Doc.hs b/unison-share-api/src/Unison/Server/Doc.hs index 423f866d7..78a412a00 100644 --- a/unison-share-api/src/Unison/Server/Doc.hs +++ b/unison-share-api/src/Unison/Server/Doc.hs @@ -145,6 +145,8 @@ data EvaluatedSpecialForm v | EEmbedInline (Term v ()) | EVideo [MediaSource] (Map Text Text) | EFrontMatter (Map Text [Text]) + | ELaTeXInline Text + | ESvg Text | ERenderError (RenderError (Term v ())) deriving stock (Eq, Show, Generic) @@ -225,6 +227,8 @@ renderDoc pped doc = renderSpecial <$> doc EEmbedInline any -> EmbedInline ("{{ embed {{" <> source any <> "}} }}") EVideo sources config -> Video sources config EFrontMatter frontMatter -> FrontMatter frontMatter + ELaTeXInline latex -> LaTeXInline latex + ESvg svg -> Svg svg ERenderError (InvalidTerm tm) -> Embed ("🆘 unable to render " <> source tm) evalErrMsg :: SyntaxText @@ -380,10 +384,10 @@ evalDoc terms typeOf eval types tm = -- Embed LaTeXInline DD.Doc2SpecialFormEmbedLaTeXInline latex -> - pure $ LaTeXInline latex + pure $ ELaTeXInline latex -- Embed Svg DD.Doc2SpecialFormEmbedSvg svg -> - pure $ Svg svg + pure $ ESvg svg -- Embed Any DD.Doc2SpecialFormEmbed (Term.App' _ any) -> pure $ EEmbed any @@ -483,6 +487,8 @@ dependenciesSpecial = \case EEmbedInline trm -> Term.labeledDependencies trm EVideo {} -> mempty EFrontMatter {} -> mempty + ELaTeXInline {} -> mempty + ESvg {} -> mempty ERenderError (InvalidTerm trm) -> Term.labeledDependencies trm where sigtypDeps :: [(Referent, Type v a)] -> Set LD.LabeledDependency From e7ec58c69634fb885882f9094b4ee3007f01539a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8jberg?= Date: Mon, 23 Jan 2023 10:44:01 -0500 Subject: [PATCH 103/467] update transcripts --- .../all-base-hashes.output.md | 1281 +++++++++-------- .../transcripts/emptyCodebase.output.md | 2 +- .../transcripts/move-namespace.output.md | 28 +- 3 files changed, 662 insertions(+), 649 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index b14d0c4c6..5ae84b72a 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -472,330 +472,343 @@ This transcript is intended to make visible accidental changes to the hashing al 142. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 builtin.Doc2.Join : [Doc2] -> Doc2 - 143. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 + 143. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto + unique type builtin.Doc2.LaTeXInline + + 144. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto#0 + builtin.Doc2.LaTeXInline.LaTeXInline : Text + -> LaTeXInline + + 145. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 builtin.Doc2.Linebreak : Doc2 - 144. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 + 146. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 unique type builtin.Doc2.MediaSource - 145. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 + 147. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 builtin.Doc2.MediaSource.MediaSource : Text -> Optional Text -> MediaSource - 146. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so + 148. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so builtin.Doc2.MediaSource.mimeType : MediaSource -> Optional Text - 147. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg + 149. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg builtin.Doc2.MediaSource.mimeType.modify : (Optional Text ->{g} Optional Text) -> MediaSource ->{g} MediaSource - 148. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 + 150. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 builtin.Doc2.MediaSource.mimeType.set : Optional Text -> MediaSource -> MediaSource - 149. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg + 151. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg builtin.Doc2.MediaSource.sourceUrl : MediaSource -> Text - 150. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 + 152. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 builtin.Doc2.MediaSource.sourceUrl.modify : (Text ->{g} Text) -> MediaSource ->{g} MediaSource - 151. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo + 153. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo builtin.Doc2.MediaSource.sourceUrl.set : Text -> MediaSource -> MediaSource - 152. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 + 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 builtin.Doc2.NamedLink : Doc2 -> Doc2 -> Doc2 - 153. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 + 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 builtin.Doc2.NumberedList : Nat -> [Doc2] -> Doc2 - 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 + 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 builtin.Doc2.Paragraph : [Doc2] -> Doc2 - 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 + 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 builtin.Doc2.Section : Doc2 -> [Doc2] -> Doc2 - 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 + 158. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 builtin.Doc2.SectionBreak : Doc2 - 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 + 159. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 builtin.Doc2.Special : SpecialForm -> Doc2 - 158. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 + 160. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 unique type builtin.Doc2.SpecialForm - 159. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 + 161. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 builtin.Doc2.SpecialForm.Embed : Any -> SpecialForm - 160. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 + 162. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 builtin.Doc2.SpecialForm.EmbedInline : Any -> SpecialForm - 161. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 + 163. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 builtin.Doc2.SpecialForm.Eval : Doc2.Term -> SpecialForm - 162. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 + 164. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 builtin.Doc2.SpecialForm.EvalInline : Doc2.Term -> SpecialForm - 163. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 + 165. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 builtin.Doc2.SpecialForm.Example : Nat -> Doc2.Term -> SpecialForm - 164. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 + 166. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 builtin.Doc2.SpecialForm.ExampleBlock : Nat -> Doc2.Term -> SpecialForm - 165. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 + 167. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 builtin.Doc2.SpecialForm.FoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 166. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 + 168. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 builtin.Doc2.SpecialForm.Link : Either Type Doc2.Term -> SpecialForm - 167. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 + 169. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 builtin.Doc2.SpecialForm.Signature : [Doc2.Term] -> SpecialForm - 168. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 + 170. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 builtin.Doc2.SpecialForm.SignatureInline : Doc2.Term -> SpecialForm - 169. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 + 171. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 builtin.Doc2.SpecialForm.Source : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 170. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 + 172. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 builtin.Doc2.Strikethrough : Doc2 -> Doc2 - 171. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 + 173. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 builtin.Doc2.Style : Text -> Doc2 -> Doc2 - 172. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 + 174. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg + unique type builtin.Doc2.Svg + + 175. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg#0 + builtin.Doc2.Svg.Svg : Text -> Svg + + 176. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 builtin.Doc2.Table : [[Doc2]] -> Doc2 - 173. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg + 177. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg unique type builtin.Doc2.Term - 174. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 + 178. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 builtin.Doc2.term : '{g} a -> Doc2.Term - 175. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 + 179. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 builtin.Doc2.Term.Term : Any -> Doc2.Term - 176. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 + 180. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 builtin.Doc2.Tooltip : Doc2 -> Doc2 -> Doc2 - 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 + 181. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 builtin.Doc2.UntitledSection : [Doc2] -> Doc2 - 178. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 + 182. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 unique type builtin.Doc2.Video - 179. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 + 183. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 builtin.Doc2.Video.config : Video -> [(Text, Text)] - 180. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g + 184. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g builtin.Doc2.Video.config.modify : ([(Text, Text)] ->{g} [(Text, Text)]) -> Video ->{g} Video - 181. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 + 185. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 builtin.Doc2.Video.config.set : [(Text, Text)] -> Video -> Video - 182. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o + 186. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o builtin.Doc2.Video.sources : Video -> [MediaSource] - 183. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo + 187. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo builtin.Doc2.Video.sources.modify : ([MediaSource] ->{g} [MediaSource]) -> Video ->{g} Video - 184. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 + 188. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 builtin.Doc2.Video.sources.set : [MediaSource] -> Video -> Video - 185. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 + 189. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 builtin.Doc2.Video.Video : [MediaSource] -> [(Text, Text)] -> Video - 186. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 + 190. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 builtin.Doc2.Word : Text -> Doc2 - 187. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 + 191. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 structural type builtin.Either a b - 188. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 + 192. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 builtin.Either.Left : a -> Either a b - 189. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g + 193. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g builtin.Either.mapRight : (a ->{g} b) -> Either e a ->{g} Either e b - 190. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 + 194. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 builtin.Either.Right : b -> Either a b - 191. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 195. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability builtin.Exception structural ability Exception - 192. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 196. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 builtin.Exception.raise, Exception.raise : Failure ->{Exception} x - 193. -- ##Float + 197. -- ##Float builtin type builtin.Float - 194. -- ##Float.* + 198. -- ##Float.* builtin.Float.* : Float -> Float -> Float - 195. -- ##Float.+ + 199. -- ##Float.+ builtin.Float.+ : Float -> Float -> Float - 196. -- ##Float.- + 200. -- ##Float.- builtin.Float.- : Float -> Float -> Float - 197. -- ##Float./ + 201. -- ##Float./ builtin.Float./ : Float -> Float -> Float - 198. -- ##Float.abs + 202. -- ##Float.abs builtin.Float.abs : Float -> Float - 199. -- ##Float.acos + 203. -- ##Float.acos builtin.Float.acos : Float -> Float - 200. -- ##Float.acosh + 204. -- ##Float.acosh builtin.Float.acosh : Float -> Float - 201. -- ##Float.asin + 205. -- ##Float.asin builtin.Float.asin : Float -> Float - 202. -- ##Float.asinh + 206. -- ##Float.asinh builtin.Float.asinh : Float -> Float - 203. -- ##Float.atan + 207. -- ##Float.atan builtin.Float.atan : Float -> Float - 204. -- ##Float.atan2 + 208. -- ##Float.atan2 builtin.Float.atan2 : Float -> Float -> Float - 205. -- ##Float.atanh + 209. -- ##Float.atanh builtin.Float.atanh : Float -> Float - 206. -- ##Float.ceiling + 210. -- ##Float.ceiling builtin.Float.ceiling : Float -> Int - 207. -- ##Float.cos + 211. -- ##Float.cos builtin.Float.cos : Float -> Float - 208. -- ##Float.cosh + 212. -- ##Float.cosh builtin.Float.cosh : Float -> Float - 209. -- ##Float.== + 213. -- ##Float.== builtin.Float.eq : Float -> Float -> Boolean - 210. -- ##Float.exp + 214. -- ##Float.exp builtin.Float.exp : Float -> Float - 211. -- ##Float.floor + 215. -- ##Float.floor builtin.Float.floor : Float -> Int - 212. -- ##Float.fromRepresentation + 216. -- ##Float.fromRepresentation builtin.Float.fromRepresentation : Nat -> Float - 213. -- ##Float.fromText + 217. -- ##Float.fromText builtin.Float.fromText : Text -> Optional Float - 214. -- ##Float.> + 218. -- ##Float.> builtin.Float.gt : Float -> Float -> Boolean - 215. -- ##Float.>= + 219. -- ##Float.>= builtin.Float.gteq : Float -> Float -> Boolean - 216. -- ##Float.log + 220. -- ##Float.log builtin.Float.log : Float -> Float - 217. -- ##Float.logBase + 221. -- ##Float.logBase builtin.Float.logBase : Float -> Float -> Float - 218. -- ##Float.< + 222. -- ##Float.< builtin.Float.lt : Float -> Float -> Boolean - 219. -- ##Float.<= + 223. -- ##Float.<= builtin.Float.lteq : Float -> Float -> Boolean - 220. -- ##Float.max + 224. -- ##Float.max builtin.Float.max : Float -> Float -> Float - 221. -- ##Float.min + 225. -- ##Float.min builtin.Float.min : Float -> Float -> Float - 222. -- ##Float.pow + 226. -- ##Float.pow builtin.Float.pow : Float -> Float -> Float - 223. -- ##Float.round + 227. -- ##Float.round builtin.Float.round : Float -> Int - 224. -- ##Float.sin + 228. -- ##Float.sin builtin.Float.sin : Float -> Float - 225. -- ##Float.sinh + 229. -- ##Float.sinh builtin.Float.sinh : Float -> Float - 226. -- ##Float.sqrt + 230. -- ##Float.sqrt builtin.Float.sqrt : Float -> Float - 227. -- ##Float.tan + 231. -- ##Float.tan builtin.Float.tan : Float -> Float - 228. -- ##Float.tanh + 232. -- ##Float.tanh builtin.Float.tanh : Float -> Float - 229. -- ##Float.toRepresentation + 233. -- ##Float.toRepresentation builtin.Float.toRepresentation : Float -> Nat - 230. -- ##Float.toText + 234. -- ##Float.toText builtin.Float.toText : Float -> Text - 231. -- ##Float.truncate + 235. -- ##Float.truncate builtin.Float.truncate : Float -> Int - 232. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 + 236. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 unique type builtin.GUID - 233. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 + 237. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 builtin.GUID.GUID : Bytes -> GUID - 234. -- ##Handle.toText + 238. -- ##Handle.toText builtin.Handle.toText : Handle -> Text - 235. -- ##ImmutableArray + 239. -- ##ImmutableArray builtin type builtin.ImmutableArray - 236. -- ##ImmutableArray.copyTo! + 240. -- ##ImmutableArray.copyTo! builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray a @@ -803,18 +816,18 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 237. -- ##ImmutableArray.read + 241. -- ##ImmutableArray.read builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 238. -- ##ImmutableArray.size + 242. -- ##ImmutableArray.size builtin.ImmutableArray.size : ImmutableArray a -> Nat - 239. -- ##ImmutableByteArray + 243. -- ##ImmutableByteArray builtin type builtin.ImmutableByteArray - 240. -- ##ImmutableByteArray.copyTo! + 244. -- ##ImmutableByteArray.copyTo! builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -822,843 +835,843 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 241. -- ##ImmutableByteArray.read16be + 245. -- ##ImmutableByteArray.read16be builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 242. -- ##ImmutableByteArray.read24be + 246. -- ##ImmutableByteArray.read24be builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 243. -- ##ImmutableByteArray.read32be + 247. -- ##ImmutableByteArray.read32be builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 244. -- ##ImmutableByteArray.read40be + 248. -- ##ImmutableByteArray.read40be builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 245. -- ##ImmutableByteArray.read64be + 249. -- ##ImmutableByteArray.read64be builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 246. -- ##ImmutableByteArray.read8 + 250. -- ##ImmutableByteArray.read8 builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 247. -- ##ImmutableByteArray.size + 251. -- ##ImmutableByteArray.size builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 248. -- ##Int + 252. -- ##Int builtin type builtin.Int - 249. -- ##Int.* + 253. -- ##Int.* builtin.Int.* : Int -> Int -> Int - 250. -- ##Int.+ + 254. -- ##Int.+ builtin.Int.+ : Int -> Int -> Int - 251. -- ##Int.- + 255. -- ##Int.- builtin.Int.- : Int -> Int -> Int - 252. -- ##Int./ + 256. -- ##Int./ builtin.Int./ : Int -> Int -> Int - 253. -- ##Int.and + 257. -- ##Int.and builtin.Int.and : Int -> Int -> Int - 254. -- ##Int.complement + 258. -- ##Int.complement builtin.Int.complement : Int -> Int - 255. -- ##Int.== + 259. -- ##Int.== builtin.Int.eq : Int -> Int -> Boolean - 256. -- ##Int.fromRepresentation + 260. -- ##Int.fromRepresentation builtin.Int.fromRepresentation : Nat -> Int - 257. -- ##Int.fromText + 261. -- ##Int.fromText builtin.Int.fromText : Text -> Optional Int - 258. -- ##Int.> + 262. -- ##Int.> builtin.Int.gt : Int -> Int -> Boolean - 259. -- ##Int.>= + 263. -- ##Int.>= builtin.Int.gteq : Int -> Int -> Boolean - 260. -- ##Int.increment + 264. -- ##Int.increment builtin.Int.increment : Int -> Int - 261. -- ##Int.isEven + 265. -- ##Int.isEven builtin.Int.isEven : Int -> Boolean - 262. -- ##Int.isOdd + 266. -- ##Int.isOdd builtin.Int.isOdd : Int -> Boolean - 263. -- ##Int.leadingZeros + 267. -- ##Int.leadingZeros builtin.Int.leadingZeros : Int -> Nat - 264. -- ##Int.< + 268. -- ##Int.< builtin.Int.lt : Int -> Int -> Boolean - 265. -- ##Int.<= + 269. -- ##Int.<= builtin.Int.lteq : Int -> Int -> Boolean - 266. -- ##Int.mod + 270. -- ##Int.mod builtin.Int.mod : Int -> Int -> Int - 267. -- ##Int.negate + 271. -- ##Int.negate builtin.Int.negate : Int -> Int - 268. -- ##Int.or + 272. -- ##Int.or builtin.Int.or : Int -> Int -> Int - 269. -- ##Int.popCount + 273. -- ##Int.popCount builtin.Int.popCount : Int -> Nat - 270. -- ##Int.pow + 274. -- ##Int.pow builtin.Int.pow : Int -> Nat -> Int - 271. -- ##Int.shiftLeft + 275. -- ##Int.shiftLeft builtin.Int.shiftLeft : Int -> Nat -> Int - 272. -- ##Int.shiftRight + 276. -- ##Int.shiftRight builtin.Int.shiftRight : Int -> Nat -> Int - 273. -- ##Int.signum + 277. -- ##Int.signum builtin.Int.signum : Int -> Int - 274. -- ##Int.toFloat + 278. -- ##Int.toFloat builtin.Int.toFloat : Int -> Float - 275. -- ##Int.toRepresentation + 279. -- ##Int.toRepresentation builtin.Int.toRepresentation : Int -> Nat - 276. -- ##Int.toText + 280. -- ##Int.toText builtin.Int.toText : Int -> Text - 277. -- ##Int.trailingZeros + 281. -- ##Int.trailingZeros builtin.Int.trailingZeros : Int -> Nat - 278. -- ##Int.truncate0 + 282. -- ##Int.truncate0 builtin.Int.truncate0 : Int -> Nat - 279. -- ##Int.xor + 283. -- ##Int.xor builtin.Int.xor : Int -> Int -> Int - 280. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 + 284. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 unique type builtin.io2.ArithmeticFailure - 281. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag + 285. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag unique type builtin.io2.ArrayFailure - 282. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 + 286. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 unique type builtin.io2.BufferMode - 283. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 + 287. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 builtin.io2.BufferMode.BlockBuffering : BufferMode - 284. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 + 288. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 builtin.io2.BufferMode.LineBuffering : BufferMode - 285. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 + 289. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 builtin.io2.BufferMode.NoBuffering : BufferMode - 286. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 + 290. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 287. -- ##Clock.internals.monotonic.v1 + 291. -- ##Clock.internals.monotonic.v1 builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 288. -- ##Clock.internals.nsec.v1 + 292. -- ##Clock.internals.nsec.v1 builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 289. -- ##Clock.internals.processCPUTime.v1 + 293. -- ##Clock.internals.processCPUTime.v1 builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 290. -- ##Clock.internals.realtime.v1 + 294. -- ##Clock.internals.realtime.v1 builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 291. -- ##Clock.internals.sec.v1 + 295. -- ##Clock.internals.sec.v1 builtin.io2.Clock.internals.sec : TimeSpec -> Int - 292. -- ##Clock.internals.threadCPUTime.v1 + 296. -- ##Clock.internals.threadCPUTime.v1 builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 293. -- ##TimeSpec + 297. -- ##TimeSpec builtin type builtin.io2.Clock.internals.TimeSpec - 294. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 + 298. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 unique type builtin.io2.Failure - 295. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 + 299. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 296. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 + 300. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 unique type builtin.io2.FileMode - 297. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 + 301. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 builtin.io2.FileMode.Append : FileMode - 298. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 + 302. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 builtin.io2.FileMode.Read : FileMode - 299. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 + 303. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 builtin.io2.FileMode.ReadWrite : FileMode - 300. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 + 304. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 builtin.io2.FileMode.Write : FileMode - 301. -- ##Handle + 305. -- ##Handle builtin type builtin.io2.Handle - 302. -- ##IO + 306. -- ##IO builtin type builtin.io2.IO - 303. -- ##IO.array + 307. -- ##IO.array builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 304. -- ##IO.arrayOf + 308. -- ##IO.arrayOf builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 305. -- ##IO.bytearray + 309. -- ##IO.bytearray builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 306. -- ##IO.bytearrayOf + 310. -- ##IO.bytearrayOf builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 307. -- ##IO.clientSocket.impl.v3 + 311. -- ##IO.clientSocket.impl.v3 builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 308. -- ##IO.closeFile.impl.v3 + 312. -- ##IO.closeFile.impl.v3 builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 309. -- ##IO.closeSocket.impl.v3 + 313. -- ##IO.closeSocket.impl.v3 builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 310. -- ##IO.createDirectory.impl.v3 + 314. -- ##IO.createDirectory.impl.v3 builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 311. -- ##IO.createTempDirectory.impl.v3 + 315. -- ##IO.createTempDirectory.impl.v3 builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 312. -- ##IO.delay.impl.v3 + 316. -- ##IO.delay.impl.v3 builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 313. -- ##IO.directoryContents.impl.v3 + 317. -- ##IO.directoryContents.impl.v3 builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 314. -- ##IO.fileExists.impl.v3 + 318. -- ##IO.fileExists.impl.v3 builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 315. -- ##IO.forkComp.v2 + 319. -- ##IO.forkComp.v2 builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 316. -- ##IO.getArgs.impl.v1 + 320. -- ##IO.getArgs.impl.v1 builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 317. -- ##IO.getBuffering.impl.v3 + 321. -- ##IO.getBuffering.impl.v3 builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 318. -- ##IO.getBytes.impl.v3 + 322. -- ##IO.getBytes.impl.v3 builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 319. -- ##IO.getChar.impl.v1 + 323. -- ##IO.getChar.impl.v1 builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 320. -- ##IO.getCurrentDirectory.impl.v3 + 324. -- ##IO.getCurrentDirectory.impl.v3 builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 321. -- ##IO.getEcho.impl.v1 + 325. -- ##IO.getEcho.impl.v1 builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 322. -- ##IO.getEnv.impl.v1 + 326. -- ##IO.getEnv.impl.v1 builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 323. -- ##IO.getFileSize.impl.v3 + 327. -- ##IO.getFileSize.impl.v3 builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 324. -- ##IO.getFileTimestamp.impl.v3 + 328. -- ##IO.getFileTimestamp.impl.v3 builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 325. -- ##IO.getLine.impl.v1 + 329. -- ##IO.getLine.impl.v1 builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 326. -- ##IO.getSomeBytes.impl.v1 + 330. -- ##IO.getSomeBytes.impl.v1 builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 327. -- ##IO.getTempDirectory.impl.v3 + 331. -- ##IO.getTempDirectory.impl.v3 builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 328. -- ##IO.handlePosition.impl.v3 + 332. -- ##IO.handlePosition.impl.v3 builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 329. -- ##IO.isDirectory.impl.v3 + 333. -- ##IO.isDirectory.impl.v3 builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 330. -- ##IO.isFileEOF.impl.v3 + 334. -- ##IO.isFileEOF.impl.v3 builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 331. -- ##IO.isFileOpen.impl.v3 + 335. -- ##IO.isFileOpen.impl.v3 builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 332. -- ##IO.isSeekable.impl.v3 + 336. -- ##IO.isSeekable.impl.v3 builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 333. -- ##IO.kill.impl.v3 + 337. -- ##IO.kill.impl.v3 builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 334. -- ##IO.listen.impl.v3 + 338. -- ##IO.listen.impl.v3 builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 335. -- ##IO.openFile.impl.v3 + 339. -- ##IO.openFile.impl.v3 builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 336. -- ##IO.putBytes.impl.v3 + 340. -- ##IO.putBytes.impl.v3 builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 337. -- ##IO.ready.impl.v1 + 341. -- ##IO.ready.impl.v1 builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 338. -- ##IO.ref + 342. -- ##IO.ref builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 339. -- ##IO.removeDirectory.impl.v3 + 343. -- ##IO.removeDirectory.impl.v3 builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 340. -- ##IO.removeFile.impl.v3 + 344. -- ##IO.removeFile.impl.v3 builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 341. -- ##IO.renameDirectory.impl.v3 + 345. -- ##IO.renameDirectory.impl.v3 builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 342. -- ##IO.renameFile.impl.v3 + 346. -- ##IO.renameFile.impl.v3 builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 343. -- ##IO.seekHandle.impl.v3 + 347. -- ##IO.seekHandle.impl.v3 builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 344. -- ##IO.serverSocket.impl.v3 + 348. -- ##IO.serverSocket.impl.v3 builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 345. -- ##IO.setBuffering.impl.v3 + 349. -- ##IO.setBuffering.impl.v3 builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 346. -- ##IO.setCurrentDirectory.impl.v3 + 350. -- ##IO.setCurrentDirectory.impl.v3 builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 347. -- ##IO.setEcho.impl.v1 + 351. -- ##IO.setEcho.impl.v1 builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 348. -- ##IO.socketAccept.impl.v3 + 352. -- ##IO.socketAccept.impl.v3 builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 349. -- ##IO.socketPort.impl.v3 + 353. -- ##IO.socketPort.impl.v3 builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 350. -- ##IO.socketReceive.impl.v3 + 354. -- ##IO.socketReceive.impl.v3 builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 351. -- ##IO.socketSend.impl.v3 + 355. -- ##IO.socketSend.impl.v3 builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 352. -- ##IO.stdHandle + 356. -- ##IO.stdHandle builtin.io2.IO.stdHandle : StdHandle -> Handle - 353. -- ##IO.systemTime.impl.v3 + 357. -- ##IO.systemTime.impl.v3 builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 354. -- ##IO.systemTimeMicroseconds.v1 + 358. -- ##IO.systemTimeMicroseconds.v1 builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 355. -- ##IO.tryEval + 359. -- ##IO.tryEval builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 356. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 + 360. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 unique type builtin.io2.IOError - 357. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 + 361. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 builtin.io2.IOError.AlreadyExists : IOError - 358. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 + 362. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 builtin.io2.IOError.EOF : IOError - 359. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 + 363. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 builtin.io2.IOError.IllegalOperation : IOError - 360. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 + 364. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 builtin.io2.IOError.NoSuchThing : IOError - 361. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 + 365. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 builtin.io2.IOError.PermissionDenied : IOError - 362. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 + 366. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 builtin.io2.IOError.ResourceBusy : IOError - 363. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 + 367. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 builtin.io2.IOError.ResourceExhausted : IOError - 364. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 + 368. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 builtin.io2.IOError.UserError : IOError - 365. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g + 369. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g unique type builtin.io2.IOFailure - 366. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg + 370. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg unique type builtin.io2.MiscFailure - 367. -- ##MVar + 371. -- ##MVar builtin type builtin.io2.MVar - 368. -- ##MVar.isEmpty + 372. -- ##MVar.isEmpty builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 369. -- ##MVar.new + 373. -- ##MVar.new builtin.io2.MVar.new : a ->{IO} MVar a - 370. -- ##MVar.newEmpty.v2 + 374. -- ##MVar.newEmpty.v2 builtin.io2.MVar.newEmpty : '{IO} MVar a - 371. -- ##MVar.put.impl.v3 + 375. -- ##MVar.put.impl.v3 builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 372. -- ##MVar.read.impl.v3 + 376. -- ##MVar.read.impl.v3 builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 373. -- ##MVar.swap.impl.v3 + 377. -- ##MVar.swap.impl.v3 builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 374. -- ##MVar.take.impl.v3 + 378. -- ##MVar.take.impl.v3 builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 375. -- ##MVar.tryPut.impl.v3 + 379. -- ##MVar.tryPut.impl.v3 builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 376. -- ##MVar.tryRead.impl.v3 + 380. -- ##MVar.tryRead.impl.v3 builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 377. -- ##MVar.tryTake + 381. -- ##MVar.tryTake builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 378. -- ##Promise + 382. -- ##Promise builtin type builtin.io2.Promise - 379. -- ##Promise.new + 383. -- ##Promise.new builtin.io2.Promise.new : '{IO} Promise a - 380. -- ##Promise.read + 384. -- ##Promise.read builtin.io2.Promise.read : Promise a ->{IO} a - 381. -- ##Promise.tryRead + 385. -- ##Promise.tryRead builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 382. -- ##Promise.write + 386. -- ##Promise.write builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 383. -- ##Ref.cas + 387. -- ##Ref.cas builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 384. -- ##Ref.readForCas + 388. -- ##Ref.readForCas builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 385. -- ##Ref.Ticket + 389. -- ##Ref.Ticket builtin type builtin.io2.Ref.Ticket - 386. -- ##Ref.Ticket.read + 390. -- ##Ref.Ticket.read builtin.io2.Ref.Ticket.read : Ticket a -> a - 387. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 + 391. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 unique type builtin.io2.RuntimeFailure - 388. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 + 392. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 unique type builtin.io2.SeekMode - 389. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 + 393. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 390. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 + 394. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 builtin.io2.SeekMode.RelativeSeek : SeekMode - 391. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 + 395. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 builtin.io2.SeekMode.SeekFromEnd : SeekMode - 392. -- ##Socket + 396. -- ##Socket builtin type builtin.io2.Socket - 393. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 + 397. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 unique type builtin.io2.StdHandle - 394. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 + 398. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 builtin.io2.StdHandle.StdErr : StdHandle - 395. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 + 399. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 builtin.io2.StdHandle.StdIn : StdHandle - 396. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 + 400. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 builtin.io2.StdHandle.StdOut : StdHandle - 397. -- ##STM + 401. -- ##STM builtin type builtin.io2.STM - 398. -- ##STM.atomically + 402. -- ##STM.atomically builtin.io2.STM.atomically : '{STM} a ->{IO} a - 399. -- ##STM.retry + 403. -- ##STM.retry builtin.io2.STM.retry : '{STM} a - 400. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g + 404. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g unique type builtin.io2.STMFailure - 401. -- ##ThreadId + 405. -- ##ThreadId builtin type builtin.io2.ThreadId - 402. -- ##Tls + 406. -- ##Tls builtin type builtin.io2.Tls - 403. -- ##Tls.Cipher + 407. -- ##Tls.Cipher builtin type builtin.io2.Tls.Cipher - 404. -- ##Tls.ClientConfig + 408. -- ##Tls.ClientConfig builtin type builtin.io2.Tls.ClientConfig - 405. -- ##Tls.ClientConfig.certificates.set + 409. -- ##Tls.ClientConfig.certificates.set builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 406. -- ##TLS.ClientConfig.ciphers.set + 410. -- ##TLS.ClientConfig.ciphers.set builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 407. -- ##Tls.ClientConfig.default + 411. -- ##Tls.ClientConfig.default builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 408. -- ##Tls.ClientConfig.versions.set + 412. -- ##Tls.ClientConfig.versions.set builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 409. -- ##Tls.decodeCert.impl.v3 + 413. -- ##Tls.decodeCert.impl.v3 builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 410. -- ##Tls.decodePrivateKey + 414. -- ##Tls.decodePrivateKey builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 411. -- ##Tls.encodeCert + 415. -- ##Tls.encodeCert builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 412. -- ##Tls.encodePrivateKey + 416. -- ##Tls.encodePrivateKey builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 413. -- ##Tls.handshake.impl.v3 + 417. -- ##Tls.handshake.impl.v3 builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 414. -- ##Tls.newClient.impl.v3 + 418. -- ##Tls.newClient.impl.v3 builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 415. -- ##Tls.newServer.impl.v3 + 419. -- ##Tls.newServer.impl.v3 builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 416. -- ##Tls.PrivateKey + 420. -- ##Tls.PrivateKey builtin type builtin.io2.Tls.PrivateKey - 417. -- ##Tls.receive.impl.v3 + 421. -- ##Tls.receive.impl.v3 builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 418. -- ##Tls.send.impl.v3 + 422. -- ##Tls.send.impl.v3 builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 419. -- ##Tls.ServerConfig + 423. -- ##Tls.ServerConfig builtin type builtin.io2.Tls.ServerConfig - 420. -- ##Tls.ServerConfig.certificates.set + 424. -- ##Tls.ServerConfig.certificates.set builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 421. -- ##Tls.ServerConfig.ciphers.set + 425. -- ##Tls.ServerConfig.ciphers.set builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 422. -- ##Tls.ServerConfig.default + 426. -- ##Tls.ServerConfig.default builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 423. -- ##Tls.ServerConfig.versions.set + 427. -- ##Tls.ServerConfig.versions.set builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 424. -- ##Tls.SignedCert + 428. -- ##Tls.SignedCert builtin type builtin.io2.Tls.SignedCert - 425. -- ##Tls.terminate.impl.v3 + 429. -- ##Tls.terminate.impl.v3 builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 426. -- ##Tls.Version + 430. -- ##Tls.Version builtin type builtin.io2.Tls.Version - 427. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + 431. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 unique type builtin.io2.TlsFailure - 428. -- ##TVar + 432. -- ##TVar builtin type builtin.io2.TVar - 429. -- ##TVar.new + 433. -- ##TVar.new builtin.io2.TVar.new : a ->{STM} TVar a - 430. -- ##TVar.newIO + 434. -- ##TVar.newIO builtin.io2.TVar.newIO : a ->{IO} TVar a - 431. -- ##TVar.read + 435. -- ##TVar.read builtin.io2.TVar.read : TVar a ->{STM} a - 432. -- ##TVar.readIO + 436. -- ##TVar.readIO builtin.io2.TVar.readIO : TVar a ->{IO} a - 433. -- ##TVar.swap + 437. -- ##TVar.swap builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 434. -- ##TVar.write + 438. -- ##TVar.write builtin.io2.TVar.write : TVar a -> a ->{STM} () - 435. -- ##validateSandboxed + 439. -- ##validateSandboxed builtin.io2.validateSandboxed : [Link.Term] -> a -> Boolean - 436. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + 440. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 unique type builtin.IsPropagated - 437. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + 441. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 builtin.IsPropagated.IsPropagated : IsPropagated - 438. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + 442. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 unique type builtin.IsTest - 439. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + 443. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 builtin.IsTest.IsTest : IsTest - 440. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + 444. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g unique type builtin.License - 441. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + 445. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 builtin.License.copyrightHolders : License -> [CopyrightHolder] - 442. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + 446. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo builtin.License.copyrightHolders.modify : ([CopyrightHolder] ->{g} [CopyrightHolder]) -> License ->{g} License - 443. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + 447. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro builtin.License.copyrightHolders.set : [CopyrightHolder] -> License -> License - 444. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + 448. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 builtin.License.License : [CopyrightHolder] -> [Year] -> LicenseType -> License - 445. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + 449. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g builtin.License.licenseType : License -> LicenseType - 446. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + 450. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo builtin.License.licenseType.modify : (LicenseType ->{g} LicenseType) -> License ->{g} License - 447. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + 451. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o builtin.License.licenseType.set : LicenseType -> License -> License - 448. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + 452. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig builtin.License.years : License -> [Year] - 449. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + 453. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 builtin.License.years.modify : ([Year] ->{g} [Year]) -> License ->{g} License - 450. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + 454. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo builtin.License.years.set : [Year] -> License -> License - 451. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + 455. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 unique type builtin.LicenseType - 452. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + 456. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 builtin.LicenseType.LicenseType : Doc -> LicenseType - 453. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + 457. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 unique type builtin.Link - 454. -- ##Link.Term + 458. -- ##Link.Term builtin type builtin.Link.Term - 455. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + 459. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 builtin.Link.Term : Link.Term -> Link - 456. -- ##Link.Term.toText + 460. -- ##Link.Term.toText builtin.Link.Term.toText : Link.Term -> Text - 457. -- ##Link.Type + 461. -- ##Link.Type builtin type builtin.Link.Type - 458. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + 462. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 builtin.Link.Type : Type -> Link - 459. -- ##Sequence + 463. -- ##Sequence builtin type builtin.List - 460. -- ##List.++ + 464. -- ##List.++ builtin.List.++ : [a] -> [a] -> [a] - 461. -- ##List.cons + 465. -- ##List.cons builtin.List.+:, builtin.List.cons : a -> [a] -> [a] - 462. -- ##List.snoc + 466. -- ##List.snoc builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] - 463. -- ##List.at + 467. -- ##List.at builtin.List.at : Nat -> [a] -> Optional a - 464. -- ##List.cons + 468. -- ##List.cons builtin.List.cons, builtin.List.+: : a -> [a] -> [a] - 465. -- ##List.drop + 469. -- ##List.drop builtin.List.drop : Nat -> [a] -> [a] - 466. -- ##List.empty + 470. -- ##List.empty builtin.List.empty : [a] - 467. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + 471. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] - 468. -- ##List.size + 472. -- ##List.size builtin.List.size : [a] -> Nat - 469. -- ##List.snoc + 473. -- ##List.snoc builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] - 470. -- ##List.take + 474. -- ##List.take builtin.List.take : Nat -> [a] -> [a] - 471. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + 475. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g builtin.metadata.isPropagated : IsPropagated - 472. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + 476. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko builtin.metadata.isTest : IsTest - 473. -- ##MutableArray + 477. -- ##MutableArray builtin type builtin.MutableArray - 474. -- ##MutableArray.copyTo! + 478. -- ##MutableArray.copyTo! builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a @@ -1666,34 +1679,34 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 475. -- ##MutableArray.freeze + 479. -- ##MutableArray.freeze builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 476. -- ##MutableArray.freeze! + 480. -- ##MutableArray.freeze! builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 477. -- ##MutableArray.read + 481. -- ##MutableArray.read builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 478. -- ##MutableArray.size + 482. -- ##MutableArray.size builtin.MutableArray.size : MutableArray g a -> Nat - 479. -- ##MutableArray.write + 483. -- ##MutableArray.write builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 480. -- ##MutableByteArray + 484. -- ##MutableByteArray builtin type builtin.MutableByteArray - 481. -- ##MutableByteArray.copyTo! + 485. -- ##MutableByteArray.copyTo! builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g @@ -1701,682 +1714,682 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 482. -- ##MutableByteArray.freeze + 486. -- ##MutableByteArray.freeze builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 483. -- ##MutableByteArray.freeze! + 487. -- ##MutableByteArray.freeze! builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 484. -- ##MutableByteArray.read16be + 488. -- ##MutableByteArray.read16be builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 485. -- ##MutableByteArray.read24be + 489. -- ##MutableByteArray.read24be builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 486. -- ##MutableByteArray.read32be + 490. -- ##MutableByteArray.read32be builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 487. -- ##MutableByteArray.read40be + 491. -- ##MutableByteArray.read40be builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 488. -- ##MutableByteArray.read64be + 492. -- ##MutableByteArray.read64be builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 489. -- ##MutableByteArray.read8 + 493. -- ##MutableByteArray.read8 builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 490. -- ##MutableByteArray.size + 494. -- ##MutableByteArray.size builtin.MutableByteArray.size : MutableByteArray g -> Nat - 491. -- ##MutableByteArray.write16be + 495. -- ##MutableByteArray.write16be builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 492. -- ##MutableByteArray.write32be + 496. -- ##MutableByteArray.write32be builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 493. -- ##MutableByteArray.write64be + 497. -- ##MutableByteArray.write64be builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 494. -- ##MutableByteArray.write8 + 498. -- ##MutableByteArray.write8 builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 495. -- ##Nat + 499. -- ##Nat builtin type builtin.Nat - 496. -- ##Nat.* + 500. -- ##Nat.* builtin.Nat.* : Nat -> Nat -> Nat - 497. -- ##Nat.+ + 501. -- ##Nat.+ builtin.Nat.+ : Nat -> Nat -> Nat - 498. -- ##Nat./ + 502. -- ##Nat./ builtin.Nat./ : Nat -> Nat -> Nat - 499. -- ##Nat.and + 503. -- ##Nat.and builtin.Nat.and : Nat -> Nat -> Nat - 500. -- ##Nat.complement + 504. -- ##Nat.complement builtin.Nat.complement : Nat -> Nat - 501. -- ##Nat.drop + 505. -- ##Nat.drop builtin.Nat.drop : Nat -> Nat -> Nat - 502. -- ##Nat.== + 506. -- ##Nat.== builtin.Nat.eq : Nat -> Nat -> Boolean - 503. -- ##Nat.fromText + 507. -- ##Nat.fromText builtin.Nat.fromText : Text -> Optional Nat - 504. -- ##Nat.> + 508. -- ##Nat.> builtin.Nat.gt : Nat -> Nat -> Boolean - 505. -- ##Nat.>= + 509. -- ##Nat.>= builtin.Nat.gteq : Nat -> Nat -> Boolean - 506. -- ##Nat.increment + 510. -- ##Nat.increment builtin.Nat.increment : Nat -> Nat - 507. -- ##Nat.isEven + 511. -- ##Nat.isEven builtin.Nat.isEven : Nat -> Boolean - 508. -- ##Nat.isOdd + 512. -- ##Nat.isOdd builtin.Nat.isOdd : Nat -> Boolean - 509. -- ##Nat.leadingZeros + 513. -- ##Nat.leadingZeros builtin.Nat.leadingZeros : Nat -> Nat - 510. -- ##Nat.< + 514. -- ##Nat.< builtin.Nat.lt : Nat -> Nat -> Boolean - 511. -- ##Nat.<= + 515. -- ##Nat.<= builtin.Nat.lteq : Nat -> Nat -> Boolean - 512. -- ##Nat.mod + 516. -- ##Nat.mod builtin.Nat.mod : Nat -> Nat -> Nat - 513. -- ##Nat.or + 517. -- ##Nat.or builtin.Nat.or : Nat -> Nat -> Nat - 514. -- ##Nat.popCount + 518. -- ##Nat.popCount builtin.Nat.popCount : Nat -> Nat - 515. -- ##Nat.pow + 519. -- ##Nat.pow builtin.Nat.pow : Nat -> Nat -> Nat - 516. -- ##Nat.shiftLeft + 520. -- ##Nat.shiftLeft builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 517. -- ##Nat.shiftRight + 521. -- ##Nat.shiftRight builtin.Nat.shiftRight : Nat -> Nat -> Nat - 518. -- ##Nat.sub + 522. -- ##Nat.sub builtin.Nat.sub : Nat -> Nat -> Int - 519. -- ##Nat.toFloat + 523. -- ##Nat.toFloat builtin.Nat.toFloat : Nat -> Float - 520. -- ##Nat.toInt + 524. -- ##Nat.toInt builtin.Nat.toInt : Nat -> Int - 521. -- ##Nat.toText + 525. -- ##Nat.toText builtin.Nat.toText : Nat -> Text - 522. -- ##Nat.trailingZeros + 526. -- ##Nat.trailingZeros builtin.Nat.trailingZeros : Nat -> Nat - 523. -- ##Nat.xor + 527. -- ##Nat.xor builtin.Nat.xor : Nat -> Nat -> Nat - 524. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + 528. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg structural type builtin.Optional a - 525. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + 529. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 builtin.Optional.None : Optional a - 526. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + 530. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 builtin.Optional.Some : a -> Optional a - 527. -- ##Pattern + 531. -- ##Pattern builtin type builtin.Pattern - 528. -- ##Pattern.capture + 532. -- ##Pattern.capture builtin.Pattern.capture : Pattern a -> Pattern a - 529. -- ##Pattern.isMatch + 533. -- ##Pattern.isMatch builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 530. -- ##Pattern.join + 534. -- ##Pattern.join builtin.Pattern.join : [Pattern a] -> Pattern a - 531. -- ##Pattern.many + 535. -- ##Pattern.many builtin.Pattern.many : Pattern a -> Pattern a - 532. -- ##Pattern.or + 536. -- ##Pattern.or builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 533. -- ##Pattern.replicate + 537. -- ##Pattern.replicate builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 534. -- ##Pattern.run + 538. -- ##Pattern.run builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) - 535. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + 539. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg structural type builtin.Pretty txt - 536. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + 540. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 unique type builtin.Pretty.Annotated w txt - 537. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + 541. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 builtin.Pretty.Annotated.Append : w -> [Annotated w txt] -> Annotated w txt - 538. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + 542. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 builtin.Pretty.Annotated.Empty : Annotated w txt - 539. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + 543. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 builtin.Pretty.Annotated.Group : w -> Annotated w txt -> Annotated w txt - 540. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + 544. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 builtin.Pretty.Annotated.Indent : w -> Annotated w txt -> Annotated w txt -> Annotated w txt -> Annotated w txt - 541. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + 545. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 builtin.Pretty.Annotated.Lit : w -> txt -> Annotated w txt - 542. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + 546. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 builtin.Pretty.Annotated.OrElse : w -> Annotated w txt -> Annotated w txt -> Annotated w txt - 543. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + 547. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 builtin.Pretty.Annotated.Table : w -> [[Annotated w txt]] -> Annotated w txt - 544. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + 548. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 builtin.Pretty.Annotated.Wrap : w -> Annotated w txt -> Annotated w txt - 545. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + 549. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg builtin.Pretty.append : Pretty txt -> Pretty txt -> Pretty txt - 546. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + 550. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 builtin.Pretty.empty : Pretty txt - 547. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + 551. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo builtin.Pretty.get : Pretty txt -> Annotated () txt - 548. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + 552. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 builtin.Pretty.group : Pretty txt -> Pretty txt - 549. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + 553. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno builtin.Pretty.indent : Pretty txt -> Pretty txt -> Pretty txt - 550. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + 554. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug builtin.Pretty.indent' : Pretty txt -> Pretty txt -> Pretty txt -> Pretty txt - 551. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + 555. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo builtin.Pretty.join : [Pretty txt] -> Pretty txt - 552. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + 556. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 553. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + 557. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 - 554. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + 558. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 builtin.Pretty.orElse : Pretty txt -> Pretty txt -> Pretty txt - 555. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + 559. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 builtin.Pretty.Pretty : Annotated () txt -> Pretty txt - 556. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + 560. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g builtin.Pretty.sepBy : Pretty txt -> [Pretty txt] -> Pretty txt - 557. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + 561. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro builtin.Pretty.table : [[Pretty txt]] -> Pretty txt - 558. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + 562. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 builtin.Pretty.wrap : Pretty txt -> Pretty txt - 559. -- ##Ref + 563. -- ##Ref builtin type builtin.Ref - 560. -- ##Ref.read + 564. -- ##Ref.read builtin.Ref.read : Ref g a ->{g} a - 561. -- ##Ref.write + 565. -- ##Ref.write builtin.Ref.write : Ref g a -> a ->{g} () - 562. -- ##Effect + 566. -- ##Effect builtin type builtin.Request - 563. -- ##Scope + 567. -- ##Scope builtin type builtin.Scope - 564. -- ##Scope.array + 568. -- ##Scope.array builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 565. -- ##Scope.arrayOf + 569. -- ##Scope.arrayOf builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 566. -- ##Scope.bytearray + 570. -- ##Scope.bytearray builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 567. -- ##Scope.bytearrayOf + 571. -- ##Scope.bytearrayOf builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 568. -- ##Scope.ref + 572. -- ##Scope.ref builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 569. -- ##Scope.run + 573. -- ##Scope.run builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 570. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + 574. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 structural type builtin.SeqView a b - 571. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + 575. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 builtin.SeqView.VElem : a -> b -> SeqView a b - 572. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + 576. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 builtin.SeqView.VEmpty : SeqView a b - 573. -- ##Socket.toText + 577. -- ##Socket.toText builtin.Socket.toText : Socket -> Text - 574. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + 578. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo builtin.syntax.docAside : Doc2 -> Doc2 - 575. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + 579. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 builtin.syntax.docBlockquote : Doc2 -> Doc2 - 576. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + 580. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 builtin.syntax.docBold : Doc2 -> Doc2 - 577. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + 581. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg builtin.syntax.docBulletedList : [Doc2] -> Doc2 - 578. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + 582. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 - 579. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + 583. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo builtin.syntax.docCode : Doc2 -> Doc2 - 580. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + 584. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 builtin.syntax.docCodeBlock : Text -> Text -> Doc2 - 581. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + 585. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 builtin.syntax.docColumn : [Doc2] -> Doc2 - 582. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + 586. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term - 583. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + 587. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg builtin.syntax.docEmbedAnnotations : tms -> tms - 584. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + 588. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 builtin.syntax.docEmbedSignatureLink : '{g} t -> Doc2.Term - 585. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + 589. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao builtin.syntax.docEmbedTermLink : '{g} t -> Either a Doc2.Term - 586. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + 590. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 builtin.syntax.docEmbedTypeLink : typ -> Either typ b - 587. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + 591. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg builtin.syntax.docEval : 'a -> Doc2 - 588. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + 592. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g builtin.syntax.docEvalInline : 'a -> Doc2 - 589. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + 593. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 builtin.syntax.docExample : Nat -> '{g} t -> Doc2 - 590. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + 594. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 - 591. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + 595. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 592. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + 596. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) - 593. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + 597. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 builtin.syntax.docGroup : Doc2 -> Doc2 - 594. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + 598. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 builtin.syntax.docItalic : Doc2 -> Doc2 - 595. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + 599. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 builtin.syntax.docJoin : [Doc2] -> Doc2 - 596. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + 600. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 - 597. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + 601. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 - 598. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + 602. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 - 599. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + 603. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 builtin.syntax.docParagraph : [Doc2] -> Doc2 - 600. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + 604. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 - 601. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + 605. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 builtin.syntax.docSignature : [Doc2.Term] -> Doc2 - 602. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + 606. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 - 603. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + 607. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 builtin.syntax.docSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 604. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + 608. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 builtin.syntax.docSourceElement : link -> annotations -> (link, annotations) - 605. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + 609. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag builtin.syntax.docStrikethrough : Doc2 -> Doc2 - 606. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + 610. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g builtin.syntax.docTable : [[Doc2]] -> Doc2 - 607. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + 611. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 - 608. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + 612. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 builtin.syntax.docTransclude : d -> d - 609. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + 613. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 builtin.syntax.docUntitledSection : [Doc2] -> Doc2 - 610. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + 614. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo builtin.syntax.docVerbatim : Doc2 -> Doc2 - 611. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + 615. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 builtin.syntax.docWord : Text -> Doc2 - 612. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + 616. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 unique type builtin.Test.Result - 613. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + 617. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 builtin.Test.Result.Fail : Text -> Result - 614. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + 618. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 builtin.Test.Result.Ok : Text -> Result - 615. -- ##Text + 619. -- ##Text builtin type builtin.Text - 616. -- ##Text.!= + 620. -- ##Text.!= builtin.Text.!= : Text -> Text -> Boolean - 617. -- ##Text.++ + 621. -- ##Text.++ builtin.Text.++ : Text -> Text -> Text - 618. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + 622. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text - 619. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + 623. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg builtin.Text.alignRightWith : Nat -> Char -> Text -> Text - 620. -- ##Text.drop + 624. -- ##Text.drop builtin.Text.drop : Nat -> Text -> Text - 621. -- ##Text.empty + 625. -- ##Text.empty builtin.Text.empty : Text - 622. -- ##Text.== + 626. -- ##Text.== builtin.Text.eq : Text -> Text -> Boolean - 623. -- ##Text.fromCharList + 627. -- ##Text.fromCharList builtin.Text.fromCharList : [Char] -> Text - 624. -- ##Text.fromUtf8.impl.v3 + 628. -- ##Text.fromUtf8.impl.v3 builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 625. -- ##Text.> + 629. -- ##Text.> builtin.Text.gt : Text -> Text -> Boolean - 626. -- ##Text.>= + 630. -- ##Text.>= builtin.Text.gteq : Text -> Text -> Boolean - 627. -- ##Text.< + 631. -- ##Text.< builtin.Text.lt : Text -> Text -> Boolean - 628. -- ##Text.<= + 632. -- ##Text.<= builtin.Text.lteq : Text -> Text -> Boolean - 629. -- ##Text.patterns.anyChar + 633. -- ##Text.patterns.anyChar builtin.Text.patterns.anyChar : Pattern Text - 630. -- ##Text.patterns.charIn + 634. -- ##Text.patterns.charIn builtin.Text.patterns.charIn : [Char] -> Pattern Text - 631. -- ##Text.patterns.charRange + 635. -- ##Text.patterns.charRange builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 632. -- ##Text.patterns.digit + 636. -- ##Text.patterns.digit builtin.Text.patterns.digit : Pattern Text - 633. -- ##Text.patterns.eof + 637. -- ##Text.patterns.eof builtin.Text.patterns.eof : Pattern Text - 634. -- ##Text.patterns.letter + 638. -- ##Text.patterns.letter builtin.Text.patterns.letter : Pattern Text - 635. -- ##Text.patterns.literal + 639. -- ##Text.patterns.literal builtin.Text.patterns.literal : Text -> Pattern Text - 636. -- ##Text.patterns.notCharIn + 640. -- ##Text.patterns.notCharIn builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 637. -- ##Text.patterns.notCharRange + 641. -- ##Text.patterns.notCharRange builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 638. -- ##Text.patterns.punctuation + 642. -- ##Text.patterns.punctuation builtin.Text.patterns.punctuation : Pattern Text - 639. -- ##Text.patterns.space + 643. -- ##Text.patterns.space builtin.Text.patterns.space : Pattern Text - 640. -- ##Text.repeat + 644. -- ##Text.repeat builtin.Text.repeat : Nat -> Text -> Text - 641. -- ##Text.reverse + 645. -- ##Text.reverse builtin.Text.reverse : Text -> Text - 642. -- ##Text.size + 646. -- ##Text.size builtin.Text.size : Text -> Nat - 643. -- ##Text.take + 647. -- ##Text.take builtin.Text.take : Nat -> Text -> Text - 644. -- ##Text.toCharList + 648. -- ##Text.toCharList builtin.Text.toCharList : Text -> [Char] - 645. -- ##Text.toLowercase + 649. -- ##Text.toLowercase builtin.Text.toLowercase : Text -> Text - 646. -- ##Text.toUppercase + 650. -- ##Text.toUppercase builtin.Text.toUppercase : Text -> Text - 647. -- ##Text.toUtf8 + 651. -- ##Text.toUtf8 builtin.Text.toUtf8 : Text -> Bytes - 648. -- ##Text.uncons + 652. -- ##Text.uncons builtin.Text.uncons : Text -> Optional (Char, Text) - 649. -- ##Text.unsnoc + 653. -- ##Text.unsnoc builtin.Text.unsnoc : Text -> Optional (Text, Char) - 650. -- ##ThreadId.toText + 654. -- ##ThreadId.toText builtin.ThreadId.toText : ThreadId -> Text - 651. -- ##todo + 655. -- ##todo builtin.todo : a -> b - 652. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + 656. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 structural type builtin.Tuple a b - 653. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + 657. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 builtin.Tuple.Cons : a -> b -> Tuple a b - 654. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + 658. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g structural type builtin.Unit - 655. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + 659. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 builtin.Unit.Unit : () - 656. -- ##Universal.< + 660. -- ##Universal.< builtin.Universal.< : a -> a -> Boolean - 657. -- ##Universal.<= + 661. -- ##Universal.<= builtin.Universal.<= : a -> a -> Boolean - 658. -- ##Universal.== + 662. -- ##Universal.== builtin.Universal.== : a -> a -> Boolean - 659. -- ##Universal.> + 663. -- ##Universal.> builtin.Universal.> : a -> a -> Boolean - 660. -- ##Universal.>= + 664. -- ##Universal.>= builtin.Universal.>= : a -> a -> Boolean - 661. -- ##Universal.compare + 665. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 662. -- ##unsafe.coerceAbilities + 666. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 663. -- ##Value + 667. -- ##Value builtin type builtin.Value - 664. -- ##Value.dependencies + 668. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 665. -- ##Value.deserialize + 669. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 666. -- ##Value.load + 670. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 667. -- ##Value.serialize + 671. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 668. -- ##Value.value + 672. -- ##Value.value builtin.Value.value : a -> Value - 669. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 673. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 670. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 674. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 671. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 675. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 672. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 676. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 673. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 677. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 674. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 678. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 675. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 679. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 676. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 680. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 677. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 681. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 678. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 682. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 679. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 683. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2384,7 +2397,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 680. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 684. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2393,318 +2406,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 681. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 685. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 682. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 686. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 683. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 687. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 684. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 688. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 685. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 689. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 686. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 690. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 687. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 691. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 688. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 692. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 689. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 693. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 690. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 694. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 691. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 695. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 692. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 696. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 693. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 697. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 694. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 698. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 695. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 699. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 696. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 700. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 697. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 701. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 698. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 702. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 699. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 703. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 700. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 704. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 701. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 705. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 702. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 706. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 703. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 707. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 704. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 708. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 705. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 709. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 706. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 710. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 707. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 711. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 708. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 712. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 709. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 713. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 710. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 714. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 711. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 715. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 712. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 716. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 713. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 717. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 714. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 718. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 715. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 719. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 716. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 720. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 717. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 721. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 718. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 722. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 719. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 723. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 720. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 724. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 721. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 725. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 722. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 726. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 723. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 727. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 724. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 728. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 725. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 729. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 726. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 730. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 727. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 731. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 728. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 732. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 729. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 733. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 730. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 734. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 731. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 735. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 732. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 736. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 733. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 737. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 734. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 738. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 735. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 739. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 736. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 740. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 737. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 741. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 738. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 742. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 739. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 743. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 740. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 744. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 741. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 745. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 742. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 746. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 743. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 747. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 744. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 748. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 745. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 749. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o saveSelfContained : a -> Text ->{IO, Exception} () - 746. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 750. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 747. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 751. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 748. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 752. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 749. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 753. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 750. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 754. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 751. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 755. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 752. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 756. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 753. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 757. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 754. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 758. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 755. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 759. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 756. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 760. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 757. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 761. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 758. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 762. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 759. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 763. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 760. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 764. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 761. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 765. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 762. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 766. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 763. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 767. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 764. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 768. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 765. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 769. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 766. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 770. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 767. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 771. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 768. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 772. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 769. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 773. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 770. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 774. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 771. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 775. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 772. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 776. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 773. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 777. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 774. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 778. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 775. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 779. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 776. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 780. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index af0e59a94..a07ce47e7 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (583 terms, 79 types) + 1. builtin/ (585 terms, 81 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 9d5534fa3..c72d5c210 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -267,7 +267,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (588 terms, 80 types) + 1. root/ (590 terms, 82 types) .> history @@ -276,13 +276,13 @@ I should be able to move the root into a sub-namespace - □ 1. #3rt95kasco (start of history) + □ 1. #6rt8346pgk (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (583 terms, 79 types) + 1. builtin/ (585 terms, 81 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -292,7 +292,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #9h5q2s97j1 + ⊙ 1. #nkpiat6fir - Deletes: @@ -303,7 +303,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #uc76cu49n5 + ⊙ 2. #qruojhp1a6 + Adds / updates: @@ -315,26 +315,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #p0i5leprku + ⊙ 3. #g76hq3494q + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #6653phkspu + ⊙ 4. #b6bsk3crl0 > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #96s54m0o9q + ⊙ 5. #3j8cm8skfr - Deletes: history.b.termInB - ⊙ 6. #kdt1ubsjvc + ⊙ 6. #gtfgn9hlqs + Adds / updates: @@ -345,13 +345,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #ilms0te7e9 + ⊙ 7. #vqk9u7c2ju + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #s4rrj4ar8p + ⊙ 8. #4ss43oa5hr > Moves: @@ -361,7 +361,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #neo6d1tqh5 + ⊙ 9. #ocino6ar91 + Adds / updates: @@ -371,7 +371,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #u3uo460daa + ⊙ 10. #dh39ksk0rm + Adds / updates: @@ -383,7 +383,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #bqq857tsem + ⊙ 11. #apndr0gb5o ``` From 03474ac2b0befb03288eca005e116d539f9f4265 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 23 Jan 2023 15:04:52 -0500 Subject: [PATCH 104/467] Add a Debug.toText builtin - This reworks the Debug.trace machinery to allow getting just the text that would be shown for a value. Instead of carrying a tracing function in the runtime, a function that generates the (annotated) text is used, and the logic for printing it is moved to the runtime itself. - Also, a primitive instruction is available for getting at the text. It has three possible results: * None - the tracer is completely off * Some (Left txt) - an 'ugly' textual representation * Some (Right txt) - a 'pretty' textual representation --- parser-typechecker/src/Unison/Builtin.hs | 2 + parser-typechecker/src/Unison/Runtime/ANF.hs | 1 + .../src/Unison/Runtime/ANF/Serialize.hs | 1 + .../src/Unison/Runtime/Builtin.hs | 12 ++++++ .../src/Unison/Runtime/Interface.hs | 22 +++++------ .../src/Unison/Runtime/MCode.hs | 7 +++- .../src/Unison/Runtime/Machine.hs | 38 +++++++++++++++++-- .../src/Unison/Runtime/Serialize.hs | 2 + 8 files changed, 66 insertions(+), 19 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index b6afe0b13..a5f6eb20b 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -548,6 +548,8 @@ builtinsSrc = B "ThreadId.toText" $ threadId --> text, B "Debug.watch" $ forall1 "a" (\a -> text --> a --> a), B "Debug.trace" $ forall1 "a" (\a -> text --> a --> unit), + B "Debug.toText" $ + forall1 "a" (\a -> a --> optionalt (eithert text text)), B "unsafe.coerceAbilities" $ forall4 "a" "b" "e1" "e2" $ \a b e1 e2 -> (a --> Type.effect1 () e1 b) --> (a --> Type.effect1 () e2 b), diff --git a/parser-typechecker/src/Unison/Runtime/ANF.hs b/parser-typechecker/src/Unison/Runtime/ANF.hs index 52f3aafb3..a7b8c1be5 100644 --- a/parser-typechecker/src/Unison/Runtime/ANF.hs +++ b/parser-typechecker/src/Unison/Runtime/ANF.hs @@ -1301,6 +1301,7 @@ data POp | PRNT | INFO | TRCE + | DBTX | -- STM ATOM | TFRC -- try force diff --git a/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs b/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs index 201335dcb..93e405070 100644 --- a/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs @@ -549,6 +549,7 @@ pOpCode op = case op of TRCE -> 116 ATOM -> 117 TFRC -> 118 + DBTX -> 119 pOpAssoc :: [(POp, Word16)] pOpAssoc = map (\op -> (op, pOpCode op)) [minBound .. maxBound] diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 948c3406e..35b2618ac 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -880,6 +880,17 @@ gen'trace = TLets Direct [] [] (TPrm TRCE [t, v]) $ TCon Ty.unitRef 0 [] +debug'text :: SuperNormal Symbol +debug'text = + unop0 3 $ \[c,r,t,e] -> + TLetD r UN (TPrm DBTX [c]) . + TMatch r . MatchSum $ + mapFromList [ + (0, ([], none)), + (1, ([BX], TAbs t . TLetD e BX (left t) $ some e)), + (2, ([BX], TAbs t . TLetD e BX (right t) $ some e)) + ] + code'missing :: SuperNormal Symbol code'missing = unop0 1 $ \[link, b] -> @@ -1922,6 +1933,7 @@ builtinLookup = ("todo", (Untracked, bug "builtin.todo")), ("Debug.watch", (Tracked, watch)), ("Debug.trace", (Tracked, gen'trace)), + ("Debug.toText", (Tracked, debug'text)), ("unsafe.coerceAbilities", (Untracked, poly'coerce)), ("Char.toNat", (Untracked, cast Ty.charRef Ty.natRef)), ("Char.fromNat", (Untracked, cast Ty.natRef Ty.charRef)), diff --git a/parser-typechecker/src/Unison/Runtime/Interface.hs b/parser-typechecker/src/Unison/Runtime/Interface.hs index 57c7808dc..b9eb97c98 100644 --- a/parser-typechecker/src/Unison/Runtime/Interface.hs +++ b/parser-typechecker/src/Unison/Runtime/Interface.hs @@ -77,6 +77,7 @@ import Unison.Runtime.MCode import Unison.Runtime.MCode.Serialize import Unison.Runtime.Machine ( ActiveThreads, + Tracer (..), CCache (..), apply0, baseCCache, @@ -99,7 +100,6 @@ import Unison.Syntax.TermPrinter import qualified Unison.Term as Tm import Unison.Util.EnumContainers as EC import Unison.Util.Pretty as P -import qualified Unison.Util.Text as UT import qualified UnliftIO import qualified UnliftIO.Concurrent as UnliftIO @@ -366,20 +366,18 @@ evalInContext ppe ctx activeThreads w = do prettyError (PE _ p) = p prettyError (BU tr nm c) = either id (bugMsg ppe tr nm) $ decom c - tr tx c = case decom c of - Right dv -> do - putStrLn $ "trace: " ++ UT.unpack tx - putStrLn . toANSI 50 $ pretty ppe dv - Left _ -> do - putStrLn $ "trace: " ++ UT.unpack tx - putStrLn "Couldn't decompile value." - print c + debugText fancy c = case decom c of + Right dv -> SimpleTrace . fmt $ pretty ppe dv + Left _ -> MsgTrace ("Couldn't decompile value") (show c) + where + fmt | fancy = toANSI 50 + | otherwise = toPlain 50 result <- traverse (const $ readIORef r) . first prettyError <=< try - $ apply0 (Just hook) ((ccache ctx) {tracer = tr}) activeThreads w + $ apply0 (Just hook) ((ccache ctx) {tracer = debugText}) activeThreads w pure $ decom =<< result executeMainComb :: @@ -618,9 +616,7 @@ restoreCache (SCache cs crs trs ftm fty int rtm rty sbs) = <*> newTVarIO (rty <> builtinTypeNumbering) <*> newTVarIO (sbs <> baseSandboxInfo) where - uglyTrace tx c = do - putStrLn $ "trace: " ++ UT.unpack tx - print c + uglyTrace _ c = SimpleTrace $ show c rns = emptyRNs {dnum = refLookup "ty" builtinTypeNumbering} rf k = builtinTermBackref ! k combs = diff --git a/parser-typechecker/src/Unison/Runtime/MCode.hs b/parser-typechecker/src/Unison/Runtime/MCode.hs index 3c5c05514..ec1c8a8e2 100644 --- a/parser-typechecker/src/Unison/Runtime/MCode.hs +++ b/parser-typechecker/src/Unison/Runtime/MCode.hs @@ -387,6 +387,8 @@ data BPrim1 | CVLD -- validate | VALU | TLTT -- value, Term.Link.toText + -- debug + | DBTX -- debug text deriving (Show, Eq, Ord) data BPrim2 @@ -415,8 +417,8 @@ data BPrim2 | IDXB | CATB -- take,drop,index,append -- general - | THRO - | TRCE -- throw + | THRO -- throw + | TRCE -- trace -- code | SDBX -- sandbox deriving (Show, Eq, Ord) @@ -1176,6 +1178,7 @@ emitPOp ANF.SDBX = emitBP2 SDBX -- error call emitPOp ANF.EROR = emitBP2 THRO emitPOp ANF.TRCE = emitBP2 TRCE +emitPOp ANF.DBTX = emitBP1 DBTX -- non-prim translations emitPOp ANF.BLDS = Seq emitPOp ANF.FORK = \case diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index 9ad0c4557..d4aab56fd 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -51,7 +51,6 @@ import qualified Unison.Type as Rf import qualified Unison.Util.Bytes as By import Unison.Util.EnumContainers as EC import Unison.Util.Pretty (toPlainUnbroken) -import Unison.Util.Text (Text) import qualified Unison.Util.Text as Util.Text import UnliftIO (IORef) import qualified UnliftIO @@ -69,11 +68,16 @@ type Tag = Word64 -- dynamic environment type DEnv = EnumMap Word64 Closure +data Tracer + = NoTrace + | MsgTrace String String + | SimpleTrace String + -- code caching environment data CCache = CCache { foreignFuncs :: EnumMap Word64 ForeignFunc, sandboxed :: Bool, - tracer :: Unison.Util.Text.Text -> Closure -> IO (), + tracer :: Bool -> Closure -> Tracer, combs :: TVar (EnumMap Word64 Combs), combRefs :: TVar (EnumMap Word64 Reference), tagRefs :: TVar (EnumMap Word64 Reference), @@ -120,7 +124,7 @@ baseCCache sandboxed = do <*> newTVarIO baseSandboxInfo where ffuncs | sandboxed = sandboxedForeigns | otherwise = builtinForeigns - noTrace _ _ = pure () + noTrace _ _ = NoTrace ftm = 1 + maximum builtinTermNumbering fty = 1 + maximum builtinTypeNumbering @@ -351,6 +355,23 @@ exec !env !denv !_activeThreads !ustk !bstk !k _ (BPrim1 VALU i) = do bstk <- bump bstk pokeBi bstk =<< reflectValue m c pure (denv, ustk, bstk, k) +exec !env !denv !_activeThreads !ustk !bstk !k _ (BPrim1 DBTX i) + | sandboxed env = + die "attempted to use sandboxed operation: Debug.toText" + | otherwise = do + clo <- peekOff bstk i + ustk <- bump ustk + bstk <- case tracer env False clo of + NoTrace -> bstk <$ poke ustk 0 + MsgTrace _ tx -> do + poke ustk 1 + bstk <- bump bstk + bstk <$ pokeBi bstk (Util.Text.pack tx) + SimpleTrace tx -> do + poke ustk 2 + bstk <- bump bstk + bstk <$ pokeBi bstk (Util.Text.pack tx) + pure (denv, ustk, bstk, k) exec !_ !denv !_activeThreads !ustk !bstk !k _ (BPrim1 op i) = do (ustk, bstk) <- bprim1 ustk bstk op i pure (denv, ustk, bstk, k) @@ -383,7 +404,15 @@ exec !env !denv !_activeThreads !ustk !bstk !k _ (BPrim2 TRCE i j) | otherwise = do tx <- peekOffBi bstk i clo <- peekOff bstk j - tracer env tx clo + case tracer env True clo of + NoTrace -> pure () + SimpleTrace str -> do + putStrLn $ "trace: " ++ Util.Text.unpack tx + putStrLn str + MsgTrace msg str -> do + putStrLn $ "trace: " ++ Util.Text.unpack tx + putStrLn msg + putStrLn str pure (denv, ustk, bstk, k) exec !_ !denv !_trackThreads !ustk !bstk !k _ (BPrim2 op i j) = do (ustk, bstk) <- bprim2 ustk bstk op i j @@ -1445,6 +1474,7 @@ bprim1 !ustk !bstk CVLD _ = pure (ustk, bstk) bprim1 !ustk !bstk TLTT _ = pure (ustk, bstk) bprim1 !ustk !bstk LOAD _ = pure (ustk, bstk) bprim1 !ustk !bstk VALU _ = pure (ustk, bstk) +bprim1 !ustk !bstk DBTX _ = pure (ustk, bstk) {-# INLINE bprim1 #-} bprim2 :: diff --git a/parser-typechecker/src/Unison/Runtime/Serialize.hs b/parser-typechecker/src/Unison/Runtime/Serialize.hs index 5ef8e8b09..ae7464e7c 100644 --- a/parser-typechecker/src/Unison/Runtime/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/Serialize.hs @@ -401,6 +401,7 @@ instance Tag BPrim1 where tag2word CVLD = 22 tag2word VALU = 23 tag2word TLTT = 24 + tag2word DBTX = 25 word2tag 0 = pure SIZT word2tag 1 = pure USNC @@ -427,6 +428,7 @@ instance Tag BPrim1 where word2tag 22 = pure CVLD word2tag 23 = pure VALU word2tag 24 = pure TLTT + word2tag 25 = pure DBTX word2tag n = unknownTag "BPrim1" n instance Tag BPrim2 where From 3d553b3048f9b004180056dd75759df494d9072e Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 23 Jan 2023 15:37:54 -0500 Subject: [PATCH 105/467] Transcript updates --- .../all-base-hashes.output.md | 1327 +++++++++-------- unison-src/transcripts/alias-many.output.md | 865 +++++------ .../transcripts/builtins-merge.output.md | 2 +- .../transcripts/emptyCodebase.output.md | 4 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 28 +- .../transcripts/name-selection.output.md | 75 +- unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 +- 9 files changed, 1176 insertions(+), 1167 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index b14d0c4c6..f56d3c429 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -384,418 +384,421 @@ This transcript is intended to make visible accidental changes to the hashing al -> Bytes -> Bytes - 115. -- ##Debug.trace + 115. -- ##Debug.toText + builtin.Debug.toText : a -> Optional (Either Text Text) + + 116. -- ##Debug.trace builtin.Debug.trace : Text -> a -> () - 116. -- ##Debug.watch + 117. -- ##Debug.watch builtin.Debug.watch : Text -> a -> a - 117. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8 + 118. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8 unique type builtin.Doc - 118. -- #baiqeiovdrs4ju0grn5q5akq64k4kuhgifqno52smkkttqg31jkgm3qa9o3ohe54fgpiigd1tj0an7rfveopfg622sjj9v9g44n27go + 119. -- #baiqeiovdrs4ju0grn5q5akq64k4kuhgifqno52smkkttqg31jkgm3qa9o3ohe54fgpiigd1tj0an7rfveopfg622sjj9v9g44n27go builtin.Doc.++ : Doc2 -> Doc2 -> Doc2 - 119. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#0 + 120. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#0 builtin.Doc.Blob : Text -> Doc - 120. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#4 + 121. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#4 builtin.Doc.Evaluate : Link.Term -> Doc - 121. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#5 + 122. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#5 builtin.Doc.Join : [Doc] -> Doc - 122. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#1 + 123. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#1 builtin.Doc.Link : Link -> Doc - 123. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#3 + 124. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#3 builtin.Doc.Signature : Link.Term -> Doc - 124. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#2 + 125. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#2 builtin.Doc.Source : Link -> Doc - 125. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0 + 126. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0 unique type builtin.Doc2 - 126. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#27 + 127. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#27 builtin.Doc2.Anchor : Text -> Doc2 -> Doc2 - 127. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#11 + 128. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#11 builtin.Doc2.Aside : Doc2 -> Doc2 - 128. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#15 + 129. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#15 builtin.Doc2.Blankline : Doc2 - 129. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#10 + 130. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#10 builtin.Doc2.Blockquote : Doc2 -> Doc2 - 130. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#7 + 131. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#7 builtin.Doc2.Bold : Doc2 -> Doc2 - 131. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#21 + 132. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#21 builtin.Doc2.BulletedList : [Doc2] -> Doc2 - 132. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#3 + 133. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#3 builtin.Doc2.Callout : Optional Doc2 -> Doc2 -> Doc2 - 133. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#6 + 134. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#6 builtin.Doc2.Code : Doc2 -> Doc2 - 134. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#25 + 135. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#25 builtin.Doc2.CodeBlock : Text -> Doc2 -> Doc2 - 135. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#24 + 136. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#24 builtin.Doc2.Column : [Doc2] -> Doc2 - 136. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#0 + 137. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#0 builtin.Doc2.Folded : Boolean -> Doc2 -> Doc2 -> Doc2 - 137. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68 + 138. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68 unique type builtin.Doc2.FrontMatter - 138. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68#0 + 139. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68#0 builtin.Doc2.FrontMatter.FrontMatter : [(Text, Text)] -> FrontMatter - 139. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#12 + 140. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#12 builtin.Doc2.Group : Doc2 -> Doc2 - 140. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#14 + 141. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#14 builtin.Doc2.Image : Doc2 -> Doc2 -> Optional Doc2 -> Doc2 - 141. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#8 + 142. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#8 builtin.Doc2.Italic : Doc2 -> Doc2 - 142. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 + 143. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 builtin.Doc2.Join : [Doc2] -> Doc2 - 143. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 + 144. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 builtin.Doc2.Linebreak : Doc2 - 144. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 + 145. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 unique type builtin.Doc2.MediaSource - 145. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 + 146. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 builtin.Doc2.MediaSource.MediaSource : Text -> Optional Text -> MediaSource - 146. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so + 147. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so builtin.Doc2.MediaSource.mimeType : MediaSource -> Optional Text - 147. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg + 148. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg builtin.Doc2.MediaSource.mimeType.modify : (Optional Text ->{g} Optional Text) -> MediaSource ->{g} MediaSource - 148. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 + 149. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 builtin.Doc2.MediaSource.mimeType.set : Optional Text -> MediaSource -> MediaSource - 149. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg + 150. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg builtin.Doc2.MediaSource.sourceUrl : MediaSource -> Text - 150. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 + 151. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 builtin.Doc2.MediaSource.sourceUrl.modify : (Text ->{g} Text) -> MediaSource ->{g} MediaSource - 151. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo + 152. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo builtin.Doc2.MediaSource.sourceUrl.set : Text -> MediaSource -> MediaSource - 152. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 + 153. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 builtin.Doc2.NamedLink : Doc2 -> Doc2 -> Doc2 - 153. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 + 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 builtin.Doc2.NumberedList : Nat -> [Doc2] -> Doc2 - 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 + 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 builtin.Doc2.Paragraph : [Doc2] -> Doc2 - 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 + 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 builtin.Doc2.Section : Doc2 -> [Doc2] -> Doc2 - 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 + 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 builtin.Doc2.SectionBreak : Doc2 - 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 + 158. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 builtin.Doc2.Special : SpecialForm -> Doc2 - 158. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 + 159. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 unique type builtin.Doc2.SpecialForm - 159. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 + 160. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 builtin.Doc2.SpecialForm.Embed : Any -> SpecialForm - 160. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 + 161. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 builtin.Doc2.SpecialForm.EmbedInline : Any -> SpecialForm - 161. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 + 162. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 builtin.Doc2.SpecialForm.Eval : Doc2.Term -> SpecialForm - 162. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 + 163. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 builtin.Doc2.SpecialForm.EvalInline : Doc2.Term -> SpecialForm - 163. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 + 164. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 builtin.Doc2.SpecialForm.Example : Nat -> Doc2.Term -> SpecialForm - 164. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 + 165. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 builtin.Doc2.SpecialForm.ExampleBlock : Nat -> Doc2.Term -> SpecialForm - 165. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 + 166. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 builtin.Doc2.SpecialForm.FoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 166. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 + 167. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 builtin.Doc2.SpecialForm.Link : Either Type Doc2.Term -> SpecialForm - 167. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 + 168. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 builtin.Doc2.SpecialForm.Signature : [Doc2.Term] -> SpecialForm - 168. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 + 169. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 builtin.Doc2.SpecialForm.SignatureInline : Doc2.Term -> SpecialForm - 169. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 + 170. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 builtin.Doc2.SpecialForm.Source : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 170. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 + 171. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 builtin.Doc2.Strikethrough : Doc2 -> Doc2 - 171. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 + 172. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 builtin.Doc2.Style : Text -> Doc2 -> Doc2 - 172. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 + 173. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 builtin.Doc2.Table : [[Doc2]] -> Doc2 - 173. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg + 174. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg unique type builtin.Doc2.Term - 174. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 + 175. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 builtin.Doc2.term : '{g} a -> Doc2.Term - 175. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 + 176. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 builtin.Doc2.Term.Term : Any -> Doc2.Term - 176. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 + 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 builtin.Doc2.Tooltip : Doc2 -> Doc2 -> Doc2 - 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 + 178. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 builtin.Doc2.UntitledSection : [Doc2] -> Doc2 - 178. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 + 179. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 unique type builtin.Doc2.Video - 179. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 + 180. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 builtin.Doc2.Video.config : Video -> [(Text, Text)] - 180. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g + 181. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g builtin.Doc2.Video.config.modify : ([(Text, Text)] ->{g} [(Text, Text)]) -> Video ->{g} Video - 181. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 + 182. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 builtin.Doc2.Video.config.set : [(Text, Text)] -> Video -> Video - 182. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o + 183. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o builtin.Doc2.Video.sources : Video -> [MediaSource] - 183. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo + 184. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo builtin.Doc2.Video.sources.modify : ([MediaSource] ->{g} [MediaSource]) -> Video ->{g} Video - 184. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 + 185. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 builtin.Doc2.Video.sources.set : [MediaSource] -> Video -> Video - 185. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 + 186. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 builtin.Doc2.Video.Video : [MediaSource] -> [(Text, Text)] -> Video - 186. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 + 187. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 builtin.Doc2.Word : Text -> Doc2 - 187. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 + 188. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 structural type builtin.Either a b - 188. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 + 189. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 builtin.Either.Left : a -> Either a b - 189. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g + 190. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g builtin.Either.mapRight : (a ->{g} b) -> Either e a ->{g} Either e b - 190. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 + 191. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 builtin.Either.Right : b -> Either a b - 191. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 192. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability builtin.Exception structural ability Exception - 192. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 193. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 builtin.Exception.raise, Exception.raise : Failure ->{Exception} x - 193. -- ##Float + 194. -- ##Float builtin type builtin.Float - 194. -- ##Float.* + 195. -- ##Float.* builtin.Float.* : Float -> Float -> Float - 195. -- ##Float.+ + 196. -- ##Float.+ builtin.Float.+ : Float -> Float -> Float - 196. -- ##Float.- + 197. -- ##Float.- builtin.Float.- : Float -> Float -> Float - 197. -- ##Float./ + 198. -- ##Float./ builtin.Float./ : Float -> Float -> Float - 198. -- ##Float.abs + 199. -- ##Float.abs builtin.Float.abs : Float -> Float - 199. -- ##Float.acos + 200. -- ##Float.acos builtin.Float.acos : Float -> Float - 200. -- ##Float.acosh + 201. -- ##Float.acosh builtin.Float.acosh : Float -> Float - 201. -- ##Float.asin + 202. -- ##Float.asin builtin.Float.asin : Float -> Float - 202. -- ##Float.asinh + 203. -- ##Float.asinh builtin.Float.asinh : Float -> Float - 203. -- ##Float.atan + 204. -- ##Float.atan builtin.Float.atan : Float -> Float - 204. -- ##Float.atan2 + 205. -- ##Float.atan2 builtin.Float.atan2 : Float -> Float -> Float - 205. -- ##Float.atanh + 206. -- ##Float.atanh builtin.Float.atanh : Float -> Float - 206. -- ##Float.ceiling + 207. -- ##Float.ceiling builtin.Float.ceiling : Float -> Int - 207. -- ##Float.cos + 208. -- ##Float.cos builtin.Float.cos : Float -> Float - 208. -- ##Float.cosh + 209. -- ##Float.cosh builtin.Float.cosh : Float -> Float - 209. -- ##Float.== + 210. -- ##Float.== builtin.Float.eq : Float -> Float -> Boolean - 210. -- ##Float.exp + 211. -- ##Float.exp builtin.Float.exp : Float -> Float - 211. -- ##Float.floor + 212. -- ##Float.floor builtin.Float.floor : Float -> Int - 212. -- ##Float.fromRepresentation + 213. -- ##Float.fromRepresentation builtin.Float.fromRepresentation : Nat -> Float - 213. -- ##Float.fromText + 214. -- ##Float.fromText builtin.Float.fromText : Text -> Optional Float - 214. -- ##Float.> + 215. -- ##Float.> builtin.Float.gt : Float -> Float -> Boolean - 215. -- ##Float.>= + 216. -- ##Float.>= builtin.Float.gteq : Float -> Float -> Boolean - 216. -- ##Float.log + 217. -- ##Float.log builtin.Float.log : Float -> Float - 217. -- ##Float.logBase + 218. -- ##Float.logBase builtin.Float.logBase : Float -> Float -> Float - 218. -- ##Float.< + 219. -- ##Float.< builtin.Float.lt : Float -> Float -> Boolean - 219. -- ##Float.<= + 220. -- ##Float.<= builtin.Float.lteq : Float -> Float -> Boolean - 220. -- ##Float.max + 221. -- ##Float.max builtin.Float.max : Float -> Float -> Float - 221. -- ##Float.min + 222. -- ##Float.min builtin.Float.min : Float -> Float -> Float - 222. -- ##Float.pow + 223. -- ##Float.pow builtin.Float.pow : Float -> Float -> Float - 223. -- ##Float.round + 224. -- ##Float.round builtin.Float.round : Float -> Int - 224. -- ##Float.sin + 225. -- ##Float.sin builtin.Float.sin : Float -> Float - 225. -- ##Float.sinh + 226. -- ##Float.sinh builtin.Float.sinh : Float -> Float - 226. -- ##Float.sqrt + 227. -- ##Float.sqrt builtin.Float.sqrt : Float -> Float - 227. -- ##Float.tan + 228. -- ##Float.tan builtin.Float.tan : Float -> Float - 228. -- ##Float.tanh + 229. -- ##Float.tanh builtin.Float.tanh : Float -> Float - 229. -- ##Float.toRepresentation + 230. -- ##Float.toRepresentation builtin.Float.toRepresentation : Float -> Nat - 230. -- ##Float.toText + 231. -- ##Float.toText builtin.Float.toText : Float -> Text - 231. -- ##Float.truncate + 232. -- ##Float.truncate builtin.Float.truncate : Float -> Int - 232. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 + 233. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 unique type builtin.GUID - 233. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 + 234. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 builtin.GUID.GUID : Bytes -> GUID - 234. -- ##Handle.toText + 235. -- ##Handle.toText builtin.Handle.toText : Handle -> Text - 235. -- ##ImmutableArray + 236. -- ##ImmutableArray builtin type builtin.ImmutableArray - 236. -- ##ImmutableArray.copyTo! + 237. -- ##ImmutableArray.copyTo! builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray a @@ -803,18 +806,18 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 237. -- ##ImmutableArray.read + 238. -- ##ImmutableArray.read builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 238. -- ##ImmutableArray.size + 239. -- ##ImmutableArray.size builtin.ImmutableArray.size : ImmutableArray a -> Nat - 239. -- ##ImmutableByteArray + 240. -- ##ImmutableByteArray builtin type builtin.ImmutableByteArray - 240. -- ##ImmutableByteArray.copyTo! + 241. -- ##ImmutableByteArray.copyTo! builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -822,843 +825,843 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 241. -- ##ImmutableByteArray.read16be + 242. -- ##ImmutableByteArray.read16be builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 242. -- ##ImmutableByteArray.read24be + 243. -- ##ImmutableByteArray.read24be builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 243. -- ##ImmutableByteArray.read32be + 244. -- ##ImmutableByteArray.read32be builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 244. -- ##ImmutableByteArray.read40be + 245. -- ##ImmutableByteArray.read40be builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 245. -- ##ImmutableByteArray.read64be + 246. -- ##ImmutableByteArray.read64be builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 246. -- ##ImmutableByteArray.read8 + 247. -- ##ImmutableByteArray.read8 builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 247. -- ##ImmutableByteArray.size + 248. -- ##ImmutableByteArray.size builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 248. -- ##Int + 249. -- ##Int builtin type builtin.Int - 249. -- ##Int.* + 250. -- ##Int.* builtin.Int.* : Int -> Int -> Int - 250. -- ##Int.+ + 251. -- ##Int.+ builtin.Int.+ : Int -> Int -> Int - 251. -- ##Int.- + 252. -- ##Int.- builtin.Int.- : Int -> Int -> Int - 252. -- ##Int./ + 253. -- ##Int./ builtin.Int./ : Int -> Int -> Int - 253. -- ##Int.and + 254. -- ##Int.and builtin.Int.and : Int -> Int -> Int - 254. -- ##Int.complement + 255. -- ##Int.complement builtin.Int.complement : Int -> Int - 255. -- ##Int.== + 256. -- ##Int.== builtin.Int.eq : Int -> Int -> Boolean - 256. -- ##Int.fromRepresentation + 257. -- ##Int.fromRepresentation builtin.Int.fromRepresentation : Nat -> Int - 257. -- ##Int.fromText + 258. -- ##Int.fromText builtin.Int.fromText : Text -> Optional Int - 258. -- ##Int.> + 259. -- ##Int.> builtin.Int.gt : Int -> Int -> Boolean - 259. -- ##Int.>= + 260. -- ##Int.>= builtin.Int.gteq : Int -> Int -> Boolean - 260. -- ##Int.increment + 261. -- ##Int.increment builtin.Int.increment : Int -> Int - 261. -- ##Int.isEven + 262. -- ##Int.isEven builtin.Int.isEven : Int -> Boolean - 262. -- ##Int.isOdd + 263. -- ##Int.isOdd builtin.Int.isOdd : Int -> Boolean - 263. -- ##Int.leadingZeros + 264. -- ##Int.leadingZeros builtin.Int.leadingZeros : Int -> Nat - 264. -- ##Int.< + 265. -- ##Int.< builtin.Int.lt : Int -> Int -> Boolean - 265. -- ##Int.<= + 266. -- ##Int.<= builtin.Int.lteq : Int -> Int -> Boolean - 266. -- ##Int.mod + 267. -- ##Int.mod builtin.Int.mod : Int -> Int -> Int - 267. -- ##Int.negate + 268. -- ##Int.negate builtin.Int.negate : Int -> Int - 268. -- ##Int.or + 269. -- ##Int.or builtin.Int.or : Int -> Int -> Int - 269. -- ##Int.popCount + 270. -- ##Int.popCount builtin.Int.popCount : Int -> Nat - 270. -- ##Int.pow + 271. -- ##Int.pow builtin.Int.pow : Int -> Nat -> Int - 271. -- ##Int.shiftLeft + 272. -- ##Int.shiftLeft builtin.Int.shiftLeft : Int -> Nat -> Int - 272. -- ##Int.shiftRight + 273. -- ##Int.shiftRight builtin.Int.shiftRight : Int -> Nat -> Int - 273. -- ##Int.signum + 274. -- ##Int.signum builtin.Int.signum : Int -> Int - 274. -- ##Int.toFloat + 275. -- ##Int.toFloat builtin.Int.toFloat : Int -> Float - 275. -- ##Int.toRepresentation + 276. -- ##Int.toRepresentation builtin.Int.toRepresentation : Int -> Nat - 276. -- ##Int.toText + 277. -- ##Int.toText builtin.Int.toText : Int -> Text - 277. -- ##Int.trailingZeros + 278. -- ##Int.trailingZeros builtin.Int.trailingZeros : Int -> Nat - 278. -- ##Int.truncate0 + 279. -- ##Int.truncate0 builtin.Int.truncate0 : Int -> Nat - 279. -- ##Int.xor + 280. -- ##Int.xor builtin.Int.xor : Int -> Int -> Int - 280. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 + 281. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 unique type builtin.io2.ArithmeticFailure - 281. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag + 282. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag unique type builtin.io2.ArrayFailure - 282. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 + 283. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 unique type builtin.io2.BufferMode - 283. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 + 284. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 builtin.io2.BufferMode.BlockBuffering : BufferMode - 284. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 + 285. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 builtin.io2.BufferMode.LineBuffering : BufferMode - 285. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 + 286. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 builtin.io2.BufferMode.NoBuffering : BufferMode - 286. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 + 287. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 287. -- ##Clock.internals.monotonic.v1 + 288. -- ##Clock.internals.monotonic.v1 builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 288. -- ##Clock.internals.nsec.v1 + 289. -- ##Clock.internals.nsec.v1 builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 289. -- ##Clock.internals.processCPUTime.v1 + 290. -- ##Clock.internals.processCPUTime.v1 builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 290. -- ##Clock.internals.realtime.v1 + 291. -- ##Clock.internals.realtime.v1 builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 291. -- ##Clock.internals.sec.v1 + 292. -- ##Clock.internals.sec.v1 builtin.io2.Clock.internals.sec : TimeSpec -> Int - 292. -- ##Clock.internals.threadCPUTime.v1 + 293. -- ##Clock.internals.threadCPUTime.v1 builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 293. -- ##TimeSpec + 294. -- ##TimeSpec builtin type builtin.io2.Clock.internals.TimeSpec - 294. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 + 295. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 unique type builtin.io2.Failure - 295. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 + 296. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 296. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 + 297. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 unique type builtin.io2.FileMode - 297. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 + 298. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 builtin.io2.FileMode.Append : FileMode - 298. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 + 299. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 builtin.io2.FileMode.Read : FileMode - 299. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 + 300. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 builtin.io2.FileMode.ReadWrite : FileMode - 300. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 + 301. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 builtin.io2.FileMode.Write : FileMode - 301. -- ##Handle + 302. -- ##Handle builtin type builtin.io2.Handle - 302. -- ##IO + 303. -- ##IO builtin type builtin.io2.IO - 303. -- ##IO.array + 304. -- ##IO.array builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 304. -- ##IO.arrayOf + 305. -- ##IO.arrayOf builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 305. -- ##IO.bytearray + 306. -- ##IO.bytearray builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 306. -- ##IO.bytearrayOf + 307. -- ##IO.bytearrayOf builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 307. -- ##IO.clientSocket.impl.v3 + 308. -- ##IO.clientSocket.impl.v3 builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 308. -- ##IO.closeFile.impl.v3 + 309. -- ##IO.closeFile.impl.v3 builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 309. -- ##IO.closeSocket.impl.v3 + 310. -- ##IO.closeSocket.impl.v3 builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 310. -- ##IO.createDirectory.impl.v3 + 311. -- ##IO.createDirectory.impl.v3 builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 311. -- ##IO.createTempDirectory.impl.v3 + 312. -- ##IO.createTempDirectory.impl.v3 builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 312. -- ##IO.delay.impl.v3 + 313. -- ##IO.delay.impl.v3 builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 313. -- ##IO.directoryContents.impl.v3 + 314. -- ##IO.directoryContents.impl.v3 builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 314. -- ##IO.fileExists.impl.v3 + 315. -- ##IO.fileExists.impl.v3 builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 315. -- ##IO.forkComp.v2 + 316. -- ##IO.forkComp.v2 builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 316. -- ##IO.getArgs.impl.v1 + 317. -- ##IO.getArgs.impl.v1 builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 317. -- ##IO.getBuffering.impl.v3 + 318. -- ##IO.getBuffering.impl.v3 builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 318. -- ##IO.getBytes.impl.v3 + 319. -- ##IO.getBytes.impl.v3 builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 319. -- ##IO.getChar.impl.v1 + 320. -- ##IO.getChar.impl.v1 builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 320. -- ##IO.getCurrentDirectory.impl.v3 + 321. -- ##IO.getCurrentDirectory.impl.v3 builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 321. -- ##IO.getEcho.impl.v1 + 322. -- ##IO.getEcho.impl.v1 builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 322. -- ##IO.getEnv.impl.v1 + 323. -- ##IO.getEnv.impl.v1 builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 323. -- ##IO.getFileSize.impl.v3 + 324. -- ##IO.getFileSize.impl.v3 builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 324. -- ##IO.getFileTimestamp.impl.v3 + 325. -- ##IO.getFileTimestamp.impl.v3 builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 325. -- ##IO.getLine.impl.v1 + 326. -- ##IO.getLine.impl.v1 builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 326. -- ##IO.getSomeBytes.impl.v1 + 327. -- ##IO.getSomeBytes.impl.v1 builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 327. -- ##IO.getTempDirectory.impl.v3 + 328. -- ##IO.getTempDirectory.impl.v3 builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 328. -- ##IO.handlePosition.impl.v3 + 329. -- ##IO.handlePosition.impl.v3 builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 329. -- ##IO.isDirectory.impl.v3 + 330. -- ##IO.isDirectory.impl.v3 builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 330. -- ##IO.isFileEOF.impl.v3 + 331. -- ##IO.isFileEOF.impl.v3 builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 331. -- ##IO.isFileOpen.impl.v3 + 332. -- ##IO.isFileOpen.impl.v3 builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 332. -- ##IO.isSeekable.impl.v3 + 333. -- ##IO.isSeekable.impl.v3 builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 333. -- ##IO.kill.impl.v3 + 334. -- ##IO.kill.impl.v3 builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 334. -- ##IO.listen.impl.v3 + 335. -- ##IO.listen.impl.v3 builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 335. -- ##IO.openFile.impl.v3 + 336. -- ##IO.openFile.impl.v3 builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 336. -- ##IO.putBytes.impl.v3 + 337. -- ##IO.putBytes.impl.v3 builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 337. -- ##IO.ready.impl.v1 + 338. -- ##IO.ready.impl.v1 builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 338. -- ##IO.ref + 339. -- ##IO.ref builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 339. -- ##IO.removeDirectory.impl.v3 + 340. -- ##IO.removeDirectory.impl.v3 builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 340. -- ##IO.removeFile.impl.v3 + 341. -- ##IO.removeFile.impl.v3 builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 341. -- ##IO.renameDirectory.impl.v3 + 342. -- ##IO.renameDirectory.impl.v3 builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 342. -- ##IO.renameFile.impl.v3 + 343. -- ##IO.renameFile.impl.v3 builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 343. -- ##IO.seekHandle.impl.v3 + 344. -- ##IO.seekHandle.impl.v3 builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 344. -- ##IO.serverSocket.impl.v3 + 345. -- ##IO.serverSocket.impl.v3 builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 345. -- ##IO.setBuffering.impl.v3 + 346. -- ##IO.setBuffering.impl.v3 builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 346. -- ##IO.setCurrentDirectory.impl.v3 + 347. -- ##IO.setCurrentDirectory.impl.v3 builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 347. -- ##IO.setEcho.impl.v1 + 348. -- ##IO.setEcho.impl.v1 builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 348. -- ##IO.socketAccept.impl.v3 + 349. -- ##IO.socketAccept.impl.v3 builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 349. -- ##IO.socketPort.impl.v3 + 350. -- ##IO.socketPort.impl.v3 builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 350. -- ##IO.socketReceive.impl.v3 + 351. -- ##IO.socketReceive.impl.v3 builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 351. -- ##IO.socketSend.impl.v3 + 352. -- ##IO.socketSend.impl.v3 builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 352. -- ##IO.stdHandle + 353. -- ##IO.stdHandle builtin.io2.IO.stdHandle : StdHandle -> Handle - 353. -- ##IO.systemTime.impl.v3 + 354. -- ##IO.systemTime.impl.v3 builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 354. -- ##IO.systemTimeMicroseconds.v1 + 355. -- ##IO.systemTimeMicroseconds.v1 builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 355. -- ##IO.tryEval + 356. -- ##IO.tryEval builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 356. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 + 357. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 unique type builtin.io2.IOError - 357. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 + 358. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 builtin.io2.IOError.AlreadyExists : IOError - 358. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 + 359. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 builtin.io2.IOError.EOF : IOError - 359. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 + 360. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 builtin.io2.IOError.IllegalOperation : IOError - 360. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 + 361. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 builtin.io2.IOError.NoSuchThing : IOError - 361. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 + 362. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 builtin.io2.IOError.PermissionDenied : IOError - 362. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 + 363. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 builtin.io2.IOError.ResourceBusy : IOError - 363. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 + 364. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 builtin.io2.IOError.ResourceExhausted : IOError - 364. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 + 365. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 builtin.io2.IOError.UserError : IOError - 365. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g + 366. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g unique type builtin.io2.IOFailure - 366. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg + 367. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg unique type builtin.io2.MiscFailure - 367. -- ##MVar + 368. -- ##MVar builtin type builtin.io2.MVar - 368. -- ##MVar.isEmpty + 369. -- ##MVar.isEmpty builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 369. -- ##MVar.new + 370. -- ##MVar.new builtin.io2.MVar.new : a ->{IO} MVar a - 370. -- ##MVar.newEmpty.v2 + 371. -- ##MVar.newEmpty.v2 builtin.io2.MVar.newEmpty : '{IO} MVar a - 371. -- ##MVar.put.impl.v3 + 372. -- ##MVar.put.impl.v3 builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 372. -- ##MVar.read.impl.v3 + 373. -- ##MVar.read.impl.v3 builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 373. -- ##MVar.swap.impl.v3 + 374. -- ##MVar.swap.impl.v3 builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 374. -- ##MVar.take.impl.v3 + 375. -- ##MVar.take.impl.v3 builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 375. -- ##MVar.tryPut.impl.v3 + 376. -- ##MVar.tryPut.impl.v3 builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 376. -- ##MVar.tryRead.impl.v3 + 377. -- ##MVar.tryRead.impl.v3 builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 377. -- ##MVar.tryTake + 378. -- ##MVar.tryTake builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 378. -- ##Promise + 379. -- ##Promise builtin type builtin.io2.Promise - 379. -- ##Promise.new + 380. -- ##Promise.new builtin.io2.Promise.new : '{IO} Promise a - 380. -- ##Promise.read + 381. -- ##Promise.read builtin.io2.Promise.read : Promise a ->{IO} a - 381. -- ##Promise.tryRead + 382. -- ##Promise.tryRead builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 382. -- ##Promise.write + 383. -- ##Promise.write builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 383. -- ##Ref.cas + 384. -- ##Ref.cas builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 384. -- ##Ref.readForCas + 385. -- ##Ref.readForCas builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 385. -- ##Ref.Ticket + 386. -- ##Ref.Ticket builtin type builtin.io2.Ref.Ticket - 386. -- ##Ref.Ticket.read + 387. -- ##Ref.Ticket.read builtin.io2.Ref.Ticket.read : Ticket a -> a - 387. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 + 388. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 unique type builtin.io2.RuntimeFailure - 388. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 + 389. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 unique type builtin.io2.SeekMode - 389. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 + 390. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 390. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 + 391. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 builtin.io2.SeekMode.RelativeSeek : SeekMode - 391. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 + 392. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 builtin.io2.SeekMode.SeekFromEnd : SeekMode - 392. -- ##Socket + 393. -- ##Socket builtin type builtin.io2.Socket - 393. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 + 394. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 unique type builtin.io2.StdHandle - 394. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 + 395. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 builtin.io2.StdHandle.StdErr : StdHandle - 395. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 + 396. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 builtin.io2.StdHandle.StdIn : StdHandle - 396. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 + 397. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 builtin.io2.StdHandle.StdOut : StdHandle - 397. -- ##STM + 398. -- ##STM builtin type builtin.io2.STM - 398. -- ##STM.atomically + 399. -- ##STM.atomically builtin.io2.STM.atomically : '{STM} a ->{IO} a - 399. -- ##STM.retry + 400. -- ##STM.retry builtin.io2.STM.retry : '{STM} a - 400. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g + 401. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g unique type builtin.io2.STMFailure - 401. -- ##ThreadId + 402. -- ##ThreadId builtin type builtin.io2.ThreadId - 402. -- ##Tls + 403. -- ##Tls builtin type builtin.io2.Tls - 403. -- ##Tls.Cipher + 404. -- ##Tls.Cipher builtin type builtin.io2.Tls.Cipher - 404. -- ##Tls.ClientConfig + 405. -- ##Tls.ClientConfig builtin type builtin.io2.Tls.ClientConfig - 405. -- ##Tls.ClientConfig.certificates.set + 406. -- ##Tls.ClientConfig.certificates.set builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 406. -- ##TLS.ClientConfig.ciphers.set + 407. -- ##TLS.ClientConfig.ciphers.set builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 407. -- ##Tls.ClientConfig.default + 408. -- ##Tls.ClientConfig.default builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 408. -- ##Tls.ClientConfig.versions.set + 409. -- ##Tls.ClientConfig.versions.set builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 409. -- ##Tls.decodeCert.impl.v3 + 410. -- ##Tls.decodeCert.impl.v3 builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 410. -- ##Tls.decodePrivateKey + 411. -- ##Tls.decodePrivateKey builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 411. -- ##Tls.encodeCert + 412. -- ##Tls.encodeCert builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 412. -- ##Tls.encodePrivateKey + 413. -- ##Tls.encodePrivateKey builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 413. -- ##Tls.handshake.impl.v3 + 414. -- ##Tls.handshake.impl.v3 builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 414. -- ##Tls.newClient.impl.v3 + 415. -- ##Tls.newClient.impl.v3 builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 415. -- ##Tls.newServer.impl.v3 + 416. -- ##Tls.newServer.impl.v3 builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 416. -- ##Tls.PrivateKey + 417. -- ##Tls.PrivateKey builtin type builtin.io2.Tls.PrivateKey - 417. -- ##Tls.receive.impl.v3 + 418. -- ##Tls.receive.impl.v3 builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 418. -- ##Tls.send.impl.v3 + 419. -- ##Tls.send.impl.v3 builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 419. -- ##Tls.ServerConfig + 420. -- ##Tls.ServerConfig builtin type builtin.io2.Tls.ServerConfig - 420. -- ##Tls.ServerConfig.certificates.set + 421. -- ##Tls.ServerConfig.certificates.set builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 421. -- ##Tls.ServerConfig.ciphers.set + 422. -- ##Tls.ServerConfig.ciphers.set builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 422. -- ##Tls.ServerConfig.default + 423. -- ##Tls.ServerConfig.default builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 423. -- ##Tls.ServerConfig.versions.set + 424. -- ##Tls.ServerConfig.versions.set builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 424. -- ##Tls.SignedCert + 425. -- ##Tls.SignedCert builtin type builtin.io2.Tls.SignedCert - 425. -- ##Tls.terminate.impl.v3 + 426. -- ##Tls.terminate.impl.v3 builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 426. -- ##Tls.Version + 427. -- ##Tls.Version builtin type builtin.io2.Tls.Version - 427. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + 428. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 unique type builtin.io2.TlsFailure - 428. -- ##TVar + 429. -- ##TVar builtin type builtin.io2.TVar - 429. -- ##TVar.new + 430. -- ##TVar.new builtin.io2.TVar.new : a ->{STM} TVar a - 430. -- ##TVar.newIO + 431. -- ##TVar.newIO builtin.io2.TVar.newIO : a ->{IO} TVar a - 431. -- ##TVar.read + 432. -- ##TVar.read builtin.io2.TVar.read : TVar a ->{STM} a - 432. -- ##TVar.readIO + 433. -- ##TVar.readIO builtin.io2.TVar.readIO : TVar a ->{IO} a - 433. -- ##TVar.swap + 434. -- ##TVar.swap builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 434. -- ##TVar.write + 435. -- ##TVar.write builtin.io2.TVar.write : TVar a -> a ->{STM} () - 435. -- ##validateSandboxed + 436. -- ##validateSandboxed builtin.io2.validateSandboxed : [Link.Term] -> a -> Boolean - 436. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + 437. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 unique type builtin.IsPropagated - 437. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + 438. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 builtin.IsPropagated.IsPropagated : IsPropagated - 438. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + 439. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 unique type builtin.IsTest - 439. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + 440. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 builtin.IsTest.IsTest : IsTest - 440. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + 441. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g unique type builtin.License - 441. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + 442. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 builtin.License.copyrightHolders : License -> [CopyrightHolder] - 442. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + 443. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo builtin.License.copyrightHolders.modify : ([CopyrightHolder] ->{g} [CopyrightHolder]) -> License ->{g} License - 443. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + 444. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro builtin.License.copyrightHolders.set : [CopyrightHolder] -> License -> License - 444. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + 445. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 builtin.License.License : [CopyrightHolder] -> [Year] -> LicenseType -> License - 445. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + 446. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g builtin.License.licenseType : License -> LicenseType - 446. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + 447. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo builtin.License.licenseType.modify : (LicenseType ->{g} LicenseType) -> License ->{g} License - 447. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + 448. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o builtin.License.licenseType.set : LicenseType -> License -> License - 448. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + 449. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig builtin.License.years : License -> [Year] - 449. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + 450. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 builtin.License.years.modify : ([Year] ->{g} [Year]) -> License ->{g} License - 450. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + 451. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo builtin.License.years.set : [Year] -> License -> License - 451. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + 452. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 unique type builtin.LicenseType - 452. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + 453. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 builtin.LicenseType.LicenseType : Doc -> LicenseType - 453. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + 454. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 unique type builtin.Link - 454. -- ##Link.Term + 455. -- ##Link.Term builtin type builtin.Link.Term - 455. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + 456. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 builtin.Link.Term : Link.Term -> Link - 456. -- ##Link.Term.toText + 457. -- ##Link.Term.toText builtin.Link.Term.toText : Link.Term -> Text - 457. -- ##Link.Type + 458. -- ##Link.Type builtin type builtin.Link.Type - 458. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + 459. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 builtin.Link.Type : Type -> Link - 459. -- ##Sequence + 460. -- ##Sequence builtin type builtin.List - 460. -- ##List.++ + 461. -- ##List.++ builtin.List.++ : [a] -> [a] -> [a] - 461. -- ##List.cons + 462. -- ##List.cons builtin.List.+:, builtin.List.cons : a -> [a] -> [a] - 462. -- ##List.snoc + 463. -- ##List.snoc builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] - 463. -- ##List.at + 464. -- ##List.at builtin.List.at : Nat -> [a] -> Optional a - 464. -- ##List.cons + 465. -- ##List.cons builtin.List.cons, builtin.List.+: : a -> [a] -> [a] - 465. -- ##List.drop + 466. -- ##List.drop builtin.List.drop : Nat -> [a] -> [a] - 466. -- ##List.empty + 467. -- ##List.empty builtin.List.empty : [a] - 467. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + 468. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] - 468. -- ##List.size + 469. -- ##List.size builtin.List.size : [a] -> Nat - 469. -- ##List.snoc + 470. -- ##List.snoc builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] - 470. -- ##List.take + 471. -- ##List.take builtin.List.take : Nat -> [a] -> [a] - 471. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + 472. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g builtin.metadata.isPropagated : IsPropagated - 472. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + 473. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko builtin.metadata.isTest : IsTest - 473. -- ##MutableArray + 474. -- ##MutableArray builtin type builtin.MutableArray - 474. -- ##MutableArray.copyTo! + 475. -- ##MutableArray.copyTo! builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a @@ -1666,34 +1669,34 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 475. -- ##MutableArray.freeze + 476. -- ##MutableArray.freeze builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 476. -- ##MutableArray.freeze! + 477. -- ##MutableArray.freeze! builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 477. -- ##MutableArray.read + 478. -- ##MutableArray.read builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 478. -- ##MutableArray.size + 479. -- ##MutableArray.size builtin.MutableArray.size : MutableArray g a -> Nat - 479. -- ##MutableArray.write + 480. -- ##MutableArray.write builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 480. -- ##MutableByteArray + 481. -- ##MutableByteArray builtin type builtin.MutableByteArray - 481. -- ##MutableByteArray.copyTo! + 482. -- ##MutableByteArray.copyTo! builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g @@ -1701,682 +1704,682 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 482. -- ##MutableByteArray.freeze + 483. -- ##MutableByteArray.freeze builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 483. -- ##MutableByteArray.freeze! + 484. -- ##MutableByteArray.freeze! builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 484. -- ##MutableByteArray.read16be + 485. -- ##MutableByteArray.read16be builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 485. -- ##MutableByteArray.read24be + 486. -- ##MutableByteArray.read24be builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 486. -- ##MutableByteArray.read32be + 487. -- ##MutableByteArray.read32be builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 487. -- ##MutableByteArray.read40be + 488. -- ##MutableByteArray.read40be builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 488. -- ##MutableByteArray.read64be + 489. -- ##MutableByteArray.read64be builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 489. -- ##MutableByteArray.read8 + 490. -- ##MutableByteArray.read8 builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 490. -- ##MutableByteArray.size + 491. -- ##MutableByteArray.size builtin.MutableByteArray.size : MutableByteArray g -> Nat - 491. -- ##MutableByteArray.write16be + 492. -- ##MutableByteArray.write16be builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 492. -- ##MutableByteArray.write32be + 493. -- ##MutableByteArray.write32be builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 493. -- ##MutableByteArray.write64be + 494. -- ##MutableByteArray.write64be builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 494. -- ##MutableByteArray.write8 + 495. -- ##MutableByteArray.write8 builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 495. -- ##Nat + 496. -- ##Nat builtin type builtin.Nat - 496. -- ##Nat.* + 497. -- ##Nat.* builtin.Nat.* : Nat -> Nat -> Nat - 497. -- ##Nat.+ + 498. -- ##Nat.+ builtin.Nat.+ : Nat -> Nat -> Nat - 498. -- ##Nat./ + 499. -- ##Nat./ builtin.Nat./ : Nat -> Nat -> Nat - 499. -- ##Nat.and + 500. -- ##Nat.and builtin.Nat.and : Nat -> Nat -> Nat - 500. -- ##Nat.complement + 501. -- ##Nat.complement builtin.Nat.complement : Nat -> Nat - 501. -- ##Nat.drop + 502. -- ##Nat.drop builtin.Nat.drop : Nat -> Nat -> Nat - 502. -- ##Nat.== + 503. -- ##Nat.== builtin.Nat.eq : Nat -> Nat -> Boolean - 503. -- ##Nat.fromText + 504. -- ##Nat.fromText builtin.Nat.fromText : Text -> Optional Nat - 504. -- ##Nat.> + 505. -- ##Nat.> builtin.Nat.gt : Nat -> Nat -> Boolean - 505. -- ##Nat.>= + 506. -- ##Nat.>= builtin.Nat.gteq : Nat -> Nat -> Boolean - 506. -- ##Nat.increment + 507. -- ##Nat.increment builtin.Nat.increment : Nat -> Nat - 507. -- ##Nat.isEven + 508. -- ##Nat.isEven builtin.Nat.isEven : Nat -> Boolean - 508. -- ##Nat.isOdd + 509. -- ##Nat.isOdd builtin.Nat.isOdd : Nat -> Boolean - 509. -- ##Nat.leadingZeros + 510. -- ##Nat.leadingZeros builtin.Nat.leadingZeros : Nat -> Nat - 510. -- ##Nat.< + 511. -- ##Nat.< builtin.Nat.lt : Nat -> Nat -> Boolean - 511. -- ##Nat.<= + 512. -- ##Nat.<= builtin.Nat.lteq : Nat -> Nat -> Boolean - 512. -- ##Nat.mod + 513. -- ##Nat.mod builtin.Nat.mod : Nat -> Nat -> Nat - 513. -- ##Nat.or + 514. -- ##Nat.or builtin.Nat.or : Nat -> Nat -> Nat - 514. -- ##Nat.popCount + 515. -- ##Nat.popCount builtin.Nat.popCount : Nat -> Nat - 515. -- ##Nat.pow + 516. -- ##Nat.pow builtin.Nat.pow : Nat -> Nat -> Nat - 516. -- ##Nat.shiftLeft + 517. -- ##Nat.shiftLeft builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 517. -- ##Nat.shiftRight + 518. -- ##Nat.shiftRight builtin.Nat.shiftRight : Nat -> Nat -> Nat - 518. -- ##Nat.sub + 519. -- ##Nat.sub builtin.Nat.sub : Nat -> Nat -> Int - 519. -- ##Nat.toFloat + 520. -- ##Nat.toFloat builtin.Nat.toFloat : Nat -> Float - 520. -- ##Nat.toInt + 521. -- ##Nat.toInt builtin.Nat.toInt : Nat -> Int - 521. -- ##Nat.toText + 522. -- ##Nat.toText builtin.Nat.toText : Nat -> Text - 522. -- ##Nat.trailingZeros + 523. -- ##Nat.trailingZeros builtin.Nat.trailingZeros : Nat -> Nat - 523. -- ##Nat.xor + 524. -- ##Nat.xor builtin.Nat.xor : Nat -> Nat -> Nat - 524. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + 525. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg structural type builtin.Optional a - 525. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + 526. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 builtin.Optional.None : Optional a - 526. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + 527. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 builtin.Optional.Some : a -> Optional a - 527. -- ##Pattern + 528. -- ##Pattern builtin type builtin.Pattern - 528. -- ##Pattern.capture + 529. -- ##Pattern.capture builtin.Pattern.capture : Pattern a -> Pattern a - 529. -- ##Pattern.isMatch + 530. -- ##Pattern.isMatch builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 530. -- ##Pattern.join + 531. -- ##Pattern.join builtin.Pattern.join : [Pattern a] -> Pattern a - 531. -- ##Pattern.many + 532. -- ##Pattern.many builtin.Pattern.many : Pattern a -> Pattern a - 532. -- ##Pattern.or + 533. -- ##Pattern.or builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 533. -- ##Pattern.replicate + 534. -- ##Pattern.replicate builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 534. -- ##Pattern.run + 535. -- ##Pattern.run builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) - 535. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + 536. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg structural type builtin.Pretty txt - 536. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + 537. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 unique type builtin.Pretty.Annotated w txt - 537. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + 538. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 builtin.Pretty.Annotated.Append : w -> [Annotated w txt] -> Annotated w txt - 538. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + 539. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 builtin.Pretty.Annotated.Empty : Annotated w txt - 539. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + 540. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 builtin.Pretty.Annotated.Group : w -> Annotated w txt -> Annotated w txt - 540. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + 541. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 builtin.Pretty.Annotated.Indent : w -> Annotated w txt -> Annotated w txt -> Annotated w txt -> Annotated w txt - 541. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + 542. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 builtin.Pretty.Annotated.Lit : w -> txt -> Annotated w txt - 542. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + 543. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 builtin.Pretty.Annotated.OrElse : w -> Annotated w txt -> Annotated w txt -> Annotated w txt - 543. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + 544. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 builtin.Pretty.Annotated.Table : w -> [[Annotated w txt]] -> Annotated w txt - 544. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + 545. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 builtin.Pretty.Annotated.Wrap : w -> Annotated w txt -> Annotated w txt - 545. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + 546. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg builtin.Pretty.append : Pretty txt -> Pretty txt -> Pretty txt - 546. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + 547. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 builtin.Pretty.empty : Pretty txt - 547. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + 548. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo builtin.Pretty.get : Pretty txt -> Annotated () txt - 548. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + 549. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 builtin.Pretty.group : Pretty txt -> Pretty txt - 549. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + 550. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno builtin.Pretty.indent : Pretty txt -> Pretty txt -> Pretty txt - 550. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + 551. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug builtin.Pretty.indent' : Pretty txt -> Pretty txt -> Pretty txt -> Pretty txt - 551. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + 552. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo builtin.Pretty.join : [Pretty txt] -> Pretty txt - 552. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + 553. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 553. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + 554. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 - 554. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + 555. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 builtin.Pretty.orElse : Pretty txt -> Pretty txt -> Pretty txt - 555. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + 556. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 builtin.Pretty.Pretty : Annotated () txt -> Pretty txt - 556. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + 557. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g builtin.Pretty.sepBy : Pretty txt -> [Pretty txt] -> Pretty txt - 557. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + 558. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro builtin.Pretty.table : [[Pretty txt]] -> Pretty txt - 558. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + 559. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 builtin.Pretty.wrap : Pretty txt -> Pretty txt - 559. -- ##Ref + 560. -- ##Ref builtin type builtin.Ref - 560. -- ##Ref.read + 561. -- ##Ref.read builtin.Ref.read : Ref g a ->{g} a - 561. -- ##Ref.write + 562. -- ##Ref.write builtin.Ref.write : Ref g a -> a ->{g} () - 562. -- ##Effect + 563. -- ##Effect builtin type builtin.Request - 563. -- ##Scope + 564. -- ##Scope builtin type builtin.Scope - 564. -- ##Scope.array + 565. -- ##Scope.array builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 565. -- ##Scope.arrayOf + 566. -- ##Scope.arrayOf builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 566. -- ##Scope.bytearray + 567. -- ##Scope.bytearray builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 567. -- ##Scope.bytearrayOf + 568. -- ##Scope.bytearrayOf builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 568. -- ##Scope.ref + 569. -- ##Scope.ref builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 569. -- ##Scope.run + 570. -- ##Scope.run builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 570. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + 571. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 structural type builtin.SeqView a b - 571. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + 572. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 builtin.SeqView.VElem : a -> b -> SeqView a b - 572. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + 573. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 builtin.SeqView.VEmpty : SeqView a b - 573. -- ##Socket.toText + 574. -- ##Socket.toText builtin.Socket.toText : Socket -> Text - 574. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + 575. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo builtin.syntax.docAside : Doc2 -> Doc2 - 575. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + 576. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 builtin.syntax.docBlockquote : Doc2 -> Doc2 - 576. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + 577. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 builtin.syntax.docBold : Doc2 -> Doc2 - 577. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + 578. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg builtin.syntax.docBulletedList : [Doc2] -> Doc2 - 578. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + 579. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 - 579. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + 580. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo builtin.syntax.docCode : Doc2 -> Doc2 - 580. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + 581. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 builtin.syntax.docCodeBlock : Text -> Text -> Doc2 - 581. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + 582. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 builtin.syntax.docColumn : [Doc2] -> Doc2 - 582. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + 583. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term - 583. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + 584. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg builtin.syntax.docEmbedAnnotations : tms -> tms - 584. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + 585. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 builtin.syntax.docEmbedSignatureLink : '{g} t -> Doc2.Term - 585. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + 586. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao builtin.syntax.docEmbedTermLink : '{g} t -> Either a Doc2.Term - 586. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + 587. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 builtin.syntax.docEmbedTypeLink : typ -> Either typ b - 587. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + 588. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg builtin.syntax.docEval : 'a -> Doc2 - 588. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + 589. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g builtin.syntax.docEvalInline : 'a -> Doc2 - 589. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + 590. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 builtin.syntax.docExample : Nat -> '{g} t -> Doc2 - 590. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + 591. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 - 591. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + 592. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 592. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + 593. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) - 593. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + 594. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 builtin.syntax.docGroup : Doc2 -> Doc2 - 594. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + 595. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 builtin.syntax.docItalic : Doc2 -> Doc2 - 595. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + 596. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 builtin.syntax.docJoin : [Doc2] -> Doc2 - 596. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + 597. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 - 597. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + 598. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 - 598. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + 599. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 - 599. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + 600. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 builtin.syntax.docParagraph : [Doc2] -> Doc2 - 600. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + 601. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 - 601. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + 602. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 builtin.syntax.docSignature : [Doc2.Term] -> Doc2 - 602. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + 603. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 - 603. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + 604. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 builtin.syntax.docSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 604. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + 605. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 builtin.syntax.docSourceElement : link -> annotations -> (link, annotations) - 605. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + 606. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag builtin.syntax.docStrikethrough : Doc2 -> Doc2 - 606. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + 607. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g builtin.syntax.docTable : [[Doc2]] -> Doc2 - 607. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + 608. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 - 608. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + 609. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 builtin.syntax.docTransclude : d -> d - 609. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + 610. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 builtin.syntax.docUntitledSection : [Doc2] -> Doc2 - 610. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + 611. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo builtin.syntax.docVerbatim : Doc2 -> Doc2 - 611. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + 612. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 builtin.syntax.docWord : Text -> Doc2 - 612. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + 613. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 unique type builtin.Test.Result - 613. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + 614. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 builtin.Test.Result.Fail : Text -> Result - 614. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + 615. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 builtin.Test.Result.Ok : Text -> Result - 615. -- ##Text + 616. -- ##Text builtin type builtin.Text - 616. -- ##Text.!= + 617. -- ##Text.!= builtin.Text.!= : Text -> Text -> Boolean - 617. -- ##Text.++ + 618. -- ##Text.++ builtin.Text.++ : Text -> Text -> Text - 618. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + 619. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text - 619. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + 620. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg builtin.Text.alignRightWith : Nat -> Char -> Text -> Text - 620. -- ##Text.drop + 621. -- ##Text.drop builtin.Text.drop : Nat -> Text -> Text - 621. -- ##Text.empty + 622. -- ##Text.empty builtin.Text.empty : Text - 622. -- ##Text.== + 623. -- ##Text.== builtin.Text.eq : Text -> Text -> Boolean - 623. -- ##Text.fromCharList + 624. -- ##Text.fromCharList builtin.Text.fromCharList : [Char] -> Text - 624. -- ##Text.fromUtf8.impl.v3 + 625. -- ##Text.fromUtf8.impl.v3 builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 625. -- ##Text.> + 626. -- ##Text.> builtin.Text.gt : Text -> Text -> Boolean - 626. -- ##Text.>= + 627. -- ##Text.>= builtin.Text.gteq : Text -> Text -> Boolean - 627. -- ##Text.< + 628. -- ##Text.< builtin.Text.lt : Text -> Text -> Boolean - 628. -- ##Text.<= + 629. -- ##Text.<= builtin.Text.lteq : Text -> Text -> Boolean - 629. -- ##Text.patterns.anyChar + 630. -- ##Text.patterns.anyChar builtin.Text.patterns.anyChar : Pattern Text - 630. -- ##Text.patterns.charIn + 631. -- ##Text.patterns.charIn builtin.Text.patterns.charIn : [Char] -> Pattern Text - 631. -- ##Text.patterns.charRange + 632. -- ##Text.patterns.charRange builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 632. -- ##Text.patterns.digit + 633. -- ##Text.patterns.digit builtin.Text.patterns.digit : Pattern Text - 633. -- ##Text.patterns.eof + 634. -- ##Text.patterns.eof builtin.Text.patterns.eof : Pattern Text - 634. -- ##Text.patterns.letter + 635. -- ##Text.patterns.letter builtin.Text.patterns.letter : Pattern Text - 635. -- ##Text.patterns.literal + 636. -- ##Text.patterns.literal builtin.Text.patterns.literal : Text -> Pattern Text - 636. -- ##Text.patterns.notCharIn + 637. -- ##Text.patterns.notCharIn builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 637. -- ##Text.patterns.notCharRange + 638. -- ##Text.patterns.notCharRange builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 638. -- ##Text.patterns.punctuation + 639. -- ##Text.patterns.punctuation builtin.Text.patterns.punctuation : Pattern Text - 639. -- ##Text.patterns.space + 640. -- ##Text.patterns.space builtin.Text.patterns.space : Pattern Text - 640. -- ##Text.repeat + 641. -- ##Text.repeat builtin.Text.repeat : Nat -> Text -> Text - 641. -- ##Text.reverse + 642. -- ##Text.reverse builtin.Text.reverse : Text -> Text - 642. -- ##Text.size + 643. -- ##Text.size builtin.Text.size : Text -> Nat - 643. -- ##Text.take + 644. -- ##Text.take builtin.Text.take : Nat -> Text -> Text - 644. -- ##Text.toCharList + 645. -- ##Text.toCharList builtin.Text.toCharList : Text -> [Char] - 645. -- ##Text.toLowercase + 646. -- ##Text.toLowercase builtin.Text.toLowercase : Text -> Text - 646. -- ##Text.toUppercase + 647. -- ##Text.toUppercase builtin.Text.toUppercase : Text -> Text - 647. -- ##Text.toUtf8 + 648. -- ##Text.toUtf8 builtin.Text.toUtf8 : Text -> Bytes - 648. -- ##Text.uncons + 649. -- ##Text.uncons builtin.Text.uncons : Text -> Optional (Char, Text) - 649. -- ##Text.unsnoc + 650. -- ##Text.unsnoc builtin.Text.unsnoc : Text -> Optional (Text, Char) - 650. -- ##ThreadId.toText + 651. -- ##ThreadId.toText builtin.ThreadId.toText : ThreadId -> Text - 651. -- ##todo + 652. -- ##todo builtin.todo : a -> b - 652. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + 653. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 structural type builtin.Tuple a b - 653. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + 654. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 builtin.Tuple.Cons : a -> b -> Tuple a b - 654. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + 655. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g structural type builtin.Unit - 655. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + 656. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 builtin.Unit.Unit : () - 656. -- ##Universal.< + 657. -- ##Universal.< builtin.Universal.< : a -> a -> Boolean - 657. -- ##Universal.<= + 658. -- ##Universal.<= builtin.Universal.<= : a -> a -> Boolean - 658. -- ##Universal.== + 659. -- ##Universal.== builtin.Universal.== : a -> a -> Boolean - 659. -- ##Universal.> + 660. -- ##Universal.> builtin.Universal.> : a -> a -> Boolean - 660. -- ##Universal.>= + 661. -- ##Universal.>= builtin.Universal.>= : a -> a -> Boolean - 661. -- ##Universal.compare + 662. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 662. -- ##unsafe.coerceAbilities + 663. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 663. -- ##Value + 664. -- ##Value builtin type builtin.Value - 664. -- ##Value.dependencies + 665. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 665. -- ##Value.deserialize + 666. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 666. -- ##Value.load + 667. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 667. -- ##Value.serialize + 668. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 668. -- ##Value.value + 669. -- ##Value.value builtin.Value.value : a -> Value - 669. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 670. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 670. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 671. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 671. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 672. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 672. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 673. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 673. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 674. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 674. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 675. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 675. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 676. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 676. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 677. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 677. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 678. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 678. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 679. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 679. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 680. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2384,7 +2387,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 680. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 681. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2393,318 +2396,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 681. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 682. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 682. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 683. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 683. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 684. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 684. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 685. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 685. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 686. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 686. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 687. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 687. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 688. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 688. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 689. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 689. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 690. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 690. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 691. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 691. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 692. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 692. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 693. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 693. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 694. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 694. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 695. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 695. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 696. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 696. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 697. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 697. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 698. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 698. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 699. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 699. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 700. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 700. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 701. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 701. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 702. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 702. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 703. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 703. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 704. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 704. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 705. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 705. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 706. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 706. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 707. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 707. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 708. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 708. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 709. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 709. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 710. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 710. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 711. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 711. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 712. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 712. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 713. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 713. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 714. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 714. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 715. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 715. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 716. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 716. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 717. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 717. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 718. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 718. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 719. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 719. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 720. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 720. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 721. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 721. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 722. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 722. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 723. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 723. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 724. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 724. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 725. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 725. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 726. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 726. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 727. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 727. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 728. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 728. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 729. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 729. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 730. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 730. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 731. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 731. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 732. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 732. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 733. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 733. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 734. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 734. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 735. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 735. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 736. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 736. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 737. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 737. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 738. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 738. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 739. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 739. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 740. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 740. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 741. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 741. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 742. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 742. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 743. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 743. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 744. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 744. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 745. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 745. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 746. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o saveSelfContained : a -> Text ->{IO, Exception} () - 746. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 747. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 747. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 748. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 748. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 749. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 749. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 750. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 750. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 751. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 751. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 752. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 752. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 753. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 753. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 754. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 754. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 755. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 755. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 756. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 756. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 757. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 757. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 758. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 758. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 759. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 759. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 760. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 760. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 761. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 761. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 762. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 762. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 763. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 763. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 764. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 764. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 765. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 765. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 766. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 766. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 767. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 767. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 768. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 768. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 769. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 769. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 770. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 770. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 771. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 771. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 772. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 772. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 773. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 773. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 774. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 774. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 775. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 775. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 776. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 776. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 777. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index 03108f869..a2b6a2bac 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -87,571 +87,572 @@ Let's try it! -> Bytes -> Bytes -> Bytes - 67. Debug.trace : Text -> a -> () - 68. Debug.watch : Text -> a -> a - 69. unique type Doc - 70. Doc.Blob : Text -> Doc - 71. Doc.Evaluate : Term -> Doc - 72. Doc.Join : [Doc] -> Doc - 73. Doc.Link : Link -> Doc - 74. Doc.Signature : Term -> Doc - 75. Doc.Source : Link -> Doc - 76. structural type Either a b - 77. Either.Left : a -> Either a b - 78. Either.Right : b -> Either a b - 79. structural ability Exception - 80. Exception.raise : Failure ->{Exception} x - 81. builtin type Float - 82. Float.* : Float -> Float -> Float - 83. Float.+ : Float -> Float -> Float - 84. Float.- : Float -> Float -> Float - 85. Float./ : Float -> Float -> Float - 86. Float.abs : Float -> Float - 87. Float.acos : Float -> Float - 88. Float.acosh : Float -> Float - 89. Float.asin : Float -> Float - 90. Float.asinh : Float -> Float - 91. Float.atan : Float -> Float - 92. Float.atan2 : Float -> Float -> Float - 93. Float.atanh : Float -> Float - 94. Float.ceiling : Float -> Int - 95. Float.cos : Float -> Float - 96. Float.cosh : Float -> Float - 97. Float.eq : Float -> Float -> Boolean - 98. Float.exp : Float -> Float - 99. Float.floor : Float -> Int - 100. Float.fromRepresentation : Nat -> Float - 101. Float.fromText : Text -> Optional Float - 102. Float.gt : Float -> Float -> Boolean - 103. Float.gteq : Float -> Float -> Boolean - 104. Float.log : Float -> Float - 105. Float.logBase : Float -> Float -> Float - 106. Float.lt : Float -> Float -> Boolean - 107. Float.lteq : Float -> Float -> Boolean - 108. Float.max : Float -> Float -> Float - 109. Float.min : Float -> Float -> Float - 110. Float.pow : Float -> Float -> Float - 111. Float.round : Float -> Int - 112. Float.sin : Float -> Float - 113. Float.sinh : Float -> Float - 114. Float.sqrt : Float -> Float - 115. Float.tan : Float -> Float - 116. Float.tanh : Float -> Float - 117. Float.toRepresentation : Float -> Nat - 118. Float.toText : Float -> Text - 119. Float.truncate : Float -> Int - 120. Handle.toText : Handle -> Text - 121. builtin type ImmutableArray - 122. ImmutableArray.copyTo! : MutableArray g a + 67. Debug.toText : a -> Optional (Either Text Text) + 68. Debug.trace : Text -> a -> () + 69. Debug.watch : Text -> a -> a + 70. unique type Doc + 71. Doc.Blob : Text -> Doc + 72. Doc.Evaluate : Term -> Doc + 73. Doc.Join : [Doc] -> Doc + 74. Doc.Link : Link -> Doc + 75. Doc.Signature : Term -> Doc + 76. Doc.Source : Link -> Doc + 77. structural type Either a b + 78. Either.Left : a -> Either a b + 79. Either.Right : b -> Either a b + 80. structural ability Exception + 81. Exception.raise : Failure ->{Exception} x + 82. builtin type Float + 83. Float.* : Float -> Float -> Float + 84. Float.+ : Float -> Float -> Float + 85. Float.- : Float -> Float -> Float + 86. Float./ : Float -> Float -> Float + 87. Float.abs : Float -> Float + 88. Float.acos : Float -> Float + 89. Float.acosh : Float -> Float + 90. Float.asin : Float -> Float + 91. Float.asinh : Float -> Float + 92. Float.atan : Float -> Float + 93. Float.atan2 : Float -> Float -> Float + 94. Float.atanh : Float -> Float + 95. Float.ceiling : Float -> Int + 96. Float.cos : Float -> Float + 97. Float.cosh : Float -> Float + 98. Float.eq : Float -> Float -> Boolean + 99. Float.exp : Float -> Float + 100. Float.floor : Float -> Int + 101. Float.fromRepresentation : Nat -> Float + 102. Float.fromText : Text -> Optional Float + 103. Float.gt : Float -> Float -> Boolean + 104. Float.gteq : Float -> Float -> Boolean + 105. Float.log : Float -> Float + 106. Float.logBase : Float -> Float -> Float + 107. Float.lt : Float -> Float -> Boolean + 108. Float.lteq : Float -> Float -> Boolean + 109. Float.max : Float -> Float -> Float + 110. Float.min : Float -> Float -> Float + 111. Float.pow : Float -> Float -> Float + 112. Float.round : Float -> Int + 113. Float.sin : Float -> Float + 114. Float.sinh : Float -> Float + 115. Float.sqrt : Float -> Float + 116. Float.tan : Float -> Float + 117. Float.tanh : Float -> Float + 118. Float.toRepresentation : Float -> Nat + 119. Float.toText : Float -> Text + 120. Float.truncate : Float -> Int + 121. Handle.toText : Handle -> Text + 122. builtin type ImmutableArray + 123. ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray a -> Nat -> Nat ->{g, Exception} () - 123. ImmutableArray.read : ImmutableArray a + 124. ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 124. ImmutableArray.size : ImmutableArray a -> Nat - 125. builtin type ImmutableByteArray - 126. ImmutableByteArray.copyTo! : MutableByteArray g + 125. ImmutableArray.size : ImmutableArray a -> Nat + 126. builtin type ImmutableByteArray + 127. ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray -> Nat -> Nat ->{g, Exception} () - 127. ImmutableByteArray.read16be : ImmutableByteArray + 128. ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 128. ImmutableByteArray.read24be : ImmutableByteArray + 129. ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 129. ImmutableByteArray.read32be : ImmutableByteArray + 130. ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 130. ImmutableByteArray.read40be : ImmutableByteArray + 131. ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 131. ImmutableByteArray.read64be : ImmutableByteArray + 132. ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 132. ImmutableByteArray.read8 : ImmutableByteArray + 133. ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 133. ImmutableByteArray.size : ImmutableByteArray -> Nat - 134. builtin type Int - 135. Int.* : Int -> Int -> Int - 136. Int.+ : Int -> Int -> Int - 137. Int.- : Int -> Int -> Int - 138. Int./ : Int -> Int -> Int - 139. Int.and : Int -> Int -> Int - 140. Int.complement : Int -> Int - 141. Int.eq : Int -> Int -> Boolean - 142. Int.fromRepresentation : Nat -> Int - 143. Int.fromText : Text -> Optional Int - 144. Int.gt : Int -> Int -> Boolean - 145. Int.gteq : Int -> Int -> Boolean - 146. Int.increment : Int -> Int - 147. Int.isEven : Int -> Boolean - 148. Int.isOdd : Int -> Boolean - 149. Int.leadingZeros : Int -> Nat - 150. Int.lt : Int -> Int -> Boolean - 151. Int.lteq : Int -> Int -> Boolean - 152. Int.mod : Int -> Int -> Int - 153. Int.negate : Int -> Int - 154. Int.or : Int -> Int -> Int - 155. Int.popCount : Int -> Nat - 156. Int.pow : Int -> Nat -> Int - 157. Int.shiftLeft : Int -> Nat -> Int - 158. Int.shiftRight : Int -> Nat -> Int - 159. Int.signum : Int -> Int - 160. Int.toFloat : Int -> Float - 161. Int.toRepresentation : Int -> Nat - 162. Int.toText : Int -> Text - 163. Int.trailingZeros : Int -> Nat - 164. Int.truncate0 : Int -> Nat - 165. Int.xor : Int -> Int -> Int - 166. unique type io2.ArithmeticFailure - 167. unique type io2.ArrayFailure - 168. unique type io2.BufferMode - 169. io2.BufferMode.BlockBuffering : BufferMode - 170. io2.BufferMode.LineBuffering : BufferMode - 171. io2.BufferMode.NoBuffering : BufferMode - 172. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 173. io2.Clock.internals.monotonic : '{IO} Either + 134. ImmutableByteArray.size : ImmutableByteArray -> Nat + 135. builtin type Int + 136. Int.* : Int -> Int -> Int + 137. Int.+ : Int -> Int -> Int + 138. Int.- : Int -> Int -> Int + 139. Int./ : Int -> Int -> Int + 140. Int.and : Int -> Int -> Int + 141. Int.complement : Int -> Int + 142. Int.eq : Int -> Int -> Boolean + 143. Int.fromRepresentation : Nat -> Int + 144. Int.fromText : Text -> Optional Int + 145. Int.gt : Int -> Int -> Boolean + 146. Int.gteq : Int -> Int -> Boolean + 147. Int.increment : Int -> Int + 148. Int.isEven : Int -> Boolean + 149. Int.isOdd : Int -> Boolean + 150. Int.leadingZeros : Int -> Nat + 151. Int.lt : Int -> Int -> Boolean + 152. Int.lteq : Int -> Int -> Boolean + 153. Int.mod : Int -> Int -> Int + 154. Int.negate : Int -> Int + 155. Int.or : Int -> Int -> Int + 156. Int.popCount : Int -> Nat + 157. Int.pow : Int -> Nat -> Int + 158. Int.shiftLeft : Int -> Nat -> Int + 159. Int.shiftRight : Int -> Nat -> Int + 160. Int.signum : Int -> Int + 161. Int.toFloat : Int -> Float + 162. Int.toRepresentation : Int -> Nat + 163. Int.toText : Int -> Text + 164. Int.trailingZeros : Int -> Nat + 165. Int.truncate0 : Int -> Nat + 166. Int.xor : Int -> Int -> Int + 167. unique type io2.ArithmeticFailure + 168. unique type io2.ArrayFailure + 169. unique type io2.BufferMode + 170. io2.BufferMode.BlockBuffering : BufferMode + 171. io2.BufferMode.LineBuffering : BufferMode + 172. io2.BufferMode.NoBuffering : BufferMode + 173. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode + 174. io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 174. io2.Clock.internals.nsec : TimeSpec -> Nat - 175. io2.Clock.internals.processCPUTime : '{IO} Either + 175. io2.Clock.internals.nsec : TimeSpec -> Nat + 176. io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 176. io2.Clock.internals.realtime : '{IO} Either + 177. io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 177. io2.Clock.internals.sec : TimeSpec -> Int - 178. io2.Clock.internals.threadCPUTime : '{IO} Either + 178. io2.Clock.internals.sec : TimeSpec -> Int + 179. io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 179. builtin type io2.Clock.internals.TimeSpec - 180. unique type io2.Failure - 181. io2.Failure.Failure : Type -> Text -> Any -> Failure - 182. unique type io2.FileMode - 183. io2.FileMode.Append : FileMode - 184. io2.FileMode.Read : FileMode - 185. io2.FileMode.ReadWrite : FileMode - 186. io2.FileMode.Write : FileMode - 187. builtin type io2.Handle - 188. builtin type io2.IO - 189. io2.IO.array : Nat ->{IO} MutableArray {IO} a - 190. io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 191. io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 192. io2.IO.bytearrayOf : Nat + 180. builtin type io2.Clock.internals.TimeSpec + 181. unique type io2.Failure + 182. io2.Failure.Failure : Type -> Text -> Any -> Failure + 183. unique type io2.FileMode + 184. io2.FileMode.Append : FileMode + 185. io2.FileMode.Read : FileMode + 186. io2.FileMode.ReadWrite : FileMode + 187. io2.FileMode.Write : FileMode + 188. builtin type io2.Handle + 189. builtin type io2.IO + 190. io2.IO.array : Nat ->{IO} MutableArray {IO} a + 191. io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a + 192. io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} + 193. io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 193. io2.IO.clientSocket.impl : Text + 194. io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 194. io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 195. io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 196. io2.IO.createDirectory.impl : Text + 195. io2.IO.closeFile.impl : Handle ->{IO} Either Failure () + 196. io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () + 197. io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 197. io2.IO.createTempDirectory.impl : Text + 198. io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 198. io2.IO.delay.impl : Nat ->{IO} Either Failure () - 199. io2.IO.directoryContents.impl : Text + 199. io2.IO.delay.impl : Nat ->{IO} Either Failure () + 200. io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 200. io2.IO.fileExists.impl : Text + 201. io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 201. io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 202. io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 203. io2.IO.getBuffering.impl : Handle + 202. io2.IO.forkComp : '{IO} a ->{IO} ThreadId + 203. io2.IO.getArgs.impl : '{IO} Either Failure [Text] + 204. io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 204. io2.IO.getBytes.impl : Handle + 205. io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 205. io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 206. io2.IO.getCurrentDirectory.impl : '{IO} Either + 206. io2.IO.getChar.impl : Handle ->{IO} Either Failure Char + 207. io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 207. io2.IO.getEcho.impl : Handle + 208. io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 208. io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 209. io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 210. io2.IO.getFileTimestamp.impl : Text + 209. io2.IO.getEnv.impl : Text ->{IO} Either Failure Text + 210. io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat + 211. io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 211. io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 212. io2.IO.getSomeBytes.impl : Handle + 212. io2.IO.getLine.impl : Handle ->{IO} Either Failure Text + 213. io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 213. io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 214. io2.IO.handlePosition.impl : Handle + 214. io2.IO.getTempDirectory.impl : '{IO} Either Failure Text + 215. io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 215. io2.IO.isDirectory.impl : Text + 216. io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 216. io2.IO.isFileEOF.impl : Handle + 217. io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 217. io2.IO.isFileOpen.impl : Handle + 218. io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 218. io2.IO.isSeekable.impl : Handle + 219. io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 219. io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 220. io2.IO.listen.impl : Socket ->{IO} Either Failure () - 221. io2.IO.openFile.impl : Text + 220. io2.IO.kill.impl : ThreadId ->{IO} Either Failure () + 221. io2.IO.listen.impl : Socket ->{IO} Either Failure () + 222. io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 222. io2.IO.putBytes.impl : Handle + 223. io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 223. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 224. io2.IO.ref : a ->{IO} Ref {IO} a - 225. io2.IO.removeDirectory.impl : Text + 224. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean + 225. io2.IO.ref : a ->{IO} Ref {IO} a + 226. io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 226. io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 227. io2.IO.renameDirectory.impl : Text + 227. io2.IO.removeFile.impl : Text ->{IO} Either Failure () + 228. io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 228. io2.IO.renameFile.impl : Text + 229. io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 229. io2.IO.seekHandle.impl : Handle + 230. io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 230. io2.IO.serverSocket.impl : Optional Text + 231. io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 231. io2.IO.setBuffering.impl : Handle + 232. io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 232. io2.IO.setCurrentDirectory.impl : Text + 233. io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 233. io2.IO.setEcho.impl : Handle + 234. io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 234. io2.IO.socketAccept.impl : Socket + 235. io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 235. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 236. io2.IO.socketReceive.impl : Socket + 236. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat + 237. io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 237. io2.IO.socketSend.impl : Socket + 238. io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 238. io2.IO.stdHandle : StdHandle -> Handle - 239. io2.IO.systemTime.impl : '{IO} Either Failure Nat - 240. io2.IO.systemTimeMicroseconds : '{IO} Int - 241. io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 242. unique type io2.IOError - 243. io2.IOError.AlreadyExists : IOError - 244. io2.IOError.EOF : IOError - 245. io2.IOError.IllegalOperation : IOError - 246. io2.IOError.NoSuchThing : IOError - 247. io2.IOError.PermissionDenied : IOError - 248. io2.IOError.ResourceBusy : IOError - 249. io2.IOError.ResourceExhausted : IOError - 250. io2.IOError.UserError : IOError - 251. unique type io2.IOFailure - 252. unique type io2.MiscFailure - 253. builtin type io2.MVar - 254. io2.MVar.isEmpty : MVar a ->{IO} Boolean - 255. io2.MVar.new : a ->{IO} MVar a - 256. io2.MVar.newEmpty : '{IO} MVar a - 257. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 258. io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 259. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 260. io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 261. io2.MVar.tryPut.impl : MVar a + 239. io2.IO.stdHandle : StdHandle -> Handle + 240. io2.IO.systemTime.impl : '{IO} Either Failure Nat + 241. io2.IO.systemTimeMicroseconds : '{IO} Int + 242. io2.IO.tryEval : '{IO} a ->{IO, Exception} a + 243. unique type io2.IOError + 244. io2.IOError.AlreadyExists : IOError + 245. io2.IOError.EOF : IOError + 246. io2.IOError.IllegalOperation : IOError + 247. io2.IOError.NoSuchThing : IOError + 248. io2.IOError.PermissionDenied : IOError + 249. io2.IOError.ResourceBusy : IOError + 250. io2.IOError.ResourceExhausted : IOError + 251. io2.IOError.UserError : IOError + 252. unique type io2.IOFailure + 253. unique type io2.MiscFailure + 254. builtin type io2.MVar + 255. io2.MVar.isEmpty : MVar a ->{IO} Boolean + 256. io2.MVar.new : a ->{IO} MVar a + 257. io2.MVar.newEmpty : '{IO} MVar a + 258. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () + 259. io2.MVar.read.impl : MVar a ->{IO} Either Failure a + 260. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a + 261. io2.MVar.take.impl : MVar a ->{IO} Either Failure a + 262. io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 262. io2.MVar.tryRead.impl : MVar a + 263. io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 263. io2.MVar.tryTake : MVar a ->{IO} Optional a - 264. builtin type io2.Promise - 265. io2.Promise.new : '{IO} Promise a - 266. io2.Promise.read : Promise a ->{IO} a - 267. io2.Promise.tryRead : Promise a ->{IO} Optional a - 268. io2.Promise.write : Promise a -> a ->{IO} Boolean - 269. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 270. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 271. builtin type io2.Ref.Ticket - 272. io2.Ref.Ticket.read : Ticket a -> a - 273. unique type io2.RuntimeFailure - 274. unique type io2.SeekMode - 275. io2.SeekMode.AbsoluteSeek : SeekMode - 276. io2.SeekMode.RelativeSeek : SeekMode - 277. io2.SeekMode.SeekFromEnd : SeekMode - 278. builtin type io2.Socket - 279. unique type io2.StdHandle - 280. io2.StdHandle.StdErr : StdHandle - 281. io2.StdHandle.StdIn : StdHandle - 282. io2.StdHandle.StdOut : StdHandle - 283. builtin type io2.STM - 284. io2.STM.atomically : '{STM} a ->{IO} a - 285. io2.STM.retry : '{STM} a - 286. unique type io2.STMFailure - 287. builtin type io2.ThreadId - 288. builtin type io2.Tls - 289. builtin type io2.Tls.Cipher - 290. builtin type io2.Tls.ClientConfig - 291. io2.Tls.ClientConfig.certificates.set : [SignedCert] + 264. io2.MVar.tryTake : MVar a ->{IO} Optional a + 265. builtin type io2.Promise + 266. io2.Promise.new : '{IO} Promise a + 267. io2.Promise.read : Promise a ->{IO} a + 268. io2.Promise.tryRead : Promise a ->{IO} Optional a + 269. io2.Promise.write : Promise a -> a ->{IO} Boolean + 270. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean + 271. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a + 272. builtin type io2.Ref.Ticket + 273. io2.Ref.Ticket.read : Ticket a -> a + 274. unique type io2.RuntimeFailure + 275. unique type io2.SeekMode + 276. io2.SeekMode.AbsoluteSeek : SeekMode + 277. io2.SeekMode.RelativeSeek : SeekMode + 278. io2.SeekMode.SeekFromEnd : SeekMode + 279. builtin type io2.Socket + 280. unique type io2.StdHandle + 281. io2.StdHandle.StdErr : StdHandle + 282. io2.StdHandle.StdIn : StdHandle + 283. io2.StdHandle.StdOut : StdHandle + 284. builtin type io2.STM + 285. io2.STM.atomically : '{STM} a ->{IO} a + 286. io2.STM.retry : '{STM} a + 287. unique type io2.STMFailure + 288. builtin type io2.ThreadId + 289. builtin type io2.Tls + 290. builtin type io2.Tls.Cipher + 291. builtin type io2.Tls.ClientConfig + 292. io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 292. io2.TLS.ClientConfig.ciphers.set : [Cipher] + 293. io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 293. io2.Tls.ClientConfig.default : Text + 294. io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 294. io2.Tls.ClientConfig.versions.set : [Version] + 295. io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 295. io2.Tls.decodeCert.impl : Bytes + 296. io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 296. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 297. io2.Tls.encodeCert : SignedCert -> Bytes - 298. io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 299. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 300. io2.Tls.newClient.impl : ClientConfig + 297. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] + 298. io2.Tls.encodeCert : SignedCert -> Bytes + 299. io2.Tls.encodePrivateKey : PrivateKey -> Bytes + 300. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () + 301. io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 301. io2.Tls.newServer.impl : ServerConfig + 302. io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 302. builtin type io2.Tls.PrivateKey - 303. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 304. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 305. builtin type io2.Tls.ServerConfig - 306. io2.Tls.ServerConfig.certificates.set : [SignedCert] + 303. builtin type io2.Tls.PrivateKey + 304. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes + 305. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () + 306. builtin type io2.Tls.ServerConfig + 307. io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 307. io2.Tls.ServerConfig.ciphers.set : [Cipher] + 308. io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 308. io2.Tls.ServerConfig.default : [SignedCert] + 309. io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 309. io2.Tls.ServerConfig.versions.set : [Version] + 310. io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 310. builtin type io2.Tls.SignedCert - 311. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 312. builtin type io2.Tls.Version - 313. unique type io2.TlsFailure - 314. builtin type io2.TVar - 315. io2.TVar.new : a ->{STM} TVar a - 316. io2.TVar.newIO : a ->{IO} TVar a - 317. io2.TVar.read : TVar a ->{STM} a - 318. io2.TVar.readIO : TVar a ->{IO} a - 319. io2.TVar.swap : TVar a -> a ->{STM} a - 320. io2.TVar.write : TVar a -> a ->{STM} () - 321. io2.validateSandboxed : [Term] -> a -> Boolean - 322. unique type IsPropagated - 323. IsPropagated.IsPropagated : IsPropagated - 324. unique type IsTest - 325. IsTest.IsTest : IsTest - 326. unique type Link - 327. builtin type Link.Term - 328. Link.Term : Term -> Link - 329. Link.Term.toText : Term -> Text - 330. builtin type Link.Type - 331. Link.Type : Type -> Link - 332. builtin type List - 333. List.++ : [a] -> [a] -> [a] - 334. List.+: : a -> [a] -> [a] - 335. List.:+ : [a] -> a -> [a] - 336. List.at : Nat -> [a] -> Optional a - 337. List.cons : a -> [a] -> [a] - 338. List.drop : Nat -> [a] -> [a] - 339. List.empty : [a] - 340. List.size : [a] -> Nat - 341. List.snoc : [a] -> a -> [a] - 342. List.take : Nat -> [a] -> [a] - 343. metadata.isPropagated : IsPropagated - 344. metadata.isTest : IsTest - 345. builtin type MutableArray - 346. MutableArray.copyTo! : MutableArray g a + 311. builtin type io2.Tls.SignedCert + 312. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () + 313. builtin type io2.Tls.Version + 314. unique type io2.TlsFailure + 315. builtin type io2.TVar + 316. io2.TVar.new : a ->{STM} TVar a + 317. io2.TVar.newIO : a ->{IO} TVar a + 318. io2.TVar.read : TVar a ->{STM} a + 319. io2.TVar.readIO : TVar a ->{IO} a + 320. io2.TVar.swap : TVar a -> a ->{STM} a + 321. io2.TVar.write : TVar a -> a ->{STM} () + 322. io2.validateSandboxed : [Term] -> a -> Boolean + 323. unique type IsPropagated + 324. IsPropagated.IsPropagated : IsPropagated + 325. unique type IsTest + 326. IsTest.IsTest : IsTest + 327. unique type Link + 328. builtin type Link.Term + 329. Link.Term : Term -> Link + 330. Link.Term.toText : Term -> Text + 331. builtin type Link.Type + 332. Link.Type : Type -> Link + 333. builtin type List + 334. List.++ : [a] -> [a] -> [a] + 335. List.+: : a -> [a] -> [a] + 336. List.:+ : [a] -> a -> [a] + 337. List.at : Nat -> [a] -> Optional a + 338. List.cons : a -> [a] -> [a] + 339. List.drop : Nat -> [a] -> [a] + 340. List.empty : [a] + 341. List.size : [a] -> Nat + 342. List.snoc : [a] -> a -> [a] + 343. List.take : Nat -> [a] -> [a] + 344. metadata.isPropagated : IsPropagated + 345. metadata.isTest : IsTest + 346. builtin type MutableArray + 347. MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a -> Nat -> Nat ->{g, Exception} () - 347. MutableArray.freeze : MutableArray g a + 348. MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 348. MutableArray.freeze! : MutableArray g a + 349. MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 349. MutableArray.read : MutableArray g a + 350. MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 350. MutableArray.size : MutableArray g a -> Nat - 351. MutableArray.write : MutableArray g a + 351. MutableArray.size : MutableArray g a -> Nat + 352. MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 352. builtin type MutableByteArray - 353. MutableByteArray.copyTo! : MutableByteArray g + 353. builtin type MutableByteArray + 354. MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 354. MutableByteArray.freeze : MutableByteArray g + 355. MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 355. MutableByteArray.freeze! : MutableByteArray g + 356. MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 356. MutableByteArray.read16be : MutableByteArray g + 357. MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 357. MutableByteArray.read24be : MutableByteArray g + 358. MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 358. MutableByteArray.read32be : MutableByteArray g + 359. MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 359. MutableByteArray.read40be : MutableByteArray g + 360. MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 360. MutableByteArray.read64be : MutableByteArray g + 361. MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 361. MutableByteArray.read8 : MutableByteArray g + 362. MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 362. MutableByteArray.size : MutableByteArray g -> Nat - 363. MutableByteArray.write16be : MutableByteArray g + 363. MutableByteArray.size : MutableByteArray g -> Nat + 364. MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 364. MutableByteArray.write32be : MutableByteArray g + 365. MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 365. MutableByteArray.write64be : MutableByteArray g + 366. MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 366. MutableByteArray.write8 : MutableByteArray g + 367. MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 367. builtin type Nat - 368. Nat.* : Nat -> Nat -> Nat - 369. Nat.+ : Nat -> Nat -> Nat - 370. Nat./ : Nat -> Nat -> Nat - 371. Nat.and : Nat -> Nat -> Nat - 372. Nat.complement : Nat -> Nat - 373. Nat.drop : Nat -> Nat -> Nat - 374. Nat.eq : Nat -> Nat -> Boolean - 375. Nat.fromText : Text -> Optional Nat - 376. Nat.gt : Nat -> Nat -> Boolean - 377. Nat.gteq : Nat -> Nat -> Boolean - 378. Nat.increment : Nat -> Nat - 379. Nat.isEven : Nat -> Boolean - 380. Nat.isOdd : Nat -> Boolean - 381. Nat.leadingZeros : Nat -> Nat - 382. Nat.lt : Nat -> Nat -> Boolean - 383. Nat.lteq : Nat -> Nat -> Boolean - 384. Nat.mod : Nat -> Nat -> Nat - 385. Nat.or : Nat -> Nat -> Nat - 386. Nat.popCount : Nat -> Nat - 387. Nat.pow : Nat -> Nat -> Nat - 388. Nat.shiftLeft : Nat -> Nat -> Nat - 389. Nat.shiftRight : Nat -> Nat -> Nat - 390. Nat.sub : Nat -> Nat -> Int - 391. Nat.toFloat : Nat -> Float - 392. Nat.toInt : Nat -> Int - 393. Nat.toText : Nat -> Text - 394. Nat.trailingZeros : Nat -> Nat - 395. Nat.xor : Nat -> Nat -> Nat - 396. structural type Optional a - 397. Optional.None : Optional a - 398. Optional.Some : a -> Optional a - 399. builtin type Pattern - 400. Pattern.capture : Pattern a -> Pattern a - 401. Pattern.isMatch : Pattern a -> a -> Boolean - 402. Pattern.join : [Pattern a] -> Pattern a - 403. Pattern.many : Pattern a -> Pattern a - 404. Pattern.or : Pattern a -> Pattern a -> Pattern a - 405. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 406. Pattern.run : Pattern a -> a -> Optional ([a], a) - 407. builtin type Ref - 408. Ref.read : Ref g a ->{g} a - 409. Ref.write : Ref g a -> a ->{g} () - 410. builtin type Request - 411. builtin type Scope - 412. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 413. Scope.arrayOf : a + 368. builtin type Nat + 369. Nat.* : Nat -> Nat -> Nat + 370. Nat.+ : Nat -> Nat -> Nat + 371. Nat./ : Nat -> Nat -> Nat + 372. Nat.and : Nat -> Nat -> Nat + 373. Nat.complement : Nat -> Nat + 374. Nat.drop : Nat -> Nat -> Nat + 375. Nat.eq : Nat -> Nat -> Boolean + 376. Nat.fromText : Text -> Optional Nat + 377. Nat.gt : Nat -> Nat -> Boolean + 378. Nat.gteq : Nat -> Nat -> Boolean + 379. Nat.increment : Nat -> Nat + 380. Nat.isEven : Nat -> Boolean + 381. Nat.isOdd : Nat -> Boolean + 382. Nat.leadingZeros : Nat -> Nat + 383. Nat.lt : Nat -> Nat -> Boolean + 384. Nat.lteq : Nat -> Nat -> Boolean + 385. Nat.mod : Nat -> Nat -> Nat + 386. Nat.or : Nat -> Nat -> Nat + 387. Nat.popCount : Nat -> Nat + 388. Nat.pow : Nat -> Nat -> Nat + 389. Nat.shiftLeft : Nat -> Nat -> Nat + 390. Nat.shiftRight : Nat -> Nat -> Nat + 391. Nat.sub : Nat -> Nat -> Int + 392. Nat.toFloat : Nat -> Float + 393. Nat.toInt : Nat -> Int + 394. Nat.toText : Nat -> Text + 395. Nat.trailingZeros : Nat -> Nat + 396. Nat.xor : Nat -> Nat -> Nat + 397. structural type Optional a + 398. Optional.None : Optional a + 399. Optional.Some : a -> Optional a + 400. builtin type Pattern + 401. Pattern.capture : Pattern a -> Pattern a + 402. Pattern.isMatch : Pattern a -> a -> Boolean + 403. Pattern.join : [Pattern a] -> Pattern a + 404. Pattern.many : Pattern a -> Pattern a + 405. Pattern.or : Pattern a -> Pattern a -> Pattern a + 406. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a + 407. Pattern.run : Pattern a -> a -> Optional ([a], a) + 408. builtin type Ref + 409. Ref.read : Ref g a ->{g} a + 410. Ref.write : Ref g a -> a ->{g} () + 411. builtin type Request + 412. builtin type Scope + 413. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a + 414. Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 414. Scope.bytearray : Nat + 415. Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 415. Scope.bytearrayOf : Nat + 416. Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 416. Scope.ref : a ->{Scope s} Ref {Scope s} a - 417. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 418. structural type SeqView a b - 419. SeqView.VElem : a -> b -> SeqView a b - 420. SeqView.VEmpty : SeqView a b - 421. Socket.toText : Socket -> Text - 422. unique type Test.Result - 423. Test.Result.Fail : Text -> Result - 424. Test.Result.Ok : Text -> Result - 425. builtin type Text - 426. Text.!= : Text -> Text -> Boolean - 427. Text.++ : Text -> Text -> Text - 428. Text.drop : Nat -> Text -> Text - 429. Text.empty : Text - 430. Text.eq : Text -> Text -> Boolean - 431. Text.fromCharList : [Char] -> Text - 432. Text.fromUtf8.impl : Bytes -> Either Failure Text - 433. Text.gt : Text -> Text -> Boolean - 434. Text.gteq : Text -> Text -> Boolean - 435. Text.lt : Text -> Text -> Boolean - 436. Text.lteq : Text -> Text -> Boolean - 437. Text.patterns.anyChar : Pattern Text - 438. Text.patterns.charIn : [Char] -> Pattern Text - 439. Text.patterns.charRange : Char -> Char -> Pattern Text - 440. Text.patterns.digit : Pattern Text - 441. Text.patterns.eof : Pattern Text - 442. Text.patterns.letter : Pattern Text - 443. Text.patterns.literal : Text -> Pattern Text - 444. Text.patterns.notCharIn : [Char] -> Pattern Text - 445. Text.patterns.notCharRange : Char -> Char -> Pattern Text - 446. Text.patterns.punctuation : Pattern Text - 447. Text.patterns.space : Pattern Text - 448. Text.repeat : Nat -> Text -> Text - 449. Text.reverse : Text -> Text - 450. Text.size : Text -> Nat - 451. Text.take : Nat -> Text -> Text - 452. Text.toCharList : Text -> [Char] - 453. Text.toLowercase : Text -> Text - 454. Text.toUppercase : Text -> Text - 455. Text.toUtf8 : Text -> Bytes - 456. Text.uncons : Text -> Optional (Char, Text) - 457. Text.unsnoc : Text -> Optional (Text, Char) - 458. ThreadId.toText : ThreadId -> Text - 459. todo : a -> b - 460. structural type Tuple a b - 461. Tuple.Cons : a -> b -> Tuple a b - 462. structural type Unit - 463. Unit.Unit : () - 464. Universal.< : a -> a -> Boolean - 465. Universal.<= : a -> a -> Boolean - 466. Universal.== : a -> a -> Boolean - 467. Universal.> : a -> a -> Boolean - 468. Universal.>= : a -> a -> Boolean - 469. Universal.compare : a -> a -> Int - 470. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 471. builtin type Value - 472. Value.dependencies : Value -> [Term] - 473. Value.deserialize : Bytes -> Either Text Value - 474. Value.load : Value ->{IO} Either [Term] a - 475. Value.serialize : Value -> Bytes - 476. Value.value : a -> Value + 417. Scope.ref : a ->{Scope s} Ref {Scope s} a + 418. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r + 419. structural type SeqView a b + 420. SeqView.VElem : a -> b -> SeqView a b + 421. SeqView.VEmpty : SeqView a b + 422. Socket.toText : Socket -> Text + 423. unique type Test.Result + 424. Test.Result.Fail : Text -> Result + 425. Test.Result.Ok : Text -> Result + 426. builtin type Text + 427. Text.!= : Text -> Text -> Boolean + 428. Text.++ : Text -> Text -> Text + 429. Text.drop : Nat -> Text -> Text + 430. Text.empty : Text + 431. Text.eq : Text -> Text -> Boolean + 432. Text.fromCharList : [Char] -> Text + 433. Text.fromUtf8.impl : Bytes -> Either Failure Text + 434. Text.gt : Text -> Text -> Boolean + 435. Text.gteq : Text -> Text -> Boolean + 436. Text.lt : Text -> Text -> Boolean + 437. Text.lteq : Text -> Text -> Boolean + 438. Text.patterns.anyChar : Pattern Text + 439. Text.patterns.charIn : [Char] -> Pattern Text + 440. Text.patterns.charRange : Char -> Char -> Pattern Text + 441. Text.patterns.digit : Pattern Text + 442. Text.patterns.eof : Pattern Text + 443. Text.patterns.letter : Pattern Text + 444. Text.patterns.literal : Text -> Pattern Text + 445. Text.patterns.notCharIn : [Char] -> Pattern Text + 446. Text.patterns.notCharRange : Char -> Char -> Pattern Text + 447. Text.patterns.punctuation : Pattern Text + 448. Text.patterns.space : Pattern Text + 449. Text.repeat : Nat -> Text -> Text + 450. Text.reverse : Text -> Text + 451. Text.size : Text -> Nat + 452. Text.take : Nat -> Text -> Text + 453. Text.toCharList : Text -> [Char] + 454. Text.toLowercase : Text -> Text + 455. Text.toUppercase : Text -> Text + 456. Text.toUtf8 : Text -> Bytes + 457. Text.uncons : Text -> Optional (Char, Text) + 458. Text.unsnoc : Text -> Optional (Text, Char) + 459. ThreadId.toText : ThreadId -> Text + 460. todo : a -> b + 461. structural type Tuple a b + 462. Tuple.Cons : a -> b -> Tuple a b + 463. structural type Unit + 464. Unit.Unit : () + 465. Universal.< : a -> a -> Boolean + 466. Universal.<= : a -> a -> Boolean + 467. Universal.== : a -> a -> Boolean + 468. Universal.> : a -> a -> Boolean + 469. Universal.>= : a -> a -> Boolean + 470. Universal.compare : a -> a -> Int + 471. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b + 472. builtin type Value + 473. Value.dependencies : Value -> [Term] + 474. Value.deserialize : Bytes -> Either Text Value + 475. Value.load : Value ->{IO} Either [Term] a + 476. Value.serialize : Value -> Bytes + 477. Value.value : a -> Value .builtin> alias.many 94-104 .mylib @@ -660,17 +661,17 @@ Let's try it! Added definitions: - 1. Float.ceiling : Float -> Int - 2. Float.cos : Float -> Float - 3. Float.cosh : Float -> Float - 4. Float.eq : Float -> Float -> Boolean - 5. Float.exp : Float -> Float - 6. Float.floor : Float -> Int - 7. Float.fromRepresentation : Nat -> Float - 8. Float.fromText : Text -> Optional Float - 9. Float.gt : Float -> Float -> Boolean - 10. Float.gteq : Float -> Float -> Boolean - 11. Float.log : Float -> Float + 1. Float.atanh : Float -> Float + 2. Float.ceiling : Float -> Int + 3. Float.cos : Float -> Float + 4. Float.cosh : Float -> Float + 5. Float.eq : Float -> Float -> Boolean + 6. Float.exp : Float -> Float + 7. Float.floor : Float -> Int + 8. Float.fromRepresentation : Nat -> Float + 9. Float.fromText : Text -> Optional Float + 10. Float.gt : Float -> Float -> Boolean + 11. Float.gteq : Float -> Float -> Boolean Tip: You can use `undo` or `reflog` to undo this change. @@ -730,17 +731,17 @@ I want to incorporate a few more from another namespace: .mylib> find - 1. Float.ceiling : Float -> Int - 2. Float.cos : Float -> Float - 3. Float.cosh : Float -> Float - 4. Float.eq : Float -> Float -> Boolean - 5. Float.exp : Float -> Float - 6. Float.floor : Float -> Int - 7. Float.fromRepresentation : Nat -> Float - 8. Float.fromText : Text -> Optional Float - 9. Float.gt : Float -> Float -> Boolean - 10. Float.gteq : Float -> Float -> Boolean - 11. Float.log : Float -> Float + 1. Float.atanh : Float -> Float + 2. Float.ceiling : Float -> Int + 3. Float.cos : Float -> Float + 4. Float.cosh : Float -> Float + 5. Float.eq : Float -> Float -> Boolean + 6. Float.exp : Float -> Float + 7. Float.floor : Float -> Int + 8. Float.fromRepresentation : Nat -> Float + 9. Float.fromText : Text -> Optional Float + 10. Float.gt : Float -> Float -> Boolean + 11. Float.gteq : Float -> Float -> Boolean 12. List.adjacentPairs : [a] -> [(a, a)] 13. List.all : (a ->{g} Boolean) -> [a] ->{g} Boolean 14. List.any : (a ->{g} Boolean) -> [a] ->{g} Boolean diff --git a/unison-src/transcripts/builtins-merge.output.md b/unison-src/transcripts/builtins-merge.output.md index beb90e56d..e453ebb8e 100644 --- a/unison-src/transcripts/builtins-merge.output.md +++ b/unison-src/transcripts/builtins-merge.output.md @@ -19,7 +19,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 8. Char/ (3 terms) 9. Code (builtin type) 10. Code/ (8 terms) - 11. Debug/ (2 terms) + 11. Debug/ (3 terms) 12. Doc (type) 13. Doc/ (6 terms) 14. Either (type) diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index af0e59a94..b70ff61ea 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge` .foo> ls - 1. builtin/ (413 terms, 63 types) + 1. builtin/ (414 terms, 63 types) ``` And for a limited time, you can get even more builtin goodies: @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (583 terms, 79 types) + 1. builtin/ (584 terms, 79 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index a98df37fa..3c091572d 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -121,13 +121,13 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #q2cb2dqvje + ⊙ 1. #khhiq1sc3o - Deletes: feature1.y - ⊙ 2. #lbjaubg5e9 + ⊙ 2. #0t16m7j03m + Adds / updates: @@ -138,26 +138,26 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Original name New name(s) feature1.y master.y - ⊙ 3. #71ajvea616 + ⊙ 3. #l4cc5snm7c + Adds / updates: feature1.y - ⊙ 4. #vr2ttthg2l + ⊙ 4. #0ujfvnropc > Moves: Original name New name x master.x - ⊙ 5. #b1o80r34ce + ⊙ 5. #jd5q4ga1jk + Adds / updates: x - □ 6. #7un22ntllg (start of history) + □ 6. #67ki96tn2j (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 9d5534fa3..391b1dbee 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -267,7 +267,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (588 terms, 80 types) + 1. root/ (589 terms, 80 types) .> history @@ -276,13 +276,13 @@ I should be able to move the root into a sub-namespace - □ 1. #3rt95kasco (start of history) + □ 1. #auu2tl56oq (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (583 terms, 79 types) + 1. builtin/ (584 terms, 79 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -292,7 +292,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #9h5q2s97j1 + ⊙ 1. #97qd306bhl - Deletes: @@ -303,7 +303,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #uc76cu49n5 + ⊙ 2. #m150lr1ui2 + Adds / updates: @@ -315,26 +315,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #p0i5leprku + ⊙ 3. #jjjgo7q3n5 + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #6653phkspu + ⊙ 4. #c0mb4ochf8 > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #96s54m0o9q + ⊙ 5. #usfoef2l86 - Deletes: history.b.termInB - ⊙ 6. #kdt1ubsjvc + ⊙ 6. #gdreu1e9hl + Adds / updates: @@ -345,13 +345,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #ilms0te7e9 + ⊙ 7. #u0lvtvmjtq + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #s4rrj4ar8p + ⊙ 8. #6p6s9eutui > Moves: @@ -361,7 +361,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #neo6d1tqh5 + ⊙ 9. #iaptpdrgpv + Adds / updates: @@ -371,7 +371,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #u3uo460daa + ⊙ 10. #qt23b1u7cq + Adds / updates: @@ -383,7 +383,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #bqq857tsem + ⊙ 11. #h8kqn6r8hl ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index 973101db9..908ea6ec4 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -1284,112 +1284,117 @@ d = c + 10 -> Nat 449. builtin.Char.toText : Char -> Text - 450. builtin.Float.toText : Float + 450. builtin.Debug.toText : a + -> Optional + (Either + Text + Text) + 451. builtin.Float.toText : Float -> Text - 451. builtin.Handle.toText : Handle + 452. builtin.Handle.toText : Handle -> Text - 452. builtin.Int.toText : Int + 453. builtin.Int.toText : Int -> Text - 453. builtin.Nat.toText : Nat + 454. builtin.Nat.toText : Nat -> Text - 454. builtin.Socket.toText : Socket + 455. builtin.Socket.toText : Socket -> Text - 455. builtin.Link.Term.toText : Term + 456. builtin.Link.Term.toText : Term -> Text - 456. builtin.ThreadId.toText : ThreadId + 457. builtin.ThreadId.toText : ThreadId -> Text - 457. builtin.Text.toUppercase : Text + 458. builtin.Text.toUppercase : Text -> Text - 458. builtin.Text.toUtf8 : Text + 459. builtin.Text.toUtf8 : Text -> Bytes - 459. builtin.todo : a -> b - 460. builtin.Debug.trace : Text + 460. builtin.todo : a -> b + 461. builtin.Debug.trace : Text -> a -> () - 461. builtin.Int.trailingZeros : Int + 462. builtin.Int.trailingZeros : Int -> Nat - 462. builtin.Nat.trailingZeros : Nat + 463. builtin.Nat.trailingZeros : Nat -> Nat - 463. builtin.Float.truncate : Float + 464. builtin.Float.truncate : Float -> Int - 464. builtin.Int.truncate0 : Int + 465. builtin.Int.truncate0 : Int -> Nat - 465. builtin.io2.IO.tryEval : '{IO} a + 466. builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 466. builtin.io2.Promise.tryRead : Promise + 467. builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 467. builtin.io2.MVar.tryTake : MVar a + 468. builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 468. builtin.Text.uncons : Text + 469. builtin.Text.uncons : Text -> Optional ( Char, Text) - 469. builtin.Any.unsafeExtract : Any + 470. builtin.Any.unsafeExtract : Any -> a - 470. builtin.Text.unsnoc : Text + 471. builtin.Text.unsnoc : Text -> Optional ( Text, Char) - 471. builtin.Code.validate : [( Term, + 472. builtin.Code.validate : [( Term, Code)] ->{IO} Optional Failure - 472. builtin.io2.validateSandboxed : [Term] + 473. builtin.io2.validateSandboxed : [Term] -> a -> Boolean - 473. builtin.Value.value : a + 474. builtin.Value.value : a -> Value - 474. builtin.Debug.watch : Text + 475. builtin.Debug.watch : Text -> a -> a - 475. builtin.MutableArray.write : MutableArray + 476. builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 476. builtin.io2.Promise.write : Promise + 477. builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 477. builtin.Ref.write : Ref g a + 478. builtin.Ref.write : Ref g a -> a ->{g} () - 478. builtin.io2.TVar.write : TVar a + 479. builtin.io2.TVar.write : TVar a -> a ->{STM} () - 479. builtin.MutableByteArray.write16be : MutableByteArray + 480. builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 480. builtin.MutableByteArray.write32be : MutableByteArray + 481. builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 481. builtin.MutableByteArray.write64be : MutableByteArray + 482. builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 482. builtin.MutableByteArray.write8 : MutableByteArray + 483. builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 483. builtin.Int.xor : Int + 484. builtin.Int.xor : Int -> Int -> Int - 484. builtin.Nat.xor : Nat + 485. builtin.Nat.xor : Nat -> Nat -> Nat diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index 4531256c7..d49ab9973 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #momui2psqq .old` to make an old namespace + `fork #9014t8bemk .old` to make an old namespace accessible again, - `reset-root #momui2psqq` to reset the root namespace and + `reset-root #9014t8bemk` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #gea9reo4v8 add - 2. now #momui2psqq add - 3. now #5055be919q builtins.merge + 1. now #q24i9rm0u0 add + 2. now #9014t8bemk add + 3. now #2p31h4lsei builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index f1a48603d..df37e5337 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #jj96fe1hif (start of history) + □ 1. #5r75rvflum (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #akqqraofi8 + ⊙ 1. #ih7oa9qmee > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #jqtt4ku7e6 + ⊙ 2. #2nsvr26oeu > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #jj96fe1hif (start of history) + □ 3. #5r75rvflum (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #akqqraofi8 + ⊙ 1. #ih7oa9qmee > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #jqtt4ku7e6 + ⊙ 2. #2nsvr26oeu > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #jj96fe1hif (start of history) + □ 3. #5r75rvflum (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #jj96fe1hif (start of history) + □ 1. #5r75rvflum (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #igp95kiubr + ⊙ 1. #65gt0djmn2 - Deletes: Nat.* Nat.+ - □ 2. #jj96fe1hif (start of history) + □ 2. #5r75rvflum (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From ac9633abdc4f7b302e33ba10e1af1de96a48a41e Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 23 Jan 2023 15:03:07 -0600 Subject: [PATCH 106/467] Create new index tables --- .../U/Codebase/Sqlite/Queries.hs | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 1703f2b18..c5760a055 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -1587,9 +1587,18 @@ dropNameLookupTables = do -- | Ensure the name lookup tables exist. ensureNameLookupTables :: Transaction () ensureNameLookupTables = do + -- This table allows us to look up which causal hashes have a name lookup. execute_ [here| - CREATE TABLE IF NOT EXISTS term_name_lookup ( + CREATE TABLE IF NOT EXISTS name_lookups ( + root_causal_hash_id INTEGER PRIMARY KEY REFERENCES causal(self_hash_id) ON DELETE CASCADE, + ) + |] + + execute_ + [here| + CREATE TABLE IF NOT EXISTS scoped_term_name_lookup ( + root_causal_hash_id INTEGER NOT NULL REFERENCES causal(self_hash_id) ON DELETE CASCADE, -- The name of the term: E.g. map.List.base reversed_name TEXT NOT NULL, -- The namespace containing this term, not reversed: E.g. base.List @@ -1599,12 +1608,12 @@ ensureNameLookupTables = do referent_component_index INTEGER NULL, referent_constructor_index INTEGER NULL, referent_constructor_type INTEGER NULL, - PRIMARY KEY (reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) + PRIMARY KEY (root_causal_hash_id, reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) ) |] execute_ [here| - CREATE INDEX IF NOT EXISTS term_names_by_namespace ON term_name_lookup(namespace) + CREATE INDEX IF NOT EXISTS term_names_by_namespace ON scoped_term_name_lookup(root_causal_hash_id, namespace) |] -- Don't need this index at the moment, but will likely be useful later. -- execute_ @@ -1613,7 +1622,8 @@ ensureNameLookupTables = do -- |] execute_ [here| - CREATE TABLE IF NOT EXISTS type_name_lookup ( + CREATE TABLE IF NOT EXISTS scoped_type_name_lookup ( + root_causal_hash_id INTEGER NOT NULL, -- The name of the term: E.g. List.base reversed_name TEXT NOT NULL, -- The namespace containing this term, not reversed: E.g. base.List @@ -1626,15 +1636,9 @@ ensureNameLookupTables = do |] execute_ [here| - CREATE INDEX IF NOT EXISTS type_names_by_namespace ON type_name_lookup(namespace) + CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace ON type_name_lookup(root_causal_hash_id, namespace) |] --- Don't need this index at the moment, but will likely be useful later. --- execute_ --- [here| --- CREATE INDEX IF NOT EXISTS type_name_by_reference_lookup ON type_name_lookup(reference_builtin, reference_object_id, reference_component_index); --- |] - -- | Insert the given set of term names into the name lookup table insertTermNames :: [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] -> Transaction () insertTermNames names = do From 19011b6710594fe41bd1564fec7ad32d97062149 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 23 Jan 2023 15:06:19 -0600 Subject: [PATCH 107/467] Keep both indexes for now --- .../U/Codebase/Sqlite/Queries.hs | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index c5760a055..fce4f42b6 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -134,6 +134,7 @@ module U.Codebase.Sqlite.Queries -- * Name Lookup ensureNameLookupTables, + ensureScopedNameLookupTables, dropNameLookupTables, insertTermNames, insertTypeNames, @@ -1585,8 +1586,58 @@ dropNameLookupTables = do |] -- | Ensure the name lookup tables exist. +-- +-- These tables will be deprecated in favour of ensureScopedNameLookupTables once we've +-- migrated all the indexes over. ensureNameLookupTables :: Transaction () ensureNameLookupTables = do + execute_ + [here| + CREATE TABLE IF NOT EXISTS term_name_lookup ( + -- The name of the term: E.g. map.List.base + reversed_name TEXT NOT NULL, + -- The namespace containing this term, not reversed: E.g. base.List + namespace TEXT NOT NULL, + referent_builtin TEXT NULL, + referent_component_hash TEXT NULL, + referent_component_index INTEGER NULL, + referent_constructor_index INTEGER NULL, + referent_constructor_type INTEGER NULL, + PRIMARY KEY (reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) + ) + |] + execute_ + [here| + CREATE INDEX IF NOT EXISTS term_names_by_namespace ON term_name_lookup(namespace) + |] + -- Don't need this index at the moment, but will likely be useful later. + -- execute_ + -- [here| + -- CREATE INDEX IF NOT EXISTS term_name_by_referent_lookup ON term_name_lookup(referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) + -- |] + execute_ + [here| + CREATE TABLE IF NOT EXISTS type_name_lookup ( + -- The name of the term: E.g. List.base + reversed_name TEXT NOT NULL, + -- The namespace containing this term, not reversed: E.g. base.List + namespace TEXT NOT NULL, + reference_builtin TEXT NULL, + reference_component_hash INTEGER NULL, + reference_component_index INTEGER NULL, + PRIMARY KEY (reversed_name, reference_builtin, reference_component_hash, reference_component_index) + ); + |] + execute_ + [here| + CREATE INDEX IF NOT EXISTS type_names_by_namespace ON type_name_lookup(namespace) + |] + +-- | Ensure the causal_hash scoped name lookup tables exist. +-- this will eventually replace the tables in 'ensureNameLookupTables' after all the indexes +-- have been migrated over. +ensureScopedNameLookupTables :: Transaction () +ensureScopedNameLookupTables = do -- This table allows us to look up which causal hashes have a name lookup. execute_ [here| From 6c00225b8d5bd72b5cce925e553b86a77d25c762 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 24 Jan 2023 11:10:21 -0500 Subject: [PATCH 108/467] Reimplement delimited control on top of racket fork primitives - These delimited continuations support multiple prompts, and generating prompts as part of a reset. - They also seem to pass the space usage tests for some pathological test cases. Basically, capture and use of the delimited continuations is 'properly tail recursive,' rather than leaking memory in an unreachable portion of the continuation. --- chez-libs/unison/cont.ss | 270 ++++++++++++++++++++++++++++++++++----- 1 file changed, 241 insertions(+), 29 deletions(-) diff --git a/chez-libs/unison/cont.ss b/chez-libs/unison/cont.ss index 7656c21f4..027c755e1 100644 --- a/chez-libs/unison/cont.ss +++ b/chez-libs/unison/cont.ss @@ -1,47 +1,259 @@ ; This library is intended to contain the implementation of ; delimited continuations used in the semantics of abilities. -; -; Currently, it is a somewhat naive implementation based on call/cc. -; This has known issues that seem to still be in force even though a -; tweak has been applied that should fix certain space leaks. So, in -; the future it will likely need to be rewritten using some -; implementation specific machinery (possibly making use of -; continuation attachments as in the Racket implementation). -; -; Also, although the API includes prompts, they are currently ignored -; in `control` and `prompt` always uses the same prompt (0). This -; means that nesting handlers will not work in general, since requests -; will not be able to jump over an inner handler of unrelated -; abilities. It should be sufficient for testing simple examples in -; the mean time, though. + (library (unison cont) - (export prompt control) + (export + prompt + control) - (import (chezscheme)) + (import (chezscheme) + (unison core)) - (define mk (lambda (x) (raise "fell off end"))) + ; This implementation is based on the implementation of delimited + ; continuations used in racket, and makes use of primitives added in + ; the racket fork of chez scheme. + ; + ; The overall idea is to keep track of a meta-continuation that is + ; made up of a series of captured native continuations. The native + ; continuations make part of the frames of the meta-continuation, + ; and these frames can be labeled with prompts to support + ; multi-prompt delimited continuations. The native 'current + ; continuation' makes up the portion of the meta-continuation below + ; the nearest prompt. + ; + ; The specific racket-chez feature used is #%$call-in-continuation + ; which does not seem to be available in the upstream chez. This is + ; an important feature to have, because the mechanism for obtaining + ; the native continuation in chez is call/cc, which leaves the + ; native continuation in place. However, when we capture the native + ; continuation to push it onto a frame of the meta-continuation, it + ; may actually be completely eliminated from the implicit + ; continuation, because we will only ever return to it by popping + ; the corresponding frame of the meta=continuation. + ; + ; Failure to truncate the native continuation can lead to space + ; leaks due to growing unreachable portions of it. The racket-chez + ; feature allows us to instead repeatedly replace the implicit + ; continuation with #%$null-continuation, which avoids the leak. + (define-virtual-register meta-continuation '()) + ; A record type representing continuation prompts. + ; + ; By comparing these records for pointer equality, we can make up + ; fresh prompts whenever needed, without having to keep track of + ; some sort of supply of prompts. + (define-record-type continuation-prompt + (fields (immutable name))) + + ; A frame of the meta-continuation consists of: + ; 1. A prompt delimiting the portion of the meta-continuation in + ; front of it. + ; 2. A native continuation to resume when re-entering the given + ; frame. + (define-record-type meta-frame + (fields + (immutable prompt) + (immutable resume-k))) + + ; A convenient abbreviation for grabbing the continuation. + (define-syntax let/cc + (syntax-rules () + [(let/cc k e ...) + (identifier? #'k) + (call/cc (lambda (k) e ...))])) + + ; A wrapper around primitive operations for truncating the implicit + ; continuation. `h` should be a nullary procedure that we want to + ; execute in an empty continuation. + (define (call-in-empty-frame h) + (($primitive $call-in-continuation) + ($primitive $null-continuation) + '() ; marks + h)) + + ; Removes and returns the top frame of the meta-continuation. + ; + ; Note: this procedure assumes that the meta-continuation has + ; already been checked for emptiness, and does no checking of its + ; own. + (define (pop-frame!) + (let ([mf (car meta-continuation)]) + (set! meta-continuation (cdr meta-continuation)) + mf)) + + ; Adds a frame to the top of the meta-continuation. + (define (push-frame! fm) + (set! meta-continuation (cons fm meta-continuation))) + + ; Handles returning values up the meta-continuation. + ; + ; Note: when we replace the native continuation with the null + ; continuation, for reasons mentioned above, it's important that the + ; things we run in that null continuation actually call this to + ; return up the meta-continuation. Otherwise we will _actually_ + ; return to the null continuation, which causes a crash. + (define (yield-to-meta-continuation results) + (cond + [(null? meta-continuation) + (display "falling off end\n") + results] + [else + (let ([mf (pop-frame!)]) + (($primitive $call-in-continuation) + (meta-frame-resume-k mf) + '() + (lambda () + (if (and (pair? results) (null? (cdr results))) + (car results) + (apply values results)))))])) + + ; This operation corresponds roughly to `reset` in shift/reset + ; delimited control. It calls (h p) in a context delimited by + ; the prompt p. + ; + ; This is something of a helper function, as the actual `prompt` + ; implementation will involve making up a fresh `p`. However, + ; this common code is useful for test cases using only single + ; prompt continuations. + ; + ; Mechanically, what this does is capture the current native + ; continuation, push it on the meta-continuation with the specified + ; prompt attached, and call (h p) in an empty native continuation. + (define (call-delimited-with-prompt p h) + (let/cc k + (call-in-empty-frame + (lambda () + (let-values + ([results + (let ([fm (make-meta-frame p k)]) + (push-frame! fm) + (h p))]) + (yield-to-meta-continuation results)))))) + + ; Implements prompt for our multi-prompt prompt/control calculus. + ; + ; `prompt` makes up a fresh prompt value, and runs its body + ; delimited with that value, e.g.: + ; + ; (prompt p ...) + ; + ; where `p` is a binding for the prompt value. The above is + ; syntactic sugar for something like: + ; + ; (prompt-impl (lambda (p) ...)) (define (prompt-impl h) - ((call/cc - (lambda (k) - (let ([ok mk]) - (set! mk (lambda (x) (set! mk ok) (k x))) - ; (h 0) <-- prompt = 0 - (mk (let ([v (h 0)]) (lambda () v)))))))) + (let ([p (make-continuation-prompt 'prompt)]) + (call-delimited-with-prompt p h))) + ; The nicer syntactic form for the above prompt implementation. (define-syntax prompt (syntax-rules () [(prompt p e ...) (prompt-impl (lambda (p) e ...))])) - (define (control-impl h) - (call/cc - (lambda (k) - (let* ([g (lambda () (prompt p (h k)))]) - (mk g))))) + ; Removes the prompt from the first frame of a meta-continuation. + (define (strip-prompt mc) + (let ([mf (car mc)]) + (cons (make-meta-frame #f (meta-frame-resume-k mf) (cdr mc))))) + ; This funcion is used to reinstate a captured continuation. It + ; should be called with: + ; + ; k - a native continuation to be pushed before the captured + ; meta-continuation + ; cc - the captured meta-continuation segment + ; p - a prompt that should delimit cc + ; + ; `p` is used as the prompt value of the `k` frame, so shift/reset + ; can be implemented by passing the same `p` that was used when `cc` + ; was captured (as that means that any further `p` control effects + ; in `cc` do not escape their original scope). + ; + ; However, we will usually be calling with p = #f, since shallow + ; handlers correspond to control effects that are able to eliminate + ; prompts. + ; + ; Note: the captured continuation `cc` is assumed to be in reverse + ; order, so will be reversed back onto the meta-continuation. + (define (push-to-meta-continuation k cc p) + (push-frame! (make-meta-frame p k)) + (let rec ([cc cc]) + (cond + [(null? cc) #f] + [else + (push-frame! (car cc)) + (rec (cdr cc))]))) + + ; Wraps a captured continuation with a procedure that reinstates it + ; upon invocation. This should be called with: + ; + ; ok - the captured native continuation that was captured along + ; with... + ; cc - the split meta-continuation + ; p - a prompt associated with the captured continuation. This + ; will be installed as a delimiter when the captured + ; continuation is re-pushed. If no delimiting is desired, + ; simply use #f, or some dummy prompt that will not be + ; involved in actual control flow. + ; + ; Note: the captured continuation `cc` is assumed to be in reverse + ; order, so will be reversed back onto the meta-continuation. + (define (make-callable-continuation ok cc p) + (lambda vals + (let/cc nk + (($primitive $call-in-continuation) + ok + '() + (lambda () + push-to-meta-continuation nk cc p + (apply values vals)))))) + + ; Captures the meta-continuation up to the specified prompt. The + ; continuation is wrapped in a function that reinstates it when + ; called. The supplied 'body' `h` is then evaluated with the + ; captured continuation. + ; + ; This implementation is designed to support shallow ability + ; handlers. This means that we actually implement what would be + ; called (in delimited continuation literature) control0. This means + ; that: + ; + ; 1. The control operator _removes_ the prompt from the + ; meta-continuation. So any control effects referring to the + ; same prompt will only be delimited further up the + ; continuation. + ; 2. The procedure reinstating the captured continuation does not + ; install a delimiter, so said captured continuation is itself + ; a procedure that can have control effects relevant to the + ; original prompt. + ; + ; The reason for this is that shallow handlers are one-shot in a + ; corresponding way. They only handle the first effect in their + ; 'body', and handling _all_ relevant effects requires an explicitly + ; recursive handler that re-installs a handling delimiter after each + ; effect request. + (define (control-impl p h) + (assert (continuation-prompt? p)) + (let/cc k + (let rec ([cc '()] [mc meta-continuation]) + (cond + [(or (null? mc) + (eq? p (meta-frame-prompt (car mc)))) + (set! meta-continuation (strip-prompt mc)) + (let ([ck (make-callable-continuation k cc #f)]) + (call-in-empty-frame + (lambda () + (let-values ([results (h ck)]) + (yield-to-meta-continuation results)))))] + [else (rec (cons (car mc) cc) (cdr mc))])))) + + ; The nicer syntactic form for the control operator. (define-syntax control (syntax-rules () [(control p k e ...) - (control-impl (lambda (k) e ...))]))) + (control-impl (lambda (k) e ...))])) + ; TODO: generate this as part of the main program. + ; (define-init-registers init-regs) + ; (init-regs) + ) From ac3838fce7b6adf49735ac67b6443f50902f2d2b Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 24 Jan 2023 10:14:23 -0600 Subject: [PATCH 109/467] Fill out more scoped operations --- .../U/Codebase/Sqlite/NamedRef.hs | 19 +- .../U/Codebase/Sqlite/Operations.hs | 30 +++ .../U/Codebase/Sqlite/Queries.hs | 226 +++++++++++++++--- .../Codebase/SqliteCodebase/Operations.hs | 41 ++++ 4 files changed, 284 insertions(+), 32 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs index ea69c9c64..10c99e3df 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs @@ -5,7 +5,8 @@ import qualified Data.List.NonEmpty as NEL import qualified Data.List.NonEmpty as NonEmpty import qualified Data.Text as Text import Unison.Prelude -import Unison.Sqlite (FromField (..), FromRow (..), SQLData (..), ToField (..), ToRow (..), field) +import Unison.Sqlite +import qualified Unison.Sqlite as Sqlite type ReversedSegments = NonEmpty Text @@ -44,3 +45,19 @@ toRowWithNamespace :: ToRow ref => NamedRef ref -> [SQLData] toRowWithNamespace nr = toRow nr <> [SQLText namespace] where namespace = Text.intercalate "." . reverse . NEL.tail . reversedSegments $ nr + +-- | The new 'scoped' name lookup format is different than the old version. +-- +-- Namely, this adds the 'lastNameSegment' as well as adding a trailing '.' to the db format +-- of both the namespace and reversed_name. +-- +-- +-- Converts a NamedRef to SQLData of the form: +-- [reversedName, namespace, lastNameSegment] <> ref fields... +namedRefToScopedRow :: ToRow ref => NamedRef ref -> [SQLData] +namedRefToScopedRow (NamedRef {reversedSegments = revSegments, ref}) = + toRow $ (SQLText reversedName, SQLText namespace, SQLText lastNameSegment) Sqlite.:. ref + where + reversedName = (Text.intercalate "." . toList $ revSegments) <> "." + namespace = (Text.intercalate "." . reverse . NEL.tail $ revSegments) <> "." + lastNameSegment = NEL.head revSegments diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index 59d1a0ad1..3dcd436f3 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -70,6 +70,7 @@ module U.Codebase.Sqlite.Operations updateNameIndex, rootNamesByPath, NamesByPath (..), + checkBranchHashNameLookupExists, -- * reflog getReflog, @@ -1081,6 +1082,35 @@ updateNameIndex (newTermNames, removedTermNames) (newTypeNames, removedTypeNames Q.insertTermNames (fmap (c2sTextReferent *** fmap c2sConstructorType) <$> newTermNames) Q.insertTypeNames (fmap c2sTextReference <$> newTypeNames) +buildNameLookupForBranchHash :: + -- The existing name lookup index to copy before applying the diff. + -- If Nothing, run the diff against an empty index. + Maybe BranchHash -> + BranchHash -> + -- | (add terms, remove terms) + ([S.NamedRef (C.Referent, Maybe C.ConstructorType)], [S.NamedRef C.Referent]) -> + -- | (add types, remove types) + ([S.NamedRef C.Reference], [S.NamedRef C.Reference]) -> + Transaction () +buildNameLookupForBranchHash mayExistingBranchIndex newBranchHash (newTermNames, removedTermNames) (newTypeNames, removedTypeNames) = do + Q.ensureScopedNameLookupTables + case mayExistingBranchIndex of + Nothing -> pure () + Just existingBranchIndex -> do + existingBranchHashId <- Q.saveBranchHash existingBranchIndex + newBranchHashId <- Q.saveBranchHash newBranchHash + Q.copyScopedNameLookup existingBranchHashId newBranchHashId + Q.removeTermNames ((fmap c2sTextReferent <$> removedTermNames)) + Q.removeTypeNames ((fmap c2sTextReference <$> removedTypeNames)) + Q.insertTermNames (fmap (c2sTextReferent *** fmap c2sConstructorType) <$> newTermNames) + Q.insertTypeNames (fmap c2sTextReference <$> newTypeNames) + +-- | Check whether we've already got an index for a given causal hash. +checkBranchHashNameLookupExists :: BranchHash -> Transaction Bool +checkBranchHashNameLookupExists bh = do + bhId <- Q.saveBranchHash bh + Q.checkBranchHashNameLookupExists bhId + data NamesByPath = NamesByPath { termNamesInPath :: [S.NamedRef (C.Referent, Maybe C.ConstructorType)], typeNamesInPath :: [S.NamedRef C.Reference] diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index fce4f42b6..336ea9949 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -135,14 +135,20 @@ module U.Codebase.Sqlite.Queries -- * Name Lookup ensureNameLookupTables, ensureScopedNameLookupTables, + copyScopedNameLookup, dropNameLookupTables, insertTermNames, insertTypeNames, removeTermNames, removeTypeNames, + insertScopedTermNames, + insertScopedTypeNames, + removeScopedTermNames, + removeScopedTypeNames, rootTermNamesByPath, rootTypeNamesByPath, getNamespaceDefinitionCount, + checkBranchHashNameLookupExists, -- * Reflog appendReflog, @@ -1610,11 +1616,6 @@ ensureNameLookupTables = do [here| CREATE INDEX IF NOT EXISTS term_names_by_namespace ON term_name_lookup(namespace) |] - -- Don't need this index at the moment, but will likely be useful later. - -- execute_ - -- [here| - -- CREATE INDEX IF NOT EXISTS term_name_by_referent_lookup ON term_name_lookup(referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) - -- |] execute_ [here| CREATE TABLE IF NOT EXISTS type_name_lookup ( @@ -1642,42 +1643,84 @@ ensureScopedNameLookupTables = do execute_ [here| CREATE TABLE IF NOT EXISTS name_lookups ( - root_causal_hash_id INTEGER PRIMARY KEY REFERENCES causal(self_hash_id) ON DELETE CASCADE, + root_branch_hash_id INTEGER PRIMARY KEY REFERENCES hash(id) ON DELETE CASCADE ) |] execute_ [here| CREATE TABLE IF NOT EXISTS scoped_term_name_lookup ( - root_causal_hash_id INTEGER NOT NULL REFERENCES causal(self_hash_id) ON DELETE CASCADE, - -- The name of the term: E.g. map.List.base + root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id) ON DELETE CASCADE, + + -- The name of the term in reversed form, with a trailing '.': + -- E.g. map.List.base. + -- + -- The trailing '.' is helpful when performing suffix queries where we may not know + -- whether the suffix is complete or not, e.g. we could suffix search using any of the + -- following globs and it would still find 'map.List.base.': + -- map.List.base.* + -- map.List.* + -- map.* reversed_name TEXT NOT NULL, - -- The namespace containing this term, not reversed: E.g. base.List + + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + last_name_segment TEXT NOT NULL, + + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' namespace TEXT NOT NULL, referent_builtin TEXT NULL, referent_component_hash TEXT NULL, referent_component_index INTEGER NULL, referent_constructor_index INTEGER NULL, referent_constructor_type INTEGER NULL, - PRIMARY KEY (root_causal_hash_id, reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) + PRIMARY KEY (root_branch_hash_id, reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) ) |] + + -- This index allows finding all names we need to consider within a given namespace for + -- suffixification of a name. + -- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; + -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search + -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and + -- then glob search on the namespace prefix, and have SQLite do the final glob search on + -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. execute_ [here| - CREATE INDEX IF NOT EXISTS term_names_by_namespace ON scoped_term_name_lookup(root_causal_hash_id, namespace) + CREATE INDEX IF NOT EXISTS scoped_term_names_by_namespace_and_last_name_segment ON term_name_lookup(root_branch_hash_id, last_name_segment, namespace) + |] + -- This index allows us to find all names with a given ref within a specific namespace + execute_ + [here| + CREATE INDEX IF NOT EXISTS scoped_term_name_by_referent_lookup ON term_name_lookup(root_branch_hash_id, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, namespace) + |] + + -- Allows fetching ALL names within a specific namespace prefix. We currently use this to + -- pretty-print on share, but will be replaced with a more precise set of queries soon. + execute_ + [here| + CREATE INDEX IF NOT EXISTS scoped_term_names_by_namespace ON scoped_term_name_lookup(root_branch_hash_id, namespace) |] - -- Don't need this index at the moment, but will likely be useful later. - -- execute_ - -- [here| - -- CREATE INDEX IF NOT EXISTS term_name_by_referent_lookup ON term_name_lookup(referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) - -- |] execute_ [here| CREATE TABLE IF NOT EXISTS scoped_type_name_lookup ( - root_causal_hash_id INTEGER NOT NULL, + root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id), -- The name of the term: E.g. List.base reversed_name TEXT NOT NULL, - -- The namespace containing this term, not reversed: E.g. base.List + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + last_name_segment TEXT NOT NULL, + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' namespace TEXT NOT NULL, reference_builtin TEXT NULL, reference_component_hash INTEGER NULL, @@ -1685,11 +1728,67 @@ ensureScopedNameLookupTables = do PRIMARY KEY (reversed_name, reference_builtin, reference_component_hash, reference_component_index) ); |] + + -- This index allows finding all names we need to consider within a given namespace for + -- suffixification of a name. + -- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; + -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search + -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and + -- then glob search on the namespace prefix, and have SQLite do the final glob search on + -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. execute_ [here| - CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace ON type_name_lookup(root_causal_hash_id, namespace) + CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace_and_last_name_segment ON type_name_lookup(root_branch_hash_id, last_name_segment, namespace) |] + -- This index allows us to find all names with a given ref within a specific namespace. + execute_ + [here| + CREATE INDEX IF NOT EXISTS scoped_type_name_by_reference_lookup ON type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace) + |] + + -- Allows fetching ALL names within a specific namespace prefix. We currently use this to + -- pretty-print on share, but will be replaced with a more precise set of queries soon. + execute_ + [here| + CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace ON type_name_lookup(root_branch_hash_id, namespace) + |] + +copyScopedNameLookup :: BranchHashId -> BranchHashId -> Transaction () +copyScopedNameLookup fromBHId toBHId = do + execute termsCopySql (toBHId, fromBHId) + execute typesCopySql (toBHId, fromBHId) + where + termsCopySql = + [here| + INSERT INTO scoped_term_name_lookup + SELECT ?, reversed_name, last_name_segment, namespace, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index + FROM scoped_term_name_lookup + WHERE root_branch_hash_id = ? + |] + typesCopySql = + [here| + INSERT INTO scoped_type_name_lookup + SELECT ?, reversed_name, last_name_segment, namespace, reference_builtin, reference_component_hash, reference_component_index + FROM scoped_type_name_lookup + WHERE root_branch_hash_id = ? + |] + +-- | Check if we've already got an index for the desired root branch hash. +checkBranchHashNameLookupExists :: BranchHashId -> Transaction Bool +checkBranchHashNameLookupExists hashId = do + queryOneCol sql (Only hashId) + where + sql = + [here| + SELECT EXISTS ( + SELECT 1 + FROM name_lookups + WHERE root_branch_hash_id = ? + LIMIT 1 + ) + |] + -- | Insert the given set of term names into the name lookup table insertTermNames :: [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] -> Transaction () insertTermNames names = do @@ -1704,6 +1803,18 @@ insertTermNames names = do ON CONFLICT DO NOTHING |] +-- | Insert the given set of type names into the name lookup table +insertTypeNames :: [NamedRef (Reference.TextReference)] -> Transaction () +insertTypeNames names = + executeMany sql (NamedRef.toRowWithNamespace <$> names) + where + sql = + [here| + INSERT INTO type_name_lookup (reversed_name, reference_builtin, reference_component_hash, reference_component_index, namespace) + VALUES (?, ?, ?, ?, ?) + ON CONFLICT DO NOTHING + |] + -- | Remove the given set of term names into the name lookup table removeTermNames :: [NamedRef Referent.TextReferent] -> Transaction () removeTermNames names = do @@ -1735,6 +1846,71 @@ removeTypeNames names = do AND reference_component_index IS ? |] +-- | Insert the given set of term names into the name lookup table +insertScopedTermNames :: BranchHashId -> [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] -> Transaction () +insertScopedTermNames bhId names = do + executeMany sql (namedRefToRow <$> names) + where + namedRefToRow :: NamedRef (S.Referent.TextReferent, Maybe NamedRef.ConstructorType) -> (Only BranchHashId :. [SQLData]) + namedRefToRow namedRef = + namedRef + & fmap refToRow + & NamedRef.namedRefToScopedRow + & \nr -> (Only bhId :. nr) + refToRow :: (Referent.TextReferent, Maybe NamedRef.ConstructorType) -> (Referent.TextReferent :. Only (Maybe NamedRef.ConstructorType)) + refToRow (ref, ct) = ref :. Only ct + sql = + [here| + INSERT INTO scoped_term_name_lookup (root_branch_hash_id, reversed_name, namespace, last_name_segment, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + ON CONFLICT DO NOTHING + |] + +-- | Insert the given set of type names into the name lookup table +insertScopedTypeNames :: BranchHashId -> [NamedRef (Reference.TextReference)] -> Transaction () +insertScopedTypeNames bhId names = + executeMany sql ((Only bhId :.) . NamedRef.namedRefToScopedRow <$> names) + where + sql = + [here| + INSERT INTO type_name_lookup (root_branch_hash_id, reversed_name, namespace, last_name_segment, reference_builtin, reference_component_hash, reference_component_index) + VALUES (?, ?, ?, ?, ?, ?, ?) + ON CONFLICT DO NOTHING + |] + +-- | Remove the given set of term names into the name lookup table +removeScopedTermNames :: BranchHashId -> [NamedRef Referent.TextReferent] -> Transaction () +removeScopedTermNames bhId names = do + executeMany sql ((Only bhId :.) <$> names) + where + sql = + [here| + DELETE FROM term_name_lookup + WHERE + root_branch_hash_id IS ? + AND reversed_name IS ? + AND referent_builtin IS ? + AND referent_component_hash IS ? + AND referent_component_index IS ? + AND referent_constructor_index IS ? + |] + +-- | Remove the given set of term names into the name lookup table +removeScopedTypeNames :: BranchHashId -> [NamedRef (Reference.TextReference)] -> Transaction () +removeScopedTypeNames bhId names = do + executeMany sql ((Only bhId :.) <$> names) + where + sql = + [here| + DELETE FROM type_name_lookup + WHERE + root_branch_hash_id IS ? + AND reversed_name IS ? + AND reference_builtin IS ? + AND reference_component_hash IS ? + AND reference_component_index IS ? + |] + -- | We need to escape any special characters for globbing. -- -- >>> globEscape "Nat.*.doc" @@ -1792,18 +1968,6 @@ getNamespaceDefinitionCount namespace = do ) |] --- | Insert the given set of type names into the name lookup table -insertTypeNames :: [NamedRef (Reference.TextReference)] -> Transaction () -insertTypeNames names = - executeMany sql (NamedRef.toRowWithNamespace <$> names) - where - sql = - [here| - INSERT INTO type_name_lookup (reversed_name, reference_builtin, reference_component_hash, reference_component_index, namespace) - VALUES (?, ?, ?, ?, ?) - ON CONFLICT DO NOTHING - |] - -- | Get the list of a term names in the root namespace according to the name lookup index rootTermNamesByPath :: Maybe Text -> Transaction [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] rootTermNamesByPath mayNamespace = do diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs index edef2cba8..f1174f77e 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs @@ -655,6 +655,47 @@ updateNameLookupIndex getDeclType pathPrefix mayFromBranchHash toBranchHash = do ct <- getDeclType ref pure (referent, Just $ Cv.constructorType1to2 ct) +-- | Add an index for the provided causal hash. +ensureNameLookupForCausalHash :: + (C.Reference.Reference -> Sqlite.Transaction CT.ConstructorType) -> + -- | An optional branch which we already have an index for. + -- If provided, we can build the name index much faster by copying the index then computing only the changes we need to make between the two indexes. + Maybe CausalHash -> + BranchHash -> + Sqlite.Transaction () +ensureNameLookupForCausalHash getDeclType mayFromBranchHash toBranchHash = do + Ops.checkBranchHashNameLookupExists toBranchHash >>= \case + True -> pure () + False -> do + fromBranch <- case mayFromBranchHash of + Nothing -> pure V2Branch.empty + Just fromBH -> do + Ops.checkBranchHashNameLookupExists fromBH >>= \case + True -> Ops.expectBranchByBranchHash fromBH + False -> pure V2Branch.empty + toBranch <- Ops.expectBranchByBranchHash toBranchHash + treeDiff <- BranchDiff.diffBranches fromBranch toBranch + let namePrefix = case pathPrefix of + Path.Empty -> Nothing + (p Path.:< ps) -> Just $ Name.fromSegments (p :| Path.toList ps) + let BranchDiff.NameChanges {termNameAdds, termNameRemovals, typeNameAdds, typeNameRemovals} = BranchDiff.nameChanges namePrefix treeDiff + termNameAddsWithCT <- do + for termNameAdds \(name, ref) -> do + refWithCT <- addReferentCT ref + pure $ toNamedRef (name, refWithCT) + Ops.buildNameLookupForBranchHash mayFromBranchHash toBranchHash (termNameAddsWithCT, toNamedRef <$> termNameRemovals) (toNamedRef <$> typeNameAdds, toNamedRef <$> typeNameRemovals) + where + inferStartBranch :: BranchHash -> Sqlite.Transaction (Maybe BranchHash) + inferStartBranch = _ + toNamedRef :: (Name, ref) -> S.NamedRef ref + toNamedRef (name, ref) = S.NamedRef {reversedSegments = coerce $ Name.reverseSegments name, ref = ref} + addReferentCT :: C.Referent.Referent -> Transaction (C.Referent.Referent, Maybe C.Referent.ConstructorType) + addReferentCT referent = case referent of + C.Referent.Ref {} -> pure (referent, Nothing) + C.Referent.Con ref _conId -> do + ct <- getDeclType ref + pure (referent, Just $ Cv.constructorType1to2 ct) + -- | Compute the root namespace names index which is used by the share server for serving api -- requests. Using 'updateNameLookupIndex' is preferred whenever possible, since it's -- considerably faster. This can be used to reset the index if it ever gets out of sync due to From 67f2d6be47ab871d1f8011e2ca736165492e85ff Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 24 Jan 2023 11:19:35 -0500 Subject: [PATCH 110/467] Point at the racket fork in the readme --- chez-libs/readme.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chez-libs/readme.md b/chez-libs/readme.md index 1d15c0860..2ab672bec 100644 --- a/chez-libs/readme.md +++ b/chez-libs/readme.md @@ -24,10 +24,11 @@ denoted by `$CUSTOM`, then the compiler commands will look in: for the `unison/` directory containing the library files. The compiler commands also expect Chez Scheme to be installed -separately, and for `scheme` to be callable on the user's path. For -information on how to install, see: +separately, and for `scheme` to be callable on the user's path. The +continuation library now makes use of features in the Racket fork of +Chez. For information on how to install, see: - https://github.com/cisco/ChezScheme/blob/main/BUILDING + https://github.com/racket/ChezScheme/blob/master/BUILDING For more information on Chez Scheme in general, see: From 2ba7dff4607156709e5e5bbb3b3e8a1e4a0614e2 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 24 Jan 2023 10:24:23 -0600 Subject: [PATCH 111/467] Wire up scoped name lookups further --- .../U/Codebase/Sqlite/Operations.hs | 11 ++++++----- .../U/Codebase/Sqlite/Queries.hs | 12 ++++++++++++ .../Codebase/SqliteCodebase/Operations.hs | 17 ++++++++--------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index 3dcd436f3..809d30cfd 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -71,6 +71,7 @@ module U.Codebase.Sqlite.Operations rootNamesByPath, NamesByPath (..), checkBranchHashNameLookupExists, + buildNameLookupForBranchHash, -- * reflog getReflog, @@ -1094,16 +1095,16 @@ buildNameLookupForBranchHash :: Transaction () buildNameLookupForBranchHash mayExistingBranchIndex newBranchHash (newTermNames, removedTermNames) (newTypeNames, removedTypeNames) = do Q.ensureScopedNameLookupTables + newBranchHashId <- Q.saveBranchHash newBranchHash case mayExistingBranchIndex of Nothing -> pure () Just existingBranchIndex -> do existingBranchHashId <- Q.saveBranchHash existingBranchIndex - newBranchHashId <- Q.saveBranchHash newBranchHash Q.copyScopedNameLookup existingBranchHashId newBranchHashId - Q.removeTermNames ((fmap c2sTextReferent <$> removedTermNames)) - Q.removeTypeNames ((fmap c2sTextReference <$> removedTypeNames)) - Q.insertTermNames (fmap (c2sTextReferent *** fmap c2sConstructorType) <$> newTermNames) - Q.insertTypeNames (fmap c2sTextReference <$> newTypeNames) + Q.removeScopedTermNames newBranchHashId ((fmap c2sTextReferent <$> removedTermNames)) + Q.removeScopedTypeNames newBranchHashId ((fmap c2sTextReference <$> removedTypeNames)) + Q.insertScopedTermNames newBranchHashId (fmap (c2sTextReferent *** fmap c2sConstructorType) <$> newTermNames) + Q.insertScopedTypeNames newBranchHashId (fmap c2sTextReference <$> newTypeNames) -- | Check whether we've already got an index for a given causal hash. checkBranchHashNameLookupExists :: BranchHash -> Transaction Bool diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 336ea9949..d1f268981 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -149,6 +149,7 @@ module U.Codebase.Sqlite.Queries rootTypeNamesByPath, getNamespaceDefinitionCount, checkBranchHashNameLookupExists, + trackNewBranchHashNameLookup, -- * Reflog appendReflog, @@ -1774,6 +1775,17 @@ copyScopedNameLookup fromBHId toBHId = do WHERE root_branch_hash_id = ? |] +-- | Inserts a new record into the name_lookups table +trackNewBranchHashNameLookup :: BranchHashId -> Transaction () +trackNewBranchHashNameLookup bhId = do + execute sql (Only bhId) + where + sql = + [here| + INSERT INTO name_lookups (root_branch_hash_id) + VALUES (?) + |] + -- | Check if we've already got an index for the desired root branch hash. checkBranchHashNameLookupExists :: BranchHashId -> Transaction Bool checkBranchHashNameLookupExists hashId = do diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs index f1174f77e..bf36e2647 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs @@ -656,14 +656,14 @@ updateNameLookupIndex getDeclType pathPrefix mayFromBranchHash toBranchHash = do pure (referent, Just $ Cv.constructorType1to2 ct) -- | Add an index for the provided causal hash. -ensureNameLookupForCausalHash :: +ensureNameLookupForBranchHash :: (C.Reference.Reference -> Sqlite.Transaction CT.ConstructorType) -> -- | An optional branch which we already have an index for. -- If provided, we can build the name index much faster by copying the index then computing only the changes we need to make between the two indexes. - Maybe CausalHash -> + Maybe BranchHash -> BranchHash -> Sqlite.Transaction () -ensureNameLookupForCausalHash getDeclType mayFromBranchHash toBranchHash = do +ensureNameLookupForBranchHash getDeclType mayFromBranchHash toBranchHash = do Ops.checkBranchHashNameLookupExists toBranchHash >>= \case True -> pure () False -> do @@ -672,12 +672,13 @@ ensureNameLookupForCausalHash getDeclType mayFromBranchHash toBranchHash = do Just fromBH -> do Ops.checkBranchHashNameLookupExists fromBH >>= \case True -> Ops.expectBranchByBranchHash fromBH - False -> pure V2Branch.empty + False -> do + -- TODO: We can probably infer a good starting branch by crawling through + -- history looking for a Branch Hash we already have an index for. + pure V2Branch.empty toBranch <- Ops.expectBranchByBranchHash toBranchHash treeDiff <- BranchDiff.diffBranches fromBranch toBranch - let namePrefix = case pathPrefix of - Path.Empty -> Nothing - (p Path.:< ps) -> Just $ Name.fromSegments (p :| Path.toList ps) + let namePrefix = Nothing let BranchDiff.NameChanges {termNameAdds, termNameRemovals, typeNameAdds, typeNameRemovals} = BranchDiff.nameChanges namePrefix treeDiff termNameAddsWithCT <- do for termNameAdds \(name, ref) -> do @@ -685,8 +686,6 @@ ensureNameLookupForCausalHash getDeclType mayFromBranchHash toBranchHash = do pure $ toNamedRef (name, refWithCT) Ops.buildNameLookupForBranchHash mayFromBranchHash toBranchHash (termNameAddsWithCT, toNamedRef <$> termNameRemovals) (toNamedRef <$> typeNameAdds, toNamedRef <$> typeNameRemovals) where - inferStartBranch :: BranchHash -> Sqlite.Transaction (Maybe BranchHash) - inferStartBranch = _ toNamedRef :: (Name, ref) -> S.NamedRef ref toNamedRef (name, ref) = S.NamedRef {reversedSegments = coerce $ Name.reverseSegments name, ref = ref} addReferentCT :: C.Referent.Referent -> Transaction (C.Referent.Referent, Maybe C.Referent.ConstructorType) From a63d576fcbefb969a90b66400b5a7b75c5351532 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 24 Jan 2023 11:03:20 -0600 Subject: [PATCH 112/467] Cleanup --- .../U/Codebase/Sqlite/NamedRef.hs | 8 +++----- .../U/Codebase/Sqlite/Operations.hs | 2 ++ .../U/Codebase/Sqlite/Queries.hs | 13 +++++++++---- .../Codebase/SqliteCodebase/Operations.hs | 18 ++++++++++-------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs index 10c99e3df..80ab6c970 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs @@ -6,7 +6,6 @@ import qualified Data.List.NonEmpty as NonEmpty import qualified Data.Text as Text import Unison.Prelude import Unison.Sqlite -import qualified Unison.Sqlite as Sqlite type ReversedSegments = NonEmpty Text @@ -46,17 +45,16 @@ toRowWithNamespace nr = toRow nr <> [SQLText namespace] where namespace = Text.intercalate "." . reverse . NEL.tail . reversedSegments $ nr --- | The new 'scoped' name lookup format is different than the old version. +-- | The new 'scoped' name lookup format is different from the old version. -- --- Namely, this adds the 'lastNameSegment' as well as adding a trailing '.' to the db format +-- Specifically, the scoped format adds the 'lastNameSegment' as well as adding a trailing '.' to the db format -- of both the namespace and reversed_name. -- --- -- Converts a NamedRef to SQLData of the form: -- [reversedName, namespace, lastNameSegment] <> ref fields... namedRefToScopedRow :: ToRow ref => NamedRef ref -> [SQLData] namedRefToScopedRow (NamedRef {reversedSegments = revSegments, ref}) = - toRow $ (SQLText reversedName, SQLText namespace, SQLText lastNameSegment) Sqlite.:. ref + toRow $ (SQLText reversedName, SQLText namespace, SQLText lastNameSegment) :. ref where reversedName = (Text.intercalate "." . toList $ revSegments) <> "." namespace = (Text.intercalate "." . reverse . NEL.tail $ revSegments) <> "." diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index 809d30cfd..e40318317 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -1096,9 +1096,11 @@ buildNameLookupForBranchHash :: buildNameLookupForBranchHash mayExistingBranchIndex newBranchHash (newTermNames, removedTermNames) (newTypeNames, removedTypeNames) = do Q.ensureScopedNameLookupTables newBranchHashId <- Q.saveBranchHash newBranchHash + Q.trackNewBranchHashNameLookup newBranchHashId case mayExistingBranchIndex of Nothing -> pure () Just existingBranchIndex -> do + unlessM (checkBranchHashNameLookupExists existingBranchIndex) $ error "buildNameLookupForBranchHash: existingBranchIndex was provided, but no index was found for that branch hash." existingBranchHashId <- Q.saveBranchHash existingBranchIndex Q.copyScopedNameLookup existingBranchHashId newBranchHashId Q.removeScopedTermNames newBranchHashId ((fmap c2sTextReferent <$> removedTermNames)) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index d1f268981..0ce9d3557 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -1635,7 +1635,7 @@ ensureNameLookupTables = do CREATE INDEX IF NOT EXISTS type_names_by_namespace ON type_name_lookup(namespace) |] --- | Ensure the causal_hash scoped name lookup tables exist. +-- | Ensure the scoped name lookup tables exist. -- this will eventually replace the tables in 'ensureNameLookupTables' after all the indexes -- have been migrated over. ensureScopedNameLookupTables :: Transaction () @@ -1666,6 +1666,7 @@ ensureScopedNameLookupTables = do -- The last name segment of the name. This is used when looking up names for -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' last_name_segment TEXT NOT NULL, -- The namespace containing this definition, not reversed, with a trailing '.' @@ -1715,6 +1716,7 @@ ensureScopedNameLookupTables = do reversed_name TEXT NOT NULL, -- The last name segment of the name. This is used when looking up names for -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' last_name_segment TEXT NOT NULL, -- The namespace containing this definition, not reversed, with a trailing '.' -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in @@ -1755,6 +1757,9 @@ ensureScopedNameLookupTables = do CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace ON type_name_lookup(root_branch_hash_id, namespace) |] +-- | Copies existing name lookup rows but replaces their branch hash id; +-- This is a low-level operation used as part of deriving a new name lookup index +-- from an existing one as performantly as possible. copyScopedNameLookup :: BranchHashId -> BranchHashId -> Transaction () copyScopedNameLookup fromBHId toBHId = do execute termsCopySql (toBHId, fromBHId) @@ -1885,7 +1890,7 @@ insertScopedTypeNames bhId names = where sql = [here| - INSERT INTO type_name_lookup (root_branch_hash_id, reversed_name, namespace, last_name_segment, reference_builtin, reference_component_hash, reference_component_index) + INSERT INTO scoped_type_name_lookup (root_branch_hash_id, reversed_name, namespace, last_name_segment, reference_builtin, reference_component_hash, reference_component_index) VALUES (?, ?, ?, ?, ?, ?, ?) ON CONFLICT DO NOTHING |] @@ -1897,7 +1902,7 @@ removeScopedTermNames bhId names = do where sql = [here| - DELETE FROM term_name_lookup + DELETE FROM scoped_term_name_lookup WHERE root_branch_hash_id IS ? AND reversed_name IS ? @@ -1914,7 +1919,7 @@ removeScopedTypeNames bhId names = do where sql = [here| - DELETE FROM type_name_lookup + DELETE FROM scoped_type_name_lookup WHERE root_branch_hash_id IS ? AND reversed_name IS ? diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs index bf36e2647..b0388bf72 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs @@ -655,11 +655,13 @@ updateNameLookupIndex getDeclType pathPrefix mayFromBranchHash toBranchHash = do ct <- getDeclType ref pure (referent, Just $ Cv.constructorType1to2 ct) --- | Add an index for the provided causal hash. +-- | Add an index for the provided branch hash if one doesn't already exist. ensureNameLookupForBranchHash :: (C.Reference.Reference -> Sqlite.Transaction CT.ConstructorType) -> - -- | An optional branch which we already have an index for. - -- If provided, we can build the name index much faster by copying the index then computing only the changes we need to make between the two indexes. + -- | An optional branch which we may already have an index for. + -- This should be a branch which is relatively similar to the branch we're creating a name + -- lookup for, e.g. a recent ancestor of the new branch. The more similar it is, the faster + -- the less work we'll need to do. Maybe BranchHash -> BranchHash -> Sqlite.Transaction () @@ -667,15 +669,15 @@ ensureNameLookupForBranchHash getDeclType mayFromBranchHash toBranchHash = do Ops.checkBranchHashNameLookupExists toBranchHash >>= \case True -> pure () False -> do - fromBranch <- case mayFromBranchHash of - Nothing -> pure V2Branch.empty + (fromBranch, mayExistingLookupBH) <- case mayFromBranchHash of + Nothing -> pure (V2Branch.empty, Nothing) Just fromBH -> do Ops.checkBranchHashNameLookupExists fromBH >>= \case - True -> Ops.expectBranchByBranchHash fromBH + True -> (,Just fromBH) <$> Ops.expectBranchByBranchHash fromBH False -> do -- TODO: We can probably infer a good starting branch by crawling through -- history looking for a Branch Hash we already have an index for. - pure V2Branch.empty + pure (V2Branch.empty, Nothing) toBranch <- Ops.expectBranchByBranchHash toBranchHash treeDiff <- BranchDiff.diffBranches fromBranch toBranch let namePrefix = Nothing @@ -684,7 +686,7 @@ ensureNameLookupForBranchHash getDeclType mayFromBranchHash toBranchHash = do for termNameAdds \(name, ref) -> do refWithCT <- addReferentCT ref pure $ toNamedRef (name, refWithCT) - Ops.buildNameLookupForBranchHash mayFromBranchHash toBranchHash (termNameAddsWithCT, toNamedRef <$> termNameRemovals) (toNamedRef <$> typeNameAdds, toNamedRef <$> typeNameRemovals) + Ops.buildNameLookupForBranchHash mayExistingLookupBH toBranchHash (termNameAddsWithCT, toNamedRef <$> termNameRemovals) (toNamedRef <$> typeNameAdds, toNamedRef <$> typeNameRemovals) where toNamedRef :: (Name, ref) -> S.NamedRef ref toNamedRef (name, ref) = S.NamedRef {reversedSegments = coerce $ Name.reverseSegments name, ref = ref} From 7261823de15eefc2c1f9b12efb83b61ff6e078c1 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 24 Jan 2023 14:37:34 -0500 Subject: [PATCH 113/467] Make Nat/Int.fromText return None for over/underflows --- .../src/Unison/Runtime/Machine.hs | 28 +++++++++++-------- unison-src/transcripts/builtins.md | 4 +++ unison-src/transcripts/builtins.output.md | 4 +++ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index d4aab56fd..0eb3f0d5f 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -1366,29 +1366,33 @@ bprim1 !ustk !bstk UCNS i = pure (ustk, bstk) bprim1 !ustk !bstk TTOI i = peekOffBi bstk i >>= \t -> case readm $ Util.Text.unpack t of - Nothing -> do + Just n + | fromIntegral (minBound :: Int) <= n, + n <= fromIntegral (maxBound :: Int) -> do + ustk <- bumpn ustk 2 + poke ustk 1 + pokeOff ustk 1 (fromInteger n) + pure (ustk, bstk) + _ -> do ustk <- bump ustk poke ustk 0 pure (ustk, bstk) - Just n -> do - ustk <- bumpn ustk 2 - poke ustk 1 - pokeOff ustk 1 n - pure (ustk, bstk) where readm ('+' : s) = readMaybe s readm s = readMaybe s bprim1 !ustk !bstk TTON i = peekOffBi bstk i >>= \t -> case readMaybe $ Util.Text.unpack t of - Nothing -> do + Just n + | 0 <= n, + n <= fromIntegral (maxBound :: Word) -> do + ustk <- bumpn ustk 2 + poke ustk 1 + pokeOffN ustk 1 (fromInteger n) + pure (ustk, bstk) + _ -> do ustk <- bump ustk poke ustk 0 pure (ustk, bstk) - Just n -> do - ustk <- bumpn ustk 2 - poke ustk 1 - pokeOffN ustk 1 n - pure (ustk, bstk) bprim1 !ustk !bstk TTOF i = peekOffBi bstk i >>= \t -> case readMaybe $ Util.Text.unpack t of Nothing -> do diff --git a/unison-src/transcripts/builtins.md b/unison-src/transcripts/builtins.md index ff63a8827..3ea76dd5a 100644 --- a/unison-src/transcripts/builtins.md +++ b/unison-src/transcripts/builtins.md @@ -81,6 +81,8 @@ test> Int.tests.conversions = fromText "+0" == Some +0, fromText "a8f9djasdlfkj" == None, fromText "3940" == Some +3940, + fromText "1000000000000000000000000000" == None, + fromText "-1000000000000000000000000000" == None, toFloat +9394 == 9394.0, toFloat -20349 == -20349.0 ] @@ -150,6 +152,8 @@ test> Nat.tests.conversions = toText 10 == "10", fromText "ooga" == None, fromText "90" == Some 90, + fromText "-1" == None, + fromText "100000000000000000000000000" == None, unsnoc "abc" == Some ("ab", ?c), uncons "abc" == Some (?a, "bc"), unsnoc "" == None, diff --git a/unison-src/transcripts/builtins.output.md b/unison-src/transcripts/builtins.output.md index d6802faac..e34394e0b 100644 --- a/unison-src/transcripts/builtins.output.md +++ b/unison-src/transcripts/builtins.output.md @@ -74,6 +74,8 @@ test> Int.tests.conversions = fromText "+0" == Some +0, fromText "a8f9djasdlfkj" == None, fromText "3940" == Some +3940, + fromText "1000000000000000000000000000" == None, + fromText "-1000000000000000000000000000" == None, toFloat +9394 == 9394.0, toFloat -20349 == -20349.0 ] @@ -139,6 +141,8 @@ test> Nat.tests.conversions = toText 10 == "10", fromText "ooga" == None, fromText "90" == Some 90, + fromText "-1" == None, + fromText "100000000000000000000000000" == None, unsnoc "abc" == Some ("ab", ?c), uncons "abc" == Some (?a, "bc"), unsnoc "" == None, From 6395cb5aebab9ad89173c66e0cfd60eb5e05525a Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 24 Jan 2023 14:15:23 -0600 Subject: [PATCH 114/467] Get root branch hash id --- codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 0ce9d3557..7988d8606 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -62,6 +62,7 @@ module U.Codebase.Sqlite.Queries loadNamespaceRoot, setNamespaceRoot, expectNamespaceRoot, + expectNamespaceRootBranchHashId, -- * namespace_statistics table saveNamespaceStats, @@ -1090,6 +1091,11 @@ loadCausalParentsByHash hash = |] (Only hash) +expectNamespaceRootBranchHashId :: Transaction BranchHashId +expectNamespaceRootBranchHashId = do + chId <- expectNamespaceRoot + expectCausalValueHashId chId + expectNamespaceRoot :: Transaction CausalHashId expectNamespaceRoot = queryOneCol_ loadNamespaceRootSql From 8b84ce9547f60fdfdcfa5a2b7b22ebdc27092710 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 21 Jan 2023 23:34:36 +0000 Subject: [PATCH 115/467] Add murmur-hash --- parser-typechecker/package.yaml | 1 + parser-typechecker/unison-parser-typechecker.cabal | 2 ++ 2 files changed, 3 insertions(+) diff --git a/parser-typechecker/package.yaml b/parser-typechecker/package.yaml index 6cfaf365f..f4bf2e6f7 100644 --- a/parser-typechecker/package.yaml +++ b/parser-typechecker/package.yaml @@ -70,6 +70,7 @@ dependencies: - monad-validate - mtl - mutable-containers + - murmur-hash - mwc-random - natural-transformation - network diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 767837c13..67a44d262 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -239,6 +239,7 @@ library , mmorph , monad-validate , mtl + , murmur-hash , mutable-containers , mwc-random , natural-transformation @@ -428,6 +429,7 @@ test-suite parser-typechecker-tests , mmorph , monad-validate , mtl + , murmur-hash , mutable-containers , mwc-random , natural-transformation From 94fde101ab77a465a008b058d9fca488dc53bcbd Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 21 Jan 2023 23:53:39 +0000 Subject: [PATCH 116/467] Add signature for murmurHash --- parser-typechecker/src/Unison/Builtin.hs | 1 + parser-typechecker/src/Unison/Runtime/Builtin.hs | 1 + 2 files changed, 2 insertions(+) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index a5f6eb20b..c37cb01e0 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -453,6 +453,7 @@ builtinsSrc = B "Universal.<" $ forall1 "a" (\a -> a --> a --> boolean), B "Universal.>=" $ forall1 "a" (\a -> a --> a --> boolean), B "Universal.<=" $ forall1 "a" (\a -> a --> a --> boolean), + B "Universal.murmurHash" $ forall1 "a" (\a -> a --> nat), B "bug" $ forall1 "a" (\a -> forall1 "b" (\b -> a --> b)), B "todo" $ forall1 "a" (\a -> forall1 "b" (\b -> a --> b)), B "Any.Any" $ forall1 "a" (\a -> a --> anyt), diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 35b2618ac..094292f5d 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -36,6 +36,7 @@ import Control.Monad.Catch (MonadCatch) import qualified Control.Monad.Primitive as PA import Control.Monad.Reader (ReaderT (..), ask, runReaderT) import Control.Monad.State.Strict (State, execState, modify) +import Data.Digest.Murmur64 (hash64, asWord64) import qualified Crypto.Hash as Hash import qualified Crypto.MAC.HMAC as HMAC import Data.Bits (shiftL, shiftR, (.|.)) From acc7c18ed64c06e78a793121bc7caa75048b7efa Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 21 Jan 2023 23:59:18 +0000 Subject: [PATCH 117/467] Add binding to universal hashing --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 094292f5d..5e73fba45 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2559,6 +2559,9 @@ declareForeigns = do Left se -> Left (Util.Text.pack (show se)) Right a -> Right a + declareForeign Untracked "Universal.murmurHash" boxToNat . mkForeign $ + pure . asWord64 . hash64 . serializeValueLazy + declareForeign Untracked "Bytes.zlib.compress" boxDirect . mkForeign $ pure . Bytes.zlibCompress declareForeign Untracked "Bytes.gzip.compress" boxDirect . mkForeign $ pure . Bytes.gzipCompress declareForeign Untracked "Bytes.zlib.decompress" boxToEBoxBox . mkForeign $ \bs -> From 7b991456c3a13c95cde2d4648c4ab1e24d5598f5 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 23 Jan 2023 23:36:33 +0000 Subject: [PATCH 118/467] Add transcript tests, currently broken: hash is nondeterministic --- unison-src/transcripts/builtins.md | 12 ++++ unison-src/transcripts/builtins.output.md | 72 ++++++++++++++++++++++- 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/unison-src/transcripts/builtins.md b/unison-src/transcripts/builtins.md index ff63a8827..ad57dc002 100644 --- a/unison-src/transcripts/builtins.md +++ b/unison-src/transcripts/builtins.md @@ -356,6 +356,18 @@ openFile] .> add ``` +## Universal hash functions + +Just exercises the function + +```unison +test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] +``` + +```ucm:hide +.> add +``` + ## Run the tests Now that all the tests have been added to the codebase, let's view the test report. This will fail the transcript (with a nice message) if any of the tests are failing. diff --git a/unison-src/transcripts/builtins.output.md b/unison-src/transcripts/builtins.output.md index d6802faac..959383713 100644 --- a/unison-src/transcripts/builtins.output.md +++ b/unison-src/transcripts/builtins.output.md @@ -374,6 +374,32 @@ openFile] ✅ Passed Passed +``` +## Universal hash functions + +Just exercises the function + +```unison +test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test.boua3l3u3g : [Result] + + Now evaluating any watch expressions (lines starting with + `>`)... Ctrl+C cancels. + + 1 | test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] + + 🚫 FAILED Failed + ``` ## Run the tests @@ -408,8 +434,50 @@ Now that all the tests have been added to the codebase, let's view the test repo ◉ Text.tests.repeat Passed ◉ Text.tests.takeDropAppend Passed - ✅ 23 test(s) passing + ✗ test.boua3l3u3g Failed - Tip: Use view Any.test1 to view the source of a test. + 🚫 1 test(s) failing, ✅ 23 test(s) passing + + Tip: Use view test.boua3l3u3g to view the source of a test. ``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + Cached test results (`help testcache` to learn more) + + ◉ Any.test1 Passed + ◉ Any.test2 Passed + ◉ Boolean.tests.andTable Passed + ◉ Boolean.tests.notTable Passed + ◉ Boolean.tests.orTable Passed + ◉ Bytes.tests.at Passed + ◉ Bytes.tests.compression Passed + ◉ Bytes.tests.fromBase64UrlUnpadded Passed + ◉ Int.tests.arithmetic Passed + ◉ Int.tests.bitTwiddling Passed + ◉ Int.tests.conversions Passed + ◉ Nat.tests.arithmetic Passed + ◉ Nat.tests.bitTwiddling Passed + ◉ Nat.tests.conversions Passed + ◉ Sandbox.test1 Passed + ◉ Sandbox.test2 Passed + ◉ Sandbox.test3 Passed + ◉ test.rtjqan7bcs Passed + ◉ Text.tests.alignment Passed + ◉ Text.tests.literalsEq Passed + ◉ Text.tests.patterns Passed + ◉ Text.tests.repeat Passed + ◉ Text.tests.takeDropAppend Passed + + ✗ test.boua3l3u3g Failed + + 🚫 1 test(s) failing, ✅ 23 test(s) passing + + Tip: Use view test.boua3l3u3g to view the source of a test. + From 543e30b48048c45719b8278682717cf47cfca0a0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 24 Jan 2023 00:58:03 +0000 Subject: [PATCH 119/467] Better error: murmurHash crashes on simple values --- unison-src/transcripts/builtins.md | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/transcripts/builtins.md b/unison-src/transcripts/builtins.md index ad57dc002..f45d20f78 100644 --- a/unison-src/transcripts/builtins.md +++ b/unison-src/transcripts/builtins.md @@ -361,6 +361,7 @@ openFile] Just exercises the function ```unison +> Universal.murmurHash 1 test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] ``` From 39ae32e68a39c698e12ca96787e9438391921ab0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 25 Jan 2023 00:49:55 +0000 Subject: [PATCH 120/467] Handle calling convention properly --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 5e73fba45..833ed9643 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -1087,6 +1087,17 @@ crypto'hash instr = where (alg, x, vl) = fresh +murmur'hash :: ForeignOp +murmur'hash instr = + ([BX],) + . TAbss [x] + . TLetD vl BX (TPrm VALU [x]) + . TLetD result UN (TFOp instr [vl]) + $ TCon Ty.natRef 0 [result] + where + (x, vl, result) = fresh + + crypto'hmac :: ForeignOp crypto'hmac instr = ([BX, BX, BX],) @@ -2559,7 +2570,7 @@ declareForeigns = do Left se -> Left (Util.Text.pack (show se)) Right a -> Right a - declareForeign Untracked "Universal.murmurHash" boxToNat . mkForeign $ + declareForeign Untracked "Universal.murmurHash" murmur'hash . mkForeign $ pure . asWord64 . hash64 . serializeValueLazy declareForeign Untracked "Bytes.zlib.compress" boxDirect . mkForeign $ pure . Bytes.zlibCompress From b5a6bb53e77f027a50b85f858adcc9ac9b670141 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 25 Jan 2023 01:10:11 +0000 Subject: [PATCH 121/467] Name transcripts test for murmur hash --- unison-src/transcripts/builtins.md | 2 +- unison-src/transcripts/builtins.output.md | 60 +++++------------------ 2 files changed, 13 insertions(+), 49 deletions(-) diff --git a/unison-src/transcripts/builtins.md b/unison-src/transcripts/builtins.md index f45d20f78..81a827b9a 100644 --- a/unison-src/transcripts/builtins.md +++ b/unison-src/transcripts/builtins.md @@ -362,7 +362,7 @@ Just exercises the function ```unison > Universal.murmurHash 1 -test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] +test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] ``` ```ucm:hide diff --git a/unison-src/transcripts/builtins.output.md b/unison-src/transcripts/builtins.output.md index 959383713..a07bcad9e 100644 --- a/unison-src/transcripts/builtins.output.md +++ b/unison-src/transcripts/builtins.output.md @@ -380,7 +380,8 @@ openFile] Just exercises the function ```unison -test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] +> Universal.murmurHash 1 +test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] ``` ```ucm @@ -391,14 +392,18 @@ test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] ⍟ These new definitions are ok to `add`: - test.boua3l3u3g : [Result] + Universal.murmurHash.tests : [Result] Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels. - 1 | test> checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] + 1 | > Universal.murmurHash 1 + ⧩ + 919612540558110011 + + 2 | test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] - 🚫 FAILED Failed + ✅ Passed Passed ``` ## Run the tests @@ -433,51 +438,10 @@ Now that all the tests have been added to the codebase, let's view the test repo ◉ Text.tests.patterns Passed ◉ Text.tests.repeat Passed ◉ Text.tests.takeDropAppend Passed + ◉ Universal.murmurHash.tests Passed - ✗ test.boua3l3u3g Failed + ✅ 24 test(s) passing - 🚫 1 test(s) failing, ✅ 23 test(s) passing - - Tip: Use view test.boua3l3u3g to view the source of a test. + Tip: Use view Any.test1 to view the source of a test. ``` - - - -🛑 - -The transcript failed due to an error in the stanza above. The error is: - - - Cached test results (`help testcache` to learn more) - - ◉ Any.test1 Passed - ◉ Any.test2 Passed - ◉ Boolean.tests.andTable Passed - ◉ Boolean.tests.notTable Passed - ◉ Boolean.tests.orTable Passed - ◉ Bytes.tests.at Passed - ◉ Bytes.tests.compression Passed - ◉ Bytes.tests.fromBase64UrlUnpadded Passed - ◉ Int.tests.arithmetic Passed - ◉ Int.tests.bitTwiddling Passed - ◉ Int.tests.conversions Passed - ◉ Nat.tests.arithmetic Passed - ◉ Nat.tests.bitTwiddling Passed - ◉ Nat.tests.conversions Passed - ◉ Sandbox.test1 Passed - ◉ Sandbox.test2 Passed - ◉ Sandbox.test3 Passed - ◉ test.rtjqan7bcs Passed - ◉ Text.tests.alignment Passed - ◉ Text.tests.literalsEq Passed - ◉ Text.tests.patterns Passed - ◉ Text.tests.repeat Passed - ◉ Text.tests.takeDropAppend Passed - - ✗ test.boua3l3u3g Failed - - 🚫 1 test(s) failing, ✅ 23 test(s) passing - - Tip: Use view test.boua3l3u3g to view the source of a test. - From b09743a622947af24138cee1bb5e20fd4305d9f4 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 25 Jan 2023 02:21:22 +0000 Subject: [PATCH 122/467] Generate transcripts --- .../all-base-hashes.output.md | 233 +++++++-------- unison-src/transcripts/alias-many.output.md | 15 +- .../transcripts/builtins-merge.output.md | 2 +- unison-src/transcripts/builtins.output.md | 2 +- .../transcripts/emptyCodebase.output.md | 4 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 28 +- .../transcripts/name-selection.output.md | 272 +++++++++--------- unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 +- 10 files changed, 302 insertions(+), 296 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index 808f8fb9e..1b2c01215 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -2337,62 +2337,65 @@ This transcript is intended to make visible accidental changes to the hashing al 666. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 667. -- ##unsafe.coerceAbilities + 667. -- ##Universal.murmurHash + builtin.Universal.murmurHash : a -> Nat + + 668. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 668. -- ##Value + 669. -- ##Value builtin type builtin.Value - 669. -- ##Value.dependencies + 670. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 670. -- ##Value.deserialize + 671. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 671. -- ##Value.load + 672. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 672. -- ##Value.serialize + 673. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 673. -- ##Value.value + 674. -- ##Value.value builtin.Value.value : a -> Value - 674. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 675. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 675. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 676. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 676. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 677. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 677. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 678. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 678. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 679. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 679. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 680. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 680. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 681. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 681. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 682. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 682. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 683. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 683. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 684. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 684. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 685. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2400,7 +2403,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 685. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 686. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2409,318 +2412,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 686. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 687. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 687. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 688. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 688. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 689. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 689. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 690. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 690. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 691. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 691. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 692. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 692. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 693. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 693. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 694. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 694. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 695. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 695. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 696. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 696. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 697. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 697. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 698. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 698. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 699. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 699. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 700. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 700. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 701. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 701. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 702. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 702. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 703. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 703. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 704. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 704. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 705. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 705. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 706. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 706. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 707. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 707. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 708. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 708. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 709. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 709. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 710. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 710. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 711. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 711. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 712. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 712. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 713. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 713. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 714. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 714. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 715. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 715. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 716. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 716. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 717. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 717. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 718. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 718. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 719. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 719. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 720. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 720. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 721. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 721. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 722. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 722. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 723. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 723. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 724. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 724. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 725. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 725. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 726. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 726. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 727. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 727. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 728. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 728. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 729. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 729. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 730. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 730. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 731. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 731. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 732. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 732. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 733. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 733. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 734. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 734. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 735. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 735. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 736. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 736. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 737. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 737. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 738. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 738. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 739. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 739. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 740. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 740. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 741. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 741. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 742. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 742. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 743. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 743. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 744. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 744. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 745. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 745. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 746. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 746. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 747. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 747. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 748. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 748. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 749. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 749. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 750. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 750. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 751. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o saveSelfContained : a -> Text ->{IO, Exception} () - 751. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 752. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 752. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 753. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 753. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 754. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 754. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 755. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 755. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 756. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 756. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 757. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 757. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 758. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 758. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 759. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 759. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 760. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 760. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 761. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 761. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 762. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 762. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 763. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 763. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 764. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 764. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 765. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 765. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 766. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 766. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 767. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 767. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 768. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 768. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 769. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 769. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 770. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 770. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 771. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 771. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 772. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 772. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 773. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 773. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 774. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 774. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 775. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 775. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 776. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 776. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 777. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 777. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 778. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 778. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 779. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 779. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 780. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 780. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 781. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 781. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 782. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index a2b6a2bac..78f6a2351 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -646,13 +646,14 @@ Let's try it! 468. Universal.> : a -> a -> Boolean 469. Universal.>= : a -> a -> Boolean 470. Universal.compare : a -> a -> Int - 471. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 472. builtin type Value - 473. Value.dependencies : Value -> [Term] - 474. Value.deserialize : Bytes -> Either Text Value - 475. Value.load : Value ->{IO} Either [Term] a - 476. Value.serialize : Value -> Bytes - 477. Value.value : a -> Value + 471. Universal.murmurHash : a -> Nat + 472. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b + 473. builtin type Value + 474. Value.dependencies : Value -> [Term] + 475. Value.deserialize : Bytes -> Either Text Value + 476. Value.load : Value ->{IO} Either [Term] a + 477. Value.serialize : Value -> Bytes + 478. Value.value : a -> Value .builtin> alias.many 94-104 .mylib diff --git a/unison-src/transcripts/builtins-merge.output.md b/unison-src/transcripts/builtins-merge.output.md index e453ebb8e..94c191e48 100644 --- a/unison-src/transcripts/builtins-merge.output.md +++ b/unison-src/transcripts/builtins-merge.output.md @@ -69,7 +69,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 58. Tuple/ (1 term) 59. Unit (type) 60. Unit/ (1 term) - 61. Universal/ (6 terms) + 61. Universal/ (7 terms) 62. Value (builtin type) 63. Value/ (5 terms) 64. bug (a -> b) diff --git a/unison-src/transcripts/builtins.output.md b/unison-src/transcripts/builtins.output.md index a07bcad9e..e6aaaca9f 100644 --- a/unison-src/transcripts/builtins.output.md +++ b/unison-src/transcripts/builtins.output.md @@ -399,7 +399,7 @@ test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Unive 1 | > Universal.murmurHash 1 ⧩ - 919612540558110011 + 5006114823290027883 2 | test> Universal.murmurHash.tests = checks [Universal.murmurHash [1,2,3] == Universal.murmurHash [1,2,3]] diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index 6980b73a7..d6b586862 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge` .foo> ls - 1. builtin/ (414 terms, 63 types) + 1. builtin/ (415 terms, 63 types) ``` And for a limited time, you can get even more builtin goodies: @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (586 terms, 81 types) + 1. builtin/ (587 terms, 81 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index 3c091572d..ee3c49203 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -121,13 +121,13 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #khhiq1sc3o + ⊙ 1. #ut7mk2guld - Deletes: feature1.y - ⊙ 2. #0t16m7j03m + ⊙ 2. #oaneanmrn8 + Adds / updates: @@ -138,26 +138,26 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Original name New name(s) feature1.y master.y - ⊙ 3. #l4cc5snm7c + ⊙ 3. #m6o57p1elr + Adds / updates: feature1.y - ⊙ 4. #0ujfvnropc + ⊙ 4. #ep8ckbhnqt > Moves: Original name New name x master.x - ⊙ 5. #jd5q4ga1jk + ⊙ 5. #t7aklphn43 + Adds / updates: x - □ 6. #67ki96tn2j (start of history) + □ 6. #l6lcr63iti (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 70f0e1b97..41a76d572 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -267,7 +267,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (591 terms, 82 types) + 1. root/ (592 terms, 82 types) .> history @@ -276,13 +276,13 @@ I should be able to move the root into a sub-namespace - □ 1. #2kibet66dd (start of history) + □ 1. #o2vkdh7ltv (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (586 terms, 81 types) + 1. builtin/ (587 terms, 81 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -292,7 +292,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #e7uij3oft2 + ⊙ 1. #i0lk1c81v7 - Deletes: @@ -303,7 +303,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #v32ubv0p3r + ⊙ 2. #64lmvl3fbe + Adds / updates: @@ -315,26 +315,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #8brjmr30ls + ⊙ 3. #1upc23ts8h + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #aie72ekk7e + ⊙ 4. #hp3nttbbeu > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #t05a2u5s1a + ⊙ 5. #3vt487avqa - Deletes: history.b.termInB - ⊙ 6. #7e116chrdg + ⊙ 6. #cng5456u5h + Adds / updates: @@ -345,13 +345,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #aq0rd3db7l + ⊙ 7. #6s6rta6dft + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #rk1p4aamml + ⊙ 8. #ri5k67h719 > Moves: @@ -361,7 +361,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #dhr3sctdec + ⊙ 9. #5lhn2nqa5u + Adds / updates: @@ -371,7 +371,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #bu35nl3qi6 + ⊙ 10. #2oljit38kd + Adds / updates: @@ -383,7 +383,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #bjgbu0j8dd + ⊙ 11. #95soup1m3q ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index 908ea6ec4..1974b78fe 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -1003,398 +1003,400 @@ d = c + 10 350. builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 351. builtin.Int.negate : Int + 351. builtin.Universal.murmurHash : a + -> Nat + 352. builtin.Int.negate : Int -> Int - 352. builtin.io2.MVar.new : a + 353. builtin.io2.MVar.new : a ->{IO} MVar a - 353. builtin.io2.Promise.new : '{IO} Promise + 354. builtin.io2.Promise.new : '{IO} Promise a - 354. builtin.io2.TVar.new : a + 355. builtin.io2.TVar.new : a ->{STM} TVar a - 355. builtin.io2.MVar.newEmpty : '{IO} MVar + 356. builtin.io2.MVar.newEmpty : '{IO} MVar a - 356. builtin.io2.TVar.newIO : a + 357. builtin.io2.TVar.newIO : a ->{IO} TVar a - 357. builtin.Boolean.not : Boolean + 358. builtin.Boolean.not : Boolean -> Boolean - 358. builtin.Text.patterns.notCharIn : [Char] + 359. builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 359. builtin.Text.patterns.notCharRange : Char + 360. builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 360. builtin.io2.Clock.internals.nsec : TimeSpec + 361. builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 361. builtin.Int.or : Int + 362. builtin.Int.or : Int -> Int -> Int - 362. builtin.Nat.or : Nat + 363. builtin.Nat.or : Nat -> Nat -> Nat - 363. builtin.Pattern.or : Pattern + 364. builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 364. builtin.Int.popCount : Int + 365. builtin.Int.popCount : Int -> Nat - 365. builtin.Nat.popCount : Nat + 366. builtin.Nat.popCount : Nat -> Nat - 366. builtin.Float.pow : Float + 367. builtin.Float.pow : Float -> Float -> Float - 367. builtin.Int.pow : Int + 368. builtin.Int.pow : Int -> Nat -> Int - 368. builtin.Nat.pow : Nat + 369. builtin.Nat.pow : Nat -> Nat -> Nat - 369. builtin.io2.Clock.internals.processCPUTime : '{IO} Either + 370. builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 370. builtin.Text.patterns.punctuation : Pattern + 371. builtin.Text.patterns.punctuation : Pattern Text - 371. builtin.ImmutableArray.read : ImmutableArray + 372. builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 372. builtin.MutableArray.read : MutableArray + 373. builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 373. builtin.io2.Promise.read : Promise + 374. builtin.io2.Promise.read : Promise a ->{IO} a - 374. builtin.Ref.read : Ref g a + 375. builtin.Ref.read : Ref g a ->{g} a - 375. builtin.io2.TVar.read : TVar a + 376. builtin.io2.TVar.read : TVar a ->{STM} a - 376. builtin.io2.Ref.Ticket.read : Ticket + 377. builtin.io2.Ref.Ticket.read : Ticket a -> a - 377. builtin.ImmutableByteArray.read16be : ImmutableByteArray + 378. builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 378. builtin.MutableByteArray.read16be : MutableByteArray + 379. builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 379. builtin.ImmutableByteArray.read24be : ImmutableByteArray + 380. builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 380. builtin.MutableByteArray.read24be : MutableByteArray + 381. builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 381. builtin.ImmutableByteArray.read32be : ImmutableByteArray + 382. builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 382. builtin.MutableByteArray.read32be : MutableByteArray + 383. builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 383. builtin.ImmutableByteArray.read40be : ImmutableByteArray + 384. builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 384. builtin.MutableByteArray.read40be : MutableByteArray + 385. builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 385. builtin.ImmutableByteArray.read64be : ImmutableByteArray + 386. builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 386. builtin.MutableByteArray.read64be : MutableByteArray + 387. builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 387. builtin.ImmutableByteArray.read8 : ImmutableByteArray + 388. builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 388. builtin.MutableByteArray.read8 : MutableByteArray + 389. builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 389. builtin.io2.Ref.readForCas : Ref + 390. builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 390. builtin.io2.TVar.readIO : TVar a + 391. builtin.io2.TVar.readIO : TVar a ->{IO} a - 391. builtin.io2.Clock.internals.realtime : '{IO} Either + 392. builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 392. builtin.io2.IO.ref : a + 393. builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 393. builtin.Scope.ref : a + 394. builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 394. builtin.Text.repeat : Nat + 395. builtin.Text.repeat : Nat -> Text -> Text - 395. builtin.Pattern.replicate : Nat + 396. builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 396. builtin.io2.STM.retry : '{STM} a - 397. builtin.Text.reverse : Text + 397. builtin.io2.STM.retry : '{STM} a + 398. builtin.Text.reverse : Text -> Text - 398. builtin.Float.round : Float + 399. builtin.Float.round : Float -> Int - 399. builtin.Pattern.run : Pattern + 400. builtin.Pattern.run : Pattern a -> a -> Optional ( [a], a) - 400. builtin.Scope.run : (∀ s. + 401. builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 401. builtin.io2.Clock.internals.sec : TimeSpec + 402. builtin.io2.Clock.internals.sec : TimeSpec -> Int - 402. builtin.Code.serialize : Code + 403. builtin.Code.serialize : Code -> Bytes - 403. builtin.Value.serialize : Value + 404. builtin.Value.serialize : Value -> Bytes - 404. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + 405. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 405. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + 406. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 406. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + 407. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 407. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + 408. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 408. builtin.io2.Tls.ClientConfig.versions.set : [Version] + 409. builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 409. builtin.io2.Tls.ServerConfig.versions.set : [Version] + 410. builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 410. builtin.Int.shiftLeft : Int + 411. builtin.Int.shiftLeft : Int -> Nat -> Int - 411. builtin.Nat.shiftLeft : Nat + 412. builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 412. builtin.Int.shiftRight : Int + 413. builtin.Int.shiftRight : Int -> Nat -> Int - 413. builtin.Nat.shiftRight : Nat + 414. builtin.Nat.shiftRight : Nat -> Nat -> Nat - 414. builtin.Int.signum : Int + 415. builtin.Int.signum : Int -> Int - 415. builtin.Float.sin : Float + 416. builtin.Float.sin : Float -> Float - 416. builtin.Float.sinh : Float + 417. builtin.Float.sinh : Float -> Float - 417. builtin.Bytes.size : Bytes + 418. builtin.Bytes.size : Bytes -> Nat - 418. builtin.ImmutableArray.size : ImmutableArray + 419. builtin.ImmutableArray.size : ImmutableArray a -> Nat - 419. builtin.ImmutableByteArray.size : ImmutableByteArray + 420. builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 420. builtin.List.size : [a] + 421. builtin.List.size : [a] -> Nat - 421. builtin.MutableArray.size : MutableArray + 422. builtin.MutableArray.size : MutableArray g a -> Nat - 422. builtin.MutableByteArray.size : MutableByteArray + 423. builtin.MutableByteArray.size : MutableByteArray g -> Nat - 423. builtin.Text.size : Text + 424. builtin.Text.size : Text -> Nat - 424. builtin.Text.patterns.space : Pattern + 425. builtin.Text.patterns.space : Pattern Text - 425. builtin.Float.sqrt : Float + 426. builtin.Float.sqrt : Float -> Float - 426. builtin.io2.IO.stdHandle : StdHandle + 427. builtin.io2.IO.stdHandle : StdHandle -> Handle - 427. builtin.Nat.sub : Nat + 428. builtin.Nat.sub : Nat -> Nat -> Int - 428. builtin.io2.TVar.swap : TVar a + 429. builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 429. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 430. builtin.Bytes.take : Nat + 430. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + 431. builtin.Bytes.take : Nat -> Bytes -> Bytes - 431. builtin.List.take : Nat + 432. builtin.List.take : Nat -> [a] -> [a] - 432. builtin.Text.take : Nat + 433. builtin.Text.take : Nat -> Text -> Text - 433. builtin.Float.tan : Float + 434. builtin.Float.tan : Float -> Float - 434. builtin.Float.tanh : Float + 435. builtin.Float.tanh : Float -> Float - 435. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + 436. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 436. builtin.Bytes.toBase16 : Bytes + 437. builtin.Bytes.toBase16 : Bytes -> Bytes - 437. builtin.Bytes.toBase32 : Bytes + 438. builtin.Bytes.toBase32 : Bytes -> Bytes - 438. builtin.Bytes.toBase64 : Bytes + 439. builtin.Bytes.toBase64 : Bytes -> Bytes - 439. builtin.Bytes.toBase64UrlUnpadded : Bytes + 440. builtin.Bytes.toBase64UrlUnpadded : Bytes -> Bytes - 440. builtin.Text.toCharList : Text + 441. builtin.Text.toCharList : Text -> [Char] - 441. builtin.Int.toFloat : Int + 442. builtin.Int.toFloat : Int -> Float - 442. builtin.Nat.toFloat : Nat + 443. builtin.Nat.toFloat : Nat -> Float - 443. builtin.Nat.toInt : Nat + 444. builtin.Nat.toInt : Nat -> Int - 444. builtin.Bytes.toList : Bytes + 445. builtin.Bytes.toList : Bytes -> [Nat] - 445. builtin.Text.toLowercase : Text + 446. builtin.Text.toLowercase : Text -> Text - 446. builtin.Char.toNat : Char + 447. builtin.Char.toNat : Char -> Nat - 447. builtin.Float.toRepresentation : Float + 448. builtin.Float.toRepresentation : Float -> Nat - 448. builtin.Int.toRepresentation : Int + 449. builtin.Int.toRepresentation : Int -> Nat - 449. builtin.Char.toText : Char + 450. builtin.Char.toText : Char -> Text - 450. builtin.Debug.toText : a + 451. builtin.Debug.toText : a -> Optional (Either Text Text) - 451. builtin.Float.toText : Float + 452. builtin.Float.toText : Float -> Text - 452. builtin.Handle.toText : Handle + 453. builtin.Handle.toText : Handle -> Text - 453. builtin.Int.toText : Int + 454. builtin.Int.toText : Int -> Text - 454. builtin.Nat.toText : Nat + 455. builtin.Nat.toText : Nat -> Text - 455. builtin.Socket.toText : Socket + 456. builtin.Socket.toText : Socket -> Text - 456. builtin.Link.Term.toText : Term + 457. builtin.Link.Term.toText : Term -> Text - 457. builtin.ThreadId.toText : ThreadId + 458. builtin.ThreadId.toText : ThreadId -> Text - 458. builtin.Text.toUppercase : Text + 459. builtin.Text.toUppercase : Text -> Text - 459. builtin.Text.toUtf8 : Text + 460. builtin.Text.toUtf8 : Text -> Bytes - 460. builtin.todo : a -> b - 461. builtin.Debug.trace : Text + 461. builtin.todo : a -> b + 462. builtin.Debug.trace : Text -> a -> () - 462. builtin.Int.trailingZeros : Int + 463. builtin.Int.trailingZeros : Int -> Nat - 463. builtin.Nat.trailingZeros : Nat + 464. builtin.Nat.trailingZeros : Nat -> Nat - 464. builtin.Float.truncate : Float + 465. builtin.Float.truncate : Float -> Int - 465. builtin.Int.truncate0 : Int + 466. builtin.Int.truncate0 : Int -> Nat - 466. builtin.io2.IO.tryEval : '{IO} a + 467. builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 467. builtin.io2.Promise.tryRead : Promise + 468. builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 468. builtin.io2.MVar.tryTake : MVar a + 469. builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 469. builtin.Text.uncons : Text + 470. builtin.Text.uncons : Text -> Optional ( Char, Text) - 470. builtin.Any.unsafeExtract : Any + 471. builtin.Any.unsafeExtract : Any -> a - 471. builtin.Text.unsnoc : Text + 472. builtin.Text.unsnoc : Text -> Optional ( Text, Char) - 472. builtin.Code.validate : [( Term, + 473. builtin.Code.validate : [( Term, Code)] ->{IO} Optional Failure - 473. builtin.io2.validateSandboxed : [Term] + 474. builtin.io2.validateSandboxed : [Term] -> a -> Boolean - 474. builtin.Value.value : a + 475. builtin.Value.value : a -> Value - 475. builtin.Debug.watch : Text + 476. builtin.Debug.watch : Text -> a -> a - 476. builtin.MutableArray.write : MutableArray + 477. builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 477. builtin.io2.Promise.write : Promise + 478. builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 478. builtin.Ref.write : Ref g a + 479. builtin.Ref.write : Ref g a -> a ->{g} () - 479. builtin.io2.TVar.write : TVar a + 480. builtin.io2.TVar.write : TVar a -> a ->{STM} () - 480. builtin.MutableByteArray.write16be : MutableByteArray + 481. builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 481. builtin.MutableByteArray.write32be : MutableByteArray + 482. builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 482. builtin.MutableByteArray.write64be : MutableByteArray + 483. builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 483. builtin.MutableByteArray.write8 : MutableByteArray + 484. builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 484. builtin.Int.xor : Int + 485. builtin.Int.xor : Int -> Int -> Int - 485. builtin.Nat.xor : Nat + 486. builtin.Nat.xor : Nat -> Nat -> Nat diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index d49ab9973..22d64b0d4 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #9014t8bemk .old` to make an old namespace + `fork #c50ilio6t7 .old` to make an old namespace accessible again, - `reset-root #9014t8bemk` to reset the root namespace and + `reset-root #c50ilio6t7` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #q24i9rm0u0 add - 2. now #9014t8bemk add - 3. now #2p31h4lsei builtins.merge + 1. now #r1ojo66sp7 add + 2. now #c50ilio6t7 add + 3. now #k0vh8qed2b builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index df37e5337..b0d896d6f 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #5r75rvflum (start of history) + □ 1. #61h5m6vr8d (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #ih7oa9qmee + ⊙ 1. #h3t1td6j70 > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #2nsvr26oeu + ⊙ 2. #hof2b14ggf > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #5r75rvflum (start of history) + □ 3. #61h5m6vr8d (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #ih7oa9qmee + ⊙ 1. #h3t1td6j70 > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #2nsvr26oeu + ⊙ 2. #hof2b14ggf > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #5r75rvflum (start of history) + □ 3. #61h5m6vr8d (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #5r75rvflum (start of history) + □ 1. #61h5m6vr8d (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #65gt0djmn2 + ⊙ 1. #v3tbgssvfo - Deletes: Nat.* Nat.+ - □ 2. #5r75rvflum (start of history) + □ 2. #61h5m6vr8d (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From 78aa94370f0ca7fb9deba10819a99e3d69ffcf37 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 25 Jan 2023 11:28:11 -0600 Subject: [PATCH 123/467] Scope indexes too. --- codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 7988d8606..5bbeb413a 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -1700,12 +1700,12 @@ ensureScopedNameLookupTables = do -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. execute_ [here| - CREATE INDEX IF NOT EXISTS scoped_term_names_by_namespace_and_last_name_segment ON term_name_lookup(root_branch_hash_id, last_name_segment, namespace) + CREATE INDEX IF NOT EXISTS scoped_term_names_by_namespace_and_last_name_segment ON scoped_term_name_lookup(root_branch_hash_id, last_name_segment, namespace) |] -- This index allows us to find all names with a given ref within a specific namespace execute_ [here| - CREATE INDEX IF NOT EXISTS scoped_term_name_by_referent_lookup ON term_name_lookup(root_branch_hash_id, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, namespace) + CREATE INDEX IF NOT EXISTS scoped_term_name_by_referent_lookup ON scoped_term_name_lookup(root_branch_hash_id, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, namespace) |] -- Allows fetching ALL names within a specific namespace prefix. We currently use this to @@ -1747,20 +1747,20 @@ ensureScopedNameLookupTables = do -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. execute_ [here| - CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace_and_last_name_segment ON type_name_lookup(root_branch_hash_id, last_name_segment, namespace) + CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace_and_last_name_segment ON scoped_type_name_lookup(root_branch_hash_id, last_name_segment, namespace) |] -- This index allows us to find all names with a given ref within a specific namespace. execute_ [here| - CREATE INDEX IF NOT EXISTS scoped_type_name_by_reference_lookup ON type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace) + CREATE INDEX IF NOT EXISTS scoped_type_name_by_reference_lookup ON scoped_type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace) |] -- Allows fetching ALL names within a specific namespace prefix. We currently use this to -- pretty-print on share, but will be replaced with a more precise set of queries soon. execute_ [here| - CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace ON type_name_lookup(root_branch_hash_id, namespace) + CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace ON scoped_type_name_lookup(root_branch_hash_id, namespace) |] -- | Copies existing name lookup rows but replaces their branch hash id; From 99a0cad31871e3aa8d3a8f7897dac75b47d42bdf Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 25 Jan 2023 13:55:20 -0600 Subject: [PATCH 124/467] Fix copy tables --- codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 5bbeb413a..51c68fc17 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -1773,14 +1773,14 @@ copyScopedNameLookup fromBHId toBHId = do where termsCopySql = [here| - INSERT INTO scoped_term_name_lookup - SELECT ?, reversed_name, last_name_segment, namespace, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index + INSERT INTO scoped_term_name_lookup(root_branch_hash_id, reversed_name, last_name_segment, namespace, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type) + SELECT ?, reversed_name, last_name_segment, namespace, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type FROM scoped_term_name_lookup WHERE root_branch_hash_id = ? |] typesCopySql = [here| - INSERT INTO scoped_type_name_lookup + INSERT INTO scoped_type_name_lookup(root_branch_hash_id, reversed_name, last_name_segment, namespace, reference_builtin, reference_component_hash, reference_component_index) SELECT ?, reversed_name, last_name_segment, namespace, reference_builtin, reference_component_hash, reference_component_index FROM scoped_type_name_lookup WHERE root_branch_hash_id = ? From e306a2a4fb6475e30457e87f200e587373bc0bfd Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 25 Jan 2023 11:38:30 -0600 Subject: [PATCH 125/467] Port old name lookup combinators to the new indexes --- .../U/Codebase/Sqlite/Operations.hs | 22 +-- .../U/Codebase/Sqlite/Queries.hs | 166 +++--------------- 2 files changed, 28 insertions(+), 160 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index e40318317..de8b1d4de 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -67,7 +67,6 @@ module U.Codebase.Sqlite.Operations termsMentioningType, -- ** name lookup index - updateNameIndex, rootNamesByPath, NamesByPath (..), checkBranchHashNameLookupExists, @@ -1069,20 +1068,6 @@ derivedDependencies cid = do cids <- traverse s2cReferenceId sids pure $ Set.fromList cids --- | Given lists of names to add and remove, update the index accordingly. -updateNameIndex :: - -- | (add terms, remove terms) - ([S.NamedRef (C.Referent, Maybe C.ConstructorType)], [S.NamedRef C.Referent]) -> - -- | (add types, remove types) - ([S.NamedRef C.Reference], [S.NamedRef C.Reference]) -> - Transaction () -updateNameIndex (newTermNames, removedTermNames) (newTypeNames, removedTypeNames) = do - Q.ensureNameLookupTables - Q.removeTermNames ((fmap c2sTextReferent <$> removedTermNames)) - Q.removeTypeNames ((fmap c2sTextReference <$> removedTypeNames)) - Q.insertTermNames (fmap (c2sTextReferent *** fmap c2sConstructorType) <$> newTermNames) - Q.insertTypeNames (fmap c2sTextReference <$> newTypeNames) - buildNameLookupForBranchHash :: -- The existing name lookup index to copy before applying the diff. -- If Nothing, run the diff against an empty index. @@ -1120,13 +1105,16 @@ data NamesByPath = NamesByPath } -- | Get all the term and type names for the root namespace from the lookup table. +-- Requires that an index for this branch hash already exists, which is currently +-- only true on Share. rootNamesByPath :: -- | A relative namespace string, e.g. Just "base.List" Maybe Text -> Transaction NamesByPath rootNamesByPath path = do - termNamesInPath <- Q.rootTermNamesByPath path - typeNamesInPath <- Q.rootTypeNamesByPath path + bhId <- Q.expectNamespaceRootBranchHashId + termNamesInPath <- Q.termNamesWithinNamespace bhId path + typeNamesInPath <- Q.typeNamesWithinNamespace bhId path pure $ NamesByPath { termNamesInPath = convertTerms <$> termNamesInPath, diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 51c68fc17..e88ba8b39 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -134,21 +134,15 @@ module U.Codebase.Sqlite.Queries causalHashIdByBase32Prefix, -- * Name Lookup - ensureNameLookupTables, ensureScopedNameLookupTables, copyScopedNameLookup, dropNameLookupTables, - insertTermNames, - insertTypeNames, - removeTermNames, - removeTypeNames, insertScopedTermNames, insertScopedTypeNames, removeScopedTermNames, removeScopedTypeNames, - rootTermNamesByPath, - rootTypeNamesByPath, - getNamespaceDefinitionCount, + termNamesWithinNamespace, + typeNamesWithinNamespace, checkBranchHashNameLookupExists, trackNewBranchHashNameLookup, @@ -1598,49 +1592,6 @@ dropNameLookupTables = do DROP TABLE IF EXISTS type_name_lookup |] --- | Ensure the name lookup tables exist. --- --- These tables will be deprecated in favour of ensureScopedNameLookupTables once we've --- migrated all the indexes over. -ensureNameLookupTables :: Transaction () -ensureNameLookupTables = do - execute_ - [here| - CREATE TABLE IF NOT EXISTS term_name_lookup ( - -- The name of the term: E.g. map.List.base - reversed_name TEXT NOT NULL, - -- The namespace containing this term, not reversed: E.g. base.List - namespace TEXT NOT NULL, - referent_builtin TEXT NULL, - referent_component_hash TEXT NULL, - referent_component_index INTEGER NULL, - referent_constructor_index INTEGER NULL, - referent_constructor_type INTEGER NULL, - PRIMARY KEY (reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) - ) - |] - execute_ - [here| - CREATE INDEX IF NOT EXISTS term_names_by_namespace ON term_name_lookup(namespace) - |] - execute_ - [here| - CREATE TABLE IF NOT EXISTS type_name_lookup ( - -- The name of the term: E.g. List.base - reversed_name TEXT NOT NULL, - -- The namespace containing this term, not reversed: E.g. base.List - namespace TEXT NOT NULL, - reference_builtin TEXT NULL, - reference_component_hash INTEGER NULL, - reference_component_index INTEGER NULL, - PRIMARY KEY (reversed_name, reference_builtin, reference_component_hash, reference_component_index) - ); - |] - execute_ - [here| - CREATE INDEX IF NOT EXISTS type_names_by_namespace ON type_name_lookup(namespace) - |] - -- | Ensure the scoped name lookup tables exist. -- this will eventually replace the tables in 'ensureNameLookupTables' after all the indexes -- have been migrated over. @@ -1812,63 +1763,6 @@ checkBranchHashNameLookupExists hashId = do ) |] --- | Insert the given set of term names into the name lookup table -insertTermNames :: [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] -> Transaction () -insertTermNames names = do - executeMany sql (NamedRef.toRowWithNamespace . fmap refToRow <$> names) - where - refToRow :: (Referent.TextReferent, Maybe NamedRef.ConstructorType) -> (Referent.TextReferent :. Only (Maybe NamedRef.ConstructorType)) - refToRow (ref, ct) = ref :. Only ct - sql = - [here| - INSERT INTO term_name_lookup (reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type, namespace) - VALUES (?, ?, ?, ?, ?, ?, ?) - ON CONFLICT DO NOTHING - |] - --- | Insert the given set of type names into the name lookup table -insertTypeNames :: [NamedRef (Reference.TextReference)] -> Transaction () -insertTypeNames names = - executeMany sql (NamedRef.toRowWithNamespace <$> names) - where - sql = - [here| - INSERT INTO type_name_lookup (reversed_name, reference_builtin, reference_component_hash, reference_component_index, namespace) - VALUES (?, ?, ?, ?, ?) - ON CONFLICT DO NOTHING - |] - --- | Remove the given set of term names into the name lookup table -removeTermNames :: [NamedRef Referent.TextReferent] -> Transaction () -removeTermNames names = do - executeMany sql names - where - sql = - [here| - DELETE FROM term_name_lookup - WHERE - reversed_name IS ? - AND referent_builtin IS ? - AND referent_component_hash IS ? - AND referent_component_index IS ? - AND referent_constructor_index IS ? - |] - --- | Remove the given set of term names into the name lookup table -removeTypeNames :: [NamedRef (Reference.TextReference)] -> Transaction () -removeTypeNames names = do - executeMany sql names - where - sql = - [here| - DELETE FROM type_name_lookup - WHERE - reversed_name IS ? - AND reference_builtin IS ? - AND reference_component_hash IS ? - AND reference_component_index IS ? - |] - -- | Insert the given set of term names into the name lookup table insertScopedTermNames :: BranchHashId -> [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] -> Transaction () insertScopedTermNames bhId names = do @@ -1975,54 +1869,40 @@ likeEscape escapeChar pat = | c == escapeChar -> Text.pack [escapeChar, escapeChar] | otherwise -> Text.singleton c --- | Gets the count of all definitions within the given namespace. --- NOTE: This requires a working name lookup index. -getNamespaceDefinitionCount :: Text -> Transaction Int -getNamespaceDefinitionCount namespace = do - let subnamespace = globEscape namespace <> ".*" - queryOneCol sql (subnamespace, namespace, subnamespace, namespace) - where - sql = - [here| - SELECT COUNT(*) FROM ( - SELECT 1 FROM term_name_lookup WHERE namespace GLOB ? OR namespace = ? - UNION ALL - SELECT 1 FROM type_name_lookup WHERE namespace GLOB ? OR namespace = ? - ) - |] - -- | Get the list of a term names in the root namespace according to the name lookup index -rootTermNamesByPath :: Maybe Text -> Transaction [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] -rootTermNamesByPath mayNamespace = do - let (namespace, subnamespace) = case mayNamespace of - Nothing -> ("", "*") - Just namespace -> (namespace, globEscape namespace <> ".*") - results :: [NamedRef (Referent.TextReferent :. Only (Maybe NamedRef.ConstructorType))] <- queryListRow sql (subnamespace, namespace, subnamespace, namespace) +termNamesWithinNamespace :: BranchHashId -> Maybe Text -> Transaction [NamedRef (Referent.TextReferent, Maybe NamedRef.ConstructorType)] +termNamesWithinNamespace bhId mayNamespace = do + let namespaceGlob = case mayNamespace of + Nothing -> "*" + Just namespace -> globEscape namespace <> ".*" + results :: [NamedRef (Referent.TextReferent :. Only (Maybe NamedRef.ConstructorType))] <- queryListRow sql (bhId, namespaceGlob) pure (fmap unRow <$> results) where unRow (a :. Only b) = (a, b) sql = [here| - SELECT reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type FROM term_name_lookup - WHERE (namespace GLOB ? OR namespace = ?) - ORDER BY (namespace GLOB ? OR namespace = ?) DESC + SELECT reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type FROM scoped_term_name_lookup + WHERE + root_branch_hash_id = ? + AND namespace GLOB ? |] -- | Get the list of a type names in the root namespace according to the name lookup index -rootTypeNamesByPath :: Maybe Text -> Transaction [NamedRef Reference.TextReference] -rootTypeNamesByPath mayNamespace = do - let (namespace, subnamespace) = case mayNamespace of - Nothing -> ("", "*") - Just namespace -> (namespace, globEscape namespace <> ".*") - results :: [NamedRef Reference.TextReference] <- queryListRow sql (subnamespace, namespace, subnamespace, namespace) +typeNamesWithinNamespace :: BranchHashId -> Maybe Text -> Transaction [NamedRef Reference.TextReference] +typeNamesWithinNamespace bhId mayNamespace = do + let namespaceGlob = case mayNamespace of + Nothing -> "*" + Just namespace -> globEscape namespace <> ".*" + results :: [NamedRef Reference.TextReference] <- queryListRow sql (bhId, namespaceGlob) pure results where sql = [here| - SELECT reversed_name, reference_builtin, reference_component_hash, reference_component_index FROM type_name_lookup - WHERE namespace GLOB ? OR namespace = ? - ORDER BY (namespace GLOB ? OR namespace = ?) DESC - |] + SELECT reversed_name, reference_builtin, reference_component_hash, reference_component_index FROM scoped_type_name_lookup + WHERE + root_branch_hash_id = ? + AND namespace GLOB ? + |] -- | @before x y@ returns whether or not @x@ occurred before @y@, i.e. @x@ is an ancestor of @y@. before :: CausalHashId -> CausalHashId -> Transaction Bool From 119a254c9e6ab7bb4c3214f75c4309a60d5b934d Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 25 Jan 2023 11:44:59 -0600 Subject: [PATCH 126/467] Nuke updateNameLookup --- .../src/Unison/Codebase/SqliteCodebase.hs | 8 +- .../Codebase/SqliteCodebase/Operations.hs | 114 ------------------ .../src/Unison/Codebase/Type.hs | 18 +-- 3 files changed, 2 insertions(+), 138 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs index 1e9ca9dcd..ad62e0810 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs @@ -27,7 +27,7 @@ import qualified System.Console.ANSI as ANSI import System.FileLock (SharedExclusive (Exclusive), withTryFileLock) import qualified System.FilePath as FilePath import qualified System.FilePath.Posix as FilePath.Posix -import U.Codebase.HashTags (BranchHash, CausalHash, PatchHash (..)) +import U.Codebase.HashTags (CausalHash, PatchHash (..)) import qualified U.Codebase.Reflog as Reflog import qualified U.Codebase.Sqlite.Operations as Ops import qualified U.Codebase.Sqlite.Queries as Q @@ -52,7 +52,6 @@ import qualified Unison.Codebase.Init as Codebase import qualified Unison.Codebase.Init.CreateCodebaseError as Codebase1 import Unison.Codebase.Init.OpenCodebaseError (OpenCodebaseError (..)) import qualified Unison.Codebase.Init.OpenCodebaseError as Codebase1 -import Unison.Codebase.Path (Path) import Unison.Codebase.RootBranchCache import Unison.Codebase.SqliteCodebase.Branch.Cache (newBranchCache) import qualified Unison.Codebase.SqliteCodebase.Branch.Dependencies as BD @@ -344,10 +343,6 @@ sqliteCodebase debugName root localOrRemote lockOption migrationStrategy action referentsByPrefix = CodebaseOps.referentsByPrefix getDeclType - updateNameLookup :: Path -> Maybe BranchHash -> BranchHash -> Sqlite.Transaction () - updateNameLookup = - CodebaseOps.updateNameLookupIndex getDeclType - let codebase = C.Codebase { getTerm, @@ -374,7 +369,6 @@ sqliteCodebase debugName root localOrRemote lockOption migrationStrategy action termsOfTypeImpl, termsMentioningTypeImpl, termReferentsByPrefix = referentsByPrefix, - updateNameLookup, withConnection = withConn, withConnectionIO = withConnection debugName root } diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs index b0388bf72..c5e69e5f3 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs @@ -7,11 +7,9 @@ -- are unified with non-sqlite operations in the Codebase interface, like 'appendReflog'. module Unison.Codebase.SqliteCodebase.Operations where -import Control.Lens (ifor) import Data.Bitraversable (bitraverse) import Data.Either.Extra () import qualified Data.List as List -import qualified Data.List.NonEmpty as NEList import Data.List.NonEmpty.Extra (NonEmpty ((:|)), maximum1) import qualified Data.Map as Map import Data.Maybe (fromJust) @@ -19,7 +17,6 @@ import qualified Data.Set as Set import qualified Data.Text as Text import qualified U.Codebase.Branch as V2Branch import qualified U.Codebase.Branch.Diff as BranchDiff -import qualified U.Codebase.Causal as V2Causal import U.Codebase.HashTags (BranchHash, CausalHash (unCausalHash), PatchHash) import qualified U.Codebase.Reference as C.Reference import qualified U.Codebase.Referent as C.Referent @@ -32,8 +29,6 @@ import qualified U.Codebase.Sqlite.Queries as Q import U.Codebase.Sqlite.V2.HashHandle (v2HashHandle) import qualified Unison.Builtin as Builtins import Unison.Codebase.Branch (Branch (..)) -import qualified Unison.Codebase.Branch as Branch -import qualified Unison.Codebase.Branch.Names as V1Branch import Unison.Codebase.Patch (Patch) import Unison.Codebase.Path (Path) import qualified Unison.Codebase.Path as Path @@ -620,41 +615,6 @@ namesAtPath namesRootPath relativeToPath = do Nothing -> Nothing Just stripped -> Just (Name.makeRelative stripped, ref) --- | Update the root namespace names index which is used by the share server for serving api --- requests. -updateNameLookupIndex :: - (C.Reference.Reference -> Sqlite.Transaction CT.ConstructorType) -> - Path -> - -- | "from" branch, if 'Nothing' use the empty branch - Maybe BranchHash -> - -- | "to" branch - BranchHash -> - Sqlite.Transaction () -updateNameLookupIndex getDeclType pathPrefix mayFromBranchHash toBranchHash = do - fromBranch <- case mayFromBranchHash of - Nothing -> pure V2Branch.empty - Just fromBH -> Ops.expectBranchByBranchHash fromBH - toBranch <- Ops.expectBranchByBranchHash toBranchHash - treeDiff <- BranchDiff.diffBranches fromBranch toBranch - let namePrefix = case pathPrefix of - Path.Empty -> Nothing - (p Path.:< ps) -> Just $ Name.fromSegments (p :| Path.toList ps) - let BranchDiff.NameChanges {termNameAdds, termNameRemovals, typeNameAdds, typeNameRemovals} = BranchDiff.nameChanges namePrefix treeDiff - termNameAddsWithCT <- do - for termNameAdds \(name, ref) -> do - refWithCT <- addReferentCT ref - pure $ toNamedRef (name, refWithCT) - Ops.updateNameIndex (termNameAddsWithCT, toNamedRef <$> termNameRemovals) (toNamedRef <$> typeNameAdds, toNamedRef <$> typeNameRemovals) - where - toNamedRef :: (Name, ref) -> S.NamedRef ref - toNamedRef (name, ref) = S.NamedRef {reversedSegments = coerce $ Name.reverseSegments name, ref = ref} - addReferentCT :: C.Referent.Referent -> Transaction (C.Referent.Referent, Maybe C.Referent.ConstructorType) - addReferentCT referent = case referent of - C.Referent.Ref {} -> pure (referent, Nothing) - C.Referent.Con ref _conId -> do - ct <- getDeclType ref - pure (referent, Just $ Cv.constructorType1to2 ct) - -- | Add an index for the provided branch hash if one doesn't already exist. ensureNameLookupForBranchHash :: (C.Reference.Reference -> Sqlite.Transaction CT.ConstructorType) -> @@ -697,80 +657,6 @@ ensureNameLookupForBranchHash getDeclType mayFromBranchHash toBranchHash = do ct <- getDeclType ref pure (referent, Just $ Cv.constructorType1to2 ct) --- | Compute the root namespace names index which is used by the share server for serving api --- requests. Using 'updateNameLookupIndex' is preferred whenever possible, since it's --- considerably faster. This can be used to reset the index if it ever gets out of sync due to --- a bug. --- --- This version can be used if you've already got the root Branch pre-loaded, otherwise --- it's faster to use 'initializeNameLookupIndexFromV2Root' -initializeNameLookupIndexFromV1Branch :: Branch Transaction -> Sqlite.Transaction () -initializeNameLookupIndexFromV1Branch root = do - Q.dropNameLookupTables - saveRootNamesIndexV1 (V1Branch.toNames . Branch.head $ root) - where - saveRootNamesIndexV1 :: Names -> Transaction () - saveRootNamesIndexV1 Names {Names.terms, Names.types} = do - let termNames :: [(S.NamedRef (C.Referent.Referent, Maybe C.Referent.ConstructorType))] - termNames = Rel.toList terms <&> \(name, ref) -> S.NamedRef {reversedSegments = nameSegments name, ref = splitReferent ref} - let typeNames :: [(S.NamedRef C.Reference.Reference)] - typeNames = - Rel.toList types - <&> ( \(name, ref) -> - S.NamedRef {reversedSegments = nameSegments name, ref = Cv.reference1to2 ref} - ) - Ops.updateNameIndex (termNames, []) (typeNames, []) - where - nameSegments :: Name -> NonEmpty Text - nameSegments = coerce @(NonEmpty NameSegment) @(NonEmpty Text) . Name.reverseSegments - splitReferent :: Referent.Referent -> (C.Referent.Referent, Maybe C.Referent.ConstructorType) - splitReferent referent = case referent of - Referent.Ref {} -> (Cv.referent1to2 referent, Nothing) - Referent.Con _ref ct -> (Cv.referent1to2 referent, Just (Cv.constructorType1to2 ct)) - --- | Compute the root namespace names index which is used by the share server for serving api --- requests. Using 'updateNameLookupIndex' is preferred whenever possible, since it's --- considerably faster. This can be used to reset the index if it ever gets out of sync due to --- a bug. --- --- This version should be used if you don't already have the root Branch pre-loaded, --- If you do, use 'initializeNameLookupIndexFromV1Branch' instead. -initializeNameLookupIndexFromV2Root :: (C.Reference.Reference -> Sqlite.Transaction CT.ConstructorType) -> Sqlite.Transaction () -initializeNameLookupIndexFromV2Root getDeclType = do - Q.dropNameLookupTables - rootHash <- Ops.expectRootCausalHash - causalBranch <- Ops.expectCausalBranchByCausalHash rootHash - (termNameMap, typeNameMap) <- nameMapsFromV2Branch [] causalBranch - let expandedTermNames = Map.toList termNameMap >>= (\(name, refs) -> (name,) <$> Set.toList refs) - termNameList <- do - for expandedTermNames \(name, ref) -> do - refWithCT <- addReferentCT ref - pure S.NamedRef {S.reversedSegments = coerce name, S.ref = refWithCT} - let typeNameList = do - (name, refs) <- Map.toList typeNameMap - ref <- Set.toList refs - pure $ S.NamedRef {S.reversedSegments = coerce name, S.ref = ref} - Ops.updateNameIndex (termNameList, []) (typeNameList, []) - where - addReferentCT :: C.Referent.Referent -> Transaction (C.Referent.Referent, Maybe C.Referent.ConstructorType) - addReferentCT referent = case referent of - C.Referent.Ref {} -> pure (referent, Nothing) - C.Referent.Con ref _conId -> do - ct <- getDeclType ref - pure (referent, Just $ Cv.constructorType1to2 ct) - - -- Traverse a v2 branch - -- Collects two maps, one with all term names and one with all type names. - -- Note that unlike the `Name` type in `unison-core1`, this list of name segments is - -- in reverse order, e.g. `["map", "List", "base"]` - nameMapsFromV2Branch :: Monad m => [NameSegment] -> V2Branch.CausalBranch m -> m (Map (NonEmpty NameSegment) (Set C.Referent.Referent), Map (NonEmpty NameSegment) (Set C.Reference.Reference)) - nameMapsFromV2Branch reversedNamePrefix cb = do - b <- V2Causal.value cb - let (shallowTermNames, shallowTypeNames) = (Map.keysSet <$> V2Branch.terms b, Map.keysSet <$> V2Branch.types b) - (prefixedChildTerms, prefixedChildTypes) <- - fold <$> (ifor (V2Branch.children b) $ \nameSegment cb -> (nameMapsFromV2Branch (nameSegment : reversedNamePrefix) cb)) - pure (Map.mapKeys (NEList.:| reversedNamePrefix) shallowTermNames <> prefixedChildTerms, Map.mapKeys (NEList.:| reversedNamePrefix) shallowTypeNames <> prefixedChildTypes) - -- | Given a transaction, return a transaction that first checks a semispace cache of the given size. -- -- The transaction should probably be read-only, as we (of course) don't hit SQLite on a cache hit. diff --git a/parser-typechecker/src/Unison/Codebase/Type.hs b/parser-typechecker/src/Unison/Codebase/Type.hs index 9e932d09d..429671106 100644 --- a/parser-typechecker/src/Unison/Codebase/Type.hs +++ b/parser-typechecker/src/Unison/Codebase/Type.hs @@ -13,14 +13,13 @@ module Unison.Codebase.Type ) where -import U.Codebase.HashTags (BranchHash, CausalHash) +import U.Codebase.HashTags (CausalHash) import qualified U.Codebase.Reference as V2 import Unison.Codebase.Branch (Branch) import qualified Unison.Codebase.Editor.Git as Git import Unison.Codebase.Editor.RemoteRepo (ReadGitRemoteNamespace, ReadGitRepo, WriteGitRepo) import Unison.Codebase.GitError (GitCodebaseError, GitProtocolError) import Unison.Codebase.Init.OpenCodebaseError (OpenCodebaseError (..)) -import Unison.Codebase.Path (Path) import Unison.Codebase.SqliteCodebase.GitError (GitSqliteCodebaseError (..)) import Unison.Codebase.SyncMode (SyncMode) import Unison.CodebasePath (CodebasePath) @@ -101,21 +100,6 @@ data Codebase m v a = Codebase termsMentioningTypeImpl :: Reference -> Sqlite.Transaction (Set Referent.Id), -- | Get the set of user-defined terms-or-constructors whose hash matches the given prefix. termReferentsByPrefix :: ShortHash -> Sqlite.Transaction (Set Referent.Id), - -- Updates the root namespace names index from an old BranchHash to a new one. - -- This isn't run automatically because it can be a bit slow. - updateNameLookup :: - -- Path to the root of the _changes_. - -- E.g. if you know that all the changes occur at "base.List", you can pass "base.List" - -- here, and pass the old and new branch hashes for the branch as "base.List". - -- This allows us to avoid searching for changes in areas where it's impossible for it - -- to have occurred. - Path -> - -- The branch hash at 'Path' which the existing index was built from. - -- Pass 'Nothing' to build the index from scratch (i.e. compute a diff from an empty branch). - Maybe BranchHash -> - -- The new branch - BranchHash -> - Sqlite.Transaction (), -- | Acquire a new connection to the same underlying database file this codebase object connects to. withConnection :: forall x. (Sqlite.Connection -> m x) -> m x, -- | Acquire a new connection to the same underlying database file this codebase object connects to. From 920e33b1ad00e9d4ec4271b8c9a548ab88430da4 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 25 Jan 2023 13:38:20 -0600 Subject: [PATCH 127/467] Correctly handle trailing dots in new indices --- .../U/Codebase/Sqlite/NamedRef.hs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs index 80ab6c970..551f6eace 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs @@ -32,19 +32,23 @@ instance ToRow ref => ToRow (NamedRef ref) where toRow (NamedRef {reversedSegments = segments, ref}) = [toField reversedName] <> toRow ref where - reversedName = Text.intercalate "." . toList $ segments + reversedName = + segments + & toList + & Text.intercalate "." + & (<> ".") -- Add trailing dot, see notes on scoped_term_name_lookup schema instance FromRow ref => FromRow (NamedRef ref) where fromRow = do - reversedSegments <- NonEmpty.fromList . Text.splitOn "." <$> field + reversedSegments <- + field <&> \f -> + f + & Text.init -- Drop trailing dot, see notes on scoped_term_name_lookup schema + & Text.splitOn "." + & NonEmpty.fromList ref <- fromRow pure (NamedRef {reversedSegments, ref}) -toRowWithNamespace :: ToRow ref => NamedRef ref -> [SQLData] -toRowWithNamespace nr = toRow nr <> [SQLText namespace] - where - namespace = Text.intercalate "." . reverse . NEL.tail . reversedSegments $ nr - -- | The new 'scoped' name lookup format is different from the old version. -- -- Specifically, the scoped format adds the 'lastNameSegment' as well as adding a trailing '.' to the db format From 08172a9effce771c3e7e76d312bb7acde71b3671 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Wed, 25 Jan 2023 15:09:17 -0500 Subject: [PATCH 128/467] Add a 'callProcess' builtin - This allows calling out to an external executable with specified arguments. The executable is searched for in the path according to some platform specific rules. The call is blocking, and the exit code is returned. - Note: this is _not_ the sort of external call that involves a shell as an intermediary. - This sort of call is supported by both Haskell and racket. Chez seems to only have the shell-based external call, so it might be necessary to wrap a foreign library for it (otherwise the arguments would have to be escaped, which seems like a bad idea). Nevertheless, it seems like the right API to expose. - Opening a fully interactive, asynchronous process is left for future work. --- parser-typechecker/src/Unison/Builtin.hs | 1 + .../src/Unison/Runtime/Builtin.hs | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index a5f6eb20b..56e1b69b5 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -759,6 +759,7 @@ ioBuiltins = forall1 "a" $ \a -> a --> io (reft iot a) ), + ( "IO.callProcess", text --> list text --> io nat), ( "validateSandboxed", forall1 "a" $ \a -> list termLink --> a --> boolean ), diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 35b2618ac..9388b43a7 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -100,6 +100,7 @@ import System.Environment as SYS ( getArgs, getEnv, ) +import System.Exit as SYS (ExitCode(..)) import System.FilePath (isPathSeparator) import System.IO (Handle) import System.IO as SYS @@ -122,6 +123,11 @@ import System.IO as SYS stdout, ) import System.IO.Temp (createTempDirectory) +import System.Process as SYS + ( proc, + waitForProcess, + withCreateProcess + ) import qualified System.X509 as X import Unison.ABT.Normalized hiding (TTm) import qualified Unison.Builtin as Ty (builtinTypes) @@ -1483,6 +1489,16 @@ boxBoxTo0 instr = where (arg1, arg2) = fresh +-- a -> b ->{E} Nat +boxBoxToNat :: ForeignOp +boxBoxToNat instr = + ([BX, BX],) + . TAbss [arg1, arg2] + . TLetD result UN (TFOp instr [arg1, arg2]) + $ TCon Ty.natRef 0 [result] + where + (arg1, arg2, result) = fresh + -- a -> b -> Option c -- a -> Bool @@ -2260,6 +2276,13 @@ declareForeigns = do 2 -> pure (Just SYS.stderr) _ -> pure Nothing + declareForeign Tracked "IO.callProcess" boxBoxToNat . mkForeign $ + \(exe, map Util.Text.unpack -> args) -> + withCreateProcess (proc exe args) $ \_ _ _ p -> + waitForProcess p >>= \case + ExitSuccess -> pure 0 + ExitFailure n -> pure n + declareForeign Tracked "MVar.new" boxDirect . mkForeign $ \(c :: Closure) -> newMVar c From 015f64ffc531b1a012ef683d17781fb6618e385b Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 25 Jan 2023 15:23:22 -0600 Subject: [PATCH 129/467] Docs --- codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index e40318317..636170180 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -1083,9 +1083,11 @@ updateNameIndex (newTermNames, removedTermNames) (newTypeNames, removedTypeNames Q.insertTermNames (fmap (c2sTextReferent *** fmap c2sConstructorType) <$> newTermNames) Q.insertTypeNames (fmap c2sTextReference <$> newTypeNames) +-- | Apply a set of name updates to an existing index. buildNameLookupForBranchHash :: -- The existing name lookup index to copy before applying the diff. -- If Nothing, run the diff against an empty index. + -- If Just, the name lookup must exist or an error will be thrown. Maybe BranchHash -> BranchHash -> -- | (add terms, remove terms) From 6554ea385a89cd3fac2cd95bd9bb29505cf9b582 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Wed, 25 Jan 2023 17:51:58 -0500 Subject: [PATCH 130/467] Flesh out process builtins - Renames callProcess to process.call since there will be several related functions now. - Adds a ProcessHandle type for references to asynchronous processes - Add start, kill, wait and exitCode for interactive processes. * start spawns a new process with the given command and arguments, returning Handles for the in, out and error streams of the process, and a ProcessHandle referencing it * kill kills a process given a ProcessHandle * wait blocks on a process to finish and returns the exit code * exitCode does a non-blocking query for the exit code of the process. It returns `None` if the process is still running. --- parser-typechecker/src/Unison/Builtin.hs | 13 ++++- .../src/Unison/Runtime/Builtin.hs | 56 +++++++++++++++++-- .../src/Unison/Runtime/Foreign.hs | 3 + .../src/Unison/Runtime/Foreign/Function.hs | 21 +++++++ unison-core/src/Unison/Type.hs | 6 ++ 5 files changed, 92 insertions(+), 7 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index 56e1b69b5..bcba73b7f 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -204,6 +204,8 @@ builtinTypesSrc = Rename' "IO" "io2.IO", B' "Handle" CT.Data, Rename' "Handle" "io2.Handle", + B' "ProcessHandle" CT.Data, + Rename' "ProcessHandle" "io2.ProcessHandle", B' "Socket" CT.Data, Rename' "Socket" "io2.Socket", B' "ThreadId" CT.Data, @@ -759,7 +761,13 @@ ioBuiltins = forall1 "a" $ \a -> a --> io (reft iot a) ), - ( "IO.callProcess", text --> list text --> io nat), + ( "IO.process.call", text --> list text --> io nat), + ( "IO.process.start", + text --> list text --> + io (tuple [handle, handle, handle, phandle])), + ( "IO.process.kill", phandle --> io unit), + ( "IO.process.wait", phandle --> io nat), + ( "IO.process.exitCode", phandle --> io (optionalt nat)), ( "validateSandboxed", forall1 "a" $ \a -> list termLink --> a --> boolean ), @@ -955,10 +963,11 @@ iarrayt a = Type.iarrayType () `app` a marrayt :: Type -> Type -> Type marrayt g a = Type.marrayType () `app` g `app` a -socket, threadId, handle, unit :: Type +socket, threadId, handle, phandle, unit :: Type socket = Type.socket () threadId = Type.threadId () handle = Type.fileHandle () +phandle = Type.processHandle () unit = DD.unitType () tls, tlsClientConfig, tlsServerConfig, tlsSignedCert, tlsPrivateKey, tlsVersion, tlsCipher :: Type diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 9388b43a7..5b5e85aac 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -124,7 +124,10 @@ import System.IO as SYS ) import System.IO.Temp (createTempDirectory) import System.Process as SYS - ( proc, + ( getProcessExitCode, + proc, + runInteractiveProcess, + terminateProcess, waitForProcess, withCreateProcess ) @@ -1019,6 +1022,19 @@ infixr 0 --> (-->) :: a -> b -> (a, b) x --> y = (x, y) +start'process :: ForeignOp +start'process instr = + ([BX, BX],) + . TAbss [exe, args] + . TLets Direct [hin,hout,herr,hproc] [BX,BX,BX,BX] (TFOp instr [exe, args]) + . TLetD un BX (TCon Ty.unitRef 0 []) + . TLetD p3 BX (TCon Ty.pairRef 0 [hproc, un]) + . TLetD p2 BX (TCon Ty.pairRef 0 [herr, p3]) + . TLetD p1 BX (TCon Ty.pairRef 0 [hout, p2]) + $ TCon Ty.pairRef 0 [hin, p1] + where + (exe,args,hin,hout,herr,hproc,un,p3,p2,p1) = fresh + set'buffering :: ForeignOp set'buffering instr = ([BX, BX],) @@ -1230,6 +1246,16 @@ outMaybe maybe result = (1, ([BX], TAbs maybe $ some maybe)) ] +outMaybeNat :: Var v => v -> v -> v -> ANormal v +outMaybeNat tag result n = + TMatch tag . MatchSum $ + mapFromList + [ (0, ([], none)), + (1, ([UN], + TAbs result . + TLetD n BX (TCon Ty.natRef 0 [n]) $ some n)) + ] + outMaybeNTup :: forall v. Var v => v -> v -> v -> v -> v -> v -> v -> ANormal v outMaybeNTup a b n u bp p result = TMatch result . MatchSum $ @@ -1620,6 +1646,12 @@ boxToMaybeBox = where (arg, maybe, result) = fresh +-- a -> Maybe Nat +boxToMaybeNat :: ForeignOp +boxToMaybeNat = inBx arg tag $ outMaybeNat tag result n + where + (arg, tag, result, n) = fresh + -- a -> Maybe (Nat, b) boxToMaybeNTup :: ForeignOp boxToMaybeNTup = @@ -2276,12 +2308,26 @@ declareForeigns = do 2 -> pure (Just SYS.stderr) _ -> pure Nothing - declareForeign Tracked "IO.callProcess" boxBoxToNat . mkForeign $ + let exitDecode ExitSuccess = 0 + exitDecode (ExitFailure n) = n + + declareForeign Tracked "IO.process.call" boxBoxToNat . mkForeign $ \(exe, map Util.Text.unpack -> args) -> withCreateProcess (proc exe args) $ \_ _ _ p -> - waitForProcess p >>= \case - ExitSuccess -> pure 0 - ExitFailure n -> pure n + exitDecode <$> waitForProcess p + + declareForeign Tracked "IO.process.start" start'process . mkForeign $ + \(exe, map Util.Text.unpack -> args) -> + runInteractiveProcess exe args Nothing Nothing + + declareForeign Tracked "IO.process.kill" boxTo0 . mkForeign $ + terminateProcess + + declareForeign Tracked "IO.process.wait" boxToNat . mkForeign $ + \ph -> exitDecode <$> waitForProcess ph + + declareForeign Tracked "IO.process.exitCode" boxToMaybeNat . mkForeign $ + fmap (fmap exitDecode) . getProcessExitCode declareForeign Tracked "MVar.new" boxDirect . mkForeign diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index 6f567a70d..5be56de6f 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -27,6 +27,7 @@ import qualified Data.X509 as X509 import Network.Socket (Socket) import qualified Network.TLS as TLS (ClientParams, Context, ServerParams) import System.Clock (TimeSpec) +import System.Process (ProcessHandle) import System.IO (Handle) import Unison.Reference (Reference) import Unison.Referent (Referent) @@ -191,6 +192,8 @@ instance BuiltinForeign Bytes where foreignRef = Tagged Ty.bytesRef instance BuiltinForeign Handle where foreignRef = Tagged Ty.fileHandleRef +instance BuiltinForeign ProcessHandle where foreignRef = Tagged Ty.processHandleRef + instance BuiltinForeign Socket where foreignRef = Tagged Ty.socketRef instance BuiltinForeign ThreadId where foreignRef = Tagged Ty.threadIdRef diff --git a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs index 42b1333d1..5ec505629 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs @@ -354,6 +354,27 @@ instance (ustk, bstk) <- writeForeign ustk bstk b writeForeign ustk bstk a +instance + ( ForeignConvention a, + ForeignConvention b, + ForeignConvention c, + ForeignConvention d + ) => + ForeignConvention (a, b, c, d) + where + readForeign us bs ustk bstk = do + (us, bs, a) <- readForeign us bs ustk bstk + (us, bs, b) <- readForeign us bs ustk bstk + (us, bs, c) <- readForeign us bs ustk bstk + (us, bs, d) <- readForeign us bs ustk bstk + pure (us, bs, (a, b, c, d)) + + writeForeign ustk bstk (a, b, c, d) = do + (ustk, bstk) <- writeForeign ustk bstk d + (ustk, bstk) <- writeForeign ustk bstk c + (ustk, bstk) <- writeForeign ustk bstk b + writeForeign ustk bstk a + instance ( ForeignConvention a, ForeignConvention b, diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index 519a664f9..9d2a0cf9c 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -259,6 +259,9 @@ filePathRef = Reference.Builtin "FilePath" threadIdRef = Reference.Builtin "ThreadId" socketRef = Reference.Builtin "Socket" +processHandleRef :: Reference +processHandleRef = Reference.Builtin "ProcessHandle" + scopeRef, refRef :: Reference scopeRef = Reference.Builtin "Scope" refRef = Reference.Builtin "Ref" @@ -348,6 +351,9 @@ char a = ref a charRef fileHandle :: Ord v => a -> Type v a fileHandle a = ref a fileHandleRef +processHandle :: Ord v => a -> Type v a +processHandle a = ref a processHandleRef + threadId :: Ord v => a -> Type v a threadId a = ref a threadIdRef From 6192796344b3a38a75491369a410b52aec06fee4 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Wed, 25 Jan 2023 19:35:16 -0500 Subject: [PATCH 131/467] Transcript updates --- .../all-base-hashes.output.md | 903 +++++++++--------- unison-src/transcripts/alias-many.output.md | 522 +++++----- .../transcripts/builtins-merge.output.md | 2 +- .../transcripts/emptyCodebase.output.md | 4 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 28 +- .../transcripts/name-selection.output.md | 903 +++++++++--------- unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 +- 9 files changed, 1227 insertions(+), 1177 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index 808f8fb9e..79d0b5103 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -1179,502 +1179,523 @@ This transcript is intended to make visible accidental changes to the hashing al -> FileMode ->{IO} Either Failure Handle - 341. -- ##IO.putBytes.impl.v3 + 341. -- ##IO.process.call + builtin.io2.IO.process.call : Text -> [Text] ->{IO} Nat + + 342. -- ##IO.process.exitCode + builtin.io2.IO.process.exitCode : ProcessHandle + ->{IO} Optional Nat + + 343. -- ##IO.process.kill + builtin.io2.IO.process.kill : ProcessHandle ->{IO} () + + 344. -- ##IO.process.start + builtin.io2.IO.process.start : Text + -> [Text] + ->{IO} (Handle, Handle, Handle, ProcessHandle) + + 345. -- ##IO.process.wait + builtin.io2.IO.process.wait : ProcessHandle ->{IO} Nat + + 346. -- ##IO.putBytes.impl.v3 builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 342. -- ##IO.ready.impl.v1 + 347. -- ##IO.ready.impl.v1 builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 343. -- ##IO.ref + 348. -- ##IO.ref builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 344. -- ##IO.removeDirectory.impl.v3 + 349. -- ##IO.removeDirectory.impl.v3 builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 345. -- ##IO.removeFile.impl.v3 + 350. -- ##IO.removeFile.impl.v3 builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 346. -- ##IO.renameDirectory.impl.v3 + 351. -- ##IO.renameDirectory.impl.v3 builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 347. -- ##IO.renameFile.impl.v3 + 352. -- ##IO.renameFile.impl.v3 builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 348. -- ##IO.seekHandle.impl.v3 + 353. -- ##IO.seekHandle.impl.v3 builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 349. -- ##IO.serverSocket.impl.v3 + 354. -- ##IO.serverSocket.impl.v3 builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 350. -- ##IO.setBuffering.impl.v3 + 355. -- ##IO.setBuffering.impl.v3 builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 351. -- ##IO.setCurrentDirectory.impl.v3 + 356. -- ##IO.setCurrentDirectory.impl.v3 builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 352. -- ##IO.setEcho.impl.v1 + 357. -- ##IO.setEcho.impl.v1 builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 353. -- ##IO.socketAccept.impl.v3 + 358. -- ##IO.socketAccept.impl.v3 builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 354. -- ##IO.socketPort.impl.v3 + 359. -- ##IO.socketPort.impl.v3 builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 355. -- ##IO.socketReceive.impl.v3 + 360. -- ##IO.socketReceive.impl.v3 builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 356. -- ##IO.socketSend.impl.v3 + 361. -- ##IO.socketSend.impl.v3 builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 357. -- ##IO.stdHandle + 362. -- ##IO.stdHandle builtin.io2.IO.stdHandle : StdHandle -> Handle - 358. -- ##IO.systemTime.impl.v3 + 363. -- ##IO.systemTime.impl.v3 builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 359. -- ##IO.systemTimeMicroseconds.v1 + 364. -- ##IO.systemTimeMicroseconds.v1 builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 360. -- ##IO.tryEval + 365. -- ##IO.tryEval builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 361. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 + 366. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 unique type builtin.io2.IOError - 362. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 + 367. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 builtin.io2.IOError.AlreadyExists : IOError - 363. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 + 368. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 builtin.io2.IOError.EOF : IOError - 364. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 + 369. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 builtin.io2.IOError.IllegalOperation : IOError - 365. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 + 370. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 builtin.io2.IOError.NoSuchThing : IOError - 366. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 + 371. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 builtin.io2.IOError.PermissionDenied : IOError - 367. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 + 372. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 builtin.io2.IOError.ResourceBusy : IOError - 368. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 + 373. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 builtin.io2.IOError.ResourceExhausted : IOError - 369. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 + 374. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 builtin.io2.IOError.UserError : IOError - 370. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g + 375. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g unique type builtin.io2.IOFailure - 371. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg + 376. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg unique type builtin.io2.MiscFailure - 372. -- ##MVar + 377. -- ##MVar builtin type builtin.io2.MVar - 373. -- ##MVar.isEmpty + 378. -- ##MVar.isEmpty builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 374. -- ##MVar.new + 379. -- ##MVar.new builtin.io2.MVar.new : a ->{IO} MVar a - 375. -- ##MVar.newEmpty.v2 + 380. -- ##MVar.newEmpty.v2 builtin.io2.MVar.newEmpty : '{IO} MVar a - 376. -- ##MVar.put.impl.v3 + 381. -- ##MVar.put.impl.v3 builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 377. -- ##MVar.read.impl.v3 + 382. -- ##MVar.read.impl.v3 builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 378. -- ##MVar.swap.impl.v3 + 383. -- ##MVar.swap.impl.v3 builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 379. -- ##MVar.take.impl.v3 + 384. -- ##MVar.take.impl.v3 builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 380. -- ##MVar.tryPut.impl.v3 + 385. -- ##MVar.tryPut.impl.v3 builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 381. -- ##MVar.tryRead.impl.v3 + 386. -- ##MVar.tryRead.impl.v3 builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 382. -- ##MVar.tryTake + 387. -- ##MVar.tryTake builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 383. -- ##Promise + 388. -- ##ProcessHandle + builtin type builtin.io2.ProcessHandle + + 389. -- ##Promise builtin type builtin.io2.Promise - 384. -- ##Promise.new + 390. -- ##Promise.new builtin.io2.Promise.new : '{IO} Promise a - 385. -- ##Promise.read + 391. -- ##Promise.read builtin.io2.Promise.read : Promise a ->{IO} a - 386. -- ##Promise.tryRead + 392. -- ##Promise.tryRead builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 387. -- ##Promise.write + 393. -- ##Promise.write builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 388. -- ##Ref.cas + 394. -- ##Ref.cas builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 389. -- ##Ref.readForCas + 395. -- ##Ref.readForCas builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 390. -- ##Ref.Ticket + 396. -- ##Ref.Ticket builtin type builtin.io2.Ref.Ticket - 391. -- ##Ref.Ticket.read + 397. -- ##Ref.Ticket.read builtin.io2.Ref.Ticket.read : Ticket a -> a - 392. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 + 398. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 unique type builtin.io2.RuntimeFailure - 393. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 + 399. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 unique type builtin.io2.SeekMode - 394. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 + 400. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 395. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 + 401. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 builtin.io2.SeekMode.RelativeSeek : SeekMode - 396. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 + 402. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 builtin.io2.SeekMode.SeekFromEnd : SeekMode - 397. -- ##Socket + 403. -- ##Socket builtin type builtin.io2.Socket - 398. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 + 404. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 unique type builtin.io2.StdHandle - 399. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 + 405. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 builtin.io2.StdHandle.StdErr : StdHandle - 400. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 + 406. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 builtin.io2.StdHandle.StdIn : StdHandle - 401. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 + 407. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 builtin.io2.StdHandle.StdOut : StdHandle - 402. -- ##STM + 408. -- ##STM builtin type builtin.io2.STM - 403. -- ##STM.atomically + 409. -- ##STM.atomically builtin.io2.STM.atomically : '{STM} a ->{IO} a - 404. -- ##STM.retry + 410. -- ##STM.retry builtin.io2.STM.retry : '{STM} a - 405. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g + 411. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g unique type builtin.io2.STMFailure - 406. -- ##ThreadId + 412. -- ##ThreadId builtin type builtin.io2.ThreadId - 407. -- ##Tls + 413. -- ##Tls builtin type builtin.io2.Tls - 408. -- ##Tls.Cipher + 414. -- ##Tls.Cipher builtin type builtin.io2.Tls.Cipher - 409. -- ##Tls.ClientConfig + 415. -- ##Tls.ClientConfig builtin type builtin.io2.Tls.ClientConfig - 410. -- ##Tls.ClientConfig.certificates.set + 416. -- ##Tls.ClientConfig.certificates.set builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 411. -- ##TLS.ClientConfig.ciphers.set + 417. -- ##TLS.ClientConfig.ciphers.set builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 412. -- ##Tls.ClientConfig.default + 418. -- ##Tls.ClientConfig.default builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 413. -- ##Tls.ClientConfig.versions.set + 419. -- ##Tls.ClientConfig.versions.set builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 414. -- ##Tls.decodeCert.impl.v3 + 420. -- ##Tls.decodeCert.impl.v3 builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 415. -- ##Tls.decodePrivateKey + 421. -- ##Tls.decodePrivateKey builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 416. -- ##Tls.encodeCert + 422. -- ##Tls.encodeCert builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 417. -- ##Tls.encodePrivateKey + 423. -- ##Tls.encodePrivateKey builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 418. -- ##Tls.handshake.impl.v3 + 424. -- ##Tls.handshake.impl.v3 builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 419. -- ##Tls.newClient.impl.v3 + 425. -- ##Tls.newClient.impl.v3 builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 420. -- ##Tls.newServer.impl.v3 + 426. -- ##Tls.newServer.impl.v3 builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 421. -- ##Tls.PrivateKey + 427. -- ##Tls.PrivateKey builtin type builtin.io2.Tls.PrivateKey - 422. -- ##Tls.receive.impl.v3 + 428. -- ##Tls.receive.impl.v3 builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 423. -- ##Tls.send.impl.v3 + 429. -- ##Tls.send.impl.v3 builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 424. -- ##Tls.ServerConfig + 430. -- ##Tls.ServerConfig builtin type builtin.io2.Tls.ServerConfig - 425. -- ##Tls.ServerConfig.certificates.set + 431. -- ##Tls.ServerConfig.certificates.set builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 426. -- ##Tls.ServerConfig.ciphers.set + 432. -- ##Tls.ServerConfig.ciphers.set builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 427. -- ##Tls.ServerConfig.default + 433. -- ##Tls.ServerConfig.default builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 428. -- ##Tls.ServerConfig.versions.set + 434. -- ##Tls.ServerConfig.versions.set builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 429. -- ##Tls.SignedCert + 435. -- ##Tls.SignedCert builtin type builtin.io2.Tls.SignedCert - 430. -- ##Tls.terminate.impl.v3 + 436. -- ##Tls.terminate.impl.v3 builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 431. -- ##Tls.Version + 437. -- ##Tls.Version builtin type builtin.io2.Tls.Version - 432. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + 438. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 unique type builtin.io2.TlsFailure - 433. -- ##TVar + 439. -- ##TVar builtin type builtin.io2.TVar - 434. -- ##TVar.new + 440. -- ##TVar.new builtin.io2.TVar.new : a ->{STM} TVar a - 435. -- ##TVar.newIO + 441. -- ##TVar.newIO builtin.io2.TVar.newIO : a ->{IO} TVar a - 436. -- ##TVar.read + 442. -- ##TVar.read builtin.io2.TVar.read : TVar a ->{STM} a - 437. -- ##TVar.readIO + 443. -- ##TVar.readIO builtin.io2.TVar.readIO : TVar a ->{IO} a - 438. -- ##TVar.swap + 444. -- ##TVar.swap builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 439. -- ##TVar.write + 445. -- ##TVar.write builtin.io2.TVar.write : TVar a -> a ->{STM} () - 440. -- ##validateSandboxed + 446. -- ##validateSandboxed builtin.io2.validateSandboxed : [Link.Term] -> a -> Boolean - 441. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + 447. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 unique type builtin.IsPropagated - 442. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + 448. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 builtin.IsPropagated.IsPropagated : IsPropagated - 443. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + 449. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 unique type builtin.IsTest - 444. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + 450. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 builtin.IsTest.IsTest : IsTest - 445. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + 451. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g unique type builtin.License - 446. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + 452. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 builtin.License.copyrightHolders : License -> [CopyrightHolder] - 447. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + 453. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo builtin.License.copyrightHolders.modify : ([CopyrightHolder] ->{g} [CopyrightHolder]) -> License ->{g} License - 448. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + 454. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro builtin.License.copyrightHolders.set : [CopyrightHolder] -> License -> License - 449. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + 455. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 builtin.License.License : [CopyrightHolder] -> [Year] -> LicenseType -> License - 450. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + 456. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g builtin.License.licenseType : License -> LicenseType - 451. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + 457. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo builtin.License.licenseType.modify : (LicenseType ->{g} LicenseType) -> License ->{g} License - 452. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + 458. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o builtin.License.licenseType.set : LicenseType -> License -> License - 453. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + 459. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig builtin.License.years : License -> [Year] - 454. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + 460. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 builtin.License.years.modify : ([Year] ->{g} [Year]) -> License ->{g} License - 455. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + 461. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo builtin.License.years.set : [Year] -> License -> License - 456. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + 462. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 unique type builtin.LicenseType - 457. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + 463. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 builtin.LicenseType.LicenseType : Doc -> LicenseType - 458. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + 464. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 unique type builtin.Link - 459. -- ##Link.Term + 465. -- ##Link.Term builtin type builtin.Link.Term - 460. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + 466. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 builtin.Link.Term : Link.Term -> Link - 461. -- ##Link.Term.toText + 467. -- ##Link.Term.toText builtin.Link.Term.toText : Link.Term -> Text - 462. -- ##Link.Type + 468. -- ##Link.Type builtin type builtin.Link.Type - 463. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + 469. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 builtin.Link.Type : Type -> Link - 464. -- ##Sequence + 470. -- ##Sequence builtin type builtin.List - 465. -- ##List.++ + 471. -- ##List.++ builtin.List.++ : [a] -> [a] -> [a] - 466. -- ##List.cons + 472. -- ##List.cons builtin.List.+:, builtin.List.cons : a -> [a] -> [a] - 467. -- ##List.snoc + 473. -- ##List.snoc builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] - 468. -- ##List.at + 474. -- ##List.at builtin.List.at : Nat -> [a] -> Optional a - 469. -- ##List.cons + 475. -- ##List.cons builtin.List.cons, builtin.List.+: : a -> [a] -> [a] - 470. -- ##List.drop + 476. -- ##List.drop builtin.List.drop : Nat -> [a] -> [a] - 471. -- ##List.empty + 477. -- ##List.empty builtin.List.empty : [a] - 472. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + 478. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] - 473. -- ##List.size + 479. -- ##List.size builtin.List.size : [a] -> Nat - 474. -- ##List.snoc + 480. -- ##List.snoc builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] - 475. -- ##List.take + 481. -- ##List.take builtin.List.take : Nat -> [a] -> [a] - 476. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + 482. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g builtin.metadata.isPropagated : IsPropagated - 477. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + 483. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko builtin.metadata.isTest : IsTest - 478. -- ##MutableArray + 484. -- ##MutableArray builtin type builtin.MutableArray - 479. -- ##MutableArray.copyTo! + 485. -- ##MutableArray.copyTo! builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a @@ -1682,34 +1703,34 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 480. -- ##MutableArray.freeze + 486. -- ##MutableArray.freeze builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 481. -- ##MutableArray.freeze! + 487. -- ##MutableArray.freeze! builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 482. -- ##MutableArray.read + 488. -- ##MutableArray.read builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 483. -- ##MutableArray.size + 489. -- ##MutableArray.size builtin.MutableArray.size : MutableArray g a -> Nat - 484. -- ##MutableArray.write + 490. -- ##MutableArray.write builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 485. -- ##MutableByteArray + 491. -- ##MutableByteArray builtin type builtin.MutableByteArray - 486. -- ##MutableByteArray.copyTo! + 492. -- ##MutableByteArray.copyTo! builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g @@ -1717,682 +1738,682 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 487. -- ##MutableByteArray.freeze + 493. -- ##MutableByteArray.freeze builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 488. -- ##MutableByteArray.freeze! + 494. -- ##MutableByteArray.freeze! builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 489. -- ##MutableByteArray.read16be + 495. -- ##MutableByteArray.read16be builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 490. -- ##MutableByteArray.read24be + 496. -- ##MutableByteArray.read24be builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 491. -- ##MutableByteArray.read32be + 497. -- ##MutableByteArray.read32be builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 492. -- ##MutableByteArray.read40be + 498. -- ##MutableByteArray.read40be builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 493. -- ##MutableByteArray.read64be + 499. -- ##MutableByteArray.read64be builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 494. -- ##MutableByteArray.read8 + 500. -- ##MutableByteArray.read8 builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 495. -- ##MutableByteArray.size + 501. -- ##MutableByteArray.size builtin.MutableByteArray.size : MutableByteArray g -> Nat - 496. -- ##MutableByteArray.write16be + 502. -- ##MutableByteArray.write16be builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 497. -- ##MutableByteArray.write32be + 503. -- ##MutableByteArray.write32be builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 498. -- ##MutableByteArray.write64be + 504. -- ##MutableByteArray.write64be builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 499. -- ##MutableByteArray.write8 + 505. -- ##MutableByteArray.write8 builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 500. -- ##Nat + 506. -- ##Nat builtin type builtin.Nat - 501. -- ##Nat.* + 507. -- ##Nat.* builtin.Nat.* : Nat -> Nat -> Nat - 502. -- ##Nat.+ + 508. -- ##Nat.+ builtin.Nat.+ : Nat -> Nat -> Nat - 503. -- ##Nat./ + 509. -- ##Nat./ builtin.Nat./ : Nat -> Nat -> Nat - 504. -- ##Nat.and + 510. -- ##Nat.and builtin.Nat.and : Nat -> Nat -> Nat - 505. -- ##Nat.complement + 511. -- ##Nat.complement builtin.Nat.complement : Nat -> Nat - 506. -- ##Nat.drop + 512. -- ##Nat.drop builtin.Nat.drop : Nat -> Nat -> Nat - 507. -- ##Nat.== + 513. -- ##Nat.== builtin.Nat.eq : Nat -> Nat -> Boolean - 508. -- ##Nat.fromText + 514. -- ##Nat.fromText builtin.Nat.fromText : Text -> Optional Nat - 509. -- ##Nat.> + 515. -- ##Nat.> builtin.Nat.gt : Nat -> Nat -> Boolean - 510. -- ##Nat.>= + 516. -- ##Nat.>= builtin.Nat.gteq : Nat -> Nat -> Boolean - 511. -- ##Nat.increment + 517. -- ##Nat.increment builtin.Nat.increment : Nat -> Nat - 512. -- ##Nat.isEven + 518. -- ##Nat.isEven builtin.Nat.isEven : Nat -> Boolean - 513. -- ##Nat.isOdd + 519. -- ##Nat.isOdd builtin.Nat.isOdd : Nat -> Boolean - 514. -- ##Nat.leadingZeros + 520. -- ##Nat.leadingZeros builtin.Nat.leadingZeros : Nat -> Nat - 515. -- ##Nat.< + 521. -- ##Nat.< builtin.Nat.lt : Nat -> Nat -> Boolean - 516. -- ##Nat.<= + 522. -- ##Nat.<= builtin.Nat.lteq : Nat -> Nat -> Boolean - 517. -- ##Nat.mod + 523. -- ##Nat.mod builtin.Nat.mod : Nat -> Nat -> Nat - 518. -- ##Nat.or + 524. -- ##Nat.or builtin.Nat.or : Nat -> Nat -> Nat - 519. -- ##Nat.popCount + 525. -- ##Nat.popCount builtin.Nat.popCount : Nat -> Nat - 520. -- ##Nat.pow + 526. -- ##Nat.pow builtin.Nat.pow : Nat -> Nat -> Nat - 521. -- ##Nat.shiftLeft + 527. -- ##Nat.shiftLeft builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 522. -- ##Nat.shiftRight + 528. -- ##Nat.shiftRight builtin.Nat.shiftRight : Nat -> Nat -> Nat - 523. -- ##Nat.sub + 529. -- ##Nat.sub builtin.Nat.sub : Nat -> Nat -> Int - 524. -- ##Nat.toFloat + 530. -- ##Nat.toFloat builtin.Nat.toFloat : Nat -> Float - 525. -- ##Nat.toInt + 531. -- ##Nat.toInt builtin.Nat.toInt : Nat -> Int - 526. -- ##Nat.toText + 532. -- ##Nat.toText builtin.Nat.toText : Nat -> Text - 527. -- ##Nat.trailingZeros + 533. -- ##Nat.trailingZeros builtin.Nat.trailingZeros : Nat -> Nat - 528. -- ##Nat.xor + 534. -- ##Nat.xor builtin.Nat.xor : Nat -> Nat -> Nat - 529. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + 535. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg structural type builtin.Optional a - 530. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + 536. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 builtin.Optional.None : Optional a - 531. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + 537. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 builtin.Optional.Some : a -> Optional a - 532. -- ##Pattern + 538. -- ##Pattern builtin type builtin.Pattern - 533. -- ##Pattern.capture + 539. -- ##Pattern.capture builtin.Pattern.capture : Pattern a -> Pattern a - 534. -- ##Pattern.isMatch + 540. -- ##Pattern.isMatch builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 535. -- ##Pattern.join + 541. -- ##Pattern.join builtin.Pattern.join : [Pattern a] -> Pattern a - 536. -- ##Pattern.many + 542. -- ##Pattern.many builtin.Pattern.many : Pattern a -> Pattern a - 537. -- ##Pattern.or + 543. -- ##Pattern.or builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 538. -- ##Pattern.replicate + 544. -- ##Pattern.replicate builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 539. -- ##Pattern.run + 545. -- ##Pattern.run builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) - 540. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + 546. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg structural type builtin.Pretty txt - 541. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + 547. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 unique type builtin.Pretty.Annotated w txt - 542. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + 548. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 builtin.Pretty.Annotated.Append : w -> [Annotated w txt] -> Annotated w txt - 543. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + 549. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 builtin.Pretty.Annotated.Empty : Annotated w txt - 544. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + 550. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 builtin.Pretty.Annotated.Group : w -> Annotated w txt -> Annotated w txt - 545. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + 551. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 builtin.Pretty.Annotated.Indent : w -> Annotated w txt -> Annotated w txt -> Annotated w txt -> Annotated w txt - 546. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + 552. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 builtin.Pretty.Annotated.Lit : w -> txt -> Annotated w txt - 547. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + 553. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 builtin.Pretty.Annotated.OrElse : w -> Annotated w txt -> Annotated w txt -> Annotated w txt - 548. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + 554. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 builtin.Pretty.Annotated.Table : w -> [[Annotated w txt]] -> Annotated w txt - 549. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + 555. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 builtin.Pretty.Annotated.Wrap : w -> Annotated w txt -> Annotated w txt - 550. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + 556. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg builtin.Pretty.append : Pretty txt -> Pretty txt -> Pretty txt - 551. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + 557. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 builtin.Pretty.empty : Pretty txt - 552. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + 558. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo builtin.Pretty.get : Pretty txt -> Annotated () txt - 553. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + 559. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 builtin.Pretty.group : Pretty txt -> Pretty txt - 554. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + 560. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno builtin.Pretty.indent : Pretty txt -> Pretty txt -> Pretty txt - 555. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + 561. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug builtin.Pretty.indent' : Pretty txt -> Pretty txt -> Pretty txt -> Pretty txt - 556. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + 562. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo builtin.Pretty.join : [Pretty txt] -> Pretty txt - 557. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + 563. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 558. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + 564. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 - 559. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + 565. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 builtin.Pretty.orElse : Pretty txt -> Pretty txt -> Pretty txt - 560. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + 566. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 builtin.Pretty.Pretty : Annotated () txt -> Pretty txt - 561. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + 567. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g builtin.Pretty.sepBy : Pretty txt -> [Pretty txt] -> Pretty txt - 562. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + 568. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro builtin.Pretty.table : [[Pretty txt]] -> Pretty txt - 563. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + 569. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 builtin.Pretty.wrap : Pretty txt -> Pretty txt - 564. -- ##Ref + 570. -- ##Ref builtin type builtin.Ref - 565. -- ##Ref.read + 571. -- ##Ref.read builtin.Ref.read : Ref g a ->{g} a - 566. -- ##Ref.write + 572. -- ##Ref.write builtin.Ref.write : Ref g a -> a ->{g} () - 567. -- ##Effect + 573. -- ##Effect builtin type builtin.Request - 568. -- ##Scope + 574. -- ##Scope builtin type builtin.Scope - 569. -- ##Scope.array + 575. -- ##Scope.array builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 570. -- ##Scope.arrayOf + 576. -- ##Scope.arrayOf builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 571. -- ##Scope.bytearray + 577. -- ##Scope.bytearray builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 572. -- ##Scope.bytearrayOf + 578. -- ##Scope.bytearrayOf builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 573. -- ##Scope.ref + 579. -- ##Scope.ref builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 574. -- ##Scope.run + 580. -- ##Scope.run builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 575. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + 581. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 structural type builtin.SeqView a b - 576. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + 582. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 builtin.SeqView.VElem : a -> b -> SeqView a b - 577. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + 583. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 builtin.SeqView.VEmpty : SeqView a b - 578. -- ##Socket.toText + 584. -- ##Socket.toText builtin.Socket.toText : Socket -> Text - 579. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + 585. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo builtin.syntax.docAside : Doc2 -> Doc2 - 580. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + 586. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 builtin.syntax.docBlockquote : Doc2 -> Doc2 - 581. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + 587. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 builtin.syntax.docBold : Doc2 -> Doc2 - 582. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + 588. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg builtin.syntax.docBulletedList : [Doc2] -> Doc2 - 583. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + 589. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 - 584. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + 590. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo builtin.syntax.docCode : Doc2 -> Doc2 - 585. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + 591. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 builtin.syntax.docCodeBlock : Text -> Text -> Doc2 - 586. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + 592. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 builtin.syntax.docColumn : [Doc2] -> Doc2 - 587. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + 593. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term - 588. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + 594. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg builtin.syntax.docEmbedAnnotations : tms -> tms - 589. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + 595. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 builtin.syntax.docEmbedSignatureLink : '{g} t -> Doc2.Term - 590. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + 596. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao builtin.syntax.docEmbedTermLink : '{g} t -> Either a Doc2.Term - 591. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + 597. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 builtin.syntax.docEmbedTypeLink : typ -> Either typ b - 592. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + 598. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg builtin.syntax.docEval : 'a -> Doc2 - 593. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + 599. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g builtin.syntax.docEvalInline : 'a -> Doc2 - 594. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + 600. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 builtin.syntax.docExample : Nat -> '{g} t -> Doc2 - 595. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + 601. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 - 596. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + 602. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 597. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + 603. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) - 598. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + 604. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 builtin.syntax.docGroup : Doc2 -> Doc2 - 599. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + 605. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 builtin.syntax.docItalic : Doc2 -> Doc2 - 600. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + 606. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 builtin.syntax.docJoin : [Doc2] -> Doc2 - 601. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + 607. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 - 602. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + 608. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 - 603. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + 609. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 - 604. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + 610. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 builtin.syntax.docParagraph : [Doc2] -> Doc2 - 605. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + 611. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 - 606. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + 612. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 builtin.syntax.docSignature : [Doc2.Term] -> Doc2 - 607. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + 613. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 - 608. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + 614. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 builtin.syntax.docSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 609. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + 615. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 builtin.syntax.docSourceElement : link -> annotations -> (link, annotations) - 610. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + 616. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag builtin.syntax.docStrikethrough : Doc2 -> Doc2 - 611. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + 617. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g builtin.syntax.docTable : [[Doc2]] -> Doc2 - 612. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + 618. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 - 613. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + 619. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 builtin.syntax.docTransclude : d -> d - 614. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + 620. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 builtin.syntax.docUntitledSection : [Doc2] -> Doc2 - 615. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + 621. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo builtin.syntax.docVerbatim : Doc2 -> Doc2 - 616. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + 622. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 builtin.syntax.docWord : Text -> Doc2 - 617. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + 623. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 unique type builtin.Test.Result - 618. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + 624. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 builtin.Test.Result.Fail : Text -> Result - 619. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + 625. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 builtin.Test.Result.Ok : Text -> Result - 620. -- ##Text + 626. -- ##Text builtin type builtin.Text - 621. -- ##Text.!= + 627. -- ##Text.!= builtin.Text.!= : Text -> Text -> Boolean - 622. -- ##Text.++ + 628. -- ##Text.++ builtin.Text.++ : Text -> Text -> Text - 623. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + 629. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text - 624. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + 630. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg builtin.Text.alignRightWith : Nat -> Char -> Text -> Text - 625. -- ##Text.drop + 631. -- ##Text.drop builtin.Text.drop : Nat -> Text -> Text - 626. -- ##Text.empty + 632. -- ##Text.empty builtin.Text.empty : Text - 627. -- ##Text.== + 633. -- ##Text.== builtin.Text.eq : Text -> Text -> Boolean - 628. -- ##Text.fromCharList + 634. -- ##Text.fromCharList builtin.Text.fromCharList : [Char] -> Text - 629. -- ##Text.fromUtf8.impl.v3 + 635. -- ##Text.fromUtf8.impl.v3 builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 630. -- ##Text.> + 636. -- ##Text.> builtin.Text.gt : Text -> Text -> Boolean - 631. -- ##Text.>= + 637. -- ##Text.>= builtin.Text.gteq : Text -> Text -> Boolean - 632. -- ##Text.< + 638. -- ##Text.< builtin.Text.lt : Text -> Text -> Boolean - 633. -- ##Text.<= + 639. -- ##Text.<= builtin.Text.lteq : Text -> Text -> Boolean - 634. -- ##Text.patterns.anyChar + 640. -- ##Text.patterns.anyChar builtin.Text.patterns.anyChar : Pattern Text - 635. -- ##Text.patterns.charIn + 641. -- ##Text.patterns.charIn builtin.Text.patterns.charIn : [Char] -> Pattern Text - 636. -- ##Text.patterns.charRange + 642. -- ##Text.patterns.charRange builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 637. -- ##Text.patterns.digit + 643. -- ##Text.patterns.digit builtin.Text.patterns.digit : Pattern Text - 638. -- ##Text.patterns.eof + 644. -- ##Text.patterns.eof builtin.Text.patterns.eof : Pattern Text - 639. -- ##Text.patterns.letter + 645. -- ##Text.patterns.letter builtin.Text.patterns.letter : Pattern Text - 640. -- ##Text.patterns.literal + 646. -- ##Text.patterns.literal builtin.Text.patterns.literal : Text -> Pattern Text - 641. -- ##Text.patterns.notCharIn + 647. -- ##Text.patterns.notCharIn builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 642. -- ##Text.patterns.notCharRange + 648. -- ##Text.patterns.notCharRange builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 643. -- ##Text.patterns.punctuation + 649. -- ##Text.patterns.punctuation builtin.Text.patterns.punctuation : Pattern Text - 644. -- ##Text.patterns.space + 650. -- ##Text.patterns.space builtin.Text.patterns.space : Pattern Text - 645. -- ##Text.repeat + 651. -- ##Text.repeat builtin.Text.repeat : Nat -> Text -> Text - 646. -- ##Text.reverse + 652. -- ##Text.reverse builtin.Text.reverse : Text -> Text - 647. -- ##Text.size + 653. -- ##Text.size builtin.Text.size : Text -> Nat - 648. -- ##Text.take + 654. -- ##Text.take builtin.Text.take : Nat -> Text -> Text - 649. -- ##Text.toCharList + 655. -- ##Text.toCharList builtin.Text.toCharList : Text -> [Char] - 650. -- ##Text.toLowercase + 656. -- ##Text.toLowercase builtin.Text.toLowercase : Text -> Text - 651. -- ##Text.toUppercase + 657. -- ##Text.toUppercase builtin.Text.toUppercase : Text -> Text - 652. -- ##Text.toUtf8 + 658. -- ##Text.toUtf8 builtin.Text.toUtf8 : Text -> Bytes - 653. -- ##Text.uncons + 659. -- ##Text.uncons builtin.Text.uncons : Text -> Optional (Char, Text) - 654. -- ##Text.unsnoc + 660. -- ##Text.unsnoc builtin.Text.unsnoc : Text -> Optional (Text, Char) - 655. -- ##ThreadId.toText + 661. -- ##ThreadId.toText builtin.ThreadId.toText : ThreadId -> Text - 656. -- ##todo + 662. -- ##todo builtin.todo : a -> b - 657. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + 663. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 structural type builtin.Tuple a b - 658. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + 664. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 builtin.Tuple.Cons : a -> b -> Tuple a b - 659. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + 665. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g structural type builtin.Unit - 660. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + 666. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 builtin.Unit.Unit : () - 661. -- ##Universal.< + 667. -- ##Universal.< builtin.Universal.< : a -> a -> Boolean - 662. -- ##Universal.<= + 668. -- ##Universal.<= builtin.Universal.<= : a -> a -> Boolean - 663. -- ##Universal.== + 669. -- ##Universal.== builtin.Universal.== : a -> a -> Boolean - 664. -- ##Universal.> + 670. -- ##Universal.> builtin.Universal.> : a -> a -> Boolean - 665. -- ##Universal.>= + 671. -- ##Universal.>= builtin.Universal.>= : a -> a -> Boolean - 666. -- ##Universal.compare + 672. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 667. -- ##unsafe.coerceAbilities + 673. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 668. -- ##Value + 674. -- ##Value builtin type builtin.Value - 669. -- ##Value.dependencies + 675. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 670. -- ##Value.deserialize + 676. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 671. -- ##Value.load + 677. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 672. -- ##Value.serialize + 678. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 673. -- ##Value.value + 679. -- ##Value.value builtin.Value.value : a -> Value - 674. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 680. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 675. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 681. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 676. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 682. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 677. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 683. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 678. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 684. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 679. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 685. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 680. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 686. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 681. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 687. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 682. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 688. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 683. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 689. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 684. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 690. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2400,7 +2421,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 685. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 691. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2409,318 +2430,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 686. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 692. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 687. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 693. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 688. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 694. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 689. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 695. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 690. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 696. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 691. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 697. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 692. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 698. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 693. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 699. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 694. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 700. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 695. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 701. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 696. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 702. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 697. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 703. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 698. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 704. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 699. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 705. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 700. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 706. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 701. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 707. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 702. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 708. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 703. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 709. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 704. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 710. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 705. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 711. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 706. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 712. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 707. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 713. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 708. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 714. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 709. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 715. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 710. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 716. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 711. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 717. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 712. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 718. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 713. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 719. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 714. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 720. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 715. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 721. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 716. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 722. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 717. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 723. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 718. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 724. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 719. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 725. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 720. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 726. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 721. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 727. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 722. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 728. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 723. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 729. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 724. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 730. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 725. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 731. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 726. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 732. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 727. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 733. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 728. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 734. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 729. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 735. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 730. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 736. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 731. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 737. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 732. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 738. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 733. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 739. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 734. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 740. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 735. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 741. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 736. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 742. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 737. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 743. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 738. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 744. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 739. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 745. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 740. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 746. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 741. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 747. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 742. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 748. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 743. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 749. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 744. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 750. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 745. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 751. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 746. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 752. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 747. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 753. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 748. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 754. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 749. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 755. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 750. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 756. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o saveSelfContained : a -> Text ->{IO, Exception} () - 751. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 757. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 752. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 758. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 753. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 759. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 754. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 760. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 755. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 761. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 756. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 762. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 757. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 763. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 758. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 764. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 759. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 765. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 760. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 766. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 761. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 767. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 762. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 768. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 763. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 769. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 764. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 770. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 765. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 771. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 766. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 772. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 767. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 773. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 768. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 774. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 769. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 775. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 770. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 776. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 771. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 777. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 772. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 778. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 773. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 779. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 774. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 780. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 775. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 781. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 776. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 782. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 777. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 783. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 778. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 784. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 779. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 785. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 780. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 786. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 781. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 787. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index a2b6a2bac..0e7395200 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -297,362 +297,374 @@ Let's try it! 222. io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 223. io2.IO.putBytes.impl : Handle + 223. io2.IO.process.call : Text -> [Text] ->{IO} Nat + 224. io2.IO.process.exitCode : ProcessHandle + ->{IO} Optional Nat + 225. io2.IO.process.kill : ProcessHandle ->{IO} () + 226. io2.IO.process.start : Text + -> [Text] + ->{IO} ( Handle, + Handle, + Handle, + ProcessHandle) + 227. io2.IO.process.wait : ProcessHandle ->{IO} Nat + 228. io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 224. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 225. io2.IO.ref : a ->{IO} Ref {IO} a - 226. io2.IO.removeDirectory.impl : Text + 229. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean + 230. io2.IO.ref : a ->{IO} Ref {IO} a + 231. io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 227. io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 228. io2.IO.renameDirectory.impl : Text + 232. io2.IO.removeFile.impl : Text ->{IO} Either Failure () + 233. io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 229. io2.IO.renameFile.impl : Text + 234. io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 230. io2.IO.seekHandle.impl : Handle + 235. io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 231. io2.IO.serverSocket.impl : Optional Text + 236. io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 232. io2.IO.setBuffering.impl : Handle + 237. io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 233. io2.IO.setCurrentDirectory.impl : Text + 238. io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 234. io2.IO.setEcho.impl : Handle + 239. io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 235. io2.IO.socketAccept.impl : Socket + 240. io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 236. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 237. io2.IO.socketReceive.impl : Socket + 241. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat + 242. io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 238. io2.IO.socketSend.impl : Socket + 243. io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 239. io2.IO.stdHandle : StdHandle -> Handle - 240. io2.IO.systemTime.impl : '{IO} Either Failure Nat - 241. io2.IO.systemTimeMicroseconds : '{IO} Int - 242. io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 243. unique type io2.IOError - 244. io2.IOError.AlreadyExists : IOError - 245. io2.IOError.EOF : IOError - 246. io2.IOError.IllegalOperation : IOError - 247. io2.IOError.NoSuchThing : IOError - 248. io2.IOError.PermissionDenied : IOError - 249. io2.IOError.ResourceBusy : IOError - 250. io2.IOError.ResourceExhausted : IOError - 251. io2.IOError.UserError : IOError - 252. unique type io2.IOFailure - 253. unique type io2.MiscFailure - 254. builtin type io2.MVar - 255. io2.MVar.isEmpty : MVar a ->{IO} Boolean - 256. io2.MVar.new : a ->{IO} MVar a - 257. io2.MVar.newEmpty : '{IO} MVar a - 258. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 259. io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 260. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 261. io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 262. io2.MVar.tryPut.impl : MVar a + 244. io2.IO.stdHandle : StdHandle -> Handle + 245. io2.IO.systemTime.impl : '{IO} Either Failure Nat + 246. io2.IO.systemTimeMicroseconds : '{IO} Int + 247. io2.IO.tryEval : '{IO} a ->{IO, Exception} a + 248. unique type io2.IOError + 249. io2.IOError.AlreadyExists : IOError + 250. io2.IOError.EOF : IOError + 251. io2.IOError.IllegalOperation : IOError + 252. io2.IOError.NoSuchThing : IOError + 253. io2.IOError.PermissionDenied : IOError + 254. io2.IOError.ResourceBusy : IOError + 255. io2.IOError.ResourceExhausted : IOError + 256. io2.IOError.UserError : IOError + 257. unique type io2.IOFailure + 258. unique type io2.MiscFailure + 259. builtin type io2.MVar + 260. io2.MVar.isEmpty : MVar a ->{IO} Boolean + 261. io2.MVar.new : a ->{IO} MVar a + 262. io2.MVar.newEmpty : '{IO} MVar a + 263. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () + 264. io2.MVar.read.impl : MVar a ->{IO} Either Failure a + 265. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a + 266. io2.MVar.take.impl : MVar a ->{IO} Either Failure a + 267. io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 263. io2.MVar.tryRead.impl : MVar a + 268. io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 264. io2.MVar.tryTake : MVar a ->{IO} Optional a - 265. builtin type io2.Promise - 266. io2.Promise.new : '{IO} Promise a - 267. io2.Promise.read : Promise a ->{IO} a - 268. io2.Promise.tryRead : Promise a ->{IO} Optional a - 269. io2.Promise.write : Promise a -> a ->{IO} Boolean - 270. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 271. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 272. builtin type io2.Ref.Ticket - 273. io2.Ref.Ticket.read : Ticket a -> a - 274. unique type io2.RuntimeFailure - 275. unique type io2.SeekMode - 276. io2.SeekMode.AbsoluteSeek : SeekMode - 277. io2.SeekMode.RelativeSeek : SeekMode - 278. io2.SeekMode.SeekFromEnd : SeekMode - 279. builtin type io2.Socket - 280. unique type io2.StdHandle - 281. io2.StdHandle.StdErr : StdHandle - 282. io2.StdHandle.StdIn : StdHandle - 283. io2.StdHandle.StdOut : StdHandle - 284. builtin type io2.STM - 285. io2.STM.atomically : '{STM} a ->{IO} a - 286. io2.STM.retry : '{STM} a - 287. unique type io2.STMFailure - 288. builtin type io2.ThreadId - 289. builtin type io2.Tls - 290. builtin type io2.Tls.Cipher - 291. builtin type io2.Tls.ClientConfig - 292. io2.Tls.ClientConfig.certificates.set : [SignedCert] + 269. io2.MVar.tryTake : MVar a ->{IO} Optional a + 270. builtin type io2.ProcessHandle + 271. builtin type io2.Promise + 272. io2.Promise.new : '{IO} Promise a + 273. io2.Promise.read : Promise a ->{IO} a + 274. io2.Promise.tryRead : Promise a ->{IO} Optional a + 275. io2.Promise.write : Promise a -> a ->{IO} Boolean + 276. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean + 277. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a + 278. builtin type io2.Ref.Ticket + 279. io2.Ref.Ticket.read : Ticket a -> a + 280. unique type io2.RuntimeFailure + 281. unique type io2.SeekMode + 282. io2.SeekMode.AbsoluteSeek : SeekMode + 283. io2.SeekMode.RelativeSeek : SeekMode + 284. io2.SeekMode.SeekFromEnd : SeekMode + 285. builtin type io2.Socket + 286. unique type io2.StdHandle + 287. io2.StdHandle.StdErr : StdHandle + 288. io2.StdHandle.StdIn : StdHandle + 289. io2.StdHandle.StdOut : StdHandle + 290. builtin type io2.STM + 291. io2.STM.atomically : '{STM} a ->{IO} a + 292. io2.STM.retry : '{STM} a + 293. unique type io2.STMFailure + 294. builtin type io2.ThreadId + 295. builtin type io2.Tls + 296. builtin type io2.Tls.Cipher + 297. builtin type io2.Tls.ClientConfig + 298. io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 293. io2.TLS.ClientConfig.ciphers.set : [Cipher] + 299. io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 294. io2.Tls.ClientConfig.default : Text + 300. io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 295. io2.Tls.ClientConfig.versions.set : [Version] + 301. io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 296. io2.Tls.decodeCert.impl : Bytes + 302. io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 297. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 298. io2.Tls.encodeCert : SignedCert -> Bytes - 299. io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 300. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 301. io2.Tls.newClient.impl : ClientConfig + 303. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] + 304. io2.Tls.encodeCert : SignedCert -> Bytes + 305. io2.Tls.encodePrivateKey : PrivateKey -> Bytes + 306. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () + 307. io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 302. io2.Tls.newServer.impl : ServerConfig + 308. io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 303. builtin type io2.Tls.PrivateKey - 304. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 305. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 306. builtin type io2.Tls.ServerConfig - 307. io2.Tls.ServerConfig.certificates.set : [SignedCert] + 309. builtin type io2.Tls.PrivateKey + 310. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes + 311. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () + 312. builtin type io2.Tls.ServerConfig + 313. io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 308. io2.Tls.ServerConfig.ciphers.set : [Cipher] + 314. io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 309. io2.Tls.ServerConfig.default : [SignedCert] + 315. io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 310. io2.Tls.ServerConfig.versions.set : [Version] + 316. io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 311. builtin type io2.Tls.SignedCert - 312. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 313. builtin type io2.Tls.Version - 314. unique type io2.TlsFailure - 315. builtin type io2.TVar - 316. io2.TVar.new : a ->{STM} TVar a - 317. io2.TVar.newIO : a ->{IO} TVar a - 318. io2.TVar.read : TVar a ->{STM} a - 319. io2.TVar.readIO : TVar a ->{IO} a - 320. io2.TVar.swap : TVar a -> a ->{STM} a - 321. io2.TVar.write : TVar a -> a ->{STM} () - 322. io2.validateSandboxed : [Term] -> a -> Boolean - 323. unique type IsPropagated - 324. IsPropagated.IsPropagated : IsPropagated - 325. unique type IsTest - 326. IsTest.IsTest : IsTest - 327. unique type Link - 328. builtin type Link.Term - 329. Link.Term : Term -> Link - 330. Link.Term.toText : Term -> Text - 331. builtin type Link.Type - 332. Link.Type : Type -> Link - 333. builtin type List - 334. List.++ : [a] -> [a] -> [a] - 335. List.+: : a -> [a] -> [a] - 336. List.:+ : [a] -> a -> [a] - 337. List.at : Nat -> [a] -> Optional a - 338. List.cons : a -> [a] -> [a] - 339. List.drop : Nat -> [a] -> [a] - 340. List.empty : [a] - 341. List.size : [a] -> Nat - 342. List.snoc : [a] -> a -> [a] - 343. List.take : Nat -> [a] -> [a] - 344. metadata.isPropagated : IsPropagated - 345. metadata.isTest : IsTest - 346. builtin type MutableArray - 347. MutableArray.copyTo! : MutableArray g a + 317. builtin type io2.Tls.SignedCert + 318. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () + 319. builtin type io2.Tls.Version + 320. unique type io2.TlsFailure + 321. builtin type io2.TVar + 322. io2.TVar.new : a ->{STM} TVar a + 323. io2.TVar.newIO : a ->{IO} TVar a + 324. io2.TVar.read : TVar a ->{STM} a + 325. io2.TVar.readIO : TVar a ->{IO} a + 326. io2.TVar.swap : TVar a -> a ->{STM} a + 327. io2.TVar.write : TVar a -> a ->{STM} () + 328. io2.validateSandboxed : [Term] -> a -> Boolean + 329. unique type IsPropagated + 330. IsPropagated.IsPropagated : IsPropagated + 331. unique type IsTest + 332. IsTest.IsTest : IsTest + 333. unique type Link + 334. builtin type Link.Term + 335. Link.Term : Term -> Link + 336. Link.Term.toText : Term -> Text + 337. builtin type Link.Type + 338. Link.Type : Type -> Link + 339. builtin type List + 340. List.++ : [a] -> [a] -> [a] + 341. List.+: : a -> [a] -> [a] + 342. List.:+ : [a] -> a -> [a] + 343. List.at : Nat -> [a] -> Optional a + 344. List.cons : a -> [a] -> [a] + 345. List.drop : Nat -> [a] -> [a] + 346. List.empty : [a] + 347. List.size : [a] -> Nat + 348. List.snoc : [a] -> a -> [a] + 349. List.take : Nat -> [a] -> [a] + 350. metadata.isPropagated : IsPropagated + 351. metadata.isTest : IsTest + 352. builtin type MutableArray + 353. MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a -> Nat -> Nat ->{g, Exception} () - 348. MutableArray.freeze : MutableArray g a + 354. MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 349. MutableArray.freeze! : MutableArray g a + 355. MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 350. MutableArray.read : MutableArray g a + 356. MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 351. MutableArray.size : MutableArray g a -> Nat - 352. MutableArray.write : MutableArray g a + 357. MutableArray.size : MutableArray g a -> Nat + 358. MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 353. builtin type MutableByteArray - 354. MutableByteArray.copyTo! : MutableByteArray g + 359. builtin type MutableByteArray + 360. MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 355. MutableByteArray.freeze : MutableByteArray g + 361. MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 356. MutableByteArray.freeze! : MutableByteArray g + 362. MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 357. MutableByteArray.read16be : MutableByteArray g + 363. MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 358. MutableByteArray.read24be : MutableByteArray g + 364. MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 359. MutableByteArray.read32be : MutableByteArray g + 365. MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 360. MutableByteArray.read40be : MutableByteArray g + 366. MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 361. MutableByteArray.read64be : MutableByteArray g + 367. MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 362. MutableByteArray.read8 : MutableByteArray g + 368. MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 363. MutableByteArray.size : MutableByteArray g -> Nat - 364. MutableByteArray.write16be : MutableByteArray g + 369. MutableByteArray.size : MutableByteArray g -> Nat + 370. MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 365. MutableByteArray.write32be : MutableByteArray g + 371. MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 366. MutableByteArray.write64be : MutableByteArray g + 372. MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 367. MutableByteArray.write8 : MutableByteArray g + 373. MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 368. builtin type Nat - 369. Nat.* : Nat -> Nat -> Nat - 370. Nat.+ : Nat -> Nat -> Nat - 371. Nat./ : Nat -> Nat -> Nat - 372. Nat.and : Nat -> Nat -> Nat - 373. Nat.complement : Nat -> Nat - 374. Nat.drop : Nat -> Nat -> Nat - 375. Nat.eq : Nat -> Nat -> Boolean - 376. Nat.fromText : Text -> Optional Nat - 377. Nat.gt : Nat -> Nat -> Boolean - 378. Nat.gteq : Nat -> Nat -> Boolean - 379. Nat.increment : Nat -> Nat - 380. Nat.isEven : Nat -> Boolean - 381. Nat.isOdd : Nat -> Boolean - 382. Nat.leadingZeros : Nat -> Nat - 383. Nat.lt : Nat -> Nat -> Boolean - 384. Nat.lteq : Nat -> Nat -> Boolean - 385. Nat.mod : Nat -> Nat -> Nat - 386. Nat.or : Nat -> Nat -> Nat - 387. Nat.popCount : Nat -> Nat - 388. Nat.pow : Nat -> Nat -> Nat - 389. Nat.shiftLeft : Nat -> Nat -> Nat - 390. Nat.shiftRight : Nat -> Nat -> Nat - 391. Nat.sub : Nat -> Nat -> Int - 392. Nat.toFloat : Nat -> Float - 393. Nat.toInt : Nat -> Int - 394. Nat.toText : Nat -> Text - 395. Nat.trailingZeros : Nat -> Nat - 396. Nat.xor : Nat -> Nat -> Nat - 397. structural type Optional a - 398. Optional.None : Optional a - 399. Optional.Some : a -> Optional a - 400. builtin type Pattern - 401. Pattern.capture : Pattern a -> Pattern a - 402. Pattern.isMatch : Pattern a -> a -> Boolean - 403. Pattern.join : [Pattern a] -> Pattern a - 404. Pattern.many : Pattern a -> Pattern a - 405. Pattern.or : Pattern a -> Pattern a -> Pattern a - 406. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 407. Pattern.run : Pattern a -> a -> Optional ([a], a) - 408. builtin type Ref - 409. Ref.read : Ref g a ->{g} a - 410. Ref.write : Ref g a -> a ->{g} () - 411. builtin type Request - 412. builtin type Scope - 413. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 414. Scope.arrayOf : a + 374. builtin type Nat + 375. Nat.* : Nat -> Nat -> Nat + 376. Nat.+ : Nat -> Nat -> Nat + 377. Nat./ : Nat -> Nat -> Nat + 378. Nat.and : Nat -> Nat -> Nat + 379. Nat.complement : Nat -> Nat + 380. Nat.drop : Nat -> Nat -> Nat + 381. Nat.eq : Nat -> Nat -> Boolean + 382. Nat.fromText : Text -> Optional Nat + 383. Nat.gt : Nat -> Nat -> Boolean + 384. Nat.gteq : Nat -> Nat -> Boolean + 385. Nat.increment : Nat -> Nat + 386. Nat.isEven : Nat -> Boolean + 387. Nat.isOdd : Nat -> Boolean + 388. Nat.leadingZeros : Nat -> Nat + 389. Nat.lt : Nat -> Nat -> Boolean + 390. Nat.lteq : Nat -> Nat -> Boolean + 391. Nat.mod : Nat -> Nat -> Nat + 392. Nat.or : Nat -> Nat -> Nat + 393. Nat.popCount : Nat -> Nat + 394. Nat.pow : Nat -> Nat -> Nat + 395. Nat.shiftLeft : Nat -> Nat -> Nat + 396. Nat.shiftRight : Nat -> Nat -> Nat + 397. Nat.sub : Nat -> Nat -> Int + 398. Nat.toFloat : Nat -> Float + 399. Nat.toInt : Nat -> Int + 400. Nat.toText : Nat -> Text + 401. Nat.trailingZeros : Nat -> Nat + 402. Nat.xor : Nat -> Nat -> Nat + 403. structural type Optional a + 404. Optional.None : Optional a + 405. Optional.Some : a -> Optional a + 406. builtin type Pattern + 407. Pattern.capture : Pattern a -> Pattern a + 408. Pattern.isMatch : Pattern a -> a -> Boolean + 409. Pattern.join : [Pattern a] -> Pattern a + 410. Pattern.many : Pattern a -> Pattern a + 411. Pattern.or : Pattern a -> Pattern a -> Pattern a + 412. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a + 413. Pattern.run : Pattern a -> a -> Optional ([a], a) + 414. builtin type Ref + 415. Ref.read : Ref g a ->{g} a + 416. Ref.write : Ref g a -> a ->{g} () + 417. builtin type Request + 418. builtin type Scope + 419. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a + 420. Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 415. Scope.bytearray : Nat + 421. Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 416. Scope.bytearrayOf : Nat + 422. Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 417. Scope.ref : a ->{Scope s} Ref {Scope s} a - 418. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 419. structural type SeqView a b - 420. SeqView.VElem : a -> b -> SeqView a b - 421. SeqView.VEmpty : SeqView a b - 422. Socket.toText : Socket -> Text - 423. unique type Test.Result - 424. Test.Result.Fail : Text -> Result - 425. Test.Result.Ok : Text -> Result - 426. builtin type Text - 427. Text.!= : Text -> Text -> Boolean - 428. Text.++ : Text -> Text -> Text - 429. Text.drop : Nat -> Text -> Text - 430. Text.empty : Text - 431. Text.eq : Text -> Text -> Boolean - 432. Text.fromCharList : [Char] -> Text - 433. Text.fromUtf8.impl : Bytes -> Either Failure Text - 434. Text.gt : Text -> Text -> Boolean - 435. Text.gteq : Text -> Text -> Boolean - 436. Text.lt : Text -> Text -> Boolean - 437. Text.lteq : Text -> Text -> Boolean - 438. Text.patterns.anyChar : Pattern Text - 439. Text.patterns.charIn : [Char] -> Pattern Text - 440. Text.patterns.charRange : Char -> Char -> Pattern Text - 441. Text.patterns.digit : Pattern Text - 442. Text.patterns.eof : Pattern Text - 443. Text.patterns.letter : Pattern Text - 444. Text.patterns.literal : Text -> Pattern Text - 445. Text.patterns.notCharIn : [Char] -> Pattern Text - 446. Text.patterns.notCharRange : Char -> Char -> Pattern Text - 447. Text.patterns.punctuation : Pattern Text - 448. Text.patterns.space : Pattern Text - 449. Text.repeat : Nat -> Text -> Text - 450. Text.reverse : Text -> Text - 451. Text.size : Text -> Nat - 452. Text.take : Nat -> Text -> Text - 453. Text.toCharList : Text -> [Char] - 454. Text.toLowercase : Text -> Text - 455. Text.toUppercase : Text -> Text - 456. Text.toUtf8 : Text -> Bytes - 457. Text.uncons : Text -> Optional (Char, Text) - 458. Text.unsnoc : Text -> Optional (Text, Char) - 459. ThreadId.toText : ThreadId -> Text - 460. todo : a -> b - 461. structural type Tuple a b - 462. Tuple.Cons : a -> b -> Tuple a b - 463. structural type Unit - 464. Unit.Unit : () - 465. Universal.< : a -> a -> Boolean - 466. Universal.<= : a -> a -> Boolean - 467. Universal.== : a -> a -> Boolean - 468. Universal.> : a -> a -> Boolean - 469. Universal.>= : a -> a -> Boolean - 470. Universal.compare : a -> a -> Int - 471. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 472. builtin type Value - 473. Value.dependencies : Value -> [Term] - 474. Value.deserialize : Bytes -> Either Text Value - 475. Value.load : Value ->{IO} Either [Term] a - 476. Value.serialize : Value -> Bytes - 477. Value.value : a -> Value + 423. Scope.ref : a ->{Scope s} Ref {Scope s} a + 424. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r + 425. structural type SeqView a b + 426. SeqView.VElem : a -> b -> SeqView a b + 427. SeqView.VEmpty : SeqView a b + 428. Socket.toText : Socket -> Text + 429. unique type Test.Result + 430. Test.Result.Fail : Text -> Result + 431. Test.Result.Ok : Text -> Result + 432. builtin type Text + 433. Text.!= : Text -> Text -> Boolean + 434. Text.++ : Text -> Text -> Text + 435. Text.drop : Nat -> Text -> Text + 436. Text.empty : Text + 437. Text.eq : Text -> Text -> Boolean + 438. Text.fromCharList : [Char] -> Text + 439. Text.fromUtf8.impl : Bytes -> Either Failure Text + 440. Text.gt : Text -> Text -> Boolean + 441. Text.gteq : Text -> Text -> Boolean + 442. Text.lt : Text -> Text -> Boolean + 443. Text.lteq : Text -> Text -> Boolean + 444. Text.patterns.anyChar : Pattern Text + 445. Text.patterns.charIn : [Char] -> Pattern Text + 446. Text.patterns.charRange : Char -> Char -> Pattern Text + 447. Text.patterns.digit : Pattern Text + 448. Text.patterns.eof : Pattern Text + 449. Text.patterns.letter : Pattern Text + 450. Text.patterns.literal : Text -> Pattern Text + 451. Text.patterns.notCharIn : [Char] -> Pattern Text + 452. Text.patterns.notCharRange : Char -> Char -> Pattern Text + 453. Text.patterns.punctuation : Pattern Text + 454. Text.patterns.space : Pattern Text + 455. Text.repeat : Nat -> Text -> Text + 456. Text.reverse : Text -> Text + 457. Text.size : Text -> Nat + 458. Text.take : Nat -> Text -> Text + 459. Text.toCharList : Text -> [Char] + 460. Text.toLowercase : Text -> Text + 461. Text.toUppercase : Text -> Text + 462. Text.toUtf8 : Text -> Bytes + 463. Text.uncons : Text -> Optional (Char, Text) + 464. Text.unsnoc : Text -> Optional (Text, Char) + 465. ThreadId.toText : ThreadId -> Text + 466. todo : a -> b + 467. structural type Tuple a b + 468. Tuple.Cons : a -> b -> Tuple a b + 469. structural type Unit + 470. Unit.Unit : () + 471. Universal.< : a -> a -> Boolean + 472. Universal.<= : a -> a -> Boolean + 473. Universal.== : a -> a -> Boolean + 474. Universal.> : a -> a -> Boolean + 475. Universal.>= : a -> a -> Boolean + 476. Universal.compare : a -> a -> Int + 477. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b + 478. builtin type Value + 479. Value.dependencies : Value -> [Term] + 480. Value.deserialize : Bytes -> Either Text Value + 481. Value.load : Value ->{IO} Either [Term] a + 482. Value.serialize : Value -> Bytes + 483. Value.value : a -> Value .builtin> alias.many 94-104 .mylib diff --git a/unison-src/transcripts/builtins-merge.output.md b/unison-src/transcripts/builtins-merge.output.md index e453ebb8e..a6538cc7b 100644 --- a/unison-src/transcripts/builtins-merge.output.md +++ b/unison-src/transcripts/builtins-merge.output.md @@ -74,7 +74,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 63. Value/ (5 terms) 64. bug (a -> b) 65. crypto/ (12 terms, 1 type) - 66. io2/ (126 terms, 30 types) + 66. io2/ (131 terms, 31 types) 67. metadata/ (2 terms) 68. todo (a -> b) 69. unsafe/ (1 term) diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index 6980b73a7..ff3632b05 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge` .foo> ls - 1. builtin/ (414 terms, 63 types) + 1. builtin/ (419 terms, 64 types) ``` And for a limited time, you can get even more builtin goodies: @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (586 terms, 81 types) + 1. builtin/ (591 terms, 82 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index 3c091572d..0d27cfe96 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -121,13 +121,13 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #khhiq1sc3o + ⊙ 1. #ss5rfipsc9 - Deletes: feature1.y - ⊙ 2. #0t16m7j03m + ⊙ 2. #pbsfditts0 + Adds / updates: @@ -138,26 +138,26 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t Original name New name(s) feature1.y master.y - ⊙ 3. #l4cc5snm7c + ⊙ 3. #6vsh9eatk2 + Adds / updates: feature1.y - ⊙ 4. #0ujfvnropc + ⊙ 4. #8q0ijp9unj > Moves: Original name New name x master.x - ⊙ 5. #jd5q4ga1jk + ⊙ 5. #5ultfinuna + Adds / updates: x - □ 6. #67ki96tn2j (start of history) + □ 6. #hsdh3pm9ua (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 70f0e1b97..c986a8233 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -267,7 +267,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (591 terms, 82 types) + 1. root/ (596 terms, 83 types) .> history @@ -276,13 +276,13 @@ I should be able to move the root into a sub-namespace - □ 1. #2kibet66dd (start of history) + □ 1. #trup0d2160 (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (586 terms, 81 types) + 1. builtin/ (591 terms, 82 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -292,7 +292,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #e7uij3oft2 + ⊙ 1. #dd8n885fue - Deletes: @@ -303,7 +303,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #v32ubv0p3r + ⊙ 2. #k5g4ehotlf + Adds / updates: @@ -315,26 +315,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #8brjmr30ls + ⊙ 3. #aqijafrrrj + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #aie72ekk7e + ⊙ 4. #el3jo3o2n3 > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #t05a2u5s1a + ⊙ 5. #io04ududm1 - Deletes: history.b.termInB - ⊙ 6. #7e116chrdg + ⊙ 6. #7u417uihfu + Adds / updates: @@ -345,13 +345,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #aq0rd3db7l + ⊙ 7. #09p85hi2gq + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #rk1p4aamml + ⊙ 8. #rqjb9hgqfn > Moves: @@ -361,7 +361,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #dhr3sctdec + ⊙ 9. #11fgfgp2m2 + Adds / updates: @@ -371,7 +371,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #bu35nl3qi6 + ⊙ 10. #627cdfv199 + Adds / updates: @@ -383,7 +383,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #bjgbu0j8dd + ⊙ 11. #5o3ve5br4l ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index 908ea6ec4..e2f7b93ff 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -128,302 +128,306 @@ d = c + 10 40. structural type builtin.Optional a 41. builtin type builtin.Pattern 42. builtin type builtin.io2.Tls.PrivateKey - 43. builtin type builtin.io2.Promise - 44. builtin type builtin.Ref - 45. builtin type builtin.Request - 46. unique type builtin.Test.Result - 47. unique type builtin.io2.RuntimeFailure - 48. builtin ability builtin.io2.STM - 49. unique type builtin.io2.STMFailure - 50. builtin ability builtin.Scope - 51. unique type builtin.io2.SeekMode - 52. structural type builtin.SeqView a b - 53. builtin type builtin.io2.Tls.ServerConfig - 54. builtin type builtin.io2.Tls.SignedCert - 55. builtin type builtin.io2.Socket - 56. unique type builtin.io2.StdHandle - 57. builtin type builtin.io2.TVar - 58. builtin type builtin.Link.Term - 59. builtin type builtin.Text - 60. builtin type builtin.io2.ThreadId - 61. builtin type builtin.io2.Ref.Ticket - 62. builtin type builtin.io2.Clock.internals.TimeSpec - 63. builtin type builtin.io2.Tls - 64. unique type builtin.io2.TlsFailure - 65. structural type builtin.Tuple a b - 66. builtin type builtin.Link.Type - 67. structural type builtin.Unit - 68. builtin type builtin.Value - 69. builtin type builtin.io2.Tls.Version - 70. builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 71. builtin.io2.IOError.AlreadyExists : IOError - 72. builtin.io2.FileMode.Append : FileMode - 73. builtin.Doc.Blob : Text + 43. builtin type builtin.io2.ProcessHandle + 44. builtin type builtin.io2.Promise + 45. builtin type builtin.Ref + 46. builtin type builtin.Request + 47. unique type builtin.Test.Result + 48. unique type builtin.io2.RuntimeFailure + 49. builtin ability builtin.io2.STM + 50. unique type builtin.io2.STMFailure + 51. builtin ability builtin.Scope + 52. unique type builtin.io2.SeekMode + 53. structural type builtin.SeqView a b + 54. builtin type builtin.io2.Tls.ServerConfig + 55. builtin type builtin.io2.Tls.SignedCert + 56. builtin type builtin.io2.Socket + 57. unique type builtin.io2.StdHandle + 58. builtin type builtin.io2.TVar + 59. builtin type builtin.Link.Term + 60. builtin type builtin.Text + 61. builtin type builtin.io2.ThreadId + 62. builtin type builtin.io2.Ref.Ticket + 63. builtin type builtin.io2.Clock.internals.TimeSpec + 64. builtin type builtin.io2.Tls + 65. unique type builtin.io2.TlsFailure + 66. structural type builtin.Tuple a b + 67. builtin type builtin.Link.Type + 68. structural type builtin.Unit + 69. builtin type builtin.Value + 70. builtin type builtin.io2.Tls.Version + 71. builtin.io2.SeekMode.AbsoluteSeek : SeekMode + 72. builtin.io2.IOError.AlreadyExists : IOError + 73. builtin.io2.FileMode.Append : FileMode + 74. builtin.Doc.Blob : Text -> Doc - 74. builtin.io2.BufferMode.BlockBuffering : BufferMode - 75. builtin.Tuple.Cons : a + 75. builtin.io2.BufferMode.BlockBuffering : BufferMode + 76. builtin.Tuple.Cons : a -> b -> Tuple a b - 76. builtin.io2.IOError.EOF : IOError - 77. builtin.Doc.Evaluate : Term + 77. builtin.io2.IOError.EOF : IOError + 78. builtin.Doc.Evaluate : Term -> Doc - 78. builtin.Test.Result.Fail : Text + 79. builtin.Test.Result.Fail : Text -> Result - 79. builtin.io2.Failure.Failure : Type + 80. builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 80. builtin.io2.IOError.IllegalOperation : IOError - 81. builtin.IsPropagated.IsPropagated : IsPropagated - 82. builtin.IsTest.IsTest : IsTest - 83. builtin.Doc.Join : [Doc] + 81. builtin.io2.IOError.IllegalOperation : IOError + 82. builtin.IsPropagated.IsPropagated : IsPropagated + 83. builtin.IsTest.IsTest : IsTest + 84. builtin.Doc.Join : [Doc] -> Doc - 84. builtin.Either.Left : a + 85. builtin.Either.Left : a -> Either a b - 85. builtin.io2.BufferMode.LineBuffering : BufferMode - 86. builtin.Doc.Link : Link + 86. builtin.io2.BufferMode.LineBuffering : BufferMode + 87. builtin.Doc.Link : Link -> Doc - 87. builtin.io2.BufferMode.NoBuffering : BufferMode - 88. builtin.io2.IOError.NoSuchThing : IOError - 89. builtin.Optional.None : Optional + 88. builtin.io2.BufferMode.NoBuffering : BufferMode + 89. builtin.io2.IOError.NoSuchThing : IOError + 90. builtin.Optional.None : Optional a - 90. builtin.Test.Result.Ok : Text + 91. builtin.Test.Result.Ok : Text -> Result - 91. builtin.io2.IOError.PermissionDenied : IOError - 92. builtin.io2.FileMode.Read : FileMode - 93. builtin.io2.FileMode.ReadWrite : FileMode - 94. builtin.io2.SeekMode.RelativeSeek : SeekMode - 95. builtin.io2.IOError.ResourceBusy : IOError - 96. builtin.io2.IOError.ResourceExhausted : IOError - 97. builtin.Either.Right : b + 92. builtin.io2.IOError.PermissionDenied : IOError + 93. builtin.io2.FileMode.Read : FileMode + 94. builtin.io2.FileMode.ReadWrite : FileMode + 95. builtin.io2.SeekMode.RelativeSeek : SeekMode + 96. builtin.io2.IOError.ResourceBusy : IOError + 97. builtin.io2.IOError.ResourceExhausted : IOError + 98. builtin.Either.Right : b -> Either a b - 98. builtin.io2.SeekMode.SeekFromEnd : SeekMode - 99. builtin.Doc.Signature : Term + 99. builtin.io2.SeekMode.SeekFromEnd : SeekMode + 100. builtin.Doc.Signature : Term -> Doc - 100. builtin.io2.BufferMode.SizedBlockBuffering : Nat + 101. builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 101. builtin.Optional.Some : a + 102. builtin.Optional.Some : a -> Optional a - 102. builtin.Doc.Source : Link + 103. builtin.Doc.Source : Link -> Doc - 103. builtin.io2.StdHandle.StdErr : StdHandle - 104. builtin.io2.StdHandle.StdIn : StdHandle - 105. builtin.io2.StdHandle.StdOut : StdHandle - 106. builtin.Link.Term : Term + 104. builtin.io2.StdHandle.StdErr : StdHandle + 105. builtin.io2.StdHandle.StdIn : StdHandle + 106. builtin.io2.StdHandle.StdOut : StdHandle + 107. builtin.Link.Term : Term -> Link - 107. builtin.Link.Type : Type + 108. builtin.Link.Type : Type -> Link - 108. builtin.Unit.Unit : () - 109. builtin.io2.IOError.UserError : IOError - 110. builtin.SeqView.VElem : a + 109. builtin.Unit.Unit : () + 110. builtin.io2.IOError.UserError : IOError + 111. builtin.SeqView.VElem : a -> b -> SeqView a b - 111. builtin.SeqView.VEmpty : SeqView + 112. builtin.SeqView.VEmpty : SeqView a b - 112. builtin.io2.FileMode.Write : FileMode - 113. builtin.Exception.raise : Failure + 113. builtin.io2.FileMode.Write : FileMode + 114. builtin.Exception.raise : Failure ->{Exception} x - 114. builtin.Text.!= : Text + 115. builtin.Text.!= : Text -> Text -> Boolean - 115. builtin.Float.* : Float + 116. builtin.Float.* : Float -> Float -> Float - 116. builtin.Int.* : Int + 117. builtin.Int.* : Int -> Int -> Int - 117. builtin.Nat.* : Nat + 118. builtin.Nat.* : Nat -> Nat -> Nat - 118. builtin.Float.+ : Float + 119. builtin.Float.+ : Float -> Float -> Float - 119. builtin.Int.+ : Int + 120. builtin.Int.+ : Int -> Int -> Int - 120. builtin.Nat.+ : Nat + 121. builtin.Nat.+ : Nat -> Nat -> Nat - 121. builtin.Bytes.++ : Bytes + 122. builtin.Bytes.++ : Bytes -> Bytes -> Bytes - 122. builtin.List.++ : [a] + 123. builtin.List.++ : [a] -> [a] -> [a] - 123. builtin.Text.++ : Text + 124. builtin.Text.++ : Text -> Text -> Text - 124. ┌ builtin.List.+: : a + 125. ┌ builtin.List.+: : a -> [a] -> [a] - 125. └ builtin.List.cons : a + 126. └ builtin.List.cons : a -> [a] -> [a] - 126. builtin.Float.- : Float + 127. builtin.Float.- : Float -> Float -> Float - 127. builtin.Int.- : Int + 128. builtin.Int.- : Int -> Int -> Int - 128. builtin.Float./ : Float + 129. builtin.Float./ : Float -> Float -> Float - 129. builtin.Int./ : Int + 130. builtin.Int./ : Int -> Int -> Int - 130. builtin.Nat./ : Nat + 131. builtin.Nat./ : Nat -> Nat -> Nat - 131. ┌ builtin.List.:+ : [a] + 132. ┌ builtin.List.:+ : [a] -> a -> [a] - 132. └ builtin.List.snoc : [a] + 133. └ builtin.List.snoc : [a] -> a -> [a] - 133. builtin.Universal.< : a + 134. builtin.Universal.< : a -> a -> Boolean - 134. builtin.Universal.<= : a + 135. builtin.Universal.<= : a -> a -> Boolean - 135. builtin.Universal.== : a + 136. builtin.Universal.== : a -> a -> Boolean - 136. builtin.Universal.> : a + 137. builtin.Universal.> : a -> a -> Boolean - 137. builtin.Universal.>= : a + 138. builtin.Universal.>= : a -> a -> Boolean - 138. builtin.Any.Any : a + 139. builtin.Any.Any : a -> Any - 139. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm - 140. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm - 141. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 142. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm - 143. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 144. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 145. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 146. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 147. builtin.Float.abs : Float + 140. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm + 141. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm + 142. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm + 143. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm + 144. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + 145. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + 146. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + 147. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + 148. builtin.Float.abs : Float -> Float - 148. builtin.Float.acos : Float + 149. builtin.Float.acos : Float -> Float - 149. builtin.Float.acosh : Float + 150. builtin.Float.acosh : Float -> Float - 150. builtin.Int.and : Int + 151. builtin.Int.and : Int -> Int -> Int - 151. builtin.Nat.and : Nat + 152. builtin.Nat.and : Nat -> Nat -> Nat - 152. builtin.Text.patterns.anyChar : Pattern + 153. builtin.Text.patterns.anyChar : Pattern Text - 153. builtin.io2.IO.array : Nat + 154. builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 154. builtin.Scope.array : Nat + 155. builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 155. builtin.io2.IO.arrayOf : a + 156. builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 156. builtin.Scope.arrayOf : a + 157. builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 157. builtin.Float.asin : Float + 158. builtin.Float.asin : Float -> Float - 158. builtin.Float.asinh : Float + 159. builtin.Float.asinh : Float -> Float - 159. builtin.Bytes.at : Nat + 160. builtin.Bytes.at : Nat -> Bytes -> Optional Nat - 160. builtin.List.at : Nat + 161. builtin.List.at : Nat -> [a] -> Optional a - 161. builtin.Float.atan : Float + 162. builtin.Float.atan : Float -> Float - 162. builtin.Float.atan2 : Float + 163. builtin.Float.atan2 : Float -> Float -> Float - 163. builtin.Float.atanh : Float + 164. builtin.Float.atanh : Float -> Float - 164. builtin.io2.STM.atomically : '{STM} a + 165. builtin.io2.STM.atomically : '{STM} a ->{IO} a - 165. builtin.bug : a -> b - 166. builtin.io2.IO.bytearray : Nat + 166. builtin.bug : a -> b + 167. builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 167. builtin.Scope.bytearray : Nat + 168. builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 168. builtin.io2.IO.bytearrayOf : Nat + 169. builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 169. builtin.Scope.bytearrayOf : Nat + 170. builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 170. ┌ c#gjmq673r1v : Nat - 171. └ long.name.but.shortest.suffixification : Nat - 172. builtin.Code.cache_ : [( Term, + 171. ┌ c#gjmq673r1v : Nat + 172. └ long.name.but.shortest.suffixification : Nat + 173. builtin.Code.cache_ : [( Term, Code)] ->{IO} [Term] - 173. builtin.Pattern.capture : Pattern + 174. builtin.io2.IO.process.call : Text + -> [Text] + ->{IO} Nat + 175. builtin.Pattern.capture : Pattern a -> Pattern a - 174. builtin.io2.Ref.cas : Ref + 176. builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 175. builtin.Float.ceiling : Float + 177. builtin.Float.ceiling : Float -> Int - 176. builtin.Text.patterns.charIn : [Char] + 178. builtin.Text.patterns.charIn : [Char] -> Pattern Text - 177. builtin.Text.patterns.charRange : Char + 179. builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 178. builtin.unsafe.coerceAbilities : (a + 180. builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 179. builtin.Universal.compare : a + 181. builtin.Universal.compare : a -> a -> Int - 180. builtin.Int.complement : Int + 182. builtin.Int.complement : Int -> Int - 181. builtin.Nat.complement : Nat + 183. builtin.Nat.complement : Nat -> Nat - 182. builtin.Bytes.gzip.compress : Bytes + 184. builtin.Bytes.gzip.compress : Bytes -> Bytes - 183. builtin.Bytes.zlib.compress : Bytes + 185. builtin.Bytes.zlib.compress : Bytes -> Bytes - 184. builtin.ImmutableArray.copyTo! : MutableArray + 186. builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray @@ -432,7 +436,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 185. builtin.ImmutableByteArray.copyTo! : MutableByteArray + 187. builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -440,7 +444,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 186. builtin.MutableArray.copyTo! : MutableArray + 188. builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray @@ -449,7 +453,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 187. builtin.MutableByteArray.copyTo! : MutableByteArray + 189. builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray @@ -458,943 +462,956 @@ d = c + 10 -> Nat ->{g, Exception} () - 188. builtin.Float.cos : Float + 190. builtin.Float.cos : Float -> Float - 189. builtin.Float.cosh : Float + 191. builtin.Float.cosh : Float -> Float - 190. builtin.Bytes.decodeNat16be : Bytes + 192. builtin.Bytes.decodeNat16be : Bytes -> Optional ( Nat, Bytes) - 191. builtin.Bytes.decodeNat16le : Bytes + 193. builtin.Bytes.decodeNat16le : Bytes -> Optional ( Nat, Bytes) - 192. builtin.Bytes.decodeNat32be : Bytes + 194. builtin.Bytes.decodeNat32be : Bytes -> Optional ( Nat, Bytes) - 193. builtin.Bytes.decodeNat32le : Bytes + 195. builtin.Bytes.decodeNat32le : Bytes -> Optional ( Nat, Bytes) - 194. builtin.Bytes.decodeNat64be : Bytes + 196. builtin.Bytes.decodeNat64be : Bytes -> Optional ( Nat, Bytes) - 195. builtin.Bytes.decodeNat64le : Bytes + 197. builtin.Bytes.decodeNat64le : Bytes -> Optional ( Nat, Bytes) - 196. builtin.io2.Tls.decodePrivateKey : Bytes + 198. builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 197. builtin.Bytes.gzip.decompress : Bytes + 199. builtin.Bytes.gzip.decompress : Bytes -> Either Text Bytes - 198. builtin.Bytes.zlib.decompress : Bytes + 200. builtin.Bytes.zlib.decompress : Bytes -> Either Text Bytes - 199. builtin.io2.Tls.ClientConfig.default : Text + 201. builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 200. builtin.io2.Tls.ServerConfig.default : [SignedCert] + 202. builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 201. builtin.Code.dependencies : Code + 203. builtin.Code.dependencies : Code -> [Term] - 202. builtin.Value.dependencies : Value + 204. builtin.Value.dependencies : Value -> [Term] - 203. builtin.Code.deserialize : Bytes + 205. builtin.Code.deserialize : Bytes -> Either Text Code - 204. builtin.Value.deserialize : Bytes + 206. builtin.Value.deserialize : Bytes -> Either Text Value - 205. builtin.Text.patterns.digit : Pattern + 207. builtin.Text.patterns.digit : Pattern Text - 206. builtin.Code.display : Text + 208. builtin.Code.display : Text -> Code -> Text - 207. builtin.Bytes.drop : Nat + 209. builtin.Bytes.drop : Nat -> Bytes -> Bytes - 208. builtin.List.drop : Nat + 210. builtin.List.drop : Nat -> [a] -> [a] - 209. builtin.Nat.drop : Nat + 211. builtin.Nat.drop : Nat -> Nat -> Nat - 210. builtin.Text.drop : Nat + 212. builtin.Text.drop : Nat -> Text -> Text - 211. builtin.Bytes.empty : Bytes - 212. builtin.List.empty : [a] - 213. builtin.Text.empty : Text - 214. builtin.io2.Tls.encodeCert : SignedCert + 213. builtin.Bytes.empty : Bytes + 214. builtin.List.empty : [a] + 215. builtin.Text.empty : Text + 216. builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 215. builtin.Bytes.encodeNat16be : Nat + 217. builtin.Bytes.encodeNat16be : Nat -> Bytes - 216. builtin.Bytes.encodeNat16le : Nat + 218. builtin.Bytes.encodeNat16le : Nat -> Bytes - 217. builtin.Bytes.encodeNat32be : Nat + 219. builtin.Bytes.encodeNat32be : Nat -> Bytes - 218. builtin.Bytes.encodeNat32le : Nat + 220. builtin.Bytes.encodeNat32le : Nat -> Bytes - 219. builtin.Bytes.encodeNat64be : Nat + 221. builtin.Bytes.encodeNat64be : Nat -> Bytes - 220. builtin.Bytes.encodeNat64le : Nat + 222. builtin.Bytes.encodeNat64le : Nat -> Bytes - 221. builtin.io2.Tls.encodePrivateKey : PrivateKey + 223. builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 222. builtin.Text.patterns.eof : Pattern + 224. builtin.Text.patterns.eof : Pattern Text - 223. builtin.Float.eq : Float + 225. builtin.Float.eq : Float -> Float -> Boolean - 224. builtin.Int.eq : Int + 226. builtin.Int.eq : Int -> Int -> Boolean - 225. builtin.Nat.eq : Nat + 227. builtin.Nat.eq : Nat -> Nat -> Boolean - 226. builtin.Text.eq : Text + 228. builtin.Text.eq : Text -> Text -> Boolean - 227. builtin.Float.exp : Float + 229. builtin.io2.IO.process.exitCode : ProcessHandle + ->{IO} Optional + Nat + 230. builtin.Float.exp : Float -> Float - 228. builtin.Bytes.flatten : Bytes + 231. builtin.Bytes.flatten : Bytes -> Bytes - 229. builtin.Float.floor : Float + 232. builtin.Float.floor : Float -> Int - 230. builtin.io2.IO.forkComp : '{IO} a + 233. builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 231. builtin.MutableArray.freeze : MutableArray + 234. builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 232. builtin.MutableByteArray.freeze : MutableByteArray + 235. builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 233. builtin.MutableArray.freeze! : MutableArray + 236. builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 234. builtin.MutableByteArray.freeze! : MutableByteArray + 237. builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 235. builtin.Bytes.fromBase16 : Bytes + 238. builtin.Bytes.fromBase16 : Bytes -> Either Text Bytes - 236. builtin.Bytes.fromBase32 : Bytes + 239. builtin.Bytes.fromBase32 : Bytes -> Either Text Bytes - 237. builtin.Bytes.fromBase64 : Bytes + 240. builtin.Bytes.fromBase64 : Bytes -> Either Text Bytes - 238. builtin.Bytes.fromBase64UrlUnpadded : Bytes + 241. builtin.Bytes.fromBase64UrlUnpadded : Bytes -> Either Text Bytes - 239. builtin.Text.fromCharList : [Char] + 242. builtin.Text.fromCharList : [Char] -> Text - 240. builtin.Bytes.fromList : [Nat] + 243. builtin.Bytes.fromList : [Nat] -> Bytes - 241. builtin.Char.fromNat : Nat + 244. builtin.Char.fromNat : Nat -> Char - 242. builtin.Float.fromRepresentation : Nat + 245. builtin.Float.fromRepresentation : Nat -> Float - 243. builtin.Int.fromRepresentation : Nat + 246. builtin.Int.fromRepresentation : Nat -> Int - 244. builtin.Float.fromText : Text + 247. builtin.Float.fromText : Text -> Optional Float - 245. builtin.Int.fromText : Text + 248. builtin.Int.fromText : Text -> Optional Int - 246. builtin.Nat.fromText : Text + 249. builtin.Nat.fromText : Text -> Optional Nat - 247. builtin.Float.gt : Float + 250. builtin.Float.gt : Float -> Float -> Boolean - 248. builtin.Int.gt : Int + 251. builtin.Int.gt : Int -> Int -> Boolean - 249. builtin.Nat.gt : Nat + 252. builtin.Nat.gt : Nat -> Nat -> Boolean - 250. builtin.Text.gt : Text + 253. builtin.Text.gt : Text -> Text -> Boolean - 251. builtin.Float.gteq : Float + 254. builtin.Float.gteq : Float -> Float -> Boolean - 252. builtin.Int.gteq : Int + 255. builtin.Int.gteq : Int -> Int -> Boolean - 253. builtin.Nat.gteq : Nat + 256. builtin.Nat.gteq : Nat -> Nat -> Boolean - 254. builtin.Text.gteq : Text + 257. builtin.Text.gteq : Text -> Text -> Boolean - 255. builtin.crypto.hash : HashAlgorithm + 258. builtin.crypto.hash : HashAlgorithm -> a -> Bytes - 256. builtin.crypto.hashBytes : HashAlgorithm + 259. builtin.crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 257. builtin.crypto.hmac : HashAlgorithm + 260. builtin.crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 258. builtin.crypto.hmacBytes : HashAlgorithm + 261. builtin.crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 259. builtin.io2.IO.clientSocket.impl : Text + 262. builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 260. builtin.io2.IO.closeFile.impl : Handle + 263. builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 261. builtin.io2.IO.closeSocket.impl : Socket + 264. builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 262. builtin.io2.IO.createDirectory.impl : Text + 265. builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 263. builtin.io2.IO.createTempDirectory.impl : Text + 266. builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 264. builtin.io2.Tls.decodeCert.impl : Bytes + 267. builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 265. builtin.io2.IO.delay.impl : Nat + 268. builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 266. builtin.io2.IO.directoryContents.impl : Text + 269. builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 267. builtin.io2.IO.fileExists.impl : Text + 270. builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 268. builtin.Text.fromUtf8.impl : Bytes + 271. builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 269. builtin.io2.IO.getArgs.impl : '{IO} Either + 272. builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 270. builtin.io2.IO.getBuffering.impl : Handle + 273. builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 271. builtin.io2.IO.getBytes.impl : Handle + 274. builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 272. builtin.io2.IO.getChar.impl : Handle + 275. builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 273. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either + 276. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 274. builtin.io2.IO.getEcho.impl : Handle + 277. builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 275. builtin.io2.IO.getEnv.impl : Text + 278. builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 276. builtin.io2.IO.getFileSize.impl : Text + 279. builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 277. builtin.io2.IO.getFileTimestamp.impl : Text + 280. builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 278. builtin.io2.IO.getLine.impl : Handle + 281. builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 279. builtin.io2.IO.getSomeBytes.impl : Handle + 282. builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 280. builtin.io2.IO.getTempDirectory.impl : '{IO} Either + 283. builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 281. builtin.io2.IO.handlePosition.impl : Handle + 284. builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 282. builtin.io2.Tls.handshake.impl : Tls + 285. builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 283. builtin.io2.IO.isDirectory.impl : Text + 286. builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 284. builtin.io2.IO.isFileEOF.impl : Handle + 287. builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 285. builtin.io2.IO.isFileOpen.impl : Handle + 288. builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 286. builtin.io2.IO.isSeekable.impl : Handle + 289. builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 287. builtin.io2.IO.kill.impl : ThreadId + 290. builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 288. builtin.io2.IO.listen.impl : Socket + 291. builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 289. builtin.io2.Tls.newClient.impl : ClientConfig + 292. builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 290. builtin.io2.Tls.newServer.impl : ServerConfig + 293. builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 291. builtin.io2.IO.openFile.impl : Text + 294. builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 292. builtin.io2.MVar.put.impl : MVar a + 295. builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 293. builtin.io2.IO.putBytes.impl : Handle + 296. builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 294. builtin.io2.MVar.read.impl : MVar a + 297. builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 295. builtin.io2.IO.ready.impl : Handle + 298. builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 296. builtin.io2.Tls.receive.impl : Tls + 299. builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 297. builtin.io2.IO.removeDirectory.impl : Text + 300. builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 298. builtin.io2.IO.removeFile.impl : Text + 301. builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 299. builtin.io2.IO.renameDirectory.impl : Text + 302. builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 300. builtin.io2.IO.renameFile.impl : Text + 303. builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 301. builtin.io2.IO.seekHandle.impl : Handle + 304. builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 302. builtin.io2.Tls.send.impl : Tls + 305. builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 303. builtin.io2.IO.serverSocket.impl : Optional + 306. builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 304. builtin.io2.IO.setBuffering.impl : Handle + 307. builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 305. builtin.io2.IO.setCurrentDirectory.impl : Text + 308. builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 306. builtin.io2.IO.setEcho.impl : Handle + 309. builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 307. builtin.io2.IO.socketAccept.impl : Socket + 310. builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 308. builtin.io2.IO.socketPort.impl : Socket + 311. builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 309. builtin.io2.IO.socketReceive.impl : Socket + 312. builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 310. builtin.io2.IO.socketSend.impl : Socket + 313. builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 311. builtin.io2.MVar.swap.impl : MVar a + 314. builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 312. builtin.io2.IO.systemTime.impl : '{IO} Either + 315. builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 313. builtin.io2.MVar.take.impl : MVar a + 316. builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 314. builtin.io2.Tls.terminate.impl : Tls + 317. builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 315. builtin.io2.MVar.tryPut.impl : MVar a + 318. builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 316. builtin.io2.MVar.tryRead.impl : MVar a + 319. builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 317. builtin.Int.increment : Int + 320. builtin.Int.increment : Int -> Int - 318. builtin.Nat.increment : Nat + 321. builtin.Nat.increment : Nat -> Nat - 319. builtin.io2.MVar.isEmpty : MVar a + 322. builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 320. builtin.Int.isEven : Int + 323. builtin.Int.isEven : Int -> Boolean - 321. builtin.Nat.isEven : Nat + 324. builtin.Nat.isEven : Nat -> Boolean - 322. builtin.Pattern.isMatch : Pattern + 325. builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 323. builtin.Code.isMissing : Term + 326. builtin.Code.isMissing : Term ->{IO} Boolean - 324. builtin.Int.isOdd : Int + 327. builtin.Int.isOdd : Int -> Boolean - 325. builtin.Nat.isOdd : Nat + 328. builtin.Nat.isOdd : Nat -> Boolean - 326. builtin.metadata.isPropagated : IsPropagated - 327. builtin.metadata.isTest : IsTest - 328. builtin.Pattern.join : [Pattern + 329. builtin.metadata.isPropagated : IsPropagated + 330. builtin.metadata.isTest : IsTest + 331. builtin.Pattern.join : [Pattern a] -> Pattern a - 329. builtin.Int.leadingZeros : Int + 332. builtin.io2.IO.process.kill : ProcessHandle + ->{IO} () + 333. builtin.Int.leadingZeros : Int -> Nat - 330. builtin.Nat.leadingZeros : Nat + 334. builtin.Nat.leadingZeros : Nat -> Nat - 331. builtin.Text.patterns.letter : Pattern + 335. builtin.Text.patterns.letter : Pattern Text - 332. builtin.Text.patterns.literal : Text + 336. builtin.Text.patterns.literal : Text -> Pattern Text - 333. builtin.Value.load : Value + 337. builtin.Value.load : Value ->{IO} Either [Term] a - 334. builtin.Float.log : Float + 338. builtin.Float.log : Float -> Float - 335. builtin.Float.logBase : Float + 339. builtin.Float.logBase : Float -> Float -> Float - 336. builtin.Code.lookup : Term + 340. builtin.Code.lookup : Term ->{IO} Optional Code - 337. builtin.Float.lt : Float + 341. builtin.Float.lt : Float -> Float -> Boolean - 338. builtin.Int.lt : Int + 342. builtin.Int.lt : Int -> Int -> Boolean - 339. builtin.Nat.lt : Nat + 343. builtin.Nat.lt : Nat -> Nat -> Boolean - 340. builtin.Text.lt : Text + 344. builtin.Text.lt : Text -> Text -> Boolean - 341. builtin.Float.lteq : Float + 345. builtin.Float.lteq : Float -> Float -> Boolean - 342. builtin.Int.lteq : Int + 346. builtin.Int.lteq : Int -> Int -> Boolean - 343. builtin.Nat.lteq : Nat + 347. builtin.Nat.lteq : Nat -> Nat -> Boolean - 344. builtin.Text.lteq : Text + 348. builtin.Text.lteq : Text -> Text -> Boolean - 345. builtin.Pattern.many : Pattern + 349. builtin.Pattern.many : Pattern a -> Pattern a - 346. builtin.Float.max : Float + 350. builtin.Float.max : Float -> Float -> Float - 347. builtin.Float.min : Float + 351. builtin.Float.min : Float -> Float -> Float - 348. builtin.Int.mod : Int + 352. builtin.Int.mod : Int -> Int -> Int - 349. builtin.Nat.mod : Nat + 353. builtin.Nat.mod : Nat -> Nat -> Nat - 350. builtin.io2.Clock.internals.monotonic : '{IO} Either + 354. builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 351. builtin.Int.negate : Int + 355. builtin.Int.negate : Int -> Int - 352. builtin.io2.MVar.new : a + 356. builtin.io2.MVar.new : a ->{IO} MVar a - 353. builtin.io2.Promise.new : '{IO} Promise + 357. builtin.io2.Promise.new : '{IO} Promise a - 354. builtin.io2.TVar.new : a + 358. builtin.io2.TVar.new : a ->{STM} TVar a - 355. builtin.io2.MVar.newEmpty : '{IO} MVar + 359. builtin.io2.MVar.newEmpty : '{IO} MVar a - 356. builtin.io2.TVar.newIO : a + 360. builtin.io2.TVar.newIO : a ->{IO} TVar a - 357. builtin.Boolean.not : Boolean + 361. builtin.Boolean.not : Boolean -> Boolean - 358. builtin.Text.patterns.notCharIn : [Char] + 362. builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 359. builtin.Text.patterns.notCharRange : Char + 363. builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 360. builtin.io2.Clock.internals.nsec : TimeSpec + 364. builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 361. builtin.Int.or : Int + 365. builtin.Int.or : Int -> Int -> Int - 362. builtin.Nat.or : Nat + 366. builtin.Nat.or : Nat -> Nat -> Nat - 363. builtin.Pattern.or : Pattern + 367. builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 364. builtin.Int.popCount : Int + 368. builtin.Int.popCount : Int -> Nat - 365. builtin.Nat.popCount : Nat + 369. builtin.Nat.popCount : Nat -> Nat - 366. builtin.Float.pow : Float + 370. builtin.Float.pow : Float -> Float -> Float - 367. builtin.Int.pow : Int + 371. builtin.Int.pow : Int -> Nat -> Int - 368. builtin.Nat.pow : Nat + 372. builtin.Nat.pow : Nat -> Nat -> Nat - 369. builtin.io2.Clock.internals.processCPUTime : '{IO} Either + 373. builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 370. builtin.Text.patterns.punctuation : Pattern + 374. builtin.Text.patterns.punctuation : Pattern Text - 371. builtin.ImmutableArray.read : ImmutableArray + 375. builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 372. builtin.MutableArray.read : MutableArray + 376. builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 373. builtin.io2.Promise.read : Promise + 377. builtin.io2.Promise.read : Promise a ->{IO} a - 374. builtin.Ref.read : Ref g a + 378. builtin.Ref.read : Ref g a ->{g} a - 375. builtin.io2.TVar.read : TVar a + 379. builtin.io2.TVar.read : TVar a ->{STM} a - 376. builtin.io2.Ref.Ticket.read : Ticket + 380. builtin.io2.Ref.Ticket.read : Ticket a -> a - 377. builtin.ImmutableByteArray.read16be : ImmutableByteArray + 381. builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 378. builtin.MutableByteArray.read16be : MutableByteArray + 382. builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 379. builtin.ImmutableByteArray.read24be : ImmutableByteArray + 383. builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 380. builtin.MutableByteArray.read24be : MutableByteArray + 384. builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 381. builtin.ImmutableByteArray.read32be : ImmutableByteArray + 385. builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 382. builtin.MutableByteArray.read32be : MutableByteArray + 386. builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 383. builtin.ImmutableByteArray.read40be : ImmutableByteArray + 387. builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 384. builtin.MutableByteArray.read40be : MutableByteArray + 388. builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 385. builtin.ImmutableByteArray.read64be : ImmutableByteArray + 389. builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 386. builtin.MutableByteArray.read64be : MutableByteArray + 390. builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 387. builtin.ImmutableByteArray.read8 : ImmutableByteArray + 391. builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 388. builtin.MutableByteArray.read8 : MutableByteArray + 392. builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 389. builtin.io2.Ref.readForCas : Ref + 393. builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 390. builtin.io2.TVar.readIO : TVar a + 394. builtin.io2.TVar.readIO : TVar a ->{IO} a - 391. builtin.io2.Clock.internals.realtime : '{IO} Either + 395. builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 392. builtin.io2.IO.ref : a + 396. builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 393. builtin.Scope.ref : a + 397. builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 394. builtin.Text.repeat : Nat + 398. builtin.Text.repeat : Nat -> Text -> Text - 395. builtin.Pattern.replicate : Nat + 399. builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 396. builtin.io2.STM.retry : '{STM} a - 397. builtin.Text.reverse : Text + 400. builtin.io2.STM.retry : '{STM} a + 401. builtin.Text.reverse : Text -> Text - 398. builtin.Float.round : Float + 402. builtin.Float.round : Float -> Int - 399. builtin.Pattern.run : Pattern + 403. builtin.Pattern.run : Pattern a -> a -> Optional ( [a], a) - 400. builtin.Scope.run : (∀ s. + 404. builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 401. builtin.io2.Clock.internals.sec : TimeSpec + 405. builtin.io2.Clock.internals.sec : TimeSpec -> Int - 402. builtin.Code.serialize : Code + 406. builtin.Code.serialize : Code -> Bytes - 403. builtin.Value.serialize : Value + 407. builtin.Value.serialize : Value -> Bytes - 404. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + 408. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 405. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + 409. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 406. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + 410. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 407. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + 411. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 408. builtin.io2.Tls.ClientConfig.versions.set : [Version] + 412. builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 409. builtin.io2.Tls.ServerConfig.versions.set : [Version] + 413. builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 410. builtin.Int.shiftLeft : Int + 414. builtin.Int.shiftLeft : Int -> Nat -> Int - 411. builtin.Nat.shiftLeft : Nat + 415. builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 412. builtin.Int.shiftRight : Int + 416. builtin.Int.shiftRight : Int -> Nat -> Int - 413. builtin.Nat.shiftRight : Nat + 417. builtin.Nat.shiftRight : Nat -> Nat -> Nat - 414. builtin.Int.signum : Int + 418. builtin.Int.signum : Int -> Int - 415. builtin.Float.sin : Float + 419. builtin.Float.sin : Float -> Float - 416. builtin.Float.sinh : Float + 420. builtin.Float.sinh : Float -> Float - 417. builtin.Bytes.size : Bytes + 421. builtin.Bytes.size : Bytes -> Nat - 418. builtin.ImmutableArray.size : ImmutableArray + 422. builtin.ImmutableArray.size : ImmutableArray a -> Nat - 419. builtin.ImmutableByteArray.size : ImmutableByteArray + 423. builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 420. builtin.List.size : [a] + 424. builtin.List.size : [a] -> Nat - 421. builtin.MutableArray.size : MutableArray + 425. builtin.MutableArray.size : MutableArray g a -> Nat - 422. builtin.MutableByteArray.size : MutableByteArray + 426. builtin.MutableByteArray.size : MutableByteArray g -> Nat - 423. builtin.Text.size : Text + 427. builtin.Text.size : Text -> Nat - 424. builtin.Text.patterns.space : Pattern + 428. builtin.Text.patterns.space : Pattern Text - 425. builtin.Float.sqrt : Float + 429. builtin.Float.sqrt : Float -> Float - 426. builtin.io2.IO.stdHandle : StdHandle + 430. builtin.io2.IO.process.start : Text + -> [Text] + ->{IO} ( Handle, + Handle, + Handle, + ProcessHandle) + 431. builtin.io2.IO.stdHandle : StdHandle -> Handle - 427. builtin.Nat.sub : Nat + 432. builtin.Nat.sub : Nat -> Nat -> Int - 428. builtin.io2.TVar.swap : TVar a + 433. builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 429. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 430. builtin.Bytes.take : Nat + 434. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + 435. builtin.Bytes.take : Nat -> Bytes -> Bytes - 431. builtin.List.take : Nat + 436. builtin.List.take : Nat -> [a] -> [a] - 432. builtin.Text.take : Nat + 437. builtin.Text.take : Nat -> Text -> Text - 433. builtin.Float.tan : Float + 438. builtin.Float.tan : Float -> Float - 434. builtin.Float.tanh : Float + 439. builtin.Float.tanh : Float -> Float - 435. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + 440. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 436. builtin.Bytes.toBase16 : Bytes + 441. builtin.Bytes.toBase16 : Bytes -> Bytes - 437. builtin.Bytes.toBase32 : Bytes + 442. builtin.Bytes.toBase32 : Bytes -> Bytes - 438. builtin.Bytes.toBase64 : Bytes + 443. builtin.Bytes.toBase64 : Bytes -> Bytes - 439. builtin.Bytes.toBase64UrlUnpadded : Bytes + 444. builtin.Bytes.toBase64UrlUnpadded : Bytes -> Bytes - 440. builtin.Text.toCharList : Text + 445. builtin.Text.toCharList : Text -> [Char] - 441. builtin.Int.toFloat : Int + 446. builtin.Int.toFloat : Int -> Float - 442. builtin.Nat.toFloat : Nat + 447. builtin.Nat.toFloat : Nat -> Float - 443. builtin.Nat.toInt : Nat + 448. builtin.Nat.toInt : Nat -> Int - 444. builtin.Bytes.toList : Bytes + 449. builtin.Bytes.toList : Bytes -> [Nat] - 445. builtin.Text.toLowercase : Text + 450. builtin.Text.toLowercase : Text -> Text - 446. builtin.Char.toNat : Char + 451. builtin.Char.toNat : Char -> Nat - 447. builtin.Float.toRepresentation : Float + 452. builtin.Float.toRepresentation : Float -> Nat - 448. builtin.Int.toRepresentation : Int + 453. builtin.Int.toRepresentation : Int -> Nat - 449. builtin.Char.toText : Char + 454. builtin.Char.toText : Char -> Text - 450. builtin.Debug.toText : a + 455. builtin.Debug.toText : a -> Optional (Either Text Text) - 451. builtin.Float.toText : Float + 456. builtin.Float.toText : Float -> Text - 452. builtin.Handle.toText : Handle + 457. builtin.Handle.toText : Handle -> Text - 453. builtin.Int.toText : Int + 458. builtin.Int.toText : Int -> Text - 454. builtin.Nat.toText : Nat + 459. builtin.Nat.toText : Nat -> Text - 455. builtin.Socket.toText : Socket + 460. builtin.Socket.toText : Socket -> Text - 456. builtin.Link.Term.toText : Term + 461. builtin.Link.Term.toText : Term -> Text - 457. builtin.ThreadId.toText : ThreadId + 462. builtin.ThreadId.toText : ThreadId -> Text - 458. builtin.Text.toUppercase : Text + 463. builtin.Text.toUppercase : Text -> Text - 459. builtin.Text.toUtf8 : Text + 464. builtin.Text.toUtf8 : Text -> Bytes - 460. builtin.todo : a -> b - 461. builtin.Debug.trace : Text + 465. builtin.todo : a -> b + 466. builtin.Debug.trace : Text -> a -> () - 462. builtin.Int.trailingZeros : Int + 467. builtin.Int.trailingZeros : Int -> Nat - 463. builtin.Nat.trailingZeros : Nat + 468. builtin.Nat.trailingZeros : Nat -> Nat - 464. builtin.Float.truncate : Float + 469. builtin.Float.truncate : Float -> Int - 465. builtin.Int.truncate0 : Int + 470. builtin.Int.truncate0 : Int -> Nat - 466. builtin.io2.IO.tryEval : '{IO} a + 471. builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 467. builtin.io2.Promise.tryRead : Promise + 472. builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 468. builtin.io2.MVar.tryTake : MVar a + 473. builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 469. builtin.Text.uncons : Text + 474. builtin.Text.uncons : Text -> Optional ( Char, Text) - 470. builtin.Any.unsafeExtract : Any + 475. builtin.Any.unsafeExtract : Any -> a - 471. builtin.Text.unsnoc : Text + 476. builtin.Text.unsnoc : Text -> Optional ( Text, Char) - 472. builtin.Code.validate : [( Term, + 477. builtin.Code.validate : [( Term, Code)] ->{IO} Optional Failure - 473. builtin.io2.validateSandboxed : [Term] + 478. builtin.io2.validateSandboxed : [Term] -> a -> Boolean - 474. builtin.Value.value : a + 479. builtin.Value.value : a -> Value - 475. builtin.Debug.watch : Text + 480. builtin.io2.IO.process.wait : ProcessHandle + ->{IO} Nat + 481. builtin.Debug.watch : Text -> a -> a - 476. builtin.MutableArray.write : MutableArray + 482. builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 477. builtin.io2.Promise.write : Promise + 483. builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 478. builtin.Ref.write : Ref g a + 484. builtin.Ref.write : Ref g a -> a ->{g} () - 479. builtin.io2.TVar.write : TVar a + 485. builtin.io2.TVar.write : TVar a -> a ->{STM} () - 480. builtin.MutableByteArray.write16be : MutableByteArray + 486. builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 481. builtin.MutableByteArray.write32be : MutableByteArray + 487. builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 482. builtin.MutableByteArray.write64be : MutableByteArray + 488. builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 483. builtin.MutableByteArray.write8 : MutableByteArray + 489. builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 484. builtin.Int.xor : Int + 490. builtin.Int.xor : Int -> Int -> Int - 485. builtin.Nat.xor : Nat + 491. builtin.Nat.xor : Nat -> Nat -> Nat diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index d49ab9973..9c1a244ca 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #9014t8bemk .old` to make an old namespace + `fork #bu6c7lmbfc .old` to make an old namespace accessible again, - `reset-root #9014t8bemk` to reset the root namespace and + `reset-root #bu6c7lmbfc` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #q24i9rm0u0 add - 2. now #9014t8bemk add - 3. now #2p31h4lsei builtins.merge + 1. now #cl7pneoh0i add + 2. now #bu6c7lmbfc add + 3. now #s0g21i3u0g builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index df37e5337..05bb358ce 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #5r75rvflum (start of history) + □ 1. #d8s9u1138r (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #ih7oa9qmee + ⊙ 1. #lb60fofgfp > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #2nsvr26oeu + ⊙ 2. #vn8dtrgv6r > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #5r75rvflum (start of history) + □ 3. #d8s9u1138r (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #ih7oa9qmee + ⊙ 1. #lb60fofgfp > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #2nsvr26oeu + ⊙ 2. #vn8dtrgv6r > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #5r75rvflum (start of history) + □ 3. #d8s9u1138r (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #5r75rvflum (start of history) + □ 1. #d8s9u1138r (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #65gt0djmn2 + ⊙ 1. #8i72q7ac2u - Deletes: Nat.* Nat.+ - □ 2. #5r75rvflum (start of history) + □ 2. #d8s9u1138r (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From 797003673965bd3a986baad4b2519c88738044d0 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 26 Jan 2023 12:37:32 -0500 Subject: [PATCH 132/467] Parentheses typo --- chez-libs/unison/cont.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chez-libs/unison/cont.ss b/chez-libs/unison/cont.ss index 027c755e1..b5b0e7a6a 100644 --- a/chez-libs/unison/cont.ss +++ b/chez-libs/unison/cont.ss @@ -154,7 +154,7 @@ ; Removes the prompt from the first frame of a meta-continuation. (define (strip-prompt mc) (let ([mf (car mc)]) - (cons (make-meta-frame #f (meta-frame-resume-k mf) (cdr mc))))) + (cons (make-meta-frame #f (meta-frame-resume-k mf)) (cdr mc)))) ; This funcion is used to reinstate a captured continuation. It ; should be called with: From 3dbfd712c7f7db002ceac0b5a97577b9aef2c713 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 26 Jan 2023 16:40:43 -0500 Subject: [PATCH 133/467] Export record-case from (unison boot) - This means generated modules don't need to import (chezscheme), and we just need to implement record-case somehow in racket. --- chez-libs/unison/boot.ss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chez-libs/unison/boot.ss b/chez-libs/unison/boot.ss index 96ab92f76..eefd26020 100644 --- a/chez-libs/unison/boot.ss +++ b/chez-libs/unison/boot.ss @@ -17,7 +17,8 @@ func-wrap handle request - unison-force) + unison-force + record-case) (import (chezscheme) (unison cont)) From 1f4a96ee7341f2397abc07bc7414df4cc5417cc5 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 26 Jan 2023 18:55:48 -0500 Subject: [PATCH 134/467] Scheme library tweaks - Codify the difference between (unison boot) and (unison core) - Move identity to boot based on this - Re-export some Chez specific functions from (unison core) so that primops can be r6rs scheme. --- chez-libs/unison/boot.ss | 3 +++ chez-libs/unison/core.ss | 20 ++++++++++++----- chez-libs/unison/primops.ss | 45 +++++++++++++++++-------------------- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/chez-libs/unison/boot.ss b/chez-libs/unison/boot.ss index eefd26020..1420366f6 100644 --- a/chez-libs/unison/boot.ss +++ b/chez-libs/unison/boot.ss @@ -18,6 +18,7 @@ handle request unison-force + identity record-case) (import (chezscheme) @@ -122,6 +123,8 @@ [(data-case scrut c ...) (record-case (data-payload scrut) c ...)])) + (define (identity x) x) + ; forces something that is expected to be a thunk, defined with ; e.g. `name` above. In some cases, we might have a normal value, ; so just do nothing in that case. diff --git a/chez-libs/unison/core.ss b/chez-libs/unison/core.ss index 4f0b08e66..63dd2c169 100644 --- a/chez-libs/unison/core.ss +++ b/chez-libs/unison/core.ss @@ -1,14 +1,26 @@ +; This library implements various functions and macros that are used +; internally to the unison scheme libraries. This provides e.g. a +; measure of abstraction for the particular scheme platform. A useful +; feature of one implementation might need to be implemented on top of +; other features of another, and would go in this library. +; +; This library won't be directly imported by the generated unison +; code, so if some function is needed for those, it should be +; re-exported by (unison boot). (library (unison core) (export define-virtual-register define-init-registers - identity - describe-value decode-value - universal-compare) + universal-compare + + fx1- + list-head + + display-condition) (import (chezscheme)) @@ -56,8 +68,6 @@ (rec (cdr l) (+ 1 n))))]))]) #'(define (name) set ... #t))])) - (define (identity x) x) - ; Recovers the original function name from the partial ; application name. (define (extract-name i) diff --git a/chez-libs/unison/primops.ss b/chez-libs/unison/primops.ss index 86039ed4c..4e81786e9 100644 --- a/chez-libs/unison/primops.ss +++ b/chez-libs/unison/primops.ss @@ -103,29 +103,28 @@ ) - (import (chezscheme) + (import (rnrs) (unison core) (unison string) - (unison bytevector)) + (unison bytevector) + (unison vector)) (define (reify-exn thunk) - (call/1cc - (lambda (k) - (with-exception-handler - (lambda (e) - (let-values ([(port result) (open-string-output-port)]) - (display-condition e port) - (k (list 0 '() (result) e)))) - thunk)))) + (guard + (e [else + (let-values ([(port result) (open-string-output-port)]) + (display-condition e port) + (list 0 '() (result) e))]) + (thunk))) ; Core implemented primops, upon which primops-in-unison can be built. (define (unison-POp-ADDN m n) (fx+ m n)) - (define (unison-POp-ANDN m n) (fxlogand m n)) + (define (unison-POp-ANDN m n) (fxand m n)) (define unison-POp-BLDS list) (define (unison-POp-CATS l r) (append l r)) (define (unison-POp-CATT l r) (istring-append l r)) (define (unison-POp-CMPU l r) (universal-compare l r)) - (define (unison-POp-COMN n) (fxlognot n)) + (define (unison-POp-COMN n) (fxnot n)) (define (unison-POp-CONS x xs) (cons x xs)) (define (unison-POp-DECI n) (fx1- n)) (define (unison-POp-DIVN m n) (fxdiv m n)) @@ -133,7 +132,7 @@ (define (unison-POp-DRPS n l) (let ([m (max 0 (min n (length l)))]) (list-tail l m))) (define (unison-POp-DRPT n t) (istring-drop n t)) - (define (unison-POp-EQLN m n) (if (fx= m n) 1 0)) + (define (unison-POp-EQLN m n) (if (fx=? m n) 1 0)) (define (unison-POp-EQLT s t) (if (string=? s t) 1 0)) (define (unison-POp-EQLU x y) (if (equal? x y) 1 0)) (define (unison-POp-EROR fnm x) @@ -145,17 +144,15 @@ (define (unison-POp-FTOT f) (number->istring f)) (define (unison-POp-IDXB n bs) (bytevector-u8-ref bs n)) (define (unison-POp-IDXS n l) - (call/1cc - (lambda (k) - (with-exception-handler - (lambda (e) (list 0)) - (lambda () (list-ref l n)))))) - (define (unison-POp-IORN m n) (fxlogior m n)) + (guard + (e [else (list 0)]) + (list-ref l n))) + (define (unison-POp-IORN m n) (fxior m n)) (define (unison-POp-ITOT i) (signed-number->istring i)) - (define (unison-POp-LEQN m n) (if (fx<= m n) 1 0)) + (define (unison-POp-LEQN m n) (if (fx<=? m n) 1 0)) (define (unison-POp-LZRO m) (- 64 (fxlength m))) (define (unison-POp-MULN m n) (fx* m n)) - (define (unison-POp-MODN m n) (fxmodulo m n)) + (define (unison-POp-MODN m n) (fxmod m n)) (define (unison-POp-NTOT m) (number->istring m)) (define (unison-POp-PAKB l) (u8-list->ibytevector l)) (define (unison-POp-PAKT l) (list->istring l)) @@ -239,16 +236,14 @@ (vector-set! dst (+ doff i) (vector-ref src (+ soff i))) (next (fx1- i)))))))) - (define (unison-FOp-MutableArray.freeze! vec) - (($primitive $vector-set-immutable!) vec) - vec) + (define unison-FOp-MutableArray.freeze! freeze-vector!) (define (unison-FOp-MutableArray.freeze src off len) (let ([dst (make-vector len)]) (let next ([i (fx1- len)]) (if (< i 0) (begin - (($primitive $vector-set-immutable!) dst) + (freeze-vector! dst) (list 1 dst)) (begin (vector-set! dst i (vector-ref src (+ off i))) From 08c71f3f0e72e67810faaa777c3e37dd167b5ab8 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 26 Jan 2023 18:57:59 -0500 Subject: [PATCH 135/467] Include (unison vector) library for freezing --- chez-libs/unison/vector.ss | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 chez-libs/unison/vector.ss diff --git a/chez-libs/unison/vector.ss b/chez-libs/unison/vector.ss new file mode 100644 index 000000000..9044456ef --- /dev/null +++ b/chez-libs/unison/vector.ss @@ -0,0 +1,9 @@ + +(library (unison vector) + (export + freeze-vector!) + + (import (chezscheme)) + + (define (freeze-vector! vec) + (($primitive $vector-set-immutable!) vec))) From ccc51785377fdec615aa87cbbabb1e876d58a734 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 27 Jan 2023 10:26:23 -0500 Subject: [PATCH 136/467] Move (unison primops) to a neutral scheme-libs directory --- {chez-libs => scheme-libs}/unison/primops.ss | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {chez-libs => scheme-libs}/unison/primops.ss (100%) diff --git a/chez-libs/unison/primops.ss b/scheme-libs/unison/primops.ss similarity index 100% rename from chez-libs/unison/primops.ss rename to scheme-libs/unison/primops.ss From ca047bcf84f6f6e910ee66c6b139d0ec8aed706c Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 27 Jan 2023 10:37:30 -0500 Subject: [PATCH 137/467] Create directory hierarchy for scheme libs --- {chez-libs => scheme-libs/chez}/unison/boot.ss | 0 {chez-libs => scheme-libs/chez}/unison/bytevector.ss | 0 {chez-libs => scheme-libs/chez}/unison/cont.ss | 0 {chez-libs => scheme-libs/chez}/unison/core.ss | 0 {chez-libs => scheme-libs/chez}/unison/string.ss | 0 {chez-libs => scheme-libs/chez}/unison/vector.ss | 0 scheme-libs/{ => common}/unison/primops.ss | 0 {chez-libs => scheme-libs}/readme.md | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {chez-libs => scheme-libs/chez}/unison/boot.ss (100%) rename {chez-libs => scheme-libs/chez}/unison/bytevector.ss (100%) rename {chez-libs => scheme-libs/chez}/unison/cont.ss (100%) rename {chez-libs => scheme-libs/chez}/unison/core.ss (100%) rename {chez-libs => scheme-libs/chez}/unison/string.ss (100%) rename {chez-libs => scheme-libs/chez}/unison/vector.ss (100%) rename scheme-libs/{ => common}/unison/primops.ss (100%) rename {chez-libs => scheme-libs}/readme.md (100%) diff --git a/chez-libs/unison/boot.ss b/scheme-libs/chez/unison/boot.ss similarity index 100% rename from chez-libs/unison/boot.ss rename to scheme-libs/chez/unison/boot.ss diff --git a/chez-libs/unison/bytevector.ss b/scheme-libs/chez/unison/bytevector.ss similarity index 100% rename from chez-libs/unison/bytevector.ss rename to scheme-libs/chez/unison/bytevector.ss diff --git a/chez-libs/unison/cont.ss b/scheme-libs/chez/unison/cont.ss similarity index 100% rename from chez-libs/unison/cont.ss rename to scheme-libs/chez/unison/cont.ss diff --git a/chez-libs/unison/core.ss b/scheme-libs/chez/unison/core.ss similarity index 100% rename from chez-libs/unison/core.ss rename to scheme-libs/chez/unison/core.ss diff --git a/chez-libs/unison/string.ss b/scheme-libs/chez/unison/string.ss similarity index 100% rename from chez-libs/unison/string.ss rename to scheme-libs/chez/unison/string.ss diff --git a/chez-libs/unison/vector.ss b/scheme-libs/chez/unison/vector.ss similarity index 100% rename from chez-libs/unison/vector.ss rename to scheme-libs/chez/unison/vector.ss diff --git a/scheme-libs/unison/primops.ss b/scheme-libs/common/unison/primops.ss similarity index 100% rename from scheme-libs/unison/primops.ss rename to scheme-libs/common/unison/primops.ss diff --git a/chez-libs/readme.md b/scheme-libs/readme.md similarity index 100% rename from chez-libs/readme.md rename to scheme-libs/readme.md From bcee20376215b1ee179cbb668ee94fd7b79fa883 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Fri, 27 Jan 2023 10:10:14 -0600 Subject: [PATCH 138/467] Wait until server responds to shut down the server --- .../Codebase/Editor/HandleInput/AuthLogin.hs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs index fd92266ee..9faed3bcf 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs @@ -71,23 +71,27 @@ authLogin host = do -- and it all works out fine. redirectURIVar <- liftIO newEmptyMVar (verifier, challenge, state) <- generateParams - let codeHandler code mayNextURI = do + let codeHandler :: (Code -> Maybe URI -> (Response -> IO ResponseReceived) -> IO ResponseReceived) + codeHandler code mayNextURI respond = do redirectURI <- readMVar redirectURIVar result <- exchangeCode httpClient tokenEndpoint code verifier redirectURI - putMVar authResultVar result - case result of + respReceived <- case result of Left err -> do Debug.debugM Debug.Auth "Auth Error" err - pure $ Wai.responseLBS internalServerError500 [] "Something went wrong, please try again." + respond $ Wai.responseLBS internalServerError500 [] "Something went wrong, please try again." Right _ -> case mayNextURI of - Nothing -> pure $ Wai.responseLBS found302 [] "Authorization successful. You may close this page and return to UCM." + Nothing -> respond $ Wai.responseLBS found302 [] "Authorization successful. You may close this page and return to UCM." Just nextURI -> - pure $ + respond $ Wai.responseLBS found302 [("LOCATION", BSC.pack $ show @URI nextURI)] "Authorization successful. You may close this page and return to UCM." + -- Wait until we've responded to the browser before putting the result, + -- otherwise the server will shut down prematurely. + putMVar authResultVar result + pure respReceived tokens <- Cli.with (Warp.withApplication (pure $ authTransferServer codeHandler)) \port -> do let redirectURI = "http://localhost:" <> show port <> "/redirect" @@ -105,11 +109,11 @@ authLogin host = do -- | A server in the format expected for a Wai Application -- This is a temporary server which is spun up only until we get a code back from the -- auth server. -authTransferServer :: (Code -> Maybe URI -> IO Response) -> Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived +authTransferServer :: (Code -> Maybe URI -> (Response -> IO ResponseReceived) -> IO ResponseReceived) -> Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived authTransferServer callback req respond = case (requestMethod req, pathInfo req, getQueryParams req) of ("GET", ["redirect"], (Just code, maybeNextURI)) -> do - callback code maybeNextURI >>= respond + callback code maybeNextURI respond _ -> respond (responseLBS status404 [] "Not Found") where getQueryParams req = do From c9dc7ce2e99a7b40df1b096f11be81d7a8637df8 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 3 Jun 2022 21:33:25 -0400 Subject: [PATCH 139/467] Add nix flake for common dev env --- flake.lock | 43 ++++++++++++++++++++++++++ flake.nix | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..c5ce4e9c7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1674781052, + "narHash": "sha256-nseKFXRvmZ+BDAeWQtsiad+5MnvI/M2Ak9iAWzooWBw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cc4bb87f5457ba06af9ae57ee4328a49ce674b1b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..ed9053606 --- /dev/null +++ b/flake.nix @@ -0,0 +1,91 @@ +{ + description = "A common environment for unison development"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + }; + + outputs = { self, flake-utils, nixpkgs }: + let + systemAttrs = flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages."${system}".extend self.overlay; + + mystack = pkgs.stack; + ghc-version = "8107"; + ghc = pkgs.haskell.packages."ghc${ghc-version}"; + make-ormolu = p: + p.callHackageDirect { + pkg = "ormolu"; + ver = "0.4.0.0"; + sha256 = "0r8jb8lpaxx7wxnvxiynx2dkrfibfl8nxnjl5n4vwy0az166bbnd"; + } { + ghc-lib-parser = + pkgs.haskellPackages.ghc-lib-parser_9_2_5_20221107; + Cabal = pkgs.haskellPackages.Cabal_3_6_3_0; + }; + myhls = let + hp = pkgs.haskellPackages.extend hp-override; + hp-override = final: prev: { + hls-floskell-plugin = + pkgs.haskell.lib.dontCheck prev.hls-floskell-plugin; + hls-rename-plugin = + pkgs.haskell.lib.dontCheck prev.hls-rename-plugin; + haskell-language-server = + pkgs.haskell.lib.overrideCabal prev.haskell-language-server + (drv: { + configureFlags = drv.configureFlags ++ [ + "-f-brittany" + "-f-fourmolu" + "-f-floskell" + "-f-stylishhaskell" + "-f-hlint" + ]; + }); + ormolu = make-ormolu final; + }; + in pkgs.haskell-language-server.override { + haskellPackages = hp; + dynamic = true; + supportedGhcVersions = [ ghc-version ]; + }; + myormolu = make-ormolu pkgs.haskellPackages; + + unison-env = pkgs.mkShell { + packages = with pkgs; [ + mystack + haskell.compiler."ghc${ghc-version}" + myormolu + myhls + pkg-config + zlib + ]; + # workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/11042 + shellHook = '' + export LD_LIBRARY_PATH=${pkgs.zlib}/lib:$LD_LIBRARY_PATH + ''; + }; + in { + + apps.repl = flake-utils.lib.mkApp { + drv = + nixpkgs.legacyPackages."${system}".writeShellScriptBin "repl" '' + confnix=$(mktemp) + echo "builtins.getFlake (toString $(git rev-parse --show-toplevel))" >$confnix + trap "rm $confnix" EXIT + nix repl $confnix + ''; + }; + + pkgs = pkgs; + + devShell = unison-env; + + packages = { }; + + defaultPackage = self.packages."${system}".unison-env; + }); + topLevelAttrs = { overlay = final: prev: { }; }; + in systemAttrs // topLevelAttrs; +} From 872e942921336f9e0361496c1f1695187af30b94 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 27 Jan 2023 13:20:55 -0500 Subject: [PATCH 140/467] (unison core) racket implementation - Factored the exception displaying function to be a core function that needn't be implemented using ports. --- scheme-libs/chez/unison/core.ss | 7 +++- scheme-libs/common/unison/primops.ss | 4 +-- scheme-libs/racket/unison/core.ss | 51 ++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 scheme-libs/racket/unison/core.ss diff --git a/scheme-libs/chez/unison/core.ss b/scheme-libs/chez/unison/core.ss index 63dd2c169..cc9d287d0 100644 --- a/scheme-libs/chez/unison/core.ss +++ b/scheme-libs/chez/unison/core.ss @@ -20,7 +20,7 @@ fx1- list-head - display-condition) + exception->string) (import (chezscheme)) @@ -108,4 +108,9 @@ [(equal? l r) 1] [(and (number? l) (number? r)) (if (< l r) 0 2)] [else (raise "universal-compare: unimplemented")])) + + (define (exception->string e) + (let-values ([(port result) (open-string-output-port)]) + (display-condition e port) + (result))) ) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 4e81786e9..c44d1ecdc 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -112,9 +112,7 @@ (define (reify-exn thunk) (guard (e [else - (let-values ([(port result) (open-string-output-port)]) - (display-condition e port) - (list 0 '() (result) e))]) + (list 0 '() (exception->string e) e) ]) (thunk))) ; Core implemented primops, upon which primops-in-unison can be built. diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss new file mode 100644 index 000000000..a1a88835e --- /dev/null +++ b/scheme-libs/racket/unison/core.ss @@ -0,0 +1,51 @@ +; This library implements various functions and macros that are used +; internally to the unison scheme libraries. This provides e.g. a +; measure of abstraction for the particular scheme platform. A useful +; feature of one implementation might need to be implemented on top of +; other features of another, and would go in this library. +; +; This library won't be directly imported by the generated unison +; code, so if some function is needed for those, it should be +; re-exported by (unison boot). +#!r6rs +(library (unison core) + (export + describe-value + decode-value + + universal-compare + + fx1- + list-head + + exception->string) + + (import (rnrs) (racket exn)) + + (define (fx1- n) (fx- n 1)) + + (define (list-head l n) + (let rec ([c l] [m n]) + (cond + [(eqv? m 0) '()] + [(null? c) '()] + [else + (let ([sub (rec (cdr c) (- m 1))]) + (cons (car c) sub))]))) + + (define (describe-value x) '()) + (define (decode-value x) '()) + + ; 0 = LT + ; 1 = EQ + ; 2 = GT + (define (universal-compare l r) + (cond + [(equal? l r) 1] + [(and (number? l) (number? r)) (if (< l r) 0 2)] + [else (raise "universal-compare: unimplemented")])) + + (define exception->string exn->string) + + ) + From 6e6af086bc4c1738c3a26b69e0262f72131a42af Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 27 Jan 2023 12:28:14 -0800 Subject: [PATCH 141/467] adds tips for m1 mac toolchain setup so that others wont' suffer --- README.md | 6 +- docs/new-m1-mac-setup-tips.markdown | 162 ++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 docs/new-m1-mac-setup-tips.markdown diff --git a/README.md b/README.md index feb396101..3e015425f 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ If these instructions don't work for you or are incomplete, please file an issue The build uses [Stack](http://docs.haskellstack.org/). If you don't already have it installed, [follow the install instructions](http://docs.haskellstack.org/en/stable/README.html#how-to-install) for your platform. (Hint: `brew update && brew install stack`) +If you have not set up the Haskell toolchain before and are trying to contribute to Unison on an M1 Mac, we have [some tips specifically for you](docs/new-m1-mac-setup-tips.markdown/new). + ```sh $ git clone https://github.com/unisonweb/unison.git $ cd unison @@ -49,7 +51,7 @@ $ stack --version # we'll want to know this version if you run into trouble $ stack build --fast --test && stack exec unison ``` -To run the Unison Local UI while building from source, you can use the `/dev-ui-install.sh` script. It will download the latest release of [unison-local-ui](https://github.com/unisonweb/unison-local-ui) and put it in the expected location for the unison executable created by `stack build`. When you start unison, you'll see a url where Unison Local UI is running. +To run the Unison Local UI while building from source, you can use the `/dev-ui-install.sh` script. It will download the latest release of [unison-local-ui](https://github.com/unisonweb/unison-local-ui) and put it in the expected location for the unison executable created by `stack build`. When you start unison, you'll see a url where Unison Local UI is running. See [`development.markdown`](development.markdown) for a list of build commands you'll likely use during development. @@ -61,7 +63,7 @@ View Language Server setup instructions [here](docs/language-server.markdown). Codebase Server --------------- -When `ucm` starts it starts a Codebase web server that is used by the +When `ucm` starts it starts a Codebase web server that is used by the [Unison Local UI](https://github.com/unisonweb/unison-local-ui). It selects a random port and a unique token that must be used when starting the UI to correctly connect to the server. diff --git a/docs/new-m1-mac-setup-tips.markdown b/docs/new-m1-mac-setup-tips.markdown new file mode 100644 index 000000000..a438d93e0 --- /dev/null +++ b/docs/new-m1-mac-setup-tips.markdown @@ -0,0 +1,162 @@ + +# M1 Mac Haskell toolchain setup + +If you are a newcomer to the Haskell ecosystem trying to set up your dev environment on a Mac M1 computer, welcome, you can do this! The tips in this document provide one way to get a working development setup, but are not the only path forward. If you haven't downloaded the Haskell toolchain before, our recommendation is to use GHCup. If you're a veteran Haskell developer, much of this won't apply to you as it's likely you already have a working development environment. + +Here are the versions you'll need to build the Unison executable (as of January 24th, 2023) + +GHC version: 8.10.7 +Stack version: 2.7.5 +Cabal version 3.6.2.0 +Haskell language server version: 1.7.0.0 + +## Newcomer setup tips + +[Install GHCup using the instructions on their website.](https://www.haskell.org/ghcup/) Once it's isnstalled make sure `ghcup` is on your path. + +``` +export PATH="$HOME/.ghcup/bin:$PATH" +``` + +GHCup has a nice ui for setting Haskell toolchain versions for the project. Enter `ghcup tui` to open it up and follow the instructions for installing and setting the versions there. GHCup will try to download M1 native binaries for the versions given. + +Check your clang version. For [hand-wavey reasons](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/301) we recommend you use llvm version 12. + +```shell +$ clang --version +Homebrew clang version 12.0.1 +Target: arm64-apple-darwin20.2.0 +Thread model: posix +InstalledDir: /opt/homebrew/opt/llvm@12/bin +``` + +At the end of the process you should see something like the following for executable locations and versions. + +```shell +$ which ghcup +~/.ghcup/bin/ghcup +$ ghcup --version +The GHCup Haskell installer, version 0.1.19.0 +``` + +```bash +$ which stack +~/.ghcup/bin/stack +$ stack --version +Version 2.7.5, Git revision 717ec96c15520748f3fcee00f72504ddccaa30b5 (dirty) (163 commits) aarch64 +``` + +```shell +$ which ghc +~/.ghcup/bin/ghc +$ ghc --version +The Glorious Glasgow Haskell Compilation System, version 8.10.7 +``` + +Check which GHC version Stack thinks it's using too, for good measure: + +```shell +$ stack ghc -- --version +The Glorious Glasgow Haskell Compilation System, version 8.10.7 +$ stack exec -- which ghc +~/.ghcup/ghc/8.10.7/bin/ghc +``` + +```shell +$ which haskell-language-server-wrapper +~/.ghcup/bin/haskell-language-server-wrapper +$ haskell-language-server-wrapper + +Found "...unison/hie.yaml" for "...unison/a" +Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.7.0.0 aarch64 ghc-9.2.2 +Current directory: ...unison +Operating system: darwin +Arguments: [] +Cradle directory: ...unison +Cradle type: Stack + +Tool versions found on the $PATH +cabal: 3.6.2.0 +stack: 2.7.5 +ghc: 8.10.7 +``` + +If you're a VS Code user, you can download the Haskell extension for IDE support. You may need to configure it in `settings.json`. + +```json + "haskell.manageHLS": "GHCup", + "haskell.toolchain": { + "stack": "2.7.5", + "ghc": "8.10.7", + "cabal": "recommended", + "hls": "1.7.0.0" + } +``` + +These setting blocks say that the VS Code extension will use GHCup for your Haskell language server distribution, and sets the versions for elements in the toolchain. + +## Troubleshooting: + +The VS Code extension has compiled a helpful list of troubleshooting steps here: https://github.com/haskell/vscode-haskell#troubleshooting + +### "Couldn't figure out LLVM version" or "failed to compile a sanity check" errors + +``` +: error: + Warning: Couldn't figure out LLVM version! + Make sure you have installed LLVM between [9 and 13) +ghc: could not execute: opt +``` + +Or + +``` +ld: symbol(s) not found for architecture x86_64 +clang: error: linker command failed with exit code 1 (use -v to see invocation) +`gcc' failed in phase `Linker'. (Exit code: 1) +``` + +Try installing llvm version 12 +`brew install llvm@12` + +and prepend it to your path +``` +export PATH="$(brew --prefix)/opt/llvm@12/bin:$PATH" +``` + +(The GHC version 8.10.7 mentions it supports LLVM versions up to 12. https://www.haskell.org/ghc/download_ghc_8_10_7.html) + +### "GHC ABIs don't match!" + +Follow the steps here: + +https://github.com/haskell/vscode-haskell#ghc-abis-dont-match + +We found some success telling Stack to use the system's GHC instead of managing its own version of GHC. You can try this by setting the following two configuration flags in ~/.stack/config.yaml + +``` +system-ghc: true +install-ghc: false +``` + +This is telling Stack to use the GHC executable that it finds on your $PATH. Make sure the ghc being provided is the proper version, 8.10.7, from ghcup. + +Note that you may need to clean the cache for the project after this failure with `stack clean --full` if you have previously built things with a different stack distribution. + +### "stack" commands like "stack build" cause a segfault: + +1. Make sure your stack state is clean. `stack clean --full` removes the project's stack work directories (things in .stack-work). +2. [Wait for this bug to be fixed (or help fix this bug!)](https://github.com/commercialhaskell/stack/issues/5607) +3. Or Subshell out your stack commands $(stack blahblah) +4. Or use bash instead of zsh + +### Help! Everything is broken and I want to start over + +Warning, the following will remove ghcup, configuration files, cached packages, and versions of the toolchain. + +``` +ghcup nuke +rm -rf ~/.ghcup +rm -rf ~/.stack +rm -rf ~/.cabal +``` From d5ce3e9f093bc4c32beaa2c68e91d60b5cf0e4a0 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 27 Jan 2023 12:41:37 -0800 Subject: [PATCH 142/467] updating wording in mac-help doc --- docs/new-m1-mac-setup-tips.markdown | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/new-m1-mac-setup-tips.markdown b/docs/new-m1-mac-setup-tips.markdown index a438d93e0..f7629c6cf 100644 --- a/docs/new-m1-mac-setup-tips.markdown +++ b/docs/new-m1-mac-setup-tips.markdown @@ -1,18 +1,20 @@ # M1 Mac Haskell toolchain setup -If you are a newcomer to the Haskell ecosystem trying to set up your dev environment on a Mac M1 computer, welcome, you can do this! The tips in this document provide one way to get a working development setup, but are not the only path forward. If you haven't downloaded the Haskell toolchain before, our recommendation is to use GHCup. If you're a veteran Haskell developer, much of this won't apply to you as it's likely you already have a working development environment. +If you are a newcomer to the Haskell ecosystem trying to set up your dev environment on a Mac M1 computer, welcome, you can do this! The tips in this document provide one way to get a working development setup, but are not the only path forward. If you haven't downloaded the Haskell toolchain before, our recommendation is to use GHCup. We've found that issues can arise if you mix ARM native binaries with x86 binaries to be run with Rosetta. If you're a veteran Haskell developer, much of this won't apply to you as it's likely you already have a working development environment. -Here are the versions you'll need to build the Unison executable (as of January 24th, 2023) +Here is a working set of versions you can use to build the Unison executable: GHC version: 8.10.7 Stack version: 2.7.5 Cabal version 3.6.2.0 Haskell language server version: 1.7.0.0 +The GHC version for the project can be confirmed by looking at the `resolver` key in this project's `stack.yaml`. + ## Newcomer setup tips -[Install GHCup using the instructions on their website.](https://www.haskell.org/ghcup/) Once it's isnstalled make sure `ghcup` is on your path. +[Install GHCup using the instructions on their website.](https://www.haskell.org/ghcup/) Once it's installed make sure `ghcup` is on your path. ``` export PATH="$HOME/.ghcup/bin:$PATH" @@ -20,7 +22,7 @@ export PATH="$HOME/.ghcup/bin:$PATH" GHCup has a nice ui for setting Haskell toolchain versions for the project. Enter `ghcup tui` to open it up and follow the instructions for installing and setting the versions there. GHCup will try to download M1 native binaries for the versions given. -Check your clang version. For [hand-wavey reasons](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/301) we recommend you use llvm version 12. +Check your clang version. For [hand-wavey reasons](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/301) we recommend you use llvm version 12. See troubleshooting note below about changing your LLVM if your version is different. ```shell $ clang --version @@ -147,7 +149,7 @@ Note that you may need to clean the cache for the project after this failure wit 1. Make sure your stack state is clean. `stack clean --full` removes the project's stack work directories (things in .stack-work). 2. [Wait for this bug to be fixed (or help fix this bug!)](https://github.com/commercialhaskell/stack/issues/5607) -3. Or Subshell out your stack commands $(stack blahblah) +3. Or subshell out your stack commands `$(stack commandHere)` 4. Or use bash instead of zsh ### Help! Everything is broken and I want to start over From 95b922a140f13376f11fd9cd663fdcd88a925615 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 27 Jan 2023 12:49:45 -0800 Subject: [PATCH 143/467] rename file --- README.md | 2 +- ...ew-m1-mac-setup-tips.markdown => m1-mac-setup-tips.markdown} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename docs/{new-m1-mac-setup-tips.markdown => m1-mac-setup-tips.markdown} (100%) diff --git a/README.md b/README.md index 3e015425f..0a046567d 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ If these instructions don't work for you or are incomplete, please file an issue The build uses [Stack](http://docs.haskellstack.org/). If you don't already have it installed, [follow the install instructions](http://docs.haskellstack.org/en/stable/README.html#how-to-install) for your platform. (Hint: `brew update && brew install stack`) -If you have not set up the Haskell toolchain before and are trying to contribute to Unison on an M1 Mac, we have [some tips specifically for you](docs/new-m1-mac-setup-tips.markdown/new). +If you have not set up the Haskell toolchain before and are trying to contribute to Unison on an M1 Mac, we have [some tips specifically for you](docs/m1-mac-setup-tips.markdown/new). ```sh $ git clone https://github.com/unisonweb/unison.git diff --git a/docs/new-m1-mac-setup-tips.markdown b/docs/m1-mac-setup-tips.markdown similarity index 100% rename from docs/new-m1-mac-setup-tips.markdown rename to docs/m1-mac-setup-tips.markdown From 315af2e2404c35de70d4066eeded4e4fda9bc983 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Sat, 28 Jan 2023 07:38:41 -0600 Subject: [PATCH 144/467] Cryptographic Hashing! Adding some primops and crypto FOps Because this introduces new runtime dynamic dependencies, I've made them "soft" dependencies for now: you only need to install libcrypto and libb2 if you're using the cryptographic hash functions. Otherwise, this shouldn't impact anyone else's workstream. I've also tried to provide verbose & helpful error messages. --- chez-libs/unison/crypto.ss | 94 +++++++++++++++++++++++++++++++++++++ chez-libs/unison/primops.ss | 35 ++++++++++++-- 2 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 chez-libs/unison/crypto.ss diff --git a/chez-libs/unison/crypto.ss b/chez-libs/unison/crypto.ss new file mode 100644 index 000000000..2c77c7f6e --- /dev/null +++ b/chez-libs/unison/crypto.ss @@ -0,0 +1,94 @@ + +(library (unison crypto) + (export + unison-FOp-crypto.HashAlgorithm.Sha1 + unison-FOp-crypto.hashBytes) + + (import (chezscheme) + (unison core) + (unison string) + (unison bytevector)) + + (define try-load-shared (lambda (name message) + (guard (x [else (begin + (printf "\n🚨🚨🚨 Unable to load shared library ~s🚨🚨🚨\n---> ~a\n\nOriginal exception:\n" name message) + (raise x) + )]) + (load-shared-object name) + #t))) + + (define _libcrypto (try-load-shared "libcrypto.3.dylib" "Do you have openssl installed?")) + (define _libb2 (try-load-shared "libb2.dylib" "Do you have libb2 installed?")) + + (define EVP_Digest + (foreign-procedure "EVP_Digest" + ( + u8* ; input buffer + unsigned-int ; length of input + u8* ; output buffer + boolean ; note: not a boolean, we just need to be able to pass NULL (0) + void* ; the EVP_MD* pointer, which holds the digest algorithm + boolean ; note: not a boolean, we just need to be able to pass NULL (0) + ) + ; 1 if success, 0 or -1 for failure + int)) + + (define digest (lambda (text kind bits) + (let ([buffer (make-bytevector (/ bits 8))]) + (if (= 1 (EVP_Digest text (bytevector-length text) buffer #f kind #f)) + buffer + #f)))) + + (define EVP_sha1 (foreign-procedure "EVP_sha1" () void*)) + (define EVP_sha256 (foreign-procedure "EVP_sha256" () void*)) + (define EVP_sha512 (foreign-procedure "EVP_sha512" () void*)) + (define EVP_sha3_256 (foreign-procedure "EVP_sha3_256" () void*)) + (define EVP_sha3_512 (foreign-procedure "EVP_sha3_512" () void*)) + + (define sha1 (lambda (text) (digest text (EVP_sha1) 160))) + (define sha256 (lambda (text) (digest text (EVP_sha256) 256))) + (define sha512 (lambda (text) (digest text (EVP_sha512) 512))) + (define sha3_256 (lambda (text) (digest text (EVP_sha3_256) 256))) + (define sha3_512 (lambda (text) (digest text (EVP_sha3_512) 512))) + + (define blake2b-raw + (foreign-procedure "blake2b" + ( + u8* ; output buffer + string ; input buffer + u8* ; input key + int ; output length + int ; input length + int ; key length + ) int + )) + + (define blake2s-raw + (foreign-procedure "blake2s" + ( + u8* ; output buffer + string ; input buffer + u8* ; input key + int ; output length + int ; input length + int ; key length + ) int + )) + + (define blake2s (lambda (text size) + (let ([buffer (make-bytevector (/ size 8))]) + (if (= 0 (blake2s-raw buffer text #f (/ size 8) (string-length text) 0)) + buffer + #f)))) + + (define blake2b (lambda (text size) + (let ([buffer (make-bytevector (/ size 8))]) + (if (= 0 (blake2b-raw buffer text #f (/ size 8) (string-length text) 0)) + buffer + #f)))) + + (define (unison-FOp-crypto.HashAlgorithm.Sha1) sha1) + (define (unison-FOp-crypto.hashBytes algo text) + (algo text)) + + ) diff --git a/chez-libs/unison/primops.ss b/chez-libs/unison/primops.ss index 86039ed4c..1a270ce14 100644 --- a/chez-libs/unison/primops.ss +++ b/chez-libs/unison/primops.ss @@ -101,13 +101,35 @@ unison-POp-VALU unison-POp-VWLS + unison-POp-UPKB + unison-POp-ADDI + unison-POp-DIVI + unison-POp-EQLI + unison-POp-MODI + unison-POp-LEQI + unison-POp-POWN + unison-POp-VWRS + + unison-FOp-crypto.HashAlgorithm.Sha1 + unison-FOp-crypto.hashBytes ) (import (chezscheme) (unison core) (unison string) + (unison crypto) (unison bytevector)) + (define unison-POp-UPKB bytevector->u8-list) + (define unison-POp-ADDI +) + (define unison-POp-DIVI /) + (define (unison-POp-EQLI a b) + (if (= a b) 1 0) + ) + (define unison-POp-MODI mod) + (define unison-POp-LEQI <=) + (define unison-POp-POWN expt) + (define (reify-exn thunk) (call/1cc (lambda (k) @@ -145,11 +167,8 @@ (define (unison-POp-FTOT f) (number->istring f)) (define (unison-POp-IDXB n bs) (bytevector-u8-ref bs n)) (define (unison-POp-IDXS n l) - (call/1cc - (lambda (k) - (with-exception-handler - (lambda (e) (list 0)) - (lambda () (list-ref l n)))))) + (guard (x [else (list 0)]) + (list 1 (list-ref l n)))) (define (unison-POp-IORN m n) (fxlogior m n)) (define (unison-POp-ITOT i) (signed-number->istring i)) (define (unison-POp-LEQN m n) (if (fx<= m n) 1 0)) @@ -182,6 +201,12 @@ (if (null? l) (list 0) (list 1 (car l) (cdr l)))) + (define (unison-POp-VWRS l) + (if (null? l) + (list 0) + (let ([r (reverse l)]) + (list 1 (reverse (cdr l)) (car l))))) + (define (unison-POp-XORN m n) (fxxor m n)) (define (unison-POp-VALU c) (decode-value c)) From 894ab343e33f29381dec4dbc1cf36bf7df044625 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Sat, 28 Jan 2023 08:39:23 -0600 Subject: [PATCH 145/467] [crypto-1] better loading --- chez-libs/unison/crypto.ss | 40 ++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/chez-libs/unison/crypto.ss b/chez-libs/unison/crypto.ss index 2c77c7f6e..6285d6103 100644 --- a/chez-libs/unison/crypto.ss +++ b/chez-libs/unison/crypto.ss @@ -9,19 +9,29 @@ (unison string) (unison bytevector)) + (define (capture-output fn) + (parameterize ((current-output-port (open-output-string))) + (fn) + (get-output-string (current-output-port)))) + (define try-load-shared (lambda (name message) - (guard (x [else (begin - (printf "\n🚨🚨🚨 Unable to load shared library ~s🚨🚨🚨\n---> ~a\n\nOriginal exception:\n" name message) + (guard (x [else (lambda () + (printf "\n🚨🚨🚨 (crypto.ss) Unable to load shared library ~s 🚨🚨🚨\n---> ~a\n\nOriginal exception:\n" name message) (raise x) )]) (load-shared-object name) #t))) - (define _libcrypto (try-load-shared "libcrypto.3.dylib" "Do you have openssl installed?")) - (define _libb2 (try-load-shared "libb2.dylib" "Do you have libb2 installed?")) + (define libcrypto (try-load-shared "libcrypto.3.dylib" "Do you have openssl installed?")) + (define libb2 (try-load-shared "libb2.dylib" "Do you have libb2 installed?")) + + (define (if-loaded source fn) + (case source + (#t (fn)) + (else (lambda args (source))))) (define EVP_Digest - (foreign-procedure "EVP_Digest" + (if-loaded libcrypto (lambda () (foreign-procedure "EVP_Digest" ( u8* ; input buffer unsigned-int ; length of input @@ -31,7 +41,7 @@ boolean ; note: not a boolean, we just need to be able to pass NULL (0) ) ; 1 if success, 0 or -1 for failure - int)) + int)))) (define digest (lambda (text kind bits) (let ([buffer (make-bytevector (/ bits 8))]) @@ -39,11 +49,11 @@ buffer #f)))) - (define EVP_sha1 (foreign-procedure "EVP_sha1" () void*)) - (define EVP_sha256 (foreign-procedure "EVP_sha256" () void*)) - (define EVP_sha512 (foreign-procedure "EVP_sha512" () void*)) - (define EVP_sha3_256 (foreign-procedure "EVP_sha3_256" () void*)) - (define EVP_sha3_512 (foreign-procedure "EVP_sha3_512" () void*)) + (define EVP_sha1 (if-loaded libcrypto (lambda () (foreign-procedure "EVP_sha1" () void*)))) + (define EVP_sha256 (if-loaded libcrypto (lambda () (foreign-procedure "EVP_sha256" () void*)))) + (define EVP_sha512 (if-loaded libcrypto (lambda () (foreign-procedure "EVP_sha512" () void*)))) + (define EVP_sha3_256 (if-loaded libcrypto (lambda () (foreign-procedure "EVP_sha3_256" () void*)))) + (define EVP_sha3_512 (if-loaded libcrypto (lambda () (foreign-procedure "EVP_sha3_512" () void*)))) (define sha1 (lambda (text) (digest text (EVP_sha1) 160))) (define sha256 (lambda (text) (digest text (EVP_sha256) 256))) @@ -52,7 +62,7 @@ (define sha3_512 (lambda (text) (digest text (EVP_sha3_512) 512))) (define blake2b-raw - (foreign-procedure "blake2b" + (if-loaded libb2 (lambda () (foreign-procedure "blake2b" ( u8* ; output buffer string ; input buffer @@ -61,10 +71,10 @@ int ; input length int ; key length ) int - )) + )))) (define blake2s-raw - (foreign-procedure "blake2s" + (if-loaded libb2 (lambda () (foreign-procedure "blake2s" ( u8* ; output buffer string ; input buffer @@ -73,7 +83,7 @@ int ; input length int ; key length ) int - )) + )))) (define blake2s (lambda (text size) (let ([buffer (make-bytevector (/ size 8))]) From 4c155bdc3eb0404e39504e53d7f7117d5faeb1df Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Sat, 28 Jan 2023 08:43:06 -0600 Subject: [PATCH 146/467] [crypto-1] throw errors --- chez-libs/unison/crypto.ss | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/chez-libs/unison/crypto.ss b/chez-libs/unison/crypto.ss index 6285d6103..264c97217 100644 --- a/chez-libs/unison/crypto.ss +++ b/chez-libs/unison/crypto.ss @@ -14,6 +14,9 @@ (fn) (get-output-string (current-output-port)))) + ; if loading the dynamic library is successful, returns true + ; otherwise, returns a lambda that will throw the original error + ; with some helpful messaging. (define try-load-shared (lambda (name message) (guard (x [else (lambda () (printf "\n🚨🚨🚨 (crypto.ss) Unable to load shared library ~s 🚨🚨🚨\n---> ~a\n\nOriginal exception:\n" name message) @@ -25,6 +28,8 @@ (define libcrypto (try-load-shared "libcrypto.3.dylib" "Do you have openssl installed?")) (define libb2 (try-load-shared "libb2.dylib" "Do you have libb2 installed?")) + ; if the "source" library was loaded, call (fn), otherwise returns a lambda + ; that will throw the original source-library-loading exception when called. (define (if-loaded source fn) (case source (#t (fn)) @@ -47,7 +52,7 @@ (let ([buffer (make-bytevector (/ bits 8))]) (if (= 1 (EVP_Digest text (bytevector-length text) buffer #f kind #f)) buffer - #f)))) + (error "crypto.ss digest" "libssl was unable to hash the data for some reason"))))) (define EVP_sha1 (if-loaded libcrypto (lambda () (foreign-procedure "EVP_sha1" () void*)))) (define EVP_sha256 (if-loaded libcrypto (lambda () (foreign-procedure "EVP_sha256" () void*)))) @@ -89,13 +94,13 @@ (let ([buffer (make-bytevector (/ size 8))]) (if (= 0 (blake2s-raw buffer text #f (/ size 8) (string-length text) 0)) buffer - #f)))) + (error "crypto.ss blake2s" "libb2 was unable to hash the data for some reason"))))) (define blake2b (lambda (text size) (let ([buffer (make-bytevector (/ size 8))]) (if (= 0 (blake2b-raw buffer text #f (/ size 8) (string-length text) 0)) buffer - #f)))) + (error "crypto.ss blake2b" "libb2 was unable to hash the data for some reason"))))) (define (unison-FOp-crypto.HashAlgorithm.Sha1) sha1) (define (unison-FOp-crypto.hashBytes algo text) From d65cb39cd90dd1930e0548e56e006d56417ff799 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 08:25:25 -0600 Subject: [PATCH 147/467] Add a basic transcript testing chez generation This runs `generateScheme` to generate some scheme! We don't yet have a ucm command to shell out, so you have to run `scheme` yourself. --- chez-libs/tests/.gitignore | 1 + chez-libs/tests/basic.md | 33 ++++++++++++++++++++ chez-libs/tests/basic.output.md | 53 +++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 chez-libs/tests/.gitignore create mode 100644 chez-libs/tests/basic.md create mode 100644 chez-libs/tests/basic.output.md diff --git a/chez-libs/tests/.gitignore b/chez-libs/tests/.gitignore new file mode 100644 index 000000000..e32f74228 --- /dev/null +++ b/chez-libs/tests/.gitignore @@ -0,0 +1 @@ +*.ss \ No newline at end of file diff --git a/chez-libs/tests/basic.md b/chez-libs/tests/basic.md new file mode 100644 index 000000000..881114799 --- /dev/null +++ b/chez-libs/tests/basic.md @@ -0,0 +1,33 @@ + +```ucm:hide +.> builtins.merge +.> pull unison.public.base.latest.IO +.> pull dolio.public.internal.trunk.compiler +``` + +```unison +printHello = '(printLine "Hello") + +schemeToFile dest link = + fop = open (FilePath dest) Write + text = generateScheme false link + putText fop text + close fop +``` + +```ucm +.> add +``` + +```unison +test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +``` + +```ucm +.> run test1 +``` + +Now run the following: +```bash +$ scheme --libdirs ../:~/.cache/unisonlanguage/scheme-libs/ --script test-1.ss +``` diff --git a/chez-libs/tests/basic.output.md b/chez-libs/tests/basic.output.md new file mode 100644 index 000000000..2d7a3a812 --- /dev/null +++ b/chez-libs/tests/basic.output.md @@ -0,0 +1,53 @@ + +```unison +printHello = '(printLine "Hello") + +schemeToFile dest link = + fop = open (FilePath dest) Write + text = generateScheme false link + putText fop text + close fop +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + printHello : '{IO, Exception} () + schemeToFile : Text -> Term ->{IO, Exception} () + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + printHello : '{IO, Exception} () + schemeToFile : Text -> Term ->{IO, Exception} () + +``` +```unison +test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test1 : '{IO, Exception} () + +``` +```ucm +.> run test1 + + () + +``` From f233f1822f39696a682605739a76f5f59a789d9a Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 30 Jan 2023 10:39:25 -0600 Subject: [PATCH 148/467] Properly obliterate branch on delete --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index bdcbd4203..75497ebc4 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -889,7 +889,7 @@ loop e = do (Path.empty, const Branch.empty0) Cli.respond DeletedEverything else Cli.respond DeleteEverythingConfirmation - DeleteTarget'Branch insistence (Just p) -> do + DeleteTarget'Branch insistence (Just p@(parentPath, childName)) -> do branch <- Cli.expectBranchAtPath' (Path.unsplit' p) description <- inputDescription input absPath <- Cli.resolveSplit' p @@ -911,8 +911,12 @@ loop e = do ppeDecl <- currentPrettyPrintEnvDecl Backend.Within Cli.respondNumbered $ CantDeleteNamespace ppeDecl endangerments Cli.returnEarlyWithoutOutput - Cli.stepAt description $ - BranchUtil.makeDeleteBranch (Path.convert absPath) + parentPathAbs <- Cli.resolvePath' parentPath + -- We have to modify the parent in order to also wipe out the history at the + -- child. + Cli.updateAt description parentPathAbs \parentBranch -> + parentBranch + & Branch.modifyAt (Path.singleton childName) \_ -> Branch.empty afterDelete DisplayI outputLoc names' -> do currentBranch0 <- Cli.getCurrentBranch0 @@ -2796,7 +2800,7 @@ buildScheme main file = do ++ lns gd gen ++ [surround file] -doRunAsScheme :: HQ.HashQualified Name -> [String] -> Cli () +doRunAsScheme :: HQ.HashQualified Name -> [String] -> Cli () doRunAsScheme main args = do fullpath <- generateSchemeFile True (HQ.toString main) main runScheme fullpath args From ff166e1a29c1fbde69a4ee5338d3d2e138436a9f Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 30 Jan 2023 11:08:34 -0600 Subject: [PATCH 149/467] Update transcripts --- unison-src/transcripts/empty-namespaces.md | 6 ++-- .../transcripts/empty-namespaces.output.md | 30 +++++-------------- unison-src/transcripts/merges.md | 3 +- unison-src/transcripts/merges.output.md | 16 +++------- unison-src/transcripts/move-namespace.md | 4 ++- .../transcripts/move-namespace.output.md | 16 +++++----- 6 files changed, 28 insertions(+), 47 deletions(-) diff --git a/unison-src/transcripts/empty-namespaces.md b/unison-src/transcripts/empty-namespaces.md index 9b552bdd5..e73424c4a 100644 --- a/unison-src/transcripts/empty-namespaces.md +++ b/unison-src/transcripts/empty-namespaces.md @@ -22,15 +22,15 @@ The deleted namespace shouldn't appear in `ls` output. ## history -The history of the namespace should still exist if requested explicitly. +The history of the namespace should be empty. ```ucm .> history mynamespace ``` -Merging an empty namespace should still copy its history if it has some. +Merging an empty namespace should be a no-op -```ucm +```ucm:error .empty> history .empty> merge .mynamespace .empty> history diff --git a/unison-src/transcripts/empty-namespaces.output.md b/unison-src/transcripts/empty-namespaces.output.md index 7c682827f..7bc7f00d7 100644 --- a/unison-src/transcripts/empty-namespaces.output.md +++ b/unison-src/transcripts/empty-namespaces.output.md @@ -47,24 +47,15 @@ The deleted namespace shouldn't appear in `ls` output. ``` ## history -The history of the namespace should still exist if requested explicitly. +The history of the namespace should be empty. ```ucm .> history mynamespace - Note: The most recent namespace hash is immediately below this - message. - - ⊙ 1. #nvh8d4j0fm - - - Deletes: - - x - - □ 2. #i52j9fd57b (start of history) + ☝️ The namespace .mynamespace is empty. ``` -Merging an empty namespace should still copy its history if it has some. +Merging an empty namespace should be a no-op ```ucm ☝️ The namespace .empty is empty. @@ -75,20 +66,13 @@ Merging an empty namespace should still copy its history if it has some. .empty> merge .mynamespace - Nothing changed as a result of the merge. + ⚠️ + + The namespace .mynamespace doesn't exist. .empty> history - Note: The most recent namespace hash is immediately below this - message. - - ⊙ 1. #nvh8d4j0fm - - - Deletes: - - x - - □ 2. #i52j9fd57b (start of history) + ☝️ The namespace .empty is empty. ``` Add and then delete a term to add some history to a deleted namespace. diff --git a/unison-src/transcripts/merges.md b/unison-src/transcripts/merges.md index 2292a8877..1c0f28cf8 100644 --- a/unison-src/transcripts/merges.md +++ b/unison-src/transcripts/merges.md @@ -49,7 +49,8 @@ y = "hello" Notice that `master` now has the definition of `y` we wrote. -We can also delete the fork if we're done with it. (Don't worry, it's still in the `history` and can be resurrected at any time.) +We can also delete the fork if we're done with it. (Don't worry, even though the history at that path is now empty, +it's still in the `history` of the parent namespace and can be resurrected at any time.) ```ucm .> delete.namespace .feature1 diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index c074aff69..c727cd0ab 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -96,7 +96,8 @@ y = "hello" Notice that `master` now has the definition of `y` we wrote. -We can also delete the fork if we're done with it. (Don't worry, it's still in the `history` and can be resurrected at any time.) +We can also delete the fork if we're done with it. (Don't worry, even though the history at that path is now empty, +it's still in the `history` of the parent namespace and can be resurrected at any time.) ```ucm .> delete.namespace .feature1 @@ -105,23 +106,14 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t .> history .feature1 - Note: The most recent namespace hash is immediately below this - message. - - ⊙ 1. #hsbtlt2og6 - - - Deletes: - - y - - □ 2. #q95r47tc4l (start of history) + ☝️ The namespace .feature1 is empty. .> history Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #1487pemruj + ⊙ 1. #492bge1qkb - Deletes: diff --git a/unison-src/transcripts/move-namespace.md b/unison-src/transcripts/move-namespace.md index 6496cd8c8..8728be1da 100644 --- a/unison-src/transcripts/move-namespace.md +++ b/unison-src/transcripts/move-namespace.md @@ -58,7 +58,9 @@ b.termInB = 11 .history> update ``` -Now, if we soft-delete a namespace, but move another over it we expect the history to be replaced, and we expect the history from the source to be wiped out. +Deleting a namespace should not leave behind any history, +if we move another to that location we expect the history to simply be the history +of the moved namespace. ```ucm .history> delete.namespace b diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 2b473831c..34eda9f8b 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -150,7 +150,9 @@ b.termInB = 11 b.termInB : Nat ``` -Now, if we soft-delete a namespace, but move another over it we expect the history to be replaced, and we expect the history from the source to be wiped out. +Deleting a namespace should not leave behind any history, +if we move another to that location we expect the history to simply be the history +of the moved namespace. ```ucm .history> delete.namespace b @@ -276,7 +278,7 @@ I should be able to move the root into a sub-namespace - □ 1. #eur72kuror (start of history) + □ 1. #bn675bbtpm (start of history) ``` ```ucm @@ -292,7 +294,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #uu7qrred6m + ⊙ 1. #vor04lbt72 - Deletes: @@ -303,7 +305,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #91mc5pd4t0 + ⊙ 2. #tk3qtdeoov + Adds / updates: @@ -315,20 +317,20 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #ndr3vmlmv7 + ⊙ 3. #r971i7m95i + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #2jqg9n2e8u + ⊙ 4. #6qh988adub > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #dsj92ppiqi + ⊙ 5. #g19mlrid0i - Deletes: From 77be110ee75807568565db33995880fd6eb22f66 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 30 Jan 2023 11:14:16 -0600 Subject: [PATCH 150/467] Also wipe out history on root deletes --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 4 +--- unison-src/transcripts/delete-namespace.md | 4 ++++ unison-src/transcripts/delete-namespace.output.md | 10 ++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 75497ebc4..07f83c1be 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -884,9 +884,7 @@ loop e = do if hasConfirmed || insistence == Force then do description <- inputDescription input - Cli.stepAt - description - (Path.empty, const Branch.empty0) + Cli.updateRoot Branch.empty description Cli.respond DeletedEverything else Cli.respond DeleteEverythingConfirmation DeleteTarget'Branch insistence (Just p@(parentPath, childName)) -> do diff --git a/unison-src/transcripts/delete-namespace.md b/unison-src/transcripts/delete-namespace.md index 447bf53da..fe8f34630 100644 --- a/unison-src/transcripts/delete-namespace.md +++ b/unison-src/transcripts/delete-namespace.md @@ -47,11 +47,15 @@ Deleting the root namespace should require confirmation if not forced. ```ucm .> delete.namespace . .> delete.namespace . +-- Should have an empty history +.> history . ``` Deleting the root namespace shouldn't require confirmation if forced. ```ucm .> delete.namespace.force . +-- Should have an empty history +.> history . ``` diff --git a/unison-src/transcripts/delete-namespace.output.md b/unison-src/transcripts/delete-namespace.output.md index 0acdacbbb..36f143147 100644 --- a/unison-src/transcripts/delete-namespace.output.md +++ b/unison-src/transcripts/delete-namespace.output.md @@ -86,6 +86,11 @@ Deleting the root namespace should require confirmation if not forced. undo, or `builtins.merge` to restore the absolute basics to the current path. +-- Should have an empty history +.> history . + + ☝️ The namespace . is empty. + ``` Deleting the root namespace shouldn't require confirmation if forced. @@ -96,4 +101,9 @@ Deleting the root namespace shouldn't require confirmation if forced. undo, or `builtins.merge` to restore the absolute basics to the current path. +-- Should have an empty history +.> history . + + ☝️ The namespace . is empty. + ``` From d1bb7118ab8f135084eabb5ad438763de0e7641a Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 30 Jan 2023 12:41:30 -0500 Subject: [PATCH 151/467] use llvm for native compilation on aarch64 --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ed9053606..fc84e60f2 100644 --- a/flake.nix +++ b/flake.nix @@ -55,7 +55,9 @@ unison-env = pkgs.mkShell { packages = with pkgs; [ mystack - haskell.compiler."ghc${ghc-version}" + (haskell.compiler."ghc${ghc-version}".override { + useLLVM = pkgs.stdenv.isAarch64; + }) myormolu myhls pkg-config From 6472f51ccf5b4af766a0fb787be0687d9c0ce354 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 30 Jan 2023 12:50:04 -0500 Subject: [PATCH 152/467] pass stack flags to ensure nix provided ghc is used --- flake.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index fc84e60f2..6cbbbcd9c 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,18 @@ let pkgs = nixpkgs.legacyPackages."${system}".extend self.overlay; - mystack = pkgs.stack; + mystack = pkgs.symlinkJoin { + name = "stack"; + paths = [ pkgs.stack ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = let + flags = [ "--no-nix" "--system-ghc" "--no-install-ghc" ]; + add-flags = + "--add-flags '${pkgs.lib.concatStringsSep " " flags}'"; + in '' + wrapProgram "$out/bin/stack" ${add-flags} + ''; + }; ghc-version = "8107"; ghc = pkgs.haskell.packages."ghc${ghc-version}"; make-ormolu = p: From 0280592b340c0785eed1161468fd188196262735 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 30 Jan 2023 11:54:25 -0600 Subject: [PATCH 153/467] No guards on destructuring binds --- parser-typechecker/src/Unison/Syntax/TermParser.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index c007488f9..02c44a84f 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -984,13 +984,13 @@ destructuringBind = do -- Some 42 -- vs -- Some 42 = List.head elems - (p, boundVars, guard) <- P.try $ do + (p, boundVars) <- P.try $ do (p, boundVars) <- parsePattern let boundVars' = snd <$> boundVars - guard <- optional $ reserved "|" *> infixAppOrBooleanOp P.lookAhead (openBlockWith "=") - pure (p, boundVars', guard) + pure (p, boundVars') scrute <- block "=" -- Dwight K. Scrute ("The People's Scrutinee") + let guard = Nothing let absChain vs t = foldr (\v t -> ABT.abs' (ann t) v t) t vs thecase t = Term.MatchCase p (fmap (absChain boundVars) guard) $ absChain boundVars t pure $ From a8f217c28d6ad4bf96f1feba068f0cd4a9a1f341 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 30 Jan 2023 12:02:06 -0600 Subject: [PATCH 154/467] Remove unused branch operations --- .../src/Unison/Codebase/BranchUtil.hs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/BranchUtil.hs b/parser-typechecker/src/Unison/Codebase/BranchUtil.hs index 33c160503..a921c2d81 100644 --- a/parser-typechecker/src/Unison/Codebase/BranchUtil.hs +++ b/parser-typechecker/src/Unison/Codebase/BranchUtil.hs @@ -13,8 +13,6 @@ module Unison.Codebase.BranchUtil -- * Branch modifications makeSetBranch, - makeDeleteBranch, - makeObliterateBranch, makeAddTypeName, makeDeleteTypeName, makeAddTermName, @@ -24,7 +22,6 @@ module Unison.Codebase.BranchUtil ) where -import Control.Lens import qualified Data.Map as Map import qualified Data.Set as Set import Unison.Codebase.Branch (Branch, Branch0) @@ -137,18 +134,3 @@ makeDeleteTypeName (p, name) r = (p, Branch.deleteTypeName r name) makeSetBranch :: Path.Split -> Branch m -> (Path, Branch0 m -> Branch0 m) makeSetBranch (p, name) b = (p, Branch.setChildBranch name b) - --- | "delete"s a branch by cons'ing an empty Branch0 onto the history at that location. --- See also 'makeObliterateBranch'. -makeDeleteBranch :: - Applicative m => - Path.Split -> - (Path, Branch0 m -> Branch0 m) -makeDeleteBranch (p, name) = (p, Branch.children . ix name %~ Branch.cons Branch.empty0) - --- | Erase a branch and its history --- See also 'makeDeleteBranch'. --- Note that this requires a AllowRewritingHistory update strategy to behave correctly. -makeObliterateBranch :: - Path.Split -> (Path, Branch0 m -> Branch0 m) -makeObliterateBranch p = makeSetBranch p Branch.empty From d1b493bd6ca2e72f5f21dbc9ec24437a4cb47d88 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Mon, 30 Jan 2023 12:05:35 -0600 Subject: [PATCH 155/467] Remove destructuring bind guard in transcripts --- unison-src/transcripts/destructuring-binds.md | 8 -------- unison-src/transcripts/destructuring-binds.output.md | 8 -------- 2 files changed, 16 deletions(-) diff --git a/unison-src/transcripts/destructuring-binds.md b/unison-src/transcripts/destructuring-binds.md index 0170860d7..953cf6349 100644 --- a/unison-src/transcripts/destructuring-binds.md +++ b/unison-src/transcripts/destructuring-binds.md @@ -33,14 +33,6 @@ ex2 tup = match tup with (a, b, (c,d)) -> c + d ``` -Syntactically, the left-hand side of the bind can be any pattern and can even include guards, for instance, see below. Because a destructuring bind desugars to a regular pattern match, pattern match coverage will eventually cause this to not typecheck: - -```unison:hide -ex3 = - Some x | x > 10 = Some 19 - x + 1 -``` - ## Corner cases Destructuring binds can't be recursive: the left-hand side bound variables aren't available on the right hand side. For instance, this doesn't typecheck: diff --git a/unison-src/transcripts/destructuring-binds.output.md b/unison-src/transcripts/destructuring-binds.output.md index 58a186ae0..f4c759964 100644 --- a/unison-src/transcripts/destructuring-binds.output.md +++ b/unison-src/transcripts/destructuring-binds.output.md @@ -71,14 +71,6 @@ ex2 tup = match tup with (also named ex1) ``` -Syntactically, the left-hand side of the bind can be any pattern and can even include guards, for instance, see below. Because a destructuring bind desugars to a regular pattern match, pattern match coverage will eventually cause this to not typecheck: - -```unison -ex3 = - Some x | x > 10 = Some 19 - x + 1 -``` - ## Corner cases Destructuring binds can't be recursive: the left-hand side bound variables aren't available on the right hand side. For instance, this doesn't typecheck: From 0cbd9d8820168c1e8d75ab05490c396817cfbc80 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 12:26:16 -0600 Subject: [PATCH 156/467] Better, us IO.process --- chez-libs/tests/basic.md | 38 +++++++++++++------- chez-libs/tests/basic.output.md | 64 ++++++++++++++++++++++++++------- chez-libs/unison/.gitignore | 1 + 3 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 chez-libs/unison/.gitignore diff --git a/chez-libs/tests/basic.md b/chez-libs/tests/basic.md index 881114799..69feacb84 100644 --- a/chez-libs/tests/basic.md +++ b/chez-libs/tests/basic.md @@ -1,33 +1,47 @@ ```ucm:hide .> builtins.merge -.> pull unison.public.base.latest.IO +.> pull unison.public.base.latest.IO base.IO +.> pull unison.public.base.main.IO.Process base.IO.Process .> pull dolio.public.internal.trunk.compiler ``` ```unison -printHello = '(printLine "Hello") +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh schemeToFile dest link = - fop = open (FilePath dest) Write - text = generateScheme false link - putText fop text - close fop + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName ``` ```ucm .> add +.> run generateSchemeBuiltinLibrary ``` ```unison -test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +test1_term = '(printLine "Hello") +``` + +```ucm:hide +.> add +``` + +```unison +test1 = '(runInScheme 1 (termLink test1_term)) ``` ```ucm .> run test1 ``` - -Now run the following: -```bash -$ scheme --libdirs ../:~/.cache/unisonlanguage/scheme-libs/ --script test-1.ss -``` diff --git a/chez-libs/tests/basic.output.md b/chez-libs/tests/basic.output.md index 2d7a3a812..ec1e6c87f 100644 --- a/chez-libs/tests/basic.output.md +++ b/chez-libs/tests/basic.output.md @@ -1,12 +1,21 @@ ```unison -printHello = '(printLine "Hello") +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh schemeToFile dest link = - fop = open (FilePath dest) Write - text = generateScheme false link - putText fop text - close fop + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName ``` ```ucm @@ -17,8 +26,14 @@ schemeToFile dest link = ⍟ These new definitions are ok to `add`: - printHello : '{IO, Exception} () - schemeToFile : Text -> Term ->{IO, Exception} () + generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () + runChez : Text ->{IO} Nat + runInScheme : Nat + -> Term + ->{IO, Exception} Nat + schemeToFile : Text + -> Term + ->{IO, Exception} () ``` ```ucm @@ -26,12 +41,22 @@ schemeToFile dest link = ⍟ I've added these definitions: - printHello : '{IO, Exception} () - schemeToFile : Text -> Term ->{IO, Exception} () + generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () + runChez : Text ->{IO} Nat + runInScheme : Nat + -> Term + ->{IO, Exception} Nat + schemeToFile : Text + -> Term + ->{IO, Exception} () + +.> run generateSchemeBuiltinLibrary + + () ``` ```unison -test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +test1_term = '(printLine "Hello") ``` ```ucm @@ -42,12 +67,27 @@ test1 = '(schemeToFile "test-1.ss" (termLink printHello)) ⍟ These new definitions are ok to `add`: - test1 : '{IO, Exception} () + test1_term : '{IO, Exception} () + +``` +```unison +test1 = '(runInScheme 1 (termLink test1_term)) +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test1 : '{IO, Exception} Nat ``` ```ucm .> run test1 - () + 0 ``` diff --git a/chez-libs/unison/.gitignore b/chez-libs/unison/.gitignore new file mode 100644 index 000000000..607dadb6c --- /dev/null +++ b/chez-libs/unison/.gitignore @@ -0,0 +1 @@ +builtin-generated.ss From 1a55e0460f811cf88a2270b1508884cdd807edc8 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 18:26:16 +0000 Subject: [PATCH 157/467] [chez-test] capture text, still doesnt work --- chez-libs/tests/basic.md | 27 ++++++++++++-- chez-libs/tests/basic.output.md | 64 +++++++++++++-------------------- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/chez-libs/tests/basic.md b/chez-libs/tests/basic.md index 69feacb84..3c0794f0f 100644 --- a/chez-libs/tests/basic.md +++ b/chez-libs/tests/basic.md @@ -6,7 +6,7 @@ .> pull dolio.public.internal.trunk.compiler ``` -```unison +```unison:hide generateSchemeBuiltinLibrary _ = fh = open (FilePath "../unison/builtin-generated.ss") Write putText fh (generateBaseFile builtinSpec) @@ -17,7 +17,28 @@ schemeToFile dest link = putText fh (generateScheme false link) close fh -runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr runInScheme id term = fileName = "basic-" ++ (Nat.toText id) ++ ".ss" @@ -25,7 +46,7 @@ runInScheme id term = runChez fileName ``` -```ucm +```ucm:hide .> add .> run generateSchemeBuiltinLibrary ``` diff --git a/chez-libs/tests/basic.output.md b/chez-libs/tests/basic.output.md index ec1e6c87f..a787d3110 100644 --- a/chez-libs/tests/basic.output.md +++ b/chez-libs/tests/basic.output.md @@ -10,7 +10,28 @@ schemeToFile dest link = putText fh (generateScheme false link) close fh -runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr runInScheme id term = fileName = "basic-" ++ (Nat.toText id) ++ ".ss" @@ -18,43 +39,6 @@ runInScheme id term = runChez fileName ``` -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () - runChez : Text ->{IO} Nat - runInScheme : Nat - -> Term - ->{IO, Exception} Nat - schemeToFile : Text - -> Term - ->{IO, Exception} () - -``` -```ucm -.> add - - ⍟ I've added these definitions: - - generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () - runChez : Text ->{IO} Nat - runInScheme : Nat - -> Term - ->{IO, Exception} Nat - schemeToFile : Text - -> Term - ->{IO, Exception} () - -.> run generateSchemeBuiltinLibrary - - () - -``` ```unison test1_term = '(printLine "Hello") ``` @@ -82,12 +66,12 @@ test1 = '(runInScheme 1 (termLink test1_term)) ⍟ These new definitions are ok to `add`: - test1 : '{IO, Exception} Nat + test1 : '{IO, Exception} Text ``` ```ucm .> run test1 - 0 + "" ``` From a45c8d87dc6ec743478fbb92b95d02539aaea4fe Mon Sep 17 00:00:00 2001 From: Cody Allen Date: Mon, 30 Jan 2023 14:10:33 -0500 Subject: [PATCH 158/467] nix dev-shell: darwin requires Cocoa --- flake.lock | 6 +++--- flake.nix | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index c5ce4e9c7..dacae008c 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1623875721, - "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6cbbbcd9c..5b7888fde 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,7 @@ supportedGhcVersions = [ ghc-version ]; }; myormolu = make-ormolu pkgs.haskellPackages; + nativePackages = pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Cocoa ]); unison-env = pkgs.mkShell { packages = with pkgs; [ @@ -73,7 +74,7 @@ myhls pkg-config zlib - ]; + ] ++ nativePackages; # workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/11042 shellHook = '' export LD_LIBRARY_PATH=${pkgs.zlib}/lib:$LD_LIBRARY_PATH From 5d475a596872afbbab0e9e64ce54d221c01b3c58 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 16:11:11 -0600 Subject: [PATCH 159/467] Respect `--codebase-create` in `transcript` and `transcript.fork` Note that if you want the codebase to be retained, you also have to specify `--save-codebase` ... should `--save-codebase` be implied if you specify `--codebase-create`? Test plan: ``` $ ucm transcript -C my.base some.md --save-codebase ``` See that it creates the codebase `my.base`! If that directory alread exists, it exits with an error. --- unison-cli/unison/Main.hs | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/unison-cli/unison/Main.hs b/unison-cli/unison/Main.hs index 64f1c6f0b..37734cbff 100644 --- a/unison-cli/unison/Main.hs +++ b/unison-cli/unison/Main.hs @@ -334,25 +334,35 @@ initHTTPClient = do HTTP.setGlobalManager manager prepareTranscriptDir :: ShouldForkCodebase -> Maybe CodebasePathOption -> IO FilePath -prepareTranscriptDir shouldFork mCodePathOption = do - tmp <- Temp.getCanonicalTemporaryDirectory >>= (`Temp.createTempDirectory` "transcript") - let cbInit = SC.init - case shouldFork of - UseFork -> do - -- A forked codebase does not need to Create a codebase, because it already exists - getCodebaseOrExit mCodePathOption SC.MigrateAutomatically $ const (pure ()) - path <- Codebase.getCodebaseDir (fmap codebasePathOptionToPath mCodePathOption) +prepareTranscriptDir shouldFork mCodePathOption = case (shouldFork, mCodePathOption) of + (DontFork, Just (CreateCodebaseWhenMissing path)) -> do PT.putPrettyLn $ P.lines - [ P.wrap "Transcript will be run on a copy of the codebase at: ", + [ P.wrap "Transcript will be run on a new codebase at: ", "", P.indentN 2 (P.string path) ] - Path.copyDir (CodebaseInit.codebasePath cbInit path) (CodebaseInit.codebasePath cbInit tmp) - DontFork -> do - PT.putPrettyLn . P.wrap $ "Transcript will be run on a new, empty codebase." - CodebaseInit.withNewUcmCodebaseOrExit cbInit "main.transcript" tmp SC.DoLock (const $ pure ()) - pure tmp + CodebaseInit.withNewUcmCodebaseOrExit SC.init "main.transcript" path SC.DoLock (const $ pure ()) + pure path + _ -> do + tmp <- Temp.getCanonicalTemporaryDirectory >>= (`Temp.createTempDirectory` "transcript") + let cbInit = SC.init + case shouldFork of + UseFork -> do + -- A forked codebase does not need to Create a codebase, because it already exists + getCodebaseOrExit mCodePathOption SC.MigrateAutomatically $ const (pure ()) + path <- Codebase.getCodebaseDir (fmap codebasePathOptionToPath mCodePathOption) + PT.putPrettyLn $ + P.lines + [ P.wrap "Transcript will be run on a copy of the codebase at: ", + "", + P.indentN 2 (P.string path) + ] + Path.copyDir (CodebaseInit.codebasePath cbInit path) (CodebaseInit.codebasePath cbInit tmp) + DontFork -> do + PT.putPrettyLn . P.wrap $ "Transcript will be run on a new, empty codebase." + CodebaseInit.withNewUcmCodebaseOrExit cbInit "main.transcript" tmp SC.DoLock (const $ pure ()) + pure tmp runTranscripts' :: String -> From b277249b4b520e57971c31765280177944779083 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 22:11:11 +0000 Subject: [PATCH 160/467] handle in both cases --- unison-cli/unison/Main.hs | 40 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/unison-cli/unison/Main.hs b/unison-cli/unison/Main.hs index 37734cbff..828af1f2e 100644 --- a/unison-cli/unison/Main.hs +++ b/unison-cli/unison/Main.hs @@ -334,35 +334,27 @@ initHTTPClient = do HTTP.setGlobalManager manager prepareTranscriptDir :: ShouldForkCodebase -> Maybe CodebasePathOption -> IO FilePath -prepareTranscriptDir shouldFork mCodePathOption = case (shouldFork, mCodePathOption) of - (DontFork, Just (CreateCodebaseWhenMissing path)) -> do +prepareTranscriptDir shouldFork mCodePathOption = do + tmp <- case mCodePathOption of + Just (CreateCodebaseWhenMissing path) -> pure path + _ -> Temp.getCanonicalTemporaryDirectory >>= (`Temp.createTempDirectory` "transcript") + let cbInit = SC.init + case shouldFork of + UseFork -> do + -- A forked codebase does not need to Create a codebase, because it already exists + getCodebaseOrExit mCodePathOption SC.MigrateAutomatically $ const (pure ()) + path <- Codebase.getCodebaseDir (fmap codebasePathOptionToPath mCodePathOption) PT.putPrettyLn $ P.lines - [ P.wrap "Transcript will be run on a new codebase at: ", + [ P.wrap "Transcript will be run on a copy of the codebase at: ", "", P.indentN 2 (P.string path) ] - CodebaseInit.withNewUcmCodebaseOrExit SC.init "main.transcript" path SC.DoLock (const $ pure ()) - pure path - _ -> do - tmp <- Temp.getCanonicalTemporaryDirectory >>= (`Temp.createTempDirectory` "transcript") - let cbInit = SC.init - case shouldFork of - UseFork -> do - -- A forked codebase does not need to Create a codebase, because it already exists - getCodebaseOrExit mCodePathOption SC.MigrateAutomatically $ const (pure ()) - path <- Codebase.getCodebaseDir (fmap codebasePathOptionToPath mCodePathOption) - PT.putPrettyLn $ - P.lines - [ P.wrap "Transcript will be run on a copy of the codebase at: ", - "", - P.indentN 2 (P.string path) - ] - Path.copyDir (CodebaseInit.codebasePath cbInit path) (CodebaseInit.codebasePath cbInit tmp) - DontFork -> do - PT.putPrettyLn . P.wrap $ "Transcript will be run on a new, empty codebase." - CodebaseInit.withNewUcmCodebaseOrExit cbInit "main.transcript" tmp SC.DoLock (const $ pure ()) - pure tmp + Path.copyDir (CodebaseInit.codebasePath cbInit path) (CodebaseInit.codebasePath cbInit tmp) + DontFork -> do + PT.putPrettyLn . P.wrap $ "Transcript will be run on a new, empty codebase." + CodebaseInit.withNewUcmCodebaseOrExit cbInit "main.transcript" tmp SC.DoLock (const $ pure ()) + pure tmp runTranscripts' :: String -> From 8518a7a8c0d0c7324518b0bd5b294d0557f9e9ab Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 22:11:50 +0000 Subject: [PATCH 161/467] [transcript-create] finallllyyyy --- unison-cli/unison/ArgParse.hs | 21 +++++++++++++++++---- unison-cli/unison/Main.hs | 12 ++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/unison-cli/unison/ArgParse.hs b/unison-cli/unison/ArgParse.hs index 207e5b39b..dbb69d535 100644 --- a/unison-cli/unison/ArgParse.hs +++ b/unison-cli/unison/ArgParse.hs @@ -86,7 +86,7 @@ data ShouldDownloadBase deriving (Show, Eq) data ShouldSaveCodebase - = SaveCodebase + = SaveCodebase (Maybe FilePath) | DontSaveCodebase deriving (Show, Eq) @@ -392,10 +392,21 @@ rtsStatsOption = in optional (option OptParse.str meta) saveCodebaseFlag :: Parser ShouldSaveCodebase -saveCodebaseFlag = flag DontSaveCodebase SaveCodebase (long "save-codebase" <> help saveHelp) +saveCodebaseFlag = flag DontSaveCodebase (SaveCodebase Nothing) (long "save-codebase" <> help saveHelp) where saveHelp = "if set the resulting codebase will be saved to a new directory, otherwise it will be deleted" +saveCodebaseToFlag :: Parser ShouldSaveCodebase +saveCodebaseToFlag = do + path <- + optional . strOption $ + long "save-codebase-to" + <> short 'S' + <> help "Where the codebase should be created. Implies --save-codebase" + pure (case path of + Just _ -> SaveCodebase path + _ -> DontSaveCodebase) + downloadBaseFlag :: Parser ShouldDownloadBase downloadBaseFlag = flag @@ -457,7 +468,8 @@ fileArgument varName = transcriptParser :: Parser Command transcriptParser = do -- ApplicativeDo - shouldSaveCodebase <- saveCodebaseFlag + shouldSaveCodebase <- saveCodebaseToFlag + -- shouldSaveCodebase <- saveCodebaseFlag mrtsStatsFp <- rtsStatsOption files <- liftA2 (NE.:|) (fileArgument "FILE") (many (fileArgument "FILES...")) pure (Transcript DontFork shouldSaveCodebase mrtsStatsFp files) @@ -465,7 +477,8 @@ transcriptParser = do transcriptForkParser :: Parser Command transcriptForkParser = do -- ApplicativeDo - shouldSaveCodebase <- saveCodebaseFlag + -- shouldSaveCodebase <- saveCodebaseFlag + shouldSaveCodebase <- saveCodebaseToFlag mrtsStatsFp <- rtsStatsOption files <- liftA2 (NE.:|) (fileArgument "FILE") (many (fileArgument "FILES...")) pure (Transcript UseFork shouldSaveCodebase mrtsStatsFp files) diff --git a/unison-cli/unison/Main.hs b/unison-cli/unison/Main.hs index 828af1f2e..69fae7cb5 100644 --- a/unison-cli/unison/Main.hs +++ b/unison-cli/unison/Main.hs @@ -333,10 +333,10 @@ initHTTPClient = do manager <- HTTP.newTlsManagerWith managerSettings HTTP.setGlobalManager manager -prepareTranscriptDir :: ShouldForkCodebase -> Maybe CodebasePathOption -> IO FilePath -prepareTranscriptDir shouldFork mCodePathOption = do - tmp <- case mCodePathOption of - Just (CreateCodebaseWhenMissing path) -> pure path +prepareTranscriptDir :: ShouldForkCodebase -> Maybe CodebasePathOption -> ShouldSaveCodebase -> IO FilePath +prepareTranscriptDir shouldFork mCodePathOption shouldSaveCodebase = do + tmp <- case shouldSaveCodebase of + SaveCodebase (Just path) -> pure path _ -> Temp.getCanonicalTemporaryDirectory >>= (`Temp.createTempDirectory` "transcript") let cbInit = SC.init case shouldFork of @@ -432,12 +432,12 @@ runTranscripts renderUsageInfo shouldFork shouldSaveTempCodebase mCodePathOption Exit.exitWith (Exit.ExitFailure 1) Success markdownFiles -> pure markdownFiles progName <- getProgName - transcriptDir <- prepareTranscriptDir shouldFork mCodePathOption + transcriptDir <- prepareTranscriptDir shouldFork mCodePathOption shouldSaveTempCodebase completed <- runTranscripts' progName (Just transcriptDir) transcriptDir markdownFiles case shouldSaveTempCodebase of DontSaveCodebase -> removeDirectoryRecursive transcriptDir - SaveCodebase -> + SaveCodebase _ -> when completed $ do PT.putPrettyLn $ P.callout From 94e844b6396adae7684896d97595bb539d34ab76 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 22:12:40 +0000 Subject: [PATCH 162/467] [transcript-create] finally working --- unison-cli/unison/ArgParse.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/unison-cli/unison/ArgParse.hs b/unison-cli/unison/ArgParse.hs index dbb69d535..a619b124f 100644 --- a/unison-cli/unison/ArgParse.hs +++ b/unison-cli/unison/ArgParse.hs @@ -468,20 +468,26 @@ fileArgument varName = transcriptParser :: Parser Command transcriptParser = do -- ApplicativeDo - shouldSaveCodebase <- saveCodebaseToFlag - -- shouldSaveCodebase <- saveCodebaseFlag + shouldSaveCodebaseTo <- saveCodebaseToFlag + shouldSaveCodebase <- saveCodebaseFlag mrtsStatsFp <- rtsStatsOption files <- liftA2 (NE.:|) (fileArgument "FILE") (many (fileArgument "FILES...")) - pure (Transcript DontFork shouldSaveCodebase mrtsStatsFp files) + pure (let saveCodebase = case shouldSaveCodebaseTo of + DontSaveCodebase -> shouldSaveCodebase + _ -> shouldSaveCodebaseTo + in Transcript DontFork saveCodebase mrtsStatsFp files) transcriptForkParser :: Parser Command transcriptForkParser = do -- ApplicativeDo - -- shouldSaveCodebase <- saveCodebaseFlag - shouldSaveCodebase <- saveCodebaseToFlag + shouldSaveCodebaseTo <- saveCodebaseToFlag + shouldSaveCodebase <- saveCodebaseFlag mrtsStatsFp <- rtsStatsOption files <- liftA2 (NE.:|) (fileArgument "FILE") (many (fileArgument "FILES...")) - pure (Transcript UseFork shouldSaveCodebase mrtsStatsFp files) + pure (let saveCodebase = case shouldSaveCodebaseTo of + DontSaveCodebase -> shouldSaveCodebase + _ -> shouldSaveCodebaseTo + in Transcript UseFork saveCodebase mrtsStatsFp files) unisonHelp :: String -> String -> P.Doc unisonHelp (P.text -> executable) (P.text -> version) = From 0f3ec953f972b2afde50e7a668ed4fff44416236 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 30 Jan 2023 18:45:22 -0500 Subject: [PATCH 163/467] Factor unportable bits out of (unison boon) --- scheme-libs/chez/unison/boot.ss | 95 ++++++++++++++++----------------- scheme-libs/chez/unison/core.ss | 4 +- 2 files changed, 48 insertions(+), 51 deletions(-) diff --git a/scheme-libs/chez/unison/boot.ss b/scheme-libs/chez/unison/boot.ss index 1420366f6..82fe30b29 100644 --- a/scheme-libs/chez/unison/boot.ss +++ b/scheme-libs/chez/unison/boot.ss @@ -14,74 +14,32 @@ (export name define-unison - func-wrap handle request unison-force identity - record-case) + record-case + fluid-let) - (import (chezscheme) + (import (rnrs) + (unison core) (unison cont)) - ; Helper function. Turns a list of syntax objects into a list-syntax object. - (meta define (list->syntax l) #`(#,@l)) - - ; Concatenates - (meta define fun-sym - (case-lambda - [(pfx sfx) (string->symbol (string-append pfx "-" sfx))] - [(pfx ifx sfx) - (string->symbol (string-append pfx "-" ifx "-" sfx))])) - ; Computes a symbol for automatically generated partial application ; cases, based on number of arguments applied. The partial ; application of `f` is (locally) named `f-partial-N` - (meta define (partial-symbol name m) - (fun-sym (symbol->string name) "partial" (number->string m))) + ; (meta define (partial-symbol name m) + ; (fun-sym (symbol->string name) "partial" (number->string m))) ; As above, but takes a syntactic object representing the arguments ; rather than their count. - (meta define (partial-name name us) - (datum->syntax name (syntax->datum name))) + ; (define (partial-name name us) + ; (datum->syntax name (syntax->datum name))) (define-syntax with-name (syntax-rules () [(with-name name e) (let ([name e]) name)])) - ; Builds partial application cases for unison functions. It seems - ; most efficient to have a case for each posible under-application. - (meta define (build-partials name formals) - (let rec ([us formals] [acc '()]) - (syntax-case us () - [() (list->syntax (cons #`[() #,name] acc))] - [(a ... z) - (rec #'(a ...) - (cons - #`[(a ... z) - (with-name - #,(partial-name name us) - (lambda r (apply #,name a ... z r)))] - acc))]))) - - ; Given an overall function name, a fast path name, and a list of arguments, - ; builds the case-lambda body of a unison function that enables applying to - ; arbitrary numbers of arguments. - (meta define (func-cases name fast args) - (syntax-case args () - [() #`(case-lambda - [() (#,fast)] - [r (apply (#,fast) r)])] - [(a ... z) - #`(case-lambda - #,@(build-partials name #'(a ...)) - [(a ... z) (#,fast a ... z)] - [(a ... z . r) (apply (#,fast a ... z) r)])])) - - (meta define (func-wrap name args body) - #`(let ([fast-path (lambda (#,@args) #,@body)]) - #,(func-cases name #'fast-path args))) - ; function definition with slow/fast path. Slow path allows for ; under/overapplication. Fast path is exact application. ; @@ -89,6 +47,43 @@ ; optimize static, fast path calls itself, while still supporting ; unison-like automatic partial application and such. (define-syntax (define-unison x) + ; Helper function. Turns a list of syntax objects into a + ; list-syntax object. + (define (list->syntax l) #`(#,@l)) + ; Builds partial application cases for unison functions. + ; It seems most efficient to have a case for each posible + ; under-application. + (define (build-partials name formals) + (let rec ([us formals] [acc '()]) + (syntax-case us () + [() (list->syntax (cons #`[() #,name] acc))] + [(a ... z) + (rec #'(a ...) + (cons + #`[(a ... z) + (with-name + #,(datum->syntax name (syntax->datum name)) + (lambda r (apply #,name a ... z r)))] + acc))]))) + + ; Given an overall function name, a fast path name, and a list of + ; arguments, builds the case-lambda body of a unison function that + ; enables applying to arbitrary numbers of arguments. + (define (func-cases name fast args) + (syntax-case args () + [() #`(case-lambda + [() (#,fast)] + [r (apply (#,fast) r)])] + [(a ... z) + #`(case-lambda + #,@(build-partials name #'(a ...)) + [(a ... z) (#,fast a ... z)] + [(a ... z . r) (apply (#,fast a ... z) r)])])) + + (define (func-wrap name args body) + #`(let ([fast-path (lambda (#,@args) #,@body)]) + #,(func-cases name #'fast-path args))) + (syntax-case x () [(define-unison (name a ...) e ...) #`(define name diff --git a/scheme-libs/chez/unison/core.ss b/scheme-libs/chez/unison/core.ss index cc9d287d0..5397db521 100644 --- a/scheme-libs/chez/unison/core.ss +++ b/scheme-libs/chez/unison/core.ss @@ -20,7 +20,9 @@ fx1- list-head - exception->string) + exception->string + record-case + fluid-let) (import (chezscheme)) From 02895f17f9cdd57d5626d7ae0715bf81f6078f77 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 30 Jan 2023 18:46:57 -0500 Subject: [PATCH 164/467] Move (unison boot) to portable directory --- scheme-libs/{chez => common}/unison/boot.ss | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scheme-libs/{chez => common}/unison/boot.ss (100%) diff --git a/scheme-libs/chez/unison/boot.ss b/scheme-libs/common/unison/boot.ss similarity index 100% rename from scheme-libs/chez/unison/boot.ss rename to scheme-libs/common/unison/boot.ss From 855147e131d2309c2ce7f2640b87c2a0e0727e79 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 31 Jan 2023 11:08:49 -0500 Subject: [PATCH 165/467] Fix erroneous freeze! primop --- scheme-libs/common/unison/primops.ss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index c44d1ecdc..9154d4388 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -104,6 +104,7 @@ ) (import (rnrs) + (only (chezscheme) call/1cc) (unison core) (unison string) (unison bytevector) @@ -234,7 +235,9 @@ (vector-set! dst (+ doff i) (vector-ref src (+ soff i))) (next (fx1- i)))))))) - (define unison-FOp-MutableArray.freeze! freeze-vector!) + (define (unison-FOp-MutableArray.freeze! vec) + (freeze-vector! vec) + vec) (define (unison-FOp-MutableArray.freeze src off len) (let ([dst (make-vector len)]) From 9dc474a18a00c7db0e6f130726f2d5eae35995e3 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Tue, 31 Jan 2023 12:02:39 -0500 Subject: [PATCH 166/467] make pulled empty branch error message more specific --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 2 +- unison-cli/src/Unison/Codebase/Editor/Output.hs | 5 +++-- unison-cli/src/Unison/CommandLine/OutputMessages.hs | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index fd3ad6524..5cbdd8cbb 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2861,7 +2861,7 @@ doPullRemoteBranch mayRepo path syncMode pullMode verbosity description = do Cli.returnEarly (Output.GitError err) ReadRemoteNamespaceShare repo -> importRemoteShareBranch repo when (Branch.isEmpty0 (Branch.head remoteBranch)) do - Cli.respond (BranchEmpty (WhichBranchEmptyRemote ns)) + Cli.respond (PulledEmptyBranch ns) let unchangedMsg = PullAlreadyUpToDate ns path destAbs <- Cli.resolvePath' path let printDiffPath = if Verbosity.isSilent verbosity then Nothing else Just path diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index a1281bc80..520974db1 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -1,7 +1,7 @@ module Unison.Codebase.Editor.Output ( Output (..), DisplayDefinitionsOutput (..), - WhichBranchEmpty(..), + WhichBranchEmpty (..), NumberedOutput (..), NumberedArgs, ListDetailed, @@ -284,6 +284,7 @@ data Output | DisplayDebugNameDiff NameChanges | DisplayDebugCompletions [Completion.Completion] | ClearScreen + | PulledEmptyBranch ReadRemoteNamespace data DisplayDefinitionsOutput = DisplayDefinitionsOutput { isTest :: TermReference -> Bool, @@ -297,7 +298,6 @@ data DisplayDefinitionsOutput = DisplayDefinitionsOutput data WhichBranchEmpty = WhichBranchEmptyHash ShortCausalHash | WhichBranchEmptyPath Path' - | WhichBranchEmptyRemote ReadRemoteNamespace data ShareError = ShareErrorCheckAndSetPush Sync.CheckAndSetPushError @@ -446,6 +446,7 @@ isFailure o = case o of DisplayDebugCompletions {} -> False DisplayDebugNameDiff {} -> False ClearScreen -> False + PulledEmptyBranch {} -> False isNumberedFailure :: NumberedOutput -> Bool isNumberedFailure = \case diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index c6c7aee76..c0e02e1ec 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -1854,6 +1854,9 @@ notifyUser dir o = case o of ANSI.clearScreen ANSI.setCursorPosition 0 0 pure mempty + PulledEmptyBranch remote -> + pure . P.warnCallout . P.wrap $ + P.group (prettyReadRemoteNamespace remote) <> "has some history, but is currently empty." where _nameChange _cmd _pastTenseCmd _oldName _newName _r = error "todo" expectedEmptyPushDest writeRemotePath = @@ -3179,7 +3182,6 @@ prettyWhichBranchEmpty :: WhichBranchEmpty -> Pretty prettyWhichBranchEmpty = \case WhichBranchEmptyHash hash -> P.shown hash WhichBranchEmptyPath path -> prettyPath' path - WhichBranchEmptyRemote remote -> prettyReadRemoteNamespace remote isTestOk :: Term v Ann -> Bool isTestOk tm = case tm of From 39977f87c1acc378179cc00c7bce0c9e53fb6c72 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 31 Jan 2023 15:28:32 -0500 Subject: [PATCH 167/467] Add some additional core functionality, make strings portable - Racket doesn't have record-case, but it can be simulated by a macro relatively easily - Both racket and chez have a similar non-standard API for strings, so the immutable string wrapper can be common to both. (unison core) just needs to re-export the common extra procedures. --- scheme-libs/chez/unison/core.ss | 11 +++++++-- scheme-libs/chez/unison/string.ss | 38 ++++++++++++++----------------- scheme-libs/racket/unison/core.ss | 37 ++++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/scheme-libs/chez/unison/core.ss b/scheme-libs/chez/unison/core.ss index 5397db521..86b30ed12 100644 --- a/scheme-libs/chez/unison/core.ss +++ b/scheme-libs/chez/unison/core.ss @@ -22,7 +22,10 @@ exception->string record-case - fluid-let) + fluid-let + + freeze-string! + string-copy!) (import (chezscheme)) @@ -115,4 +118,8 @@ (let-values ([(port result) (open-string-output-port)]) (display-condition e port) (result))) - ) + + (define (freeze-string! s) + (($primitive $string-set-immutable!) s) + s)) + diff --git a/scheme-libs/chez/unison/string.ss b/scheme-libs/chez/unison/string.ss index 7df0502ad..a63c0d9c8 100644 --- a/scheme-libs/chez/unison/string.ss +++ b/scheme-libs/chez/unison/string.ss @@ -1,9 +1,9 @@ -; This library wraps some chez functionality to provide immutable -; strings. There is a wrapper for making immutable strings in chez, -; but it copies its input, so relying on that would involve every -; string operation building a fresh mutable string, then making an -; immutable copy. This library instead directly freezes the newly -; created mutable strings. +; This library wraps some implementation-specific functionality to +; provide immutable strings. Both have mechanisms for (efficiently) +; marking strings immutable, but there is no standard API for working +; entirely in terms of immutable strings. This module takes the +; freezing function, re-exported by (unison core) and implements the +; API needed for unison. (library (unison string) (export istring @@ -18,15 +18,11 @@ utf8-bytevector->istring utf-8-transcoder) - (import (chezscheme)) + (import (rnrs) (unison core)) - (define (freeze-s! s) - (($primitive $string-set-immutable!) s) - s) + (define istring (lambda l (freeze-string! (apply string l)))) - (define istring (lambda l (freeze-s! (apply string l)))) - - (define (make-istring n c) (freeze-s! (make-string n c))) + (define (make-istring n c) (freeze-string! (make-string n c))) (define (istring-repeat n s) (let* ([k (string-length s)] @@ -36,25 +32,25 @@ (begin (string-copy! s 0 t (* i k) k) (loop (+ i 1))) - (freeze-s! t))))) + (freeze-string! t))))) - (define istring-append (lambda l (freeze-s! (apply string-append l)))) + (define istring-append (lambda l (freeze-string! (apply string-append l)))) - (define (istring-drop n s) (freeze-s! (substring s n (- (string-length s) n)))) + (define (istring-drop n s) (freeze-string! (substring s n (- (string-length s) n)))) - (define (number->istring n) (freeze-s! (number->string n))) + (define (number->istring n) (freeze-string! (number->string n))) (define (signed-number->istring n) - (freeze-s! + (freeze-string! (if (>= n 0) (string-append "+" (number->string n)) (number->string n)))) - (define (list->istring l) (freeze-s! (list->string l))) + (define (list->istring l) (freeze-string! (list->string l))) - (define (istring-take n s) (freeze-s! (substring s 0 n))) + (define (istring-take n s) (freeze-string! (substring s 0 n))) (define utf-8-transcoder (make-transcoder (utf-8-codec))) (define (utf8-bytevector->istring bs) - (freeze-s! (bytevector->string bs utf-8-transcoder)))) + (freeze-string! (bytevector->string bs utf-8-transcoder)))) diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss index a1a88835e..bf686761c 100644 --- a/scheme-libs/racket/unison/core.ss +++ b/scheme-libs/racket/unison/core.ss @@ -18,7 +18,12 @@ fx1- list-head - exception->string) + exception->string + record-case + fluid-let + + freeze-string! + string-copy!) (import (rnrs) (racket exn)) @@ -47,5 +52,33 @@ (define exception->string exn->string) - ) + (define-syntax record-case + (syntax-rules (else) + ; no else + [(record-case expr + [(tag0 tag1 ...) (v ...) e ...] + ...) + (let ([val expr]) + (case (car val) + [(tag0 tag1 ...) + (let-values ([(v ...) (apply values (cdr val))]) + e ...)] + ...))] + + ; with else + [(record-case expr + [(tag0 tag1 ...) (v ...) e ...] + ... + [else ee ...]) + (let ([val expr]) + (case (car val) + [(tag0 tag1 ...) + (let-values ([(v ...) (apply values (cdr val))]) + e ...)] + ... + [else ee ...]))])) + + (define (fluid-let) '()) + + (define freeze-string! unsafe-string->immutable-string!)) From 19419ba7debfa36184734d950bc3c0fb8594cc57 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 31 Jan 2023 15:31:31 -0500 Subject: [PATCH 168/467] Move (unison string) to common directory --- scheme-libs/{chez => common}/unison/string.ss | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scheme-libs/{chez => common}/unison/string.ss (100%) diff --git a/scheme-libs/chez/unison/string.ss b/scheme-libs/common/unison/string.ss similarity index 100% rename from scheme-libs/chez/unison/string.ss rename to scheme-libs/common/unison/string.ss From 65b8648a7eceade6dbe31dde65e8e272c6981e29 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 31 Jan 2023 15:59:39 -0500 Subject: [PATCH 169/467] More implementation agnostic bytevectors --- scheme-libs/chez/unison/bytevector.ss | 27 ++++++++++++--------------- scheme-libs/chez/unison/core.ss | 11 +++++++++-- scheme-libs/common/unison/primops.ss | 3 +-- scheme-libs/racket/unison/core.ss | 8 ++++++-- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/scheme-libs/chez/unison/bytevector.ss b/scheme-libs/chez/unison/bytevector.ss index be58f9540..9de5e94a0 100644 --- a/scheme-libs/chez/unison/bytevector.ss +++ b/scheme-libs/chez/unison/bytevector.ss @@ -1,35 +1,32 @@ ; This library implements missing bytevector functionality for unison ; builtins. The main missing bits are better support for immutable -; bytevectors. Chez does provide a way to make an immutable -; bytevector, but it copies its input, so implementing things that way -; would make many unncessary copies. This library instead implements -; functions on immutable bytevectors by directly freezing the newly -; created mutable vector. It also provides the freezing function, -; which is itself a unison builtin. +; bytevectors. Both chez and racket have support for immutable +; bytevectors, but there is no standard API for dealing with them that +; implements all the functions we'd want. This library exports the +; desired functionality on top of an unsafe in-place freeze +; re-exported from the (unison core) module. (library (unison bytevector) (export - freeze-bv! + freeze-bytevector! ibytevector-drop ibytevector-take u8-list->ibytevector) - (import (chezscheme)) - - (define (freeze-bv! bs) - (($primitive $bytevector-set-immutable!) bs) - bs) + (import (rnrs) + (unison core)) (define (ibytevector-drop n bs) (let* ([l (bytevector-length bs)] [k (max 0 (- l n))] [br (make-bytevector k)]) (bytevector-copy! bs n br 0 k) - (freeze-bv! br))) + (freeze-bytevector! br))) (define (ibytevector-take n bs) (let* ([sz (min n (bytevector-length bs))] [br (make-bytevector sz)]) (bytevector-copy! bs 0 br 0 sz) - (freeze-bv! br))) + (freeze-bytevector! br))) - (define (u8-list->ibytevector l) (freeze-bv! (u8-list->bytevector l)))) + (define (u8-list->ibytevector l) + (freeze-bytevector! (u8-list->bytevector l)))) diff --git a/scheme-libs/chez/unison/core.ss b/scheme-libs/chez/unison/core.ss index 86b30ed12..caed326dc 100644 --- a/scheme-libs/chez/unison/core.ss +++ b/scheme-libs/chez/unison/core.ss @@ -25,7 +25,9 @@ fluid-let freeze-string! - string-copy!) + string-copy! + + freeze-bytevector!) (import (chezscheme)) @@ -121,5 +123,10 @@ (define (freeze-string! s) (($primitive $string-set-immutable!) s) - s)) + s) + (define (freeze-bytevector! bs) + (($primitive $bytevector-set-immutable!) bs) + bs) + + ) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 1bff06ac1..78bc4e8cc 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -298,8 +298,7 @@ (lambda () (list 1 (bytevector-u8-ref arr i))))) - (define (unison-FOp-MutableByteArray.freeze! arr) - (freeze-bv! arr)) + (define unison-FOp-MutableByteArray.freeze! freeze-bytevector!) (define (unison-FOp-MutableByteArray.write8 arr i b) (catch-array diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss index bf686761c..400beb6d6 100644 --- a/scheme-libs/racket/unison/core.ss +++ b/scheme-libs/racket/unison/core.ss @@ -23,7 +23,9 @@ fluid-let freeze-string! - string-copy!) + string-copy! + + freeze-bytevector!) (import (rnrs) (racket exn)) @@ -80,5 +82,7 @@ (define (fluid-let) '()) - (define freeze-string! unsafe-string->immutable-string!)) + (define freeze-string! unsafe-string->immutable-string!) + (define freeze-bytevector! unsafe-bytes->immutable-bytes!) + ) From 33bad28dbe48d758a2961be4903471a4b9a1faec Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 31 Jan 2023 16:00:18 -0500 Subject: [PATCH 170/467] Move (unison bytevector) to common directory --- scheme-libs/{chez => common}/unison/bytevector.ss | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scheme-libs/{chez => common}/unison/bytevector.ss (100%) diff --git a/scheme-libs/chez/unison/bytevector.ss b/scheme-libs/common/unison/bytevector.ss similarity index 100% rename from scheme-libs/chez/unison/bytevector.ss rename to scheme-libs/common/unison/bytevector.ss From 46a8044cb098f4311b29fd56a04b0b14a25a3fb6 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 31 Jan 2023 16:12:52 -0500 Subject: [PATCH 171/467] Move (unison vector) to common directory --- scheme-libs/{chez => common}/unison/vector.ss | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scheme-libs/{chez => common}/unison/vector.ss (100%) diff --git a/scheme-libs/chez/unison/vector.ss b/scheme-libs/common/unison/vector.ss similarity index 100% rename from scheme-libs/chez/unison/vector.ss rename to scheme-libs/common/unison/vector.ss From 23aa3ffa83621487b6a46f18b7443749ef7330ae Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 31 Jan 2023 16:18:18 -0500 Subject: [PATCH 172/467] Make (unison vector) not implementation specific - Also move subvector freezing there, out of primops --- scheme-libs/chez/unison/core.ss | 6 +++++- scheme-libs/common/unison/primops.ss | 15 ++------------- scheme-libs/common/unison/vector.ss | 19 +++++++++++++++---- scheme-libs/racket/unison/core.ss | 6 +++++- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/scheme-libs/chez/unison/core.ss b/scheme-libs/chez/unison/core.ss index caed326dc..614ea1204 100644 --- a/scheme-libs/chez/unison/core.ss +++ b/scheme-libs/chez/unison/core.ss @@ -27,7 +27,8 @@ freeze-string! string-copy! - freeze-bytevector!) + freeze-bytevector! + freeze-vector!) (import (chezscheme)) @@ -129,4 +130,7 @@ (($primitive $bytevector-set-immutable!) bs) bs) + (define (freeze-vector! v) + (($primitive $vector-set-immutable!) v) + v) ) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 78bc4e8cc..870b9d888 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -261,20 +261,9 @@ (vector-set! dst (+ doff i) (vector-ref src (+ soff i))) (next (fx1- i)))))))) - (define (unison-FOp-MutableArray.freeze! vec) - (freeze-vector! vec) - vec) + (define unison-FOp-MutableArray.freeze! freeze-vector!) - (define (unison-FOp-MutableArray.freeze src off len) - (let ([dst (make-vector len)]) - (let next ([i (fx1- len)]) - (if (< i 0) - (begin - (freeze-vector! dst) - (list 1 dst)) - (begin - (vector-set! dst i (vector-ref src (+ off i))) - (next (fx1- i))))))) + (define unison-FOp-MutableArray.freeze freeze-subvector) (define (unison-FOp-MutableArray.read src i) (catch-array diff --git a/scheme-libs/common/unison/vector.ss b/scheme-libs/common/unison/vector.ss index 9044456ef..2201f4184 100644 --- a/scheme-libs/common/unison/vector.ss +++ b/scheme-libs/common/unison/vector.ss @@ -1,9 +1,20 @@ (library (unison vector) (export - freeze-vector!) + freeze-vector! + freeze-subvector) - (import (chezscheme)) + (import (rnrs) + (unison core)) - (define (freeze-vector! vec) - (($primitive $vector-set-immutable!) vec))) + (define (freeze-subvector src off len) + (let ([dst (make-vector len)]) + (let next ([i (fx1- len)]) + (if (< i 0) + (begin + (freeze-vector! dst) + (list 1 dst)) + (begin + (vector-set! dst i (vector-ref src (+ off i))) + (next (fx1- i))))))) + ) diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss index 400beb6d6..8cb46daf2 100644 --- a/scheme-libs/racket/unison/core.ss +++ b/scheme-libs/racket/unison/core.ss @@ -25,7 +25,8 @@ freeze-string! string-copy! - freeze-bytevector!) + freeze-bytevector! + freeze-vector!) (import (rnrs) (racket exn)) @@ -84,5 +85,8 @@ (define freeze-string! unsafe-string->immutable-string!) (define freeze-bytevector! unsafe-bytes->immutable-bytes!) + + (define freeze-vector! unsafe-vector*->immutable-vector!) + ) From a237c1531cd82f16c2a526a86d77b7efdf82fb67 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 31 Jan 2023 22:40:48 -0600 Subject: [PATCH 173/467] Wipe inferred annotations where possible --- unison-cli/src/Unison/LSP/Queries.hs | 123 ++++++++++++++++----------- 1 file changed, 73 insertions(+), 50 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index db9db39d8..9334af7a8 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE DataKinds #-} + -- | Rewrites of some codebase queries, but which check the scratch file for info first. module Unison.LSP.Queries ( getTypeOfReferent, @@ -13,7 +15,9 @@ module Unison.LSP.Queries where import Control.Lens +import qualified Control.Lens as Lens import Control.Monad.Reader +import Data.Generics.Product (field) import Language.LSP.Types import qualified Unison.ABT as ABT import qualified Unison.Codebase as Codebase @@ -21,6 +25,7 @@ import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.DataDeclaration (Decl) import qualified Unison.DataDeclaration as DD +import qualified Unison.Debug as Debug import Unison.LSP.Conversions (lspToUPos) import Unison.LSP.FileAnalysis (getFileSummary) import Unison.LSP.Orphans () @@ -153,38 +158,38 @@ findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (Either (Term Symbo findSmallestEnclosingNode pos term | annIsFilePosition (ABT.annotation term) && not (ABT.annotation term `Ann.contains` pos) = Nothing | otherwise = do - let bestChild = case ABT.out term of - ABT.Tm f -> case f of - Term.Int {} -> Just (Left term) - Term.Nat {} -> Just (Left term) - Term.Float {} -> Just (Left term) - Term.Boolean {} -> Just (Left term) - Term.Text {} -> Just (Left term) - Term.Char {} -> Just (Left term) - Term.Blank {} -> Just (Left term) - Term.Ref {} -> Just (Left term) - Term.Constructor {} -> Just (Left term) - Term.Request {} -> Just (Left term) - Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.App a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (Right <$> findSmallestEnclosingType pos typ) - Term.List xs -> altSum (findSmallestEnclosingNode pos <$> xs) - Term.If cond a b -> findSmallestEnclosingNode pos cond <|> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.And l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r - Term.Or l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r - Term.Lam a -> findSmallestEnclosingNode pos a - Term.LetRec _isTop xs y -> altSum (findSmallestEnclosingNode pos <$> xs) <|> findSmallestEnclosingNode pos y - Term.Let _isTop a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.Match a cases -> - findSmallestEnclosingNode pos a - <|> altSum (cases <&> \(MatchCase _pat grd body) -> altSum (findSmallestEnclosingNode pos <$> grd) <|> findSmallestEnclosingNode pos body) - Term.TermLink {} -> Just (Left term) - Term.TypeLink {} -> Just (Left term) - ABT.Var _v -> Just (Left term) - ABT.Cycle r -> findSmallestEnclosingNode pos r - ABT.Abs _v r -> findSmallestEnclosingNode pos r - let fallback = if annIsFilePosition (ABT.annotation term) then Just (Left term) else Nothing - bestChild <|> fallback + let bestChild = case ABT.out term of + ABT.Tm f -> case f of + Term.Int {} -> Just (Left term) + Term.Nat {} -> Just (Left term) + Term.Float {} -> Just (Left term) + Term.Boolean {} -> Just (Left term) + Term.Text {} -> Just (Left term) + Term.Char {} -> Just (Left term) + Term.Blank {} -> Just (Left term) + Term.Ref {} -> Just (Left term) + Term.Constructor {} -> Just (Left term) + Term.Request {} -> Just (Left term) + Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.App a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (Right <$> findSmallestEnclosingType pos typ) + Term.List xs -> altSum (findSmallestEnclosingNode pos <$> xs) + Term.If cond a b -> findSmallestEnclosingNode pos cond <|> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.And l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r + Term.Or l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r + Term.Lam a -> findSmallestEnclosingNode pos a + Term.LetRec _isTop xs y -> altSum (findSmallestEnclosingNode pos <$> xs) <|> findSmallestEnclosingNode pos y + Term.Let _isTop a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.Match a cases -> + findSmallestEnclosingNode pos a + <|> altSum (cases <&> \(MatchCase _pat grd body) -> altSum (findSmallestEnclosingNode pos <$> grd) <|> findSmallestEnclosingNode pos body) + Term.TermLink {} -> Just (Left term) + Term.TypeLink {} -> Just (Left term) + ABT.Var _v -> Just (Left term) + ABT.Cycle r -> findSmallestEnclosingNode pos r + ABT.Abs _v r -> findSmallestEnclosingNode pos r + let fallback = if annIsFilePosition (ABT.annotation term) then Just (Left term) else Nothing + bestChild <|> fallback -- | Find the the node in a type which contains the specified position, but none of its -- children contain that position. @@ -194,21 +199,21 @@ findSmallestEnclosingType :: Pos -> Type Symbol Ann -> Maybe (Type Symbol Ann) findSmallestEnclosingType pos typ | annIsFilePosition (ABT.annotation typ) && not (ABT.annotation typ `Ann.contains` pos) = Nothing | otherwise = do - let bestChild = case ABT.out typ of - ABT.Tm f -> case f of - Type.Ref {} -> Just typ - Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.Forall r -> findSmallestEnclosingType pos r - Type.Ann a _kind -> findSmallestEnclosingType pos a - Type.Effects es -> altSum (findSmallestEnclosingType pos <$> es) - Type.IntroOuter a -> findSmallestEnclosingType pos a - ABT.Var _v -> Just typ - ABT.Cycle r -> findSmallestEnclosingType pos r - ABT.Abs _v r -> findSmallestEnclosingType pos r - let fallback = if annIsFilePosition (ABT.annotation typ) then Just typ else Nothing - bestChild <|> fallback + let bestChild = case ABT.out typ of + ABT.Tm f -> case f of + Type.Ref {} -> Just typ + Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Forall r -> findSmallestEnclosingType pos r + Type.Ann a _kind -> findSmallestEnclosingType pos a + Type.Effects es -> altSum (findSmallestEnclosingType pos <$> es) + Type.IntroOuter a -> findSmallestEnclosingType pos a + ABT.Var _v -> Just typ + ABT.Cycle r -> findSmallestEnclosingType pos r + ABT.Abs _v r -> findSmallestEnclosingType pos r + let fallback = if annIsFilePosition (ABT.annotation typ) then Just typ else Nothing + bestChild <|> fallback -- | Returns the type reference the given position applies to within a Decl, if any. -- @@ -229,9 +234,9 @@ nodeAtPosition uri (lspToUPos -> pos) = do (FileSummary {termsBySymbol, testWatchSummary, exprWatchSummary}) <- getFileSummary uri let (trms, typs) = termsBySymbol & foldMap \(_ref, trm, mayTyp) -> ([trm], toList mayTyp) ( altMap (fmap Right . hoistMaybe . findSmallestEnclosingType pos) typs - <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) trms - <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) (testWatchSummary ^.. folded . _3) - <|> altMap (hoistMaybe . findSmallestEnclosingNode pos) (exprWatchSummary ^.. folded . _3) + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . wipeInferredTypeAnnotations) trms + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . wipeInferredTypeAnnotations) (testWatchSummary ^.. folded . _3) + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . wipeInferredTypeAnnotations) (exprWatchSummary ^.. folded . _3) ) where hoistMaybe :: Maybe a -> MaybeT Lsp a @@ -242,3 +247,21 @@ annIsFilePosition = \case Ann.Intrinsic -> False Ann.External -> False Ann.Ann {} -> True + +-- | Okay, so currently during synthesis in typechecking the typechecker adds `Ann` nodes +-- to the term specifying types of subterms. This is a problem because we the types in these +-- Ann nodes are just tagged with the full `Ann` from the term it was inferred for, even +-- though none of these types exist in the file, and at a glance we can't tell whether a type +-- is inferred or user-specified. +-- +-- So for now we crawl the term and remove any Ann nodes from within. The downside being you +-- can no longer hover on Type signatures within a term, but the benefit is that hover +-- actually works. +wipeInferredTypeAnnotations :: Ord v => Term.Term v Ann -> Term.Term v Ann +wipeInferredTypeAnnotations = + Lens.transformOf (field @"out" . traversed) \case + ABT.Term {out = ABT.Tm (Term.Ann trm typ)} + -- If the type's annotation is identical to the term's annotation, then this must be an inferred type + | ABT.annotation typ == ABT.annotation trm -> + Debug.debugLog Debug.Temp "Wiped Annotation" trm + t -> t From 121d5f9563ae6de8acaa23a051505728186bf324 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 31 Jan 2023 23:17:43 -0600 Subject: [PATCH 174/467] Move type crawls to the end --- unison-cli/src/Unison/LSP/Queries.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 9334af7a8..7c6c455d8 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -25,7 +25,6 @@ import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.DataDeclaration (Decl) import qualified Unison.DataDeclaration as DD -import qualified Unison.Debug as Debug import Unison.LSP.Conversions (lspToUPos) import Unison.LSP.FileAnalysis (getFileSummary) import Unison.LSP.Orphans () @@ -232,11 +231,12 @@ refInDecl p (DD.asDataDecl -> dd) = nodeAtPosition :: Uri -> Position -> MaybeT Lsp (Either (Term Symbol Ann) (Type Symbol Ann)) nodeAtPosition uri (lspToUPos -> pos) = do (FileSummary {termsBySymbol, testWatchSummary, exprWatchSummary}) <- getFileSummary uri + let (trms, typs) = termsBySymbol & foldMap \(_ref, trm, mayTyp) -> ([trm], toList mayTyp) - ( altMap (fmap Right . hoistMaybe . findSmallestEnclosingType pos) typs - <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . wipeInferredTypeAnnotations) trms - <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . wipeInferredTypeAnnotations) (testWatchSummary ^.. folded . _3) - <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . wipeInferredTypeAnnotations) (exprWatchSummary ^.. folded . _3) + ( altMap (hoistMaybe . findSmallestEnclosingNode pos . removeInferredTypeAnnotations) trms + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . removeInferredTypeAnnotations) (testWatchSummary ^.. folded . _3) + <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . removeInferredTypeAnnotations) (exprWatchSummary ^.. folded . _3) + <|> altMap (fmap Right . hoistMaybe . findSmallestEnclosingType pos) typs ) where hoistMaybe :: Maybe a -> MaybeT Lsp a @@ -257,11 +257,10 @@ annIsFilePosition = \case -- So for now we crawl the term and remove any Ann nodes from within. The downside being you -- can no longer hover on Type signatures within a term, but the benefit is that hover -- actually works. -wipeInferredTypeAnnotations :: Ord v => Term.Term v Ann -> Term.Term v Ann -wipeInferredTypeAnnotations = +removeInferredTypeAnnotations :: Ord v => Term.Term v Ann -> Term.Term v Ann +removeInferredTypeAnnotations = Lens.transformOf (field @"out" . traversed) \case ABT.Term {out = ABT.Tm (Term.Ann trm typ)} -- If the type's annotation is identical to the term's annotation, then this must be an inferred type - | ABT.annotation typ == ABT.annotation trm -> - Debug.debugLog Debug.Temp "Wiped Annotation" trm + | ABT.annotation typ == ABT.annotation trm -> trm t -> t From 5a9c51f2db02b594ab7d72bd1d8187f6bab0efa4 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 08:25:25 -0600 Subject: [PATCH 175/467] Add a basic transcript testing chez generation This runs `generateScheme` to generate some scheme! We don't yet have a ucm command to shell out, so you have to run `scheme` yourself. --- chez-libs/tests/.gitignore | 1 + chez-libs/tests/basic.md | 33 ++++++++++++++++++++ chez-libs/tests/basic.output.md | 53 +++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 chez-libs/tests/.gitignore create mode 100644 chez-libs/tests/basic.md create mode 100644 chez-libs/tests/basic.output.md diff --git a/chez-libs/tests/.gitignore b/chez-libs/tests/.gitignore new file mode 100644 index 000000000..e32f74228 --- /dev/null +++ b/chez-libs/tests/.gitignore @@ -0,0 +1 @@ +*.ss \ No newline at end of file diff --git a/chez-libs/tests/basic.md b/chez-libs/tests/basic.md new file mode 100644 index 000000000..881114799 --- /dev/null +++ b/chez-libs/tests/basic.md @@ -0,0 +1,33 @@ + +```ucm:hide +.> builtins.merge +.> pull unison.public.base.latest.IO +.> pull dolio.public.internal.trunk.compiler +``` + +```unison +printHello = '(printLine "Hello") + +schemeToFile dest link = + fop = open (FilePath dest) Write + text = generateScheme false link + putText fop text + close fop +``` + +```ucm +.> add +``` + +```unison +test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +``` + +```ucm +.> run test1 +``` + +Now run the following: +```bash +$ scheme --libdirs ../:~/.cache/unisonlanguage/scheme-libs/ --script test-1.ss +``` diff --git a/chez-libs/tests/basic.output.md b/chez-libs/tests/basic.output.md new file mode 100644 index 000000000..2d7a3a812 --- /dev/null +++ b/chez-libs/tests/basic.output.md @@ -0,0 +1,53 @@ + +```unison +printHello = '(printLine "Hello") + +schemeToFile dest link = + fop = open (FilePath dest) Write + text = generateScheme false link + putText fop text + close fop +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + printHello : '{IO, Exception} () + schemeToFile : Text -> Term ->{IO, Exception} () + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + printHello : '{IO, Exception} () + schemeToFile : Text -> Term ->{IO, Exception} () + +``` +```unison +test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test1 : '{IO, Exception} () + +``` +```ucm +.> run test1 + + () + +``` From 30033d3361e710ffa6c9ffb3057678529dca730b Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 12:26:16 -0600 Subject: [PATCH 176/467] Better, us IO.process --- chez-libs/tests/basic.md | 38 ++++++++++++------ chez-libs/tests/basic.output.md | 64 ++++++++++++++++++++++++------ scheme-libs/chez/unison/.gitignore | 1 + 3 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 scheme-libs/chez/unison/.gitignore diff --git a/chez-libs/tests/basic.md b/chez-libs/tests/basic.md index 881114799..69feacb84 100644 --- a/chez-libs/tests/basic.md +++ b/chez-libs/tests/basic.md @@ -1,33 +1,47 @@ ```ucm:hide .> builtins.merge -.> pull unison.public.base.latest.IO +.> pull unison.public.base.latest.IO base.IO +.> pull unison.public.base.main.IO.Process base.IO.Process .> pull dolio.public.internal.trunk.compiler ``` ```unison -printHello = '(printLine "Hello") +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh schemeToFile dest link = - fop = open (FilePath dest) Write - text = generateScheme false link - putText fop text - close fop + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName ``` ```ucm .> add +.> run generateSchemeBuiltinLibrary ``` ```unison -test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +test1_term = '(printLine "Hello") +``` + +```ucm:hide +.> add +``` + +```unison +test1 = '(runInScheme 1 (termLink test1_term)) ``` ```ucm .> run test1 ``` - -Now run the following: -```bash -$ scheme --libdirs ../:~/.cache/unisonlanguage/scheme-libs/ --script test-1.ss -``` diff --git a/chez-libs/tests/basic.output.md b/chez-libs/tests/basic.output.md index 2d7a3a812..ec1e6c87f 100644 --- a/chez-libs/tests/basic.output.md +++ b/chez-libs/tests/basic.output.md @@ -1,12 +1,21 @@ ```unison -printHello = '(printLine "Hello") +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh schemeToFile dest link = - fop = open (FilePath dest) Write - text = generateScheme false link - putText fop text - close fop + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName ``` ```ucm @@ -17,8 +26,14 @@ schemeToFile dest link = ⍟ These new definitions are ok to `add`: - printHello : '{IO, Exception} () - schemeToFile : Text -> Term ->{IO, Exception} () + generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () + runChez : Text ->{IO} Nat + runInScheme : Nat + -> Term + ->{IO, Exception} Nat + schemeToFile : Text + -> Term + ->{IO, Exception} () ``` ```ucm @@ -26,12 +41,22 @@ schemeToFile dest link = ⍟ I've added these definitions: - printHello : '{IO, Exception} () - schemeToFile : Text -> Term ->{IO, Exception} () + generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () + runChez : Text ->{IO} Nat + runInScheme : Nat + -> Term + ->{IO, Exception} Nat + schemeToFile : Text + -> Term + ->{IO, Exception} () + +.> run generateSchemeBuiltinLibrary + + () ``` ```unison -test1 = '(schemeToFile "test-1.ss" (termLink printHello)) +test1_term = '(printLine "Hello") ``` ```ucm @@ -42,12 +67,27 @@ test1 = '(schemeToFile "test-1.ss" (termLink printHello)) ⍟ These new definitions are ok to `add`: - test1 : '{IO, Exception} () + test1_term : '{IO, Exception} () + +``` +```unison +test1 = '(runInScheme 1 (termLink test1_term)) +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test1 : '{IO, Exception} Nat ``` ```ucm .> run test1 - () + 0 ``` diff --git a/scheme-libs/chez/unison/.gitignore b/scheme-libs/chez/unison/.gitignore new file mode 100644 index 000000000..607dadb6c --- /dev/null +++ b/scheme-libs/chez/unison/.gitignore @@ -0,0 +1 @@ +builtin-generated.ss From 505fb01ce2e92300fa16e2235b4b2f0565f4d246 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 18:26:16 +0000 Subject: [PATCH 177/467] [chez-test] capture text, still doesnt work --- chez-libs/tests/basic.md | 27 ++++++++++++-- chez-libs/tests/basic.output.md | 64 +++++++++++++-------------------- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/chez-libs/tests/basic.md b/chez-libs/tests/basic.md index 69feacb84..3c0794f0f 100644 --- a/chez-libs/tests/basic.md +++ b/chez-libs/tests/basic.md @@ -6,7 +6,7 @@ .> pull dolio.public.internal.trunk.compiler ``` -```unison +```unison:hide generateSchemeBuiltinLibrary _ = fh = open (FilePath "../unison/builtin-generated.ss") Write putText fh (generateBaseFile builtinSpec) @@ -17,7 +17,28 @@ schemeToFile dest link = putText fh (generateScheme false link) close fh -runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr runInScheme id term = fileName = "basic-" ++ (Nat.toText id) ++ ".ss" @@ -25,7 +46,7 @@ runInScheme id term = runChez fileName ``` -```ucm +```ucm:hide .> add .> run generateSchemeBuiltinLibrary ``` diff --git a/chez-libs/tests/basic.output.md b/chez-libs/tests/basic.output.md index ec1e6c87f..a787d3110 100644 --- a/chez-libs/tests/basic.output.md +++ b/chez-libs/tests/basic.output.md @@ -10,7 +10,28 @@ schemeToFile dest link = putText fh (generateScheme false link) close fh -runChez fileName = IO.Process.call "scheme" ["--libdirs", "../", "--script", fileName] +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr runInScheme id term = fileName = "basic-" ++ (Nat.toText id) ++ ".ss" @@ -18,43 +39,6 @@ runInScheme id term = runChez fileName ``` -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () - runChez : Text ->{IO} Nat - runInScheme : Nat - -> Term - ->{IO, Exception} Nat - schemeToFile : Text - -> Term - ->{IO, Exception} () - -``` -```ucm -.> add - - ⍟ I've added these definitions: - - generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () - runChez : Text ->{IO} Nat - runInScheme : Nat - -> Term - ->{IO, Exception} Nat - schemeToFile : Text - -> Term - ->{IO, Exception} () - -.> run generateSchemeBuiltinLibrary - - () - -``` ```unison test1_term = '(printLine "Hello") ``` @@ -82,12 +66,12 @@ test1 = '(runInScheme 1 (termLink test1_term)) ⍟ These new definitions are ok to `add`: - test1 : '{IO, Exception} Nat + test1 : '{IO, Exception} Text ``` ```ucm .> run test1 - 0 + "" ``` From 1c657ab4db6a9c8ebeb00ff9b56ef6ba2f0dfe79 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 30 Jan 2023 18:26:16 +0000 Subject: [PATCH 178/467] [chez-test] wip --- chez-libs/tests/Readme.md | 12 ++++ chez-libs/tests/base.md | 52 +++++++++++++++ chez-libs/tests/base.output.md | 114 ++++++++++++++++++++++++++++++++ chez-libs/tests/test1.md | 61 +++++++++++++++++ chez-libs/tests/test1.output.md | 77 +++++++++++++++++++++ chez-libs/tests/utils.md | 0 chez-libs/tests/what.md | 6 ++ chez-libs/tests/what.output.md | 23 +++++++ 8 files changed, 345 insertions(+) create mode 100644 chez-libs/tests/Readme.md create mode 100644 chez-libs/tests/base.md create mode 100644 chez-libs/tests/base.output.md create mode 100644 chez-libs/tests/test1.md create mode 100644 chez-libs/tests/test1.output.md create mode 100644 chez-libs/tests/utils.md create mode 100644 chez-libs/tests/what.md create mode 100644 chez-libs/tests/what.output.md diff --git a/chez-libs/tests/Readme.md b/chez-libs/tests/Readme.md new file mode 100644 index 000000000..28db5bd9a --- /dev/null +++ b/chez-libs/tests/Readme.md @@ -0,0 +1,12 @@ + +# Testing our chez backend + +First make a codebase that has the basic things you need, that the other transcripts can run off of. +```bash +$ ucm transcript --save-codebase -C base.unison base.md +``` + +Then run the transcripts! +```bash +$ ucm transcript.fork -c base.unison test1.md +``` \ No newline at end of file diff --git a/chez-libs/tests/base.md b/chez-libs/tests/base.md new file mode 100644 index 000000000..b9fd3af0e --- /dev/null +++ b/chez-libs/tests/base.md @@ -0,0 +1,52 @@ + +```ucm +.> builtins.merge +.> pull unison.public.base.latest.IO base.IO +.> pull unison.public.base.main.IO.Process base.IO.Process +.> pull dolio.public.internal.trunk.compiler +``` + +```unison +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh + +schemeToFile dest link = + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName +``` + +```ucm +.> add +.> run generateSchemeBuiltinLibrary +``` diff --git a/chez-libs/tests/base.output.md b/chez-libs/tests/base.output.md new file mode 100644 index 000000000..ca07c811f --- /dev/null +++ b/chez-libs/tests/base.output.md @@ -0,0 +1,114 @@ + +```ucm +.> builtins.merge + + Done. + +.> pull unison.public.base.latest.IO base.IO + + 😶 + + base.IO was already up-to-date with + unison.public.base.latest.IO. + +.> pull unison.public.base.main.IO.Process base.IO.Process + + 😶 + + base.IO.Process was already up-to-date with + unison.public.base.main.IO.Process. + +.> pull dolio.public.internal.trunk.compiler + + 😶 + + the current namespace was already up-to-date with + dolio.public.internal.trunk.compiler. + +``` +```unison +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh + +schemeToFile dest link = + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () + orDefault : a -> Optional a -> a + readAll : Handle + ->{IO, Exception} Text + right : Either a b -> Optional b + runChez : Text ->{IO, Exception} Text + runInScheme : Nat + -> Term + ->{IO, Exception} Text + schemeToFile : Text + -> Term + ->{IO, Exception} () + |> : a -> (a ->{g} t) ->{g} t + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () + orDefault : a -> Optional a -> a + readAll : Handle ->{IO, Exception} Text + right : Either a b -> Optional b + runChez : Text ->{IO, Exception} Text + runInScheme : Nat + -> Term + ->{IO, Exception} Text + schemeToFile : Text + -> Term + ->{IO, Exception} () + |> : a -> (a ->{g} t) ->{g} t + +.> run generateSchemeBuiltinLibrary + + () + +``` diff --git a/chez-libs/tests/test1.md b/chez-libs/tests/test1.md new file mode 100644 index 000000000..3a9fa0cf2 --- /dev/null +++ b/chez-libs/tests/test1.md @@ -0,0 +1,61 @@ + +```unison:hide +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh + +schemeToFile dest link = + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName +``` + +```ucm:hide +.> add +.> run generateSchemeBuiltinLibrary +``` + +```unison +test1_term = '(printLine "Hello") +``` + +```ucm:hide +.> add +``` + +```unison +test1 = '(runInScheme 1 (termLink test1_term)) +``` + +```ucm +.> run test1 +``` diff --git a/chez-libs/tests/test1.output.md b/chez-libs/tests/test1.output.md new file mode 100644 index 000000000..a787d3110 --- /dev/null +++ b/chez-libs/tests/test1.output.md @@ -0,0 +1,77 @@ + +```unison +generateSchemeBuiltinLibrary _ = + fh = open (FilePath "../unison/builtin-generated.ss") Write + putText fh (generateBaseFile builtinSpec) + close fh + +schemeToFile dest link = + fh = open (FilePath dest) Write + putText fh (generateScheme false link) + close fh + +a |> f = f a + +right = cases + Left _ -> None + Right a -> Some a + +orDefault a = cases + None -> a + Some a -> a + +readAll fid = + getBytes fid 1024 + |> fromUtf8.impl + |> right + |> orDefault "Not utf8 output" + +runChez fileName = + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + exitCode = match wait pid with + 0 -> "" + code -> "Non-zero exit code! " ++ (toText code) ++ "\n" + exitCode ++ readAll stdout ++ readAll stderr + +runInScheme id term = + fileName = "basic-" ++ (Nat.toText id) ++ ".ss" + schemeToFile fileName term + runChez fileName +``` + +```unison +test1_term = '(printLine "Hello") +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test1_term : '{IO, Exception} () + +``` +```unison +test1 = '(runInScheme 1 (termLink test1_term)) +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test1 : '{IO, Exception} Text + +``` +```ucm +.> run test1 + + "" + +``` diff --git a/chez-libs/tests/utils.md b/chez-libs/tests/utils.md new file mode 100644 index 000000000..e69de29bb diff --git a/chez-libs/tests/what.md b/chez-libs/tests/what.md new file mode 100644 index 000000000..821d3de3b --- /dev/null +++ b/chez-libs/tests/what.md @@ -0,0 +1,6 @@ +```unison +hello = 10 +``` +```ucm +.> add +``` \ No newline at end of file diff --git a/chez-libs/tests/what.output.md b/chez-libs/tests/what.output.md new file mode 100644 index 000000000..e18069d28 --- /dev/null +++ b/chez-libs/tests/what.output.md @@ -0,0 +1,23 @@ +```unison +hello = 10 +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + hello : ##Nat + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + hello : ##Nat + +``` From c76a9104cb2b204fe3f5a8f9267d3b7b6108f47e Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 1 Feb 2023 07:44:18 -0600 Subject: [PATCH 179/467] [chez-test] better --- chez-libs/tests/test1.md | 45 --------------------------------- chez-libs/tests/test1.output.md | 40 ----------------------------- chez-libs/tests/utils.md | 0 3 files changed, 85 deletions(-) delete mode 100644 chez-libs/tests/utils.md diff --git a/chez-libs/tests/test1.md b/chez-libs/tests/test1.md index 3a9fa0cf2..434755db2 100644 --- a/chez-libs/tests/test1.md +++ b/chez-libs/tests/test1.md @@ -1,49 +1,4 @@ -```unison:hide -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme false link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` - -```ucm:hide -.> add -.> run generateSchemeBuiltinLibrary -``` - ```unison test1_term = '(printLine "Hello") ``` diff --git a/chez-libs/tests/test1.output.md b/chez-libs/tests/test1.output.md index a787d3110..7857dbb54 100644 --- a/chez-libs/tests/test1.output.md +++ b/chez-libs/tests/test1.output.md @@ -1,44 +1,4 @@ -```unison -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme false link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` - ```unison test1_term = '(printLine "Hello") ``` diff --git a/chez-libs/tests/utils.md b/chez-libs/tests/utils.md deleted file mode 100644 index e69de29bb..000000000 From e5461ba59d7ddb1000f26ce17baa349e594d13c8 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 1 Feb 2023 07:46:31 -0600 Subject: [PATCH 180/467] [chez-test] move --- {chez-libs => scheme-libs}/tests/.gitignore | 0 {chez-libs => scheme-libs}/tests/Readme.md | 0 {chez-libs => scheme-libs}/tests/base.md | 0 {chez-libs => scheme-libs}/tests/base.output.md | 0 {chez-libs => scheme-libs}/tests/basic.md | 0 {chez-libs => scheme-libs}/tests/basic.output.md | 0 {chez-libs => scheme-libs}/tests/test1.md | 0 {chez-libs => scheme-libs}/tests/test1.output.md | 0 {chez-libs => scheme-libs}/tests/what.md | 0 {chez-libs => scheme-libs}/tests/what.output.md | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename {chez-libs => scheme-libs}/tests/.gitignore (100%) rename {chez-libs => scheme-libs}/tests/Readme.md (100%) rename {chez-libs => scheme-libs}/tests/base.md (100%) rename {chez-libs => scheme-libs}/tests/base.output.md (100%) rename {chez-libs => scheme-libs}/tests/basic.md (100%) rename {chez-libs => scheme-libs}/tests/basic.output.md (100%) rename {chez-libs => scheme-libs}/tests/test1.md (100%) rename {chez-libs => scheme-libs}/tests/test1.output.md (100%) rename {chez-libs => scheme-libs}/tests/what.md (100%) rename {chez-libs => scheme-libs}/tests/what.output.md (100%) diff --git a/chez-libs/tests/.gitignore b/scheme-libs/tests/.gitignore similarity index 100% rename from chez-libs/tests/.gitignore rename to scheme-libs/tests/.gitignore diff --git a/chez-libs/tests/Readme.md b/scheme-libs/tests/Readme.md similarity index 100% rename from chez-libs/tests/Readme.md rename to scheme-libs/tests/Readme.md diff --git a/chez-libs/tests/base.md b/scheme-libs/tests/base.md similarity index 100% rename from chez-libs/tests/base.md rename to scheme-libs/tests/base.md diff --git a/chez-libs/tests/base.output.md b/scheme-libs/tests/base.output.md similarity index 100% rename from chez-libs/tests/base.output.md rename to scheme-libs/tests/base.output.md diff --git a/chez-libs/tests/basic.md b/scheme-libs/tests/basic.md similarity index 100% rename from chez-libs/tests/basic.md rename to scheme-libs/tests/basic.md diff --git a/chez-libs/tests/basic.output.md b/scheme-libs/tests/basic.output.md similarity index 100% rename from chez-libs/tests/basic.output.md rename to scheme-libs/tests/basic.output.md diff --git a/chez-libs/tests/test1.md b/scheme-libs/tests/test1.md similarity index 100% rename from chez-libs/tests/test1.md rename to scheme-libs/tests/test1.md diff --git a/chez-libs/tests/test1.output.md b/scheme-libs/tests/test1.output.md similarity index 100% rename from chez-libs/tests/test1.output.md rename to scheme-libs/tests/test1.output.md diff --git a/chez-libs/tests/what.md b/scheme-libs/tests/what.md similarity index 100% rename from chez-libs/tests/what.md rename to scheme-libs/tests/what.md diff --git a/chez-libs/tests/what.output.md b/scheme-libs/tests/what.output.md similarity index 100% rename from chez-libs/tests/what.output.md rename to scheme-libs/tests/what.output.md From 611cef1011400629a2e17f200a8d868bd1cdeab2 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 1 Feb 2023 11:01:46 -0600 Subject: [PATCH 181/467] Failing effect list annotation tests --- unison-cli/tests/Unison/Test/LSP.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/unison-cli/tests/Unison/Test/LSP.hs b/unison-cli/tests/Unison/Test/LSP.hs index ef791497d..7833d59a5 100644 --- a/unison-cli/tests/Unison/Test/LSP.hs +++ b/unison-cli/tests/Unison/Test/LSP.hs @@ -110,6 +110,32 @@ term = let True, Left (Term.Boolean True) ), + ( "Test annotations for types with arrows", + [here| +structural type Thing = This | That + +term : Thing -> Thing -> Thi^ng +term a b = This + |], + True, + Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) + ), + ( "Test annotations for types with effects", + [here| +unique ability Foo a where + foo : a + +unique ability Bar b where + bar : b + +structural type Thing = This | That + +term : (Thing -> {Foo a, Bar b} Th^ing) -> {Foo a, Bar b} Thing +term f = f This + |], + True, + Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) + ), -- ( "Test annotations for blocks with destructuring binds", -- [here| -- term = let From 8ff5b021cab43bd151eca335e57bf9b18bc1f721 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 1 Feb 2023 13:05:16 -0600 Subject: [PATCH 182/467] Use socket operations for LSP client communication to avoid errors on socket close (#3783) * Use socket ops for LSP * Catch exceptions on read/write --- unison-cli/src/Unison/LSP.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/unison-cli/src/Unison/LSP.hs b/unison-cli/src/Unison/LSP.hs index eb443058c..54f8cba34 100644 --- a/unison-cli/src/Unison/LSP.hs +++ b/unison-cli/src/Unison/LSP.hs @@ -9,6 +9,7 @@ import Colog.Core (LogAction (LogAction)) import qualified Colog.Core as Colog import Compat (onWindows) import Control.Monad.Reader +import Data.ByteString.Builder.Extra (defaultChunkSize) import Data.Char (toLower) import GHC.IO.Exception (ioe_errno) import qualified Ki @@ -19,7 +20,6 @@ import Language.LSP.Types.SMethodMap import qualified Language.LSP.Types.SMethodMap as SMM import Language.LSP.VFS import qualified Network.Simple.TCP as TCP -import Network.Socket (socketToHandle) import System.Environment (lookupEnv) import System.IO (hPutStrLn) import Unison.Codebase @@ -58,12 +58,21 @@ spawnLsp codebase runtime latestBranch latestPath = UnliftIO.handleIO (handleFailure lspPort) $ do TCP.serve (TCP.Host "127.0.0.1") lspPort $ \(sock, _sockaddr) -> do Ki.scoped \scope -> do - sockHandle <- socketToHandle sock ReadWriteMode + -- If the socket is closed, reading/writing will throw an exception, + -- but since the socket is closed, this connection will be shutting down + -- immediately anyways, so we just ignore it. + let clientInput = handleAny (\_ -> pure "") do + -- The server will be in the process of shutting down if the socket is closed, + -- so just return empty input in the meantime. + fromMaybe "" <$> TCP.recv sock defaultChunkSize + let clientOutput output = handleAny (\_ -> pure ()) do + TCP.sendLazy sock output + -- currently we have an independent VFS for each LSP client since each client might have -- different un-saved state for the same file. initVFS $ \vfs -> do vfsVar <- newMVar vfs - void $ runServerWithHandles lspServerLogger lspClientLogger sockHandle sockHandle (serverDefinition vfsVar codebase runtime scope latestBranch latestPath) + void $ runServerWith lspServerLogger lspClientLogger clientInput clientOutput (serverDefinition vfsVar codebase runtime scope latestBranch latestPath) where handleFailure :: String -> IOException -> IO () handleFailure lspPort ioerr = From 2e8576921b0a6bb0270dc48beaa1913a07cce30d Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 1 Feb 2023 14:04:32 -0600 Subject: [PATCH 183/467] Workaround for incorrect effect issues --- unison-cli/src/Unison/LSP/Queries.hs | 6 +++++- unison-cli/tests/Unison/Test/LSP.hs | 13 +++++++++++++ unison-core/src/Unison/Type.hs | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index cf680c191..e34bf8348 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -174,7 +174,11 @@ findSmallestEnclosingType pos typ ABT.Tm f -> case f of Type.Ref {} -> Just typ Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Effect effs rhs -> + -- There's currently a bug in the annotations for effects which cause them to + -- span larger than they should. As a workaround for now we just make sure to + -- search the RHS before the effects. + findSmallestEnclosingType pos rhs <|> findSmallestEnclosingType pos effs Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b Type.Forall r -> findSmallestEnclosingType pos r Type.Ann a _kind -> findSmallestEnclosingType pos a diff --git a/unison-cli/tests/Unison/Test/LSP.hs b/unison-cli/tests/Unison/Test/LSP.hs index 7833d59a5..a415516e9 100644 --- a/unison-cli/tests/Unison/Test/LSP.hs +++ b/unison-cli/tests/Unison/Test/LSP.hs @@ -136,6 +136,19 @@ term f = f This True, Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) ), + ( "Test annotations for effects themselves", + [here| +structural ability Foo a where + foo : a + +structural type Thing = This | That + +term : () -> {F^oo a} Thing +term _ = This + |], + True, + Right (Type.Ref (Reference.unsafeFromText "#h4uhcub76va4tckj1iccnsb07rh0fhgpigqapb4jh5n07s0tugec4nm2vikuv973mab7oh4ne07o6armcnnl7mbfjtb4imphgrjgimg")) + ), -- ( "Test annotations for blocks with destructuring binds", -- [here| -- term = let diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index 9d2a0cf9c..a676a2b6a 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -279,7 +279,7 @@ mvarRef = Reference.Builtin "MVar" tvarRef = Reference.Builtin "TVar" ticketRef :: Reference -ticketRef = Reference.Builtin "Ref.Ticket" +ticketRef = Reference.Builtin "Ref.Ticket" promiseRef :: Reference promiseRef = Reference.Builtin "Promise" From 512ef4c8e75a0b0e2d71b34107cc7f44ae93b0bc Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Thu, 2 Feb 2023 07:57:45 -0600 Subject: [PATCH 184/467] It's working! `./run-tests.sh` will run a basic chez test, and capture the output! --- chez-libs/tests/.gitignore | 1 - chez-libs/tests/basic.md | 68 --------------------------- chez-libs/tests/basic.output.md | 77 ------------------------------- scheme-libs/tests/.gitignore | 4 +- scheme-libs/tests/Readme.md | 4 +- scheme-libs/tests/base.md | 6 +-- scheme-libs/tests/base.output.md | 21 ++------- scheme-libs/tests/basic.md | 52 +-------------------- scheme-libs/tests/basic.output.md | 42 +---------------- scheme-libs/tests/run-tests.sh | 13 ++++++ 10 files changed, 29 insertions(+), 259 deletions(-) delete mode 100644 chez-libs/tests/.gitignore delete mode 100644 chez-libs/tests/basic.md delete mode 100644 chez-libs/tests/basic.output.md create mode 100755 scheme-libs/tests/run-tests.sh diff --git a/chez-libs/tests/.gitignore b/chez-libs/tests/.gitignore deleted file mode 100644 index e32f74228..000000000 --- a/chez-libs/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.ss \ No newline at end of file diff --git a/chez-libs/tests/basic.md b/chez-libs/tests/basic.md deleted file mode 100644 index 3c0794f0f..000000000 --- a/chez-libs/tests/basic.md +++ /dev/null @@ -1,68 +0,0 @@ - -```ucm:hide -.> builtins.merge -.> pull unison.public.base.latest.IO base.IO -.> pull unison.public.base.main.IO.Process base.IO.Process -.> pull dolio.public.internal.trunk.compiler -``` - -```unison:hide -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme false link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` - -```ucm:hide -.> add -.> run generateSchemeBuiltinLibrary -``` - -```unison -test1_term = '(printLine "Hello") -``` - -```ucm:hide -.> add -``` - -```unison -test1 = '(runInScheme 1 (termLink test1_term)) -``` - -```ucm -.> run test1 -``` diff --git a/chez-libs/tests/basic.output.md b/chez-libs/tests/basic.output.md deleted file mode 100644 index a787d3110..000000000 --- a/chez-libs/tests/basic.output.md +++ /dev/null @@ -1,77 +0,0 @@ - -```unison -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme false link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` - -```unison -test1_term = '(printLine "Hello") -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - test1_term : '{IO, Exception} () - -``` -```unison -test1 = '(runInScheme 1 (termLink test1_term)) -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - test1 : '{IO, Exception} Text - -``` -```ucm -.> run test1 - - "" - -``` diff --git a/scheme-libs/tests/.gitignore b/scheme-libs/tests/.gitignore index e32f74228..cb18d7d9b 100644 --- a/scheme-libs/tests/.gitignore +++ b/scheme-libs/tests/.gitignore @@ -1 +1,3 @@ -*.ss \ No newline at end of file +*.ss +ucm +base.unison diff --git a/scheme-libs/tests/Readme.md b/scheme-libs/tests/Readme.md index 28db5bd9a..1bc0d7a62 100644 --- a/scheme-libs/tests/Readme.md +++ b/scheme-libs/tests/Readme.md @@ -3,10 +3,10 @@ First make a codebase that has the basic things you need, that the other transcripts can run off of. ```bash -$ ucm transcript --save-codebase -C base.unison base.md +$ ucm transcript --save-codebase-to base.unison base.md ``` Then run the transcripts! ```bash $ ucm transcript.fork -c base.unison test1.md -``` \ No newline at end of file +``` diff --git a/scheme-libs/tests/base.md b/scheme-libs/tests/base.md index b9fd3af0e..6d9c5edd8 100644 --- a/scheme-libs/tests/base.md +++ b/scheme-libs/tests/base.md @@ -8,13 +8,13 @@ ```unison generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write + fh = open (FilePath "../chez/unison/builtin-generated.ss") Write putText fh (generateBaseFile builtinSpec) close fh schemeToFile dest link = fh = open (FilePath dest) Write - putText fh (generateScheme false link) + putText fh (generateScheme true link) close fh a |> f = f a @@ -34,7 +34,7 @@ readAll fid = |> orDefault "Not utf8 output" runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../chez:../common", "--script", fileName] exitCode = match wait pid with 0 -> "" code -> "Non-zero exit code! " ++ (toText code) ++ "\n" diff --git a/scheme-libs/tests/base.output.md b/scheme-libs/tests/base.output.md index ca07c811f..11bb176db 100644 --- a/scheme-libs/tests/base.output.md +++ b/scheme-libs/tests/base.output.md @@ -6,35 +6,24 @@ .> pull unison.public.base.latest.IO base.IO - 😶 + ✅ - base.IO was already up-to-date with - unison.public.base.latest.IO. + ✅ Successfully pulled into newly created namespace base.IO. .> pull unison.public.base.main.IO.Process base.IO.Process - 😶 - - base.IO.Process was already up-to-date with - unison.public.base.main.IO.Process. - .> pull dolio.public.internal.trunk.compiler - 😶 - - the current namespace was already up-to-date with - dolio.public.internal.trunk.compiler. - ``` ```unison generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write + fh = open (FilePath "../chez/unison/builtin-generated.ss") Write putText fh (generateBaseFile builtinSpec) close fh schemeToFile dest link = fh = open (FilePath dest) Write - putText fh (generateScheme false link) + putText fh (generateScheme true link) close fh a |> f = f a @@ -54,7 +43,7 @@ readAll fid = |> orDefault "Not utf8 output" runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] + (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../chez:../common", "--script", fileName] exitCode = match wait pid with 0 -> "" code -> "Non-zero exit code! " ++ (toText code) ++ "\n" diff --git a/scheme-libs/tests/basic.md b/scheme-libs/tests/basic.md index 3c0794f0f..b86a75641 100644 --- a/scheme-libs/tests/basic.md +++ b/scheme-libs/tests/basic.md @@ -1,55 +1,5 @@ -```ucm:hide -.> builtins.merge -.> pull unison.public.base.latest.IO base.IO -.> pull unison.public.base.main.IO.Process base.IO.Process -.> pull dolio.public.internal.trunk.compiler -``` - -```unison:hide -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme false link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` - -```ucm:hide -.> add -.> run generateSchemeBuiltinLibrary -``` +Note: This should be forked off of the codebase created by base.md ```unison test1_term = '(printLine "Hello") diff --git a/scheme-libs/tests/basic.output.md b/scheme-libs/tests/basic.output.md index a787d3110..526045716 100644 --- a/scheme-libs/tests/basic.output.md +++ b/scheme-libs/tests/basic.output.md @@ -1,43 +1,5 @@ -```unison -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme false link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../:./", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` +Note: This should be forked off of the codebase created by base.md ```unison test1_term = '(printLine "Hello") @@ -72,6 +34,6 @@ test1 = '(runInScheme 1 (termLink test1_term)) ```ucm .> run test1 - "" + "Hello\n" ``` diff --git a/scheme-libs/tests/run-tests.sh b/scheme-libs/tests/run-tests.sh new file mode 100755 index 000000000..a7dcd8e49 --- /dev/null +++ b/scheme-libs/tests/run-tests.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -ex + +if [ ! -f "ucm" ]; then + ln -s $(stack exec -- which unison) ./ucm +fi + +if [ ! -d "base.unison" ]; then + ./ucm transcript -S base.unison base.md +fi + +./ucm transcript.fork -c base.unison basic.md + From 9ff8ec52a1fb66835b9cb6ecffb4b9a268789dea Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Thu, 2 Feb 2023 08:06:45 -0600 Subject: [PATCH 185/467] [chez-test] better readme --- scheme-libs/tests/Readme.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scheme-libs/tests/Readme.md b/scheme-libs/tests/Readme.md index 1bc0d7a62..00b09fc7b 100644 --- a/scheme-libs/tests/Readme.md +++ b/scheme-libs/tests/Readme.md @@ -1,12 +1,6 @@ -# Testing our chez backend +# Testing our scheme backend -First make a codebase that has the basic things you need, that the other transcripts can run off of. ```bash -$ ucm transcript --save-codebase-to base.unison base.md -``` - -Then run the transcripts! -```bash -$ ucm transcript.fork -c base.unison test1.md +$ ./run-tests.sh ``` From cd559fbaf07b0e873a37c376d9e2f975895ab0e6 Mon Sep 17 00:00:00 2001 From: Cody Allen Date: Thu, 2 Feb 2023 09:52:16 -0500 Subject: [PATCH 186/467] Improve type error message for == on Foreign This improves the error message when there is a type mismatch in equality checks of `Foreign`. The `Eq.==` error message now matches the style of error message provided for `compare` on the `Ord` instance. --- parser-typechecker/src/Unison/Runtime/Foreign.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index 5be56de6f..eeb55e685 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -27,8 +27,8 @@ import qualified Data.X509 as X509 import Network.Socket (Socket) import qualified Network.TLS as TLS (ClientParams, Context, ServerParams) import System.Clock (TimeSpec) -import System.Process (ProcessHandle) import System.IO (Handle) +import System.Process (ProcessHandle) import Unison.Reference (Reference) import Unison.Referent (Referent) import Unison.Runtime.ANF (SuperGroup, Value) @@ -155,7 +155,10 @@ ref2cmp r instance Eq Foreign where Wrap rl t == Wrap rr u | rl == rr, Just (~~) <- ref2eq rl = t ~~ u - _ == _ = error "Eq Foreign" + Wrap rl1 _ == Wrap rl2 _ = + error $ + "Attempting to check equality of two values of different types: " + <> show (rl1, rl2) instance Ord Foreign where Wrap rl t `compare` Wrap rr u From d9e0cfa9cfb21bca56fd06f2358f80f64dc011be Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 2 Feb 2023 09:49:21 -0600 Subject: [PATCH 187/467] Upgrade to stack 2.9.1 (#3787) --- .github/workflows/ci.yaml | 6 +++--- .github/workflows/haddocks.yaml | 2 +- .github/workflows/pre-release.yaml | 8 ++++---- .github/workflows/release.yaml | 8 ++++---- docs/m1-mac-setup-tips.markdown | 8 ++++---- .../unison-pretty-printer.cabal | 8 ++++---- parser-typechecker/unison-parser-typechecker.cabal | 6 +++--- unison-cli/unison-cli.cabal | 12 ++++++------ unison-core/unison-core1.cabal | 4 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4c44f1a2f..f3887bc7c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -101,7 +101,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-linux-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: install stack (macOS) @@ -109,7 +109,7 @@ jobs: if: runner.os == 'macOS' run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-osx-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-osx-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: install stack (windows) @@ -117,7 +117,7 @@ jobs: if: runner.os == 'Windows' run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-windows-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-windows-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH # One of the transcripts fails if the user's git name hasn't been set. diff --git a/.github/workflows/haddocks.yaml b/.github/workflows/haddocks.yaml index 3f6bdbbf7..923283c82 100644 --- a/.github/workflows/haddocks.yaml +++ b/.github/workflows/haddocks.yaml @@ -62,7 +62,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-linux-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH # One of the transcripts fails if the user's git name hasn't been set. diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index 1e2ece8c1..18473efd9 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -23,7 +23,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-linux-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH # One of the transcripts fails if the user's git name hasn't been set. @@ -61,7 +61,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-osx-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-osx-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH # One of the transcripts fails if the user's git name hasn't been set. @@ -104,7 +104,7 @@ jobs: if: runner.os == 'Windows' run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-windows-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-windows-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: build @@ -118,7 +118,7 @@ jobs: run: | mkdir -p tmp\ui mkdir -p release\ui - $UCM = .\stack\stack-2.7.5-windows-x86_64\stack.exe exec -- where unison + $UCM = .\stack\stack-2.9.1-windows-x86_64\stack.exe exec -- where unison cp $UCM .\release\ucm.exe Invoke-WebRequest -Uri https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip -OutFile tmp\unisonLocal.zip Expand-Archive -Path tmp\unisonLocal.zip -DestinationPath release\ui diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c4f5ce6d5..027056b0d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -104,7 +104,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-linux-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.9.1-linux-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: build @@ -176,7 +176,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-osx-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.9.1-osx-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: remove ~/.stack/setup-exe-cache on macOS @@ -252,7 +252,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.7.5-windows-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.9.1-windows-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: build @@ -277,7 +277,7 @@ jobs: run: | mkdir -p tmp\ui mkdir -p release\ui - $UCM = .\stack\stack-2.7.5-windows-x86_64\stack.exe exec -- where unison + $UCM = .\stack\stack-2.9.1-windows-x86_64\stack.exe exec -- where unison cp $UCM .\release\ucm.exe Invoke-WebRequest -Uri https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip -OutFile tmp\unisonLocal.zip Expand-Archive -Path tmp\unisonLocal.zip -DestinationPath release\ui diff --git a/docs/m1-mac-setup-tips.markdown b/docs/m1-mac-setup-tips.markdown index f7629c6cf..6a24f3ad4 100644 --- a/docs/m1-mac-setup-tips.markdown +++ b/docs/m1-mac-setup-tips.markdown @@ -6,7 +6,7 @@ If you are a newcomer to the Haskell ecosystem trying to set up your dev environ Here is a working set of versions you can use to build the Unison executable: GHC version: 8.10.7 -Stack version: 2.7.5 +Stack version: 2.9.1 Cabal version 3.6.2.0 Haskell language server version: 1.7.0.0 @@ -45,7 +45,7 @@ The GHCup Haskell installer, version 0.1.19.0 $ which stack ~/.ghcup/bin/stack $ stack --version -Version 2.7.5, Git revision 717ec96c15520748f3fcee00f72504ddccaa30b5 (dirty) (163 commits) aarch64 +Version 2.9.1, Git revision 13c9c8772a6dce093dbeacc08bb5877bdb6cfc2e (dirty) (155 commits) aarch64 ``` ```shell @@ -79,7 +79,7 @@ Cradle type: Stack Tool versions found on the $PATH cabal: 3.6.2.0 -stack: 2.7.5 +stack: 2.9.1 ghc: 8.10.7 ``` @@ -88,7 +88,7 @@ If you're a VS Code user, you can download the Haskell extension for IDE support ```json "haskell.manageHLS": "GHCup", "haskell.toolchain": { - "stack": "2.7.5", + "stack": "2.9.1", "ghc": "8.10.7", "cabal": "recommended", "hls": "1.7.0.0" diff --git a/lib/unison-pretty-printer/unison-pretty-printer.cabal b/lib/unison-pretty-printer/unison-pretty-printer.cabal index f23faeed9..813774eff 100644 --- a/lib/unison-pretty-printer/unison-pretty-printer.cabal +++ b/lib/unison-pretty-printer/unison-pretty-printer.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -68,9 +68,9 @@ library , unison-prelude , unison-syntax , unliftio + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 executable prettyprintdemo main-is: Main.hs @@ -103,9 +103,9 @@ executable prettyprintdemo , safe , text , unison-pretty-printer + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 test-suite pretty-printer-tests type: exitcode-stdio-1.0 @@ -146,6 +146,6 @@ test-suite pretty-printer-tests , raw-strings-qq , unison-pretty-printer , unison-syntax + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 67a44d262..199865ef7 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -308,11 +308,11 @@ library , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 test-suite parser-typechecker-tests type: exitcode-stdio-1.0 @@ -500,8 +500,8 @@ test-suite parser-typechecker-tests , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 7c59e5b8a..9573c1eca 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -203,12 +203,12 @@ library , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields if !os(windows) build-depends: unix - default-language: Haskell2010 executable cli-integration-tests main-is: Suite.hs @@ -331,9 +331,9 @@ executable cli-integration-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable transcripts main-is: Transcripts.hs @@ -453,9 +453,9 @@ executable transcripts , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable unison main-is: Main.hs @@ -582,9 +582,9 @@ executable unison , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 test-suite cli-tests type: exitcode-stdio-1.0 @@ -714,6 +714,6 @@ test-suite cli-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 diff --git a/unison-core/unison-core1.cabal b/unison-core/unison-core1.cabal index 1261b0ded..48eac1036 100644 --- a/unison-core/unison-core1.cabal +++ b/unison-core/unison-core1.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -106,6 +106,6 @@ library , unison-util-base32hex , unison-util-relation , vector + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 From 7df66646871167476296e7c002ad1a6ff0710fc9 Mon Sep 17 00:00:00 2001 From: Cody Allen Date: Thu, 2 Feb 2023 11:32:14 -0500 Subject: [PATCH 188/467] Fix universal equality for Socket Resolves #3791 Delegate to the runtime's Socket equality, which I believe uses pointer equality. I tested this by running the following code, which no longer gives an error after this change: ``` main = do socket = Socket.client (HostName "www.google.com") (Port "http") socket === socket ``` --- parser-typechecker/src/Unison/Runtime/Foreign.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index eeb55e685..81b7b2a2a 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -71,6 +71,10 @@ mvarEq :: MVar () -> MVar () -> Bool mvarEq l r = l == r {-# NOINLINE mvarEq #-} +socketEq :: Socket -> Socket -> Bool +socketEq l r = l == r +{-# NOINLINE socketEq #-} + refEq :: IORef () -> IORef () -> Bool refEq l r = l == r {-# NOINLINE refEq #-} @@ -133,6 +137,7 @@ ref2eq r -- matter what type the MVar holds. | r == Ty.mvarRef = Just $ promote mvarEq -- Ditto + | r == Ty.socketRef = Just $ promote socketEq | r == Ty.refRef = Just $ promote refEq | r == Ty.threadIdRef = Just $ promote tidEq | r == Ty.marrayRef = Just $ promote marrEq From 71f104a1f419d250b4011f109d66f7960950fc99 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 2 Feb 2023 10:45:51 -0600 Subject: [PATCH 189/467] Add support and tests for pattern nodes --- unison-cli/src/Unison/LSP/Queries.hs | 72 +++++++++++++++++++++------- unison-cli/tests/Unison/Test/LSP.hs | 66 +++++++++++++++---------- unison-core/src/Unison/Pattern.hs | 17 +++++++ 3 files changed, 113 insertions(+), 42 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index cf680c191..557427456 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -7,6 +7,7 @@ module Unison.LSP.Queries refInDecl, getTypeOfReferent, getTypeDeclaration, + SourceNode (..), ) where @@ -19,6 +20,7 @@ import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.DataDeclaration (Decl) import qualified Unison.DataDeclaration as DD +import qualified Unison.DataDeclaration as Decl import Unison.LSP.FileAnalysis import Unison.LSP.Orphans () import Unison.LSP.Types @@ -27,6 +29,7 @@ import qualified Unison.LabeledDependency as LD import Unison.Lexer.Pos (Pos (..)) import Unison.Parser.Ann (Ann) import qualified Unison.Parser.Ann as Ann +import qualified Unison.Pattern as Pattern import Unison.Prelude import Unison.Reference (TypeReference) import qualified Unison.Reference as Reference @@ -123,27 +126,40 @@ refInType typ = case ABT.out typ of ABT.Cycle _r -> Nothing ABT.Abs _v _r -> Nothing +data SourceNode a + = TermNode (Term Symbol a) + | TypeNode (Type Symbol a) + | DeclNode (Decl Symbol a) + | PatternNode (Pattern.Pattern a) + deriving stock (Eq, Show) + +instance Functor SourceNode where + fmap f (TermNode t) = TermNode (Term.amap f t) + fmap f (TypeNode t) = TypeNode (fmap f t) + fmap f (DeclNode t) = DeclNode (Decl.amap f t) + fmap f (PatternNode t) = PatternNode (fmap f t) + -- | Find the the node in a term which contains the specified position, but none of its -- children contain that position. -findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (Either (Term Symbol Ann) (Type Symbol Ann)) +findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (SourceNode Ann) findSmallestEnclosingNode pos term | annIsFilePosition (ABT.annotation term) && not (ABT.annotation term `Ann.contains` pos) = Nothing | otherwise = do let bestChild = case ABT.out term of ABT.Tm f -> case f of - Term.Int {} -> Just (Left term) - Term.Nat {} -> Just (Left term) - Term.Float {} -> Just (Left term) - Term.Boolean {} -> Just (Left term) - Term.Text {} -> Just (Left term) - Term.Char {} -> Just (Left term) - Term.Blank {} -> Just (Left term) - Term.Ref {} -> Just (Left term) - Term.Constructor {} -> Just (Left term) - Term.Request {} -> Just (Left term) + Term.Int {} -> Just (TermNode term) + Term.Nat {} -> Just (TermNode term) + Term.Float {} -> Just (TermNode term) + Term.Boolean {} -> Just (TermNode term) + Term.Text {} -> Just (TermNode term) + Term.Char {} -> Just (TermNode term) + Term.Blank {} -> Just (TermNode term) + Term.Ref {} -> Just (TermNode term) + Term.Constructor {} -> Just (TermNode term) + Term.Request {} -> Just (TermNode term) Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b Term.App a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (Right <$> findSmallestEnclosingType pos typ) + Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (TypeNode <$> findSmallestEnclosingType pos typ) Term.List xs -> altSum (findSmallestEnclosingNode pos <$> xs) Term.If cond a b -> findSmallestEnclosingNode pos cond <|> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b Term.And l r -> findSmallestEnclosingNode pos l <|> findSmallestEnclosingNode pos r @@ -153,13 +169,35 @@ findSmallestEnclosingNode pos term Term.Let _isTop a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b Term.Match a cases -> findSmallestEnclosingNode pos a - <|> altSum (cases <&> \(MatchCase _pat grd body) -> altSum (findSmallestEnclosingNode pos <$> grd) <|> findSmallestEnclosingNode pos body) - Term.TermLink {} -> Just (Left term) - Term.TypeLink {} -> Just (Left term) - ABT.Var _v -> Just (Left term) + <|> altSum (cases <&> \(MatchCase pat grd body) -> ((PatternNode <$> findSmallestEnclosingPattern pos pat) <|> (grd >>= findSmallestEnclosingNode pos) <|> findSmallestEnclosingNode pos body)) + Term.TermLink {} -> Just (TermNode term) + Term.TypeLink {} -> Just (TermNode term) + ABT.Var _v -> Just (TermNode term) ABT.Cycle r -> findSmallestEnclosingNode pos r ABT.Abs _v r -> findSmallestEnclosingNode pos r - let fallback = if annIsFilePosition (ABT.annotation term) then Just (Left term) else Nothing + let fallback = if annIsFilePosition (ABT.annotation term) then Just (TermNode term) else Nothing + bestChild <|> fallback + +findSmallestEnclosingPattern :: Pos -> Pattern.Pattern Ann -> Maybe (Pattern.Pattern Ann) +findSmallestEnclosingPattern pos pat + | annIsFilePosition (Pattern.annotation pat) && not (Pattern.annotation pat `Ann.contains` pos) = Nothing + | otherwise = do + let bestChild = case pat of + Pattern.Unbound {} -> Just pat + Pattern.Var {} -> Just pat + Pattern.Boolean {} -> Just pat + Pattern.Int {} -> Just pat + Pattern.Nat {} -> Just pat + Pattern.Float {} -> Just pat + Pattern.Text {} -> Just pat + Pattern.Char {} -> Just pat + Pattern.Constructor _loc _conRef pats -> altSum (findSmallestEnclosingPattern pos <$> pats) + Pattern.As _loc p -> findSmallestEnclosingPattern pos p + Pattern.EffectPure _loc p -> findSmallestEnclosingPattern pos p + Pattern.EffectBind _loc _conRef pats p -> altSum (findSmallestEnclosingPattern pos <$> pats) <|> findSmallestEnclosingPattern pos p + Pattern.SequenceLiteral _loc pats -> altSum (findSmallestEnclosingPattern pos <$> pats) + Pattern.SequenceOp _loc p1 _op p2 -> findSmallestEnclosingPattern pos p1 <|> findSmallestEnclosingPattern pos p2 + let fallback = if annIsFilePosition (Pattern.annotation pat) then Just pat else Nothing bestChild <|> fallback -- | Find the the node in a type which contains the specified position, but none of its diff --git a/unison-cli/tests/Unison/Test/LSP.hs b/unison-cli/tests/Unison/Test/LSP.hs index ef791497d..55887b12f 100644 --- a/unison-cli/tests/Unison/Test/LSP.hs +++ b/unison-cli/tests/Unison/Test/LSP.hs @@ -4,7 +4,6 @@ module Unison.Test.LSP (test) where import qualified Crypto.Random as Random -import Data.Bifunctor (bimap) import Data.List.Extra (firstJust) import Data.String.Here.Uninterpolated (here) import Data.Text @@ -20,15 +19,14 @@ import qualified Unison.LSP.Queries as LSPQ import qualified Unison.Lexer.Pos as Lexer import Unison.Parser.Ann (Ann (..)) import qualified Unison.Parser.Ann as Ann +import qualified Unison.Pattern as Pattern import Unison.Prelude import qualified Unison.Reference as Reference import qualified Unison.Result as Result import Unison.Symbol (Symbol) import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Parser as Parser -import Unison.Term (Term) import qualified Unison.Term as Term -import Unison.Type (Type) import qualified Unison.Type as Type import qualified Unison.UnisonFile as UF import Unison.Util.Monoid (foldMapM) @@ -41,6 +39,15 @@ test = do annotationNesting ] +trm :: Term.F Symbol () () (ABT.Term (Term.F Symbol () ()) Symbol ()) -> LSPQ.SourceNode () +trm = LSPQ.TermNode . ABT.tm + +typ :: Type.F (ABT.Term Type.F Symbol ()) -> LSPQ.SourceNode () +typ = LSPQ.TypeNode . ABT.tm + +pat :: Pattern.Pattern () -> LSPQ.SourceNode () +pat = LSPQ.PatternNode + -- | Test that we can find the correct reference for a given cursor position. refFinding :: Test () refFinding = @@ -48,12 +55,12 @@ refFinding = [ ( "Binary Op lhs", [here|term = tr^ue && false|], True, - Left (Term.Boolean True) + trm (Term.Boolean True) ), ( "Binary Op rhs", [here|term = true && fa^lse|], True, - Left (Term.Boolean False) + trm (Term.Boolean False) ), ( "Custom Op lhs", [here| @@ -61,7 +68,7 @@ a &&& b = a && b term = tr^ue &&& false |], True, - Left (Term.Boolean True) + trm (Term.Boolean True) ), ( "Simple type annotation on non-typechecking file", [here| @@ -70,7 +77,7 @@ term : Thi^ng term = "this won't typecheck" |], False, - Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) + typ (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) ), ( "Simple type annotation on typechecking file", [here| @@ -79,7 +86,7 @@ term : Thi^ng term = This |], True, - Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) + typ (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) ), ( "Test annotations within bindings for do-block elements", [here| @@ -89,7 +96,7 @@ term = do first && second |], True, - Left (Term.Boolean True) + trm (Term.Boolean True) ), ( "Test annotations within bindings for let-block elements", [here| @@ -99,7 +106,7 @@ term = let first && second |], True, - Left (Term.Boolean True) + trm (Term.Boolean True) ), ( "Test annotations within actions for let-block elements", [here| @@ -108,18 +115,27 @@ term = let first && tr^ue |], True, - Left (Term.Boolean True) + trm (Term.Boolean True) + ), + ( "Test annotations for blocks with destructuring binds", + [here| +structural type Identity a = Identity a +term = let + (Identity a) = Identity tr^ue + a + |], + True, + trm (Term.Boolean True) + ), + ( "Test annotations within pattern binds", + [here| +term = let + (third, tr^ue) = (false, true) + true + |], + True, + pat (Pattern.Boolean () True) ), - -- ( "Test annotations for blocks with destructuring binds", - -- [here| - -- term = let - -- (first, second) = (false, true) - -- (third, fourth) = (false, tr^ue) - -- first && second && third && fourth - -- |], - -- True, - -- Left (Term.Boolean True) - -- ), ( "Test annotations for blocks recursive binds", [here| term = let @@ -128,7 +144,7 @@ term = let f true |], True, - Left (Term.Boolean False) + trm (Term.Boolean False) ) ] @@ -142,7 +158,7 @@ extractCursor txt = in pure $ (Lexer.Pos line col, before <> after) _ -> crash "expected exactly one cursor" -makeNodeSelectionTest :: (String, Text, Bool, Either ((Term.F Symbol Ann Ann (Term Symbol Ann))) (Type.F (Type Symbol Ann))) -> Test () +makeNodeSelectionTest :: (String, Text, Bool, LSPQ.SourceNode ()) -> Test () makeNodeSelectionTest (name, testSrc, testTypechecked, expected) = scope name $ do (pos, src) <- extractCursor testSrc (notes, mayParsedFile, mayTypecheckedFile) <- typecheckSrc name src @@ -152,7 +168,7 @@ makeNodeSelectionTest (name, testSrc, testTypechecked, expected) = scope name $ UF.terms pf & firstJust \(_v, trm) -> LSPQ.findSmallestEnclosingNode pos trm - expectEqual (Just $ bimap ABT.Tm ABT.Tm expected) (bimap ABT.out ABT.out <$> pfResult) + expectEqual (Just expected) (void <$> pfResult) when testTypechecked $ scope "typechecked file" $ do @@ -162,7 +178,7 @@ makeNodeSelectionTest (name, testSrc, testTypechecked, expected) = scope name $ & toList & firstJust \(_refId, _wk, trm, _typ) -> LSPQ.findSmallestEnclosingNode pos trm - expectEqual (Just $ bimap ABT.Tm ABT.Tm expected) (bimap ABT.out ABT.out <$> tfResult) + expectEqual (Just expected) (void <$> tfResult) -- | Tests which assert that the annotation for each ABT node spans at least the span of -- its children, i.e. all child annotations are contained within the annotation of their parent. diff --git a/unison-core/src/Unison/Pattern.hs b/unison-core/src/Unison/Pattern.hs index c2b597521..d68a28a4c 100644 --- a/unison-core/src/Unison/Pattern.hs +++ b/unison-core/src/Unison/Pattern.hs @@ -37,6 +37,23 @@ data Pattern loc | SequenceOp loc (Pattern loc) !SeqOp (Pattern loc) deriving (Ord, Generic, Functor, Foldable, Traversable) +annotation :: Pattern loc -> loc +annotation = \case + Unbound loc -> loc + Var loc -> loc + Boolean loc _ -> loc + Int loc _ -> loc + Nat loc _ -> loc + Float loc _ -> loc + Text loc _ -> loc + Char loc _ -> loc + Constructor loc _ _ -> loc + As loc _ -> loc + EffectPure loc _ -> loc + EffectBind loc _ _ _ -> loc + SequenceLiteral loc _ -> loc + SequenceOp loc _ _ _ -> loc + data SeqOp = Cons | Snoc From 53dfe47599a8914ff2c72981d5a26b1f2ba903ff Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 2 Feb 2023 11:29:58 -0600 Subject: [PATCH 190/467] Fix remainder of destructuring binding problems! --- .../src/Unison/Syntax/TermParser.hs | 2 +- unison-cli/src/Unison/LSP/Queries.hs | 26 +++++++++++++++---- unison-cli/tests/Unison/Test/LSP.hs | 8 ++++++ unison-syntax/src/Unison/Syntax/Parser.hs | 2 +- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index 02c44a84f..41a76f23d 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -1218,7 +1218,7 @@ tupleOrParenthesizedTerm = label "tuple" $ tupleOrParenthesized term DD.unitTerm (ann t1 <> ann t2) ( Term.app (ann t1) - (Term.constructor (ann t1 <> ann t2) (ConstructorReference DD.pairRef 0)) + (Term.constructor (ann t1) (ConstructorReference DD.pairRef 0)) t1 ) t2 diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 557427456..37711f4d9 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -20,7 +20,6 @@ import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT import Unison.DataDeclaration (Decl) import qualified Unison.DataDeclaration as DD -import qualified Unison.DataDeclaration as Decl import Unison.LSP.FileAnalysis import Unison.LSP.Orphans () import Unison.LSP.Types @@ -129,14 +128,12 @@ refInType typ = case ABT.out typ of data SourceNode a = TermNode (Term Symbol a) | TypeNode (Type Symbol a) - | DeclNode (Decl Symbol a) | PatternNode (Pattern.Pattern a) deriving stock (Eq, Show) instance Functor SourceNode where fmap f (TermNode t) = TermNode (Term.amap f t) fmap f (TypeNode t) = TypeNode (fmap f t) - fmap f (DeclNode t) = DeclNode (Decl.amap f t) fmap f (PatternNode t) = PatternNode (fmap f t) -- | Find the the node in a term which contains the specified position, but none of its @@ -158,7 +155,15 @@ findSmallestEnclosingNode pos term Term.Constructor {} -> Just (TermNode term) Term.Request {} -> Just (TermNode term) Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b - Term.App a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b + Term.App a b -> + -- We crawl the body of the App first because the annotations for certain + -- lambda syntaxes get a bit squirrelly. + -- Specifically Tuple constructor apps will have an annotation which spans the + -- whole tuple, e.g. the annotation of the tuple constructor for `(1, 2)` will + -- cover ALL of `(1, 2)`, so we check the body of the tuple app first to see + -- if the cursor is on 1 or 2 before falling back on the annotation of the + -- 'function' of the app. + findSmallestEnclosingNode pos b <|> findSmallestEnclosingNode pos a Term.Ann a typ -> findSmallestEnclosingNode pos a <|> (TypeNode <$> findSmallestEnclosingType pos typ) Term.List xs -> altSum (findSmallestEnclosingNode pos <$> xs) Term.If cond a b -> findSmallestEnclosingNode pos cond <|> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b @@ -176,7 +181,18 @@ findSmallestEnclosingNode pos term ABT.Cycle r -> findSmallestEnclosingNode pos r ABT.Abs _v r -> findSmallestEnclosingNode pos r let fallback = if annIsFilePosition (ABT.annotation term) then Just (TermNode term) else Nothing - bestChild <|> fallback + case bestChild of + Just child -> case child of + TermNode te -> do + guard (annIsFilePosition $ ABT.annotation te) + pure child + TypeNode te -> do + guard (annIsFilePosition $ ABT.annotation te) + pure child + PatternNode pat -> do + guard (annIsFilePosition $ Pattern.annotation pat) + pure child + Nothing -> fallback findSmallestEnclosingPattern :: Pos -> Pattern.Pattern Ann -> Maybe (Pattern.Pattern Ann) findSmallestEnclosingPattern pos pat diff --git a/unison-cli/tests/Unison/Test/LSP.hs b/unison-cli/tests/Unison/Test/LSP.hs index 55887b12f..8e8c7d681 100644 --- a/unison-cli/tests/Unison/Test/LSP.hs +++ b/unison-cli/tests/Unison/Test/LSP.hs @@ -127,6 +127,14 @@ term = let True, trm (Term.Boolean True) ), + ( "Test annotations for destructuring tuples (they have a special parser)", + [here| +term = let + (true, fal^se) + |], + True, + trm (Term.Boolean False) + ), ( "Test annotations within pattern binds", [here| term = let diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index 76a98054e..e92bfddd0 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -371,7 +371,7 @@ tupleOrParenthesized :: Ord v => P v a -> (Ann -> a) -> (a -> a -> a) -> P v a tupleOrParenthesized p unit pair = seq' "(" go p where go _ [t] = t - go a xs = foldr pair (unit a) xs + go _ xs = foldr pair (unit External) xs seq :: Ord v => (Ann -> [a] -> a) -> P v a -> P v a seq = seq' "[" From 5b76b3497668c114235e1877782317bed7b53e3c Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 2 Feb 2023 11:35:51 -0600 Subject: [PATCH 191/467] Clean up the code --- unison-cli/src/Unison/LSP/Queries.hs | 74 +++++++++++++++------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 37711f4d9..72c9631a7 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -142,18 +142,23 @@ findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (SourceNode Ann) findSmallestEnclosingNode pos term | annIsFilePosition (ABT.annotation term) && not (ABT.annotation term `Ann.contains` pos) = Nothing | otherwise = do + -- For leaf nodes we require that they be an in-file position, not Intrinsic or + -- external. + -- In some rare cases it's possible for an External/Intrinsic node to have children that + -- ARE in the file, so we need to make sure we still crawl their children. + let guardInFile = guard (annIsFilePosition (ABT.annotation term)) let bestChild = case ABT.out term of ABT.Tm f -> case f of - Term.Int {} -> Just (TermNode term) - Term.Nat {} -> Just (TermNode term) - Term.Float {} -> Just (TermNode term) - Term.Boolean {} -> Just (TermNode term) - Term.Text {} -> Just (TermNode term) - Term.Char {} -> Just (TermNode term) - Term.Blank {} -> Just (TermNode term) - Term.Ref {} -> Just (TermNode term) - Term.Constructor {} -> Just (TermNode term) - Term.Request {} -> Just (TermNode term) + Term.Int {} -> guardInFile *> Just (TermNode term) + Term.Nat {} -> guardInFile *> Just (TermNode term) + Term.Float {} -> guardInFile *> Just (TermNode term) + Term.Boolean {} -> guardInFile *> Just (TermNode term) + Term.Text {} -> guardInFile *> Just (TermNode term) + Term.Char {} -> guardInFile *> Just (TermNode term) + Term.Blank {} -> guardInFile *> Just (TermNode term) + Term.Ref {} -> guardInFile *> Just (TermNode term) + Term.Constructor {} -> guardInFile *> Just (TermNode term) + Term.Request {} -> guardInFile *> Just (TermNode term) Term.Handle a b -> findSmallestEnclosingNode pos a <|> findSmallestEnclosingNode pos b Term.App a b -> -- We crawl the body of the App first because the annotations for certain @@ -175,38 +180,32 @@ findSmallestEnclosingNode pos term Term.Match a cases -> findSmallestEnclosingNode pos a <|> altSum (cases <&> \(MatchCase pat grd body) -> ((PatternNode <$> findSmallestEnclosingPattern pos pat) <|> (grd >>= findSmallestEnclosingNode pos) <|> findSmallestEnclosingNode pos body)) - Term.TermLink {} -> Just (TermNode term) - Term.TypeLink {} -> Just (TermNode term) - ABT.Var _v -> Just (TermNode term) + Term.TermLink {} -> guardInFile *> Just (TermNode term) + Term.TypeLink {} -> guardInFile *> Just (TermNode term) + ABT.Var _v -> guardInFile *> Just (TermNode term) ABT.Cycle r -> findSmallestEnclosingNode pos r ABT.Abs _v r -> findSmallestEnclosingNode pos r let fallback = if annIsFilePosition (ABT.annotation term) then Just (TermNode term) else Nothing - case bestChild of - Just child -> case child of - TermNode te -> do - guard (annIsFilePosition $ ABT.annotation te) - pure child - TypeNode te -> do - guard (annIsFilePosition $ ABT.annotation te) - pure child - PatternNode pat -> do - guard (annIsFilePosition $ Pattern.annotation pat) - pure child - Nothing -> fallback + bestChild <|> fallback findSmallestEnclosingPattern :: Pos -> Pattern.Pattern Ann -> Maybe (Pattern.Pattern Ann) findSmallestEnclosingPattern pos pat | annIsFilePosition (Pattern.annotation pat) && not (Pattern.annotation pat `Ann.contains` pos) = Nothing | otherwise = do + -- For leaf nodes we require that they be an in-file position, not Intrinsic or + -- external. + -- In some rare cases it's possible for an External/Intrinsic node to have children that + -- ARE in the file, so we need to make sure we still crawl their children. + let guardInFile = guard (annIsFilePosition (Pattern.annotation pat)) let bestChild = case pat of - Pattern.Unbound {} -> Just pat - Pattern.Var {} -> Just pat - Pattern.Boolean {} -> Just pat - Pattern.Int {} -> Just pat - Pattern.Nat {} -> Just pat - Pattern.Float {} -> Just pat - Pattern.Text {} -> Just pat - Pattern.Char {} -> Just pat + Pattern.Unbound {} -> guardInFile *> Just pat + Pattern.Var {} -> guardInFile *> Just pat + Pattern.Boolean {} -> guardInFile *> Just pat + Pattern.Int {} -> guardInFile *> Just pat + Pattern.Nat {} -> guardInFile *> Just pat + Pattern.Float {} -> guardInFile *> Just pat + Pattern.Text {} -> guardInFile *> Just pat + Pattern.Char {} -> guardInFile *> Just pat Pattern.Constructor _loc _conRef pats -> altSum (findSmallestEnclosingPattern pos <$> pats) Pattern.As _loc p -> findSmallestEnclosingPattern pos p Pattern.EffectPure _loc p -> findSmallestEnclosingPattern pos p @@ -224,9 +223,14 @@ findSmallestEnclosingType :: Pos -> Type Symbol Ann -> Maybe (Type Symbol Ann) findSmallestEnclosingType pos typ | annIsFilePosition (ABT.annotation typ) && not (ABT.annotation typ `Ann.contains` pos) = Nothing | otherwise = do + -- For leaf nodes we require that they be an in-file position, not Intrinsic or + -- external. + -- In some rare cases it's possible for an External/Intrinsic node to have children that + -- ARE in the file, so we need to make sure we still crawl their children. + let guardInFile = guard (annIsFilePosition (ABT.annotation typ)) let bestChild = case ABT.out typ of ABT.Tm f -> case f of - Type.Ref {} -> Just typ + Type.Ref {} -> guardInFile *> Just typ Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b @@ -234,7 +238,7 @@ findSmallestEnclosingType pos typ Type.Ann a _kind -> findSmallestEnclosingType pos a Type.Effects es -> altSum (findSmallestEnclosingType pos <$> es) Type.IntroOuter a -> findSmallestEnclosingType pos a - ABT.Var _v -> Just typ + ABT.Var _v -> guardInFile *> Just typ ABT.Cycle r -> findSmallestEnclosingType pos r ABT.Abs _v r -> findSmallestEnclosingType pos r let fallback = if annIsFilePosition (ABT.annotation typ) then Just typ else Nothing From fa1d03a34e1e17b0ad1e7dc7caf92124ca68cf61 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 2 Feb 2023 13:15:03 -0600 Subject: [PATCH 192/467] Leave the annotation for tuple constructor for now --- parser-typechecker/src/Unison/Syntax/TermParser.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index 41a76f23d..02c44a84f 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -1218,7 +1218,7 @@ tupleOrParenthesizedTerm = label "tuple" $ tupleOrParenthesized term DD.unitTerm (ann t1 <> ann t2) ( Term.app (ann t1) - (Term.constructor (ann t1) (ConstructorReference DD.pairRef 0)) + (Term.constructor (ann t1 <> ann t2) (ConstructorReference DD.pairRef 0)) t1 ) t2 From 1b4fca639b9ba5e76b54abd497451e9cd9c6035c Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Thu, 2 Feb 2023 16:50:01 -0800 Subject: [PATCH 193/467] Adds working multi-deletion command --- .../unison-pretty-printer.cabal | 8 +- .../unison-parser-typechecker.cabal | 6 +- .../src/Unison/Codebase/Editor/HandleInput.hs | 182 +++++++++++------- .../src/Unison/Codebase/Editor/Input.hs | 6 +- .../src/Unison/Codebase/Editor/Output.hs | 2 + .../src/Unison/CommandLine/InputPatterns.hs | 14 +- .../src/Unison/CommandLine/OutputMessages.hs | 2 + unison-cli/unison-cli.cabal | 12 +- unison-core/unison-core1.cabal | 4 +- unison-src/.DS_Store | Bin 0 -> 8196 bytes .../transcripts/delete-silent.output.md | 2 +- unison-src/transcripts/delete.md | 96 +++++++++ unison-src/transcripts/delete.output.md | 150 ++++++++++++++- .../transcript-parser-commands.output.md | 4 +- 14 files changed, 393 insertions(+), 95 deletions(-) create mode 100644 unison-src/.DS_Store diff --git a/lib/unison-pretty-printer/unison-pretty-printer.cabal b/lib/unison-pretty-printer/unison-pretty-printer.cabal index f23faeed9..813774eff 100644 --- a/lib/unison-pretty-printer/unison-pretty-printer.cabal +++ b/lib/unison-pretty-printer/unison-pretty-printer.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -68,9 +68,9 @@ library , unison-prelude , unison-syntax , unliftio + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 executable prettyprintdemo main-is: Main.hs @@ -103,9 +103,9 @@ executable prettyprintdemo , safe , text , unison-pretty-printer + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 test-suite pretty-printer-tests type: exitcode-stdio-1.0 @@ -146,6 +146,6 @@ test-suite pretty-printer-tests , raw-strings-qq , unison-pretty-printer , unison-syntax + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 767837c13..26e226467 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -307,11 +307,11 @@ library , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 test-suite parser-typechecker-tests type: exitcode-stdio-1.0 @@ -498,8 +498,8 @@ test-suite parser-typechecker-tests , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index bdcbd4203..cf17316ac 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} +{-# HLINT ignore "Use tuple-section" #-} module Unison.Codebase.Editor.HandleInput ( loop, ) @@ -343,44 +345,6 @@ loop e = do names <- displayNames uf ppe <- PPE.suffixifiedPPE <$> prettyPrintEnvDecl names Cli.respond $ Typechecked (Text.pack sourceName) ppe sr uf - - delete :: - DeleteOutput -> - ((Path.Absolute, HQ'.HQSegment) -> Cli (Set Referent)) -> -- compute matching terms - ((Path.Absolute, HQ'.HQSegment) -> Cli (Set Reference)) -> -- compute matching types - Path.HQSplit' -> - Cli () - delete doutput getTerms getTypes hq' = do - hq <- Cli.resolveSplit' hq' - terms <- getTerms hq - types <- getTypes hq - when (Set.null terms && Set.null types) (Cli.returnEarly (NameNotFound hq')) - -- Mitchell: stripping hash seems wrong here... - resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> hq') - rootNames <- Branch.toNames <$> Cli.getRootBranch0 - let name = Path.unsafeToName (Path.unsplit resolvedPath) - toRel :: Ord ref => Set ref -> R.Relation Name ref - toRel = R.fromList . fmap (name,) . toList - -- these names are relative to the root - toDelete = Names (toRel terms) (toRel types) - endangerments <- Cli.runTransaction (getEndangeredDependents toDelete rootNames) - if null endangerments - then do - let makeDeleteTermNames = map (BranchUtil.makeDeleteTermName resolvedPath) . Set.toList $ terms - let makeDeleteTypeNames = map (BranchUtil.makeDeleteTypeName resolvedPath) . Set.toList $ types - before <- Cli.getRootBranch0 - description <- inputDescription input - Cli.stepManyAt description (makeDeleteTermNames ++ makeDeleteTypeNames) - case doutput of - DeleteOutput'Diff -> do - after <- Cli.getRootBranch0 - (ppe, diff) <- diffHelper before after - Cli.respondNumbered (ShowDiffAfterDeleteDefinitions ppe diff) - DeleteOutput'NoDiff -> do - Cli.respond Success - else do - ppeDecl <- currentPrettyPrintEnvDecl Backend.Within - Cli.respondNumbered (CantDeleteDefinitions ppeDecl endangerments) in Cli.time "InputPattern" case input of ApiI -> do Cli.Env {serverBaseUrl} <- ask @@ -868,9 +832,9 @@ loop e = do ] Cli.respond Success DeleteI dtarget -> case dtarget of - DeleteTarget'TermOrType doutput hq -> delete doutput Cli.getTermsAt Cli.getTypesAt hq - DeleteTarget'Type doutput hq -> delete doutput (const (pure Set.empty)) Cli.getTypesAt hq - DeleteTarget'Term doutput hq -> delete doutput Cli.getTermsAt (const (pure Set.empty)) hq + DeleteTarget'TermOrType doutput hqs -> delete input doutput Cli.getTermsAt Cli.getTypesAt hqs + DeleteTarget'Type doutput hqs -> delete input doutput (const (pure Set.empty)) Cli.getTypesAt hqs + DeleteTarget'Term doutput hqs -> delete input doutput Cli.getTermsAt (const (pure Set.empty)) hqs DeleteTarget'Patch src' -> do _ <- Cli.expectPatchAt src' description <- inputDescription input @@ -899,7 +863,7 @@ loop e = do (Branch.toNames (Branch.head branch)) afterDelete <- do rootNames <- Branch.toNames <$> Cli.getRootBranch0 - endangerments <- Cli.runTransaction (getEndangeredDependents toDelete rootNames) + endangerments <- Cli.runTransaction (getEndangeredDependents toDelete [] rootNames) -- hmm case (null endangerments, insistence) of (True, _) -> pure (Cli.respond Success) (False, Force) -> do @@ -1456,24 +1420,24 @@ inputDescription input = pure ("copy.patch " <> src <> " " <> dest) DeleteI dtarget -> do case dtarget of - DeleteTarget'TermOrType DeleteOutput'NoDiff thing0 -> do - thing <- hqs' thing0 - pure ("delete " <> thing) - DeleteTarget'TermOrType DeleteOutput'Diff thing0 -> do - thing <- hqs' thing0 - pure ("delete.verbose " <> thing) - DeleteTarget'Term DeleteOutput'NoDiff thing0 -> do - thing <- hqs' thing0 - pure ("delete.term " <> thing) - DeleteTarget'Term DeleteOutput'Diff thing0 -> do - thing <- hqs' thing0 - pure ("delete.term.verbose " <> thing) + DeleteTarget'TermOrType DeleteOutput'NoDiff things0 -> do + thing <- traverse hqs' things0 + pure ("delete " <> Text.intercalate " " thing) + DeleteTarget'TermOrType DeleteOutput'Diff things0 -> do + thing <- traverse hqs' things0 + pure ("delete.verbose " <> Text.intercalate " " thing) + DeleteTarget'Term DeleteOutput'NoDiff things0 -> do + thing <- traverse hqs' things0 + pure ("delete.term " <> Text.intercalate " "thing) + DeleteTarget'Term DeleteOutput'Diff things0 -> do + thing <- traverse hqs' things0 + pure ("delete.term.verbose " <> Text.intercalate " " thing) DeleteTarget'Type DeleteOutput'NoDiff thing0 -> do - thing <- hqs' thing0 - pure ("delete.type " <> thing) + thing <- traverse hqs' thing0 + pure ("delete.type " <> Text.intercalate " "thing) DeleteTarget'Type DeleteOutput'Diff thing0 -> do - thing <- hqs' thing0 - pure ("delete.type.verbose " <> thing) + thing <- traverse hqs' thing0 + pure ("delete.type.verbose " <> Text.intercalate " " thing) DeleteTarget'Branch Try opath0 -> do opath <- ops' opath0 pure ("delete.namespace " <> opath) @@ -2899,24 +2863,107 @@ loadPropagateDiffDefaultPatch inputDescription maybeDest0 dest = do (ppe, diff) <- diffHelper original (Branch.head patched) Cli.respondNumbered (ShowDiffAfterMergePropagate dest0 dest patchPath ppe diff) +delete :: + Input -> + DeleteOutput -> + ((Path.Absolute, HQ'.HQSegment) -> Cli (Set Referent)) -> -- compute matching terms + ((Path.Absolute, HQ'.HQSegment) -> Cli (Set Reference)) -> -- compute matching types + [Path.HQSplit'] -> -- targets for deletion + Cli () +delete input doutput getTerms getTypes hqs' = do + -- Takes the list of entities to delete and gets the absolute paths + -- persists the original hash qualified term for error reporting + hq <- traverse (\t -> fmap (t,) (Cli.resolveSplit' t) ) hqs' + -- from the query to delete, get terms and types + typesTermsTuple <- traverse (\(hashQualified, absolute) -> do + types <- getTypes absolute + terms <- getTerms absolute + return (hashQualified, types, terms)) hq + -- filter the list of targets down to those which don't exist + let notFounds = List.filter (\(_, types, terms) -> Set.null terms && Set.null types) typesTermsTuple + -- if there are any entities which cannot be deleted because they don't exist, short circuit. + -- TODO: confirm this is the desired behavior + if not $ null notFounds then do + let first (m,_,_) = m + Cli.returnEarly $ NamesNotFound $ fmap first notFounds + else do + checkDeletes typesTermsTuple doutput input + +toSplitName :: (Path.HQSplit', Set Reference, Set Referent) -> Cli (Path.Split, Name, Set Reference, Set Referent) +toSplitName hq = do + let first (m,_,_) = m + let second (_,m,_) = m + let third (_,_,m) = m + resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> first hq) + return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), second hq, third hq) + +-- Takes a list of entities to delete, paired with their associated terms and types +checkDeletes :: [(Path.HQSplit', Set Reference, Set Referent)] -> DeleteOutput -> Input -> Cli () +checkDeletes typesTermsTuples doutput inputs = do + -- get the splits, names, with terms, and types + splitsNames <- traverse toSplitName typesTermsTuples + let toRel :: Ord ref => Set ref -> Name -> R.Relation Name ref + toRel setRef name = R.fromList (fmap (name,) (toList setRef)) + let toDelete :: [Names] = fmap (\(_, names, types, terms) -> Names (toRel terms names) (toRel types names)) splitsNames + -- make sure endangered is compeletely contained in paths + rootNames <- Branch.toNames <$> Cli.getRootBranch0 + -- compute only once for the entire deletion set + let allTermsToDelete :: Set LabeledDependency + allTermsToDelete = Set.unions (fmap Names.labeledReferences toDelete) + -- get the set of endangered dependencies for each entity to delete + endangered <- Cli.runTransaction $ traverse (\targetToDelete -> getEndangeredDependents targetToDelete allTermsToDelete rootNames) toDelete + -- If the overall dependency map is not completely empty, there are dependencies of the deletion + let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b ) False m ) endangered + if not $ null endangeredDeletions then do + ppeDecl <- currentPrettyPrintEnvDecl Backend.Within + let combineRefs = List.foldl (Map.unionWith NESet.union) Map.empty endangeredDeletions + Cli.respondNumbered (CantDeleteDefinitions ppeDecl combineRefs) + else do + let deleteTypesTerms = splitsNames >>= (\(split, _, types, terms) -> (List.map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) ++ (List.map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms )) + before <- Cli.getRootBranch0 + description <- inputDescription inputs + Cli.stepManyAt description deleteTypesTerms + case doutput of + DeleteOutput'Diff -> do + after <- Cli.getRootBranch0 + (ppe, diff) <- diffHelper before after + Cli.respondNumbered (ShowDiffAfterDeleteDefinitions ppe diff) + DeleteOutput'NoDiff -> do + Cli.respond Success + -- | Goal: When deleting, we might be removing the last name of a given definition (i.e. the -- definition is going "extinct"). In this case we may wish to take some action or warn the -- user about these "endangered" definitions which would now contain unnamed references. getEndangeredDependents :: - -- | Which names we want to delete + -- | Single target for deletion Names -> + -- | Which names we want to delete (including the target) + Set LabeledDependency -> -- | All names from the root branch Names -> -- | map from references going extinct to the set of endangered dependents Sqlite.Transaction (Map LabeledDependency (NESet LabeledDependency)) -getEndangeredDependents namesToDelete rootNames = do +-- get the things that depend on me. root names is everything underneath my namespace +getEndangeredDependents targetNamesToDelete allTermsToDelete rootNames = do + -- names of terms left over after target deletion (but not including all other names to delete) let remainingNames :: Names - remainingNames = rootNames `Names.difference` namesToDelete - refsToDelete, remainingRefs, extinct :: Set LabeledDependency - refsToDelete = Names.labeledReferences namesToDelete - remainingRefs = Names.labeledReferences remainingNames -- left over after delete - extinct = refsToDelete `Set.difference` remainingRefs -- deleting and not left over - accumulateDependents :: LabeledDependency -> Sqlite.Transaction (Map LabeledDependency (Set LabeledDependency)) + remainingNames = rootNames `Names.difference` targetNamesToDelete + -- the target for deletion, expressed as a set of LabeledDependencies + let refsToDelete :: Set LabeledDependency + refsToDelete = Names.labeledReferences targetNamesToDelete + -- remove the target from the set of names to delete + let allOtherNamesSet :: Set LabeledDependency + allOtherNamesSet = Set.difference allTermsToDelete refsToDelete + let remainingRefs :: Set LabeledDependency + -- refs left over after deleting target + remainingRefs = Names.labeledReferences remainingNames + -- remove the other targets for deletion from the remaining terms mimicking the state if transaction succeeds + let remainingRefsWithoutOtherTargets :: Set LabeledDependency + remainingRefsWithoutOtherTargets = Set.difference remainingRefs allOtherNamesSet + -- deleting and not left over + let extinct :: Set LabeledDependency + extinct = refsToDelete `Set.difference` remainingRefsWithoutOtherTargets + let accumulateDependents :: LabeledDependency -> Sqlite.Transaction (Map LabeledDependency (Set LabeledDependency)) accumulateDependents ld = let ref = LD.fold id Referent.toReference ld in Map.singleton ld . Set.map LD.termRef <$> Codebase.dependents Queries.ExcludeOwnComponent ref @@ -2929,7 +2976,7 @@ getEndangeredDependents namesToDelete rootNames = do let extinctToEndangered :: Map LabeledDependency (NESet LabeledDependency) extinctToEndangered = allDependentsOfExtinct & Map.mapMaybe \endangeredDeps -> - let remainingEndangered = endangeredDeps `Set.intersection` remainingRefs + let remainingEndangered = endangeredDeps `Set.intersection` remainingRefsWithoutOtherTargets in NESet.nonEmptySet remainingEndangered pure extinctToEndangered @@ -3417,3 +3464,4 @@ stripUnisonFileReferences unisonFile term = | Just var <- (\k -> Map.lookup k refMap) =<< Reference.toId ref -> ABT.var var x -> ABT.tm x in ABT.cata alg term + diff --git a/unison-cli/src/Unison/Codebase/Editor/Input.hs b/unison-cli/src/Unison/Codebase/Editor/Input.hs index b932a06ff..10336c782 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Input.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Input.hs @@ -270,9 +270,9 @@ data DeleteOutput deriving stock (Eq, Show) data DeleteTarget - = DeleteTarget'TermOrType DeleteOutput Path.HQSplit' - | DeleteTarget'Term DeleteOutput Path.HQSplit' - | DeleteTarget'Type DeleteOutput Path.HQSplit' + = DeleteTarget'TermOrType DeleteOutput [Path.HQSplit'] + | DeleteTarget'Term DeleteOutput [Path.HQSplit'] + | DeleteTarget'Type DeleteOutput [Path.HQSplit'] | DeleteTarget'Branch Insistence (Maybe Path.Split') | DeleteTarget'Patch Path.Split' deriving stock (Eq, Show) diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index 0395039f5..202df6ba5 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -155,6 +155,7 @@ data Output | BranchNotFound Path' | EmptyPush Path' | NameNotFound Path.HQSplit' + | NamesNotFound [Path.HQSplit'] | PatchNotFound Path.Split' | TypeNotFound Path.HQSplit' | TermNotFound Path.HQSplit' @@ -358,6 +359,7 @@ isFailure o = case o of BadNamespace {} -> True BranchNotFound {} -> True NameNotFound {} -> True + NamesNotFound _ -> True PatchNotFound {} -> True TypeNotFound {} -> True TypeNotFound' {} -> True diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index b56854b6a..fef18ec61 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -606,7 +606,8 @@ renameType = "`rename.type` takes two arguments, like `rename.type oldname newname`." ) -deleteGen :: Maybe String -> String -> (Path.HQSplit' -> DeleteTarget) -> InputPattern +-- NOTE: mkTarget should take a list of hash qualified split arguments and create a delete target type that has been adapted to +deleteGen :: Maybe String -> String -> ([Path.HQSplit'] -> DeleteTarget) -> InputPattern deleteGen suffix target mkTarget = let cmd = maybe "delete" ("delete." <>) suffix info = @@ -631,13 +632,14 @@ deleteGen suffix target mkTarget = [(OnePlus, exactDefinitionTermQueryArg)] info ( \case - [query] -> first fromString $ do - p <- Path.parseHQSplit' query - pure $ Input.DeleteI (mkTarget p) - _ -> - Left . P.warnCallout $ P.wrap warn + [] -> Left . P.warnCallout $ P.wrap warn --- hmmmmmmm + queries -> first fromString $ do + paths <- (traverse Path.parseHQSplit' queries) -- maybe??? not sure + pure $ Input.DeleteI (mkTarget paths) ) + +-- NOTE: creates an input pattern using deleteGen delete :: InputPattern delete = deleteGen Nothing "term or type" (DeleteTarget'TermOrType DeleteOutput'NoDiff) diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index edf39a969..f94745ee6 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -771,6 +771,8 @@ notifyUser dir o = case o of pure . P.warnCallout $ "I don't know about that patch." NameNotFound _ -> pure . P.warnCallout $ "I don't know about that name." + NamesNotFound _ -> + pure . P.warnCallout $ "I don't know about those names." TermNotFound _ -> pure . P.warnCallout $ "I don't know about that term." TypeNotFound _ -> diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 7c59e5b8a..9573c1eca 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -203,12 +203,12 @@ library , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields if !os(windows) build-depends: unix - default-language: Haskell2010 executable cli-integration-tests main-is: Suite.hs @@ -331,9 +331,9 @@ executable cli-integration-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable transcripts main-is: Transcripts.hs @@ -453,9 +453,9 @@ executable transcripts , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable unison main-is: Main.hs @@ -582,9 +582,9 @@ executable unison , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 test-suite cli-tests type: exitcode-stdio-1.0 @@ -714,6 +714,6 @@ test-suite cli-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 diff --git a/unison-core/unison-core1.cabal b/unison-core/unison-core1.cabal index 1261b0ded..48eac1036 100644 --- a/unison-core/unison-core1.cabal +++ b/unison-core/unison-core1.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -106,6 +106,6 @@ library , unison-util-base32hex , unison-util-relation , vector + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 diff --git a/unison-src/.DS_Store b/unison-src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ffce1097f24319eeaaff2075f523774b4505e8ed GIT binary patch literal 8196 zcmeHMU2GIp6u#fI(3y6j0~9H^0~-nvu;9}2SALT1pHd67vMt?~pLTXR?y0g6|&T{W_Y1oGm2qW;njDUAO#OU#8BB0}(`bP(KehEO- zD*^mQ?^Fl)HnD&v0y@sAZ%T9W>H&c%f)WGVoa8Z2ooFJUGHYeZJ^dUnZ>Xj=RZOc^+OV9eohNhFs zkuJm1?4brbXK9WVPgS zLbWteUb%e5ol!;M3O5Z3s;OMsIGHot5xGhf{WW6B>c|m|_O##Dyj3(&zCiQP>T8wN z%3)8^nANG*0)zF+-H{H5oEK%4D{hL!BOMP>PDrxDM`|Nml}=Ml>!u`Ye4QPUok~}p z$6u0L`QV<&QYDqK2L{MRN8)4kN~3bjTXvu7xNU>FPS1U@lC#%;qe?u!O zmzOK8%6?J)T+__(Lcb<_RT&C@c}8f+DOG;zFIUQ`jXO z5ZZ*4pb94hTNvgJ2nFCBEjSpAj}V>ZoFU)^=ZtXv*1(J2x3}f~*8dLht}gVURMGfi_@7XPW7zsjz$AK9<$Ps;g)Sb|F2g*at;1NP#8pX*6<;uw0-hcq+{ zz=DmFl=Y`EhKDhZM=0l?psariPvb0}#|xDCui`bljyLfZ<^B8k02lEQKE@?{8X({s z%Kx8neOgZMpPJM7ZT6hbC$pAmTgOSGfQYHabAc=3o2c~a|K{0$|DOw64fha6AdJAj z6af@BC7T*(^4X3muhx#y(?^fjJiT#FeG}^Za-67NjuV~yhatVkNY%4R1azEJ8liUE Te+ak@e|U%Ye|Z1T_51%X++CG{ literal 0 HcmV?d00001 diff --git a/unison-src/transcripts/delete-silent.output.md b/unison-src/transcripts/delete-silent.output.md index 4f0b8590a..a73cc739a 100644 --- a/unison-src/transcripts/delete-silent.output.md +++ b/unison-src/transcripts/delete-silent.output.md @@ -3,7 +3,7 @@ ⚠️ - I don't know about that name. + I don't know about those names. ``` ```unison diff --git a/unison-src/transcripts/delete.md b/unison-src/transcripts/delete.md index f0d3f061d..255b63a59 100644 --- a/unison-src/transcripts/delete.md +++ b/unison-src/transcripts/delete.md @@ -98,3 +98,99 @@ structural type foo = Foo () ```ucm .> delete.verbose foo ``` + +We want to be able to delete multiple terms at once + +```unison:hide +a = "a" +b = "b" +c = "c" +``` + +```ucm +.> add +.> delete.verbose a b c +``` + +We can delete terms and types in the same invocation of delete + +```unison:hide +structural type Foo = Foo () +a = "a" +b = "b" +c = "c" +``` + +```ucm +.> add +.> delete.verbose a b c Foo +.> delete.verbose Foo.Foo +``` + +We can delete a type and its constructors + +```unison:hide +structural type Foo = Foo () +``` + +```ucm +.> add +.> delete.verbose Foo Foo.Foo +``` + +You should not be able to delete terms which are referenced by other terms + +```unison:hide +a = 1 +b = 2 +c = 3 +d = a + b + c +``` + +```ucm +.> add +.> delete.verbose a b c +``` + +But you should be able to delete all terms which reference each other in a single command + +```unison:hide +e = 11 +f = 12 + e +g = 13 + f +h = e + f + g +``` + +```ucm +.> add +.> delete.verbose e f g h +``` + +You should be able to delete a type and all the functions that reference it in a single command + +```unison:hide +structural type Foo = Foo Nat + +incrementFoo : Foo -> Nat +incrementFoo = cases + (Foo n) -> n + 1 +``` + +```ucm +.> add +.> delete.verbose Foo Foo.Foo incrementFoo +``` + +If you mess up on one of the names of your deletion set, you cannot run the command + +```unison:hide +e = 11 +f = 12 + e +g = 13 + f +h = e + f + g +``` + +```ucm +.> add +.> delete.verbose e f gg +``` diff --git a/unison-src/transcripts/delete.output.md b/unison-src/transcripts/delete.output.md index 9013563f8..167cf1810 100644 --- a/unison-src/transcripts/delete.output.md +++ b/unison-src/transcripts/delete.output.md @@ -10,7 +10,7 @@ exist. ⚠️ - I don't know about that name. + I don't know about those names. ``` Now for some easy cases. Deleting an unambiguous term, then deleting an @@ -237,3 +237,151 @@ structural type foo = Foo () Tip: You can use `undo` or `reflog` to undo this change. ``` +We want to be able to delete multiple terms at once + +```unison +a = "a" +b = "b" +c = "c" +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + a : Text + b : Text + c : Text + +.> delete.verbose a b c + + Removed definitions: + + 1. a : Text + 2. b : Text + 3. c : Text + + Tip: You can use `undo` or `reflog` to undo this change. + +``` +We can delete terms and types in the same invocation of delete + +```unison +structural type Foo = Foo () +a = "a" +b = "b" +c = "c" +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + structural type Foo + a : Text + b : Text + c : Text + +.> delete.verbose a b c Foo + + Removed definitions: + + 1. structural type Foo + 2. a : Text + 3. b : Text + 4. c : Text + + Tip: You can use `undo` or `reflog` to undo this change. + +.> delete.verbose Foo.Foo + + Name changes: + + Original Changes + 1. Foo.Foo ┐ 2. Foo.Foo (removed) + 3. foo.Foo ┘ + + Tip: You can use `undo` or `reflog` to undo this change. + +``` +We can delete a type and its constructors + +```unison +structural type Foo = Foo () +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + structural type Foo + +.> delete.verbose Foo Foo.Foo + + Removed definitions: + + 1. structural type Foo + + Name changes: + + Original Changes + 2. Foo.Foo ┐ 3. Foo.Foo (removed) + 4. foo.Foo ┘ + + Tip: You can use `undo` or `reflog` to undo this change. + +``` +You should not be able to delete terms which are referenced by other terms + +```unison +a = 1 +b = 2 +c = 3 +d = a + b + c +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + a : Nat + b : Nat + (also named b.foo) + c : Nat + d : Nat + +.> delete.verbose a b c + + ⚠️ + + I didn't delete the following definitions because they are + still in use: + + Dependency Referenced In + c 1. d + + a 2. d + +``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + ⚠️ + + I didn't delete the following definitions because they are + still in use: + + Dependency Referenced In + c 1. d + + a 2. d + diff --git a/unison-src/transcripts/transcript-parser-commands.output.md b/unison-src/transcripts/transcript-parser-commands.output.md index 1a1cdbc91..7f92fc568 100644 --- a/unison-src/transcripts/transcript-parser-commands.output.md +++ b/unison-src/transcripts/transcript-parser-commands.output.md @@ -39,7 +39,7 @@ z ⚠️ - I don't know about that name. + I don't know about those names. ``` ```ucm @@ -47,7 +47,7 @@ z ⚠️ - I don't know about that name. + I don't know about those names. ``` However handling of blocks of other languages should be supported. From 05f69d5f379b7cf3e8457d359240678b0d700b55 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 2 Feb 2023 18:44:15 -0600 Subject: [PATCH 194/467] Add workaround for tuple annotations, still need to fix it in destructuring --- unison-cli/src/Unison/LSP/Hover.hs | 31 ++++++++++-- unison-cli/src/Unison/LSP/Queries.hs | 58 +++++++++++++++++++---- unison-syntax/src/Unison/Syntax/Parser.hs | 2 +- 3 files changed, 76 insertions(+), 15 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Hover.hs b/unison-cli/src/Unison/LSP/Hover.hs index 830f23a77..e218dc368 100644 --- a/unison-cli/src/Unison/LSP/Hover.hs +++ b/unison-cli/src/Unison/LSP/Hover.hs @@ -16,6 +16,7 @@ import Unison.LSP.Types import qualified Unison.LSP.VFS as VFS import qualified Unison.LabeledDependency as LD import Unison.Parser.Ann (Ann) +import qualified Unison.Pattern as Pattern import Unison.Prelude import qualified Unison.PrettyPrintEnvDecl as PPED import qualified Unison.Reference as Reference @@ -69,17 +70,20 @@ hoverInfo uri pos = hoverInfoForLiteral :: MaybeT Lsp Text hoverInfoForLiteral = do LSPQ.nodeAtPosition uri pos >>= \case - Left term -> do - typ <- hoistMaybe $ builtinTypeForLiterals term + LSPQ.TermNode term -> do + typ <- hoistMaybe $ builtinTypeForTermLiterals term + pure (": " <> typ) + LSPQ.TypeNode {} -> empty + LSPQ.PatternNode pat -> do + typ <- hoistMaybe $ builtinTypeForPatternLiterals pat pure (": " <> typ) - Right {} -> empty hoistMaybe :: Maybe a -> MaybeT Lsp a hoistMaybe = MaybeT . pure -- | Get the type for term literals. -builtinTypeForLiterals :: Term.Term Symbol Ann -> Maybe Text -builtinTypeForLiterals term = +builtinTypeForTermLiterals :: Term.Term Symbol Ann -> Maybe Text +builtinTypeForTermLiterals term = case ABT.out term of ABT.Tm f -> case f of Term.Int {} -> Just "Int" @@ -108,3 +112,20 @@ builtinTypeForLiterals term = ABT.Var {} -> Nothing ABT.Cycle {} -> Nothing ABT.Abs {} -> Nothing + +builtinTypeForPatternLiterals :: Pattern.Pattern Ann -> Maybe Text +builtinTypeForPatternLiterals = \case + Pattern.Unbound _ -> Nothing + Pattern.Var _ -> Nothing + Pattern.Boolean _ _ -> Just "Boolean" + Pattern.Int _ _ -> Just "Int" + Pattern.Nat _ _ -> Just "Nat" + Pattern.Float _ _ -> Just "Float" + Pattern.Text _ _ -> Just "Text" + Pattern.Char _ _ -> Just "Char" + Pattern.Constructor _ _ _ -> Nothing + Pattern.As _ _ -> Nothing + Pattern.EffectPure _ _ -> Nothing + Pattern.EffectBind _ _ _ _ -> Nothing + Pattern.SequenceLiteral _ _ -> Nothing + Pattern.SequenceOp _ _ _ _ -> Nothing diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index d4fa986b8..b49e54c17 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -11,8 +11,6 @@ module Unison.LSP.Queries findSmallestEnclosingNode, findSmallestEnclosingType, refInDecl, - getTypeOfReferent, - getTypeDeclaration, SourceNode (..), ) where @@ -23,6 +21,7 @@ import Control.Monad.Reader import Data.Generics.Product (field) import Language.LSP.Types import qualified Unison.ABT as ABT +import qualified Unison.Builtin.Decls as Builtins import qualified Unison.Codebase as Codebase import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.ConstructorType as CT @@ -52,13 +51,14 @@ import qualified Unison.Type as Type -- | Returns a reference to whatever the symbol at the given position refers to. refAtPosition :: Uri -> Position -> MaybeT Lsp LabeledDependency refAtPosition uri pos = do - findInTermOrType <|> findInDecl + findInNode <|> findInDecl where - findInTermOrType :: MaybeT Lsp LabeledDependency - findInTermOrType = + findInNode :: MaybeT Lsp LabeledDependency + findInNode = nodeAtPosition uri pos >>= \case - Left term -> hoistMaybe $ refInTerm term - Right typ -> hoistMaybe $ fmap TypeReference (refInType typ) + TermNode term -> hoistMaybe $ refInTerm term + TypeNode typ -> hoistMaybe $ fmap TypeReference (refInType typ) + PatternNode pat -> hoistMaybe $ refInPattern pat findInDecl :: MaybeT Lsp LabeledDependency findInDecl = LD.TypeReference <$> do @@ -155,6 +155,24 @@ refInType typ = case ABT.out typ of ABT.Cycle _r -> Nothing ABT.Abs _v _r -> Nothing +-- Returns the reference a given type node refers to, if any. +refInPattern :: Pattern.Pattern a -> Maybe LabeledDependency +refInPattern = \case + Pattern.Unbound {} -> Nothing + Pattern.Var {} -> Nothing + Pattern.Boolean {} -> Nothing + Pattern.Int {} -> Nothing + Pattern.Nat {} -> Nothing + Pattern.Float {} -> Nothing + Pattern.Text {} -> Nothing + Pattern.Char {} -> Nothing + Pattern.Constructor _loc conRef _ -> Just (LD.ConReference conRef CT.Data) + Pattern.As _loc _pat -> Nothing + Pattern.EffectPure {} -> Nothing + Pattern.EffectBind _loc conRef _ _ -> Just (LD.ConReference conRef CT.Effect) + Pattern.SequenceLiteral {} -> Nothing + Pattern.SequenceOp {} -> Nothing + data SourceNode a = TermNode (Term Symbol a) | TypeNode (Type Symbol a) @@ -171,6 +189,7 @@ instance Functor SourceNode where findSmallestEnclosingNode :: Pos -> Term Symbol Ann -> Maybe (SourceNode Ann) findSmallestEnclosingNode pos term | annIsFilePosition (ABT.annotation term) && not (ABT.annotation term `Ann.contains` pos) = Nothing + | Just r <- cleanImplicitUnit term = findSmallestEnclosingNode pos r | otherwise = do -- For leaf nodes we require that they be an in-file position, not Intrinsic or -- external. @@ -217,9 +236,20 @@ findSmallestEnclosingNode pos term ABT.Abs _v r -> findSmallestEnclosingNode pos r let fallback = if annIsFilePosition (ABT.annotation term) then Just (TermNode term) else Nothing bestChild <|> fallback + where + -- tuples always end in an implicit unit, but it's annotated with the span of the whole + -- tuple, which is problematic, so we need to detect and remove implicit tuples. + -- We can detect them because we know that the last element of a tuple is always its + -- implicit unit. + cleanImplicitUnit :: Term Symbol Ann -> Maybe (Term Symbol Ann) + cleanImplicitUnit = \case + ABT.Tm' (Term.App (ABT.Tm' (Term.App (ABT.Tm' (Term.Constructor (ConstructorReference ref 0))) x)) trm) + | ref == Builtins.pairRef && Term.amap (const ()) trm == Builtins.unitTerm () -> Just x + _ -> Nothing findSmallestEnclosingPattern :: Pos -> Pattern.Pattern Ann -> Maybe (Pattern.Pattern Ann) findSmallestEnclosingPattern pos pat + | Just validTargets <- cleanImplicitUnit pat = findSmallestEnclosingPattern pos validTargets | annIsFilePosition (Pattern.annotation pat) && not (Pattern.annotation pat `Ann.contains` pos) = Nothing | otherwise = do -- For leaf nodes we require that they be an in-file position, not Intrinsic or @@ -244,6 +274,16 @@ findSmallestEnclosingPattern pos pat Pattern.SequenceOp _loc p1 _op p2 -> findSmallestEnclosingPattern pos p1 <|> findSmallestEnclosingPattern pos p2 let fallback = if annIsFilePosition (Pattern.annotation pat) then Just pat else Nothing bestChild <|> fallback + where + -- tuple patterns always end in an implicit unit, but it's annotated with the span of the whole + -- tuple, which is problematic, so we need to detect and remove implicit tuples. + -- We can detect them because we know that the last element of a tuple is always its + -- implicit unit. + cleanImplicitUnit :: Pattern.Pattern Ann -> Maybe (Pattern.Pattern Ann) + cleanImplicitUnit = \case + (Pattern.Constructor _loc (ConstructorReference conRef 0) [pat1, Pattern.Constructor _ (ConstructorReference mayUnitRef 0) _]) + | conRef == Builtins.pairRef && mayUnitRef == Builtins.unitRef -> Just pat1 + _ -> Nothing -- | Find the the node in a type which contains the specified position, but none of its -- children contain that position. @@ -292,7 +332,7 @@ refInDecl p (DD.asDataDecl -> dd) = -- | Returns the ABT node at the provided position. -- Does not return Decl nodes. -nodeAtPosition :: Uri -> Position -> MaybeT Lsp (Either (Term Symbol Ann) (Type Symbol Ann)) +nodeAtPosition :: Uri -> Position -> MaybeT Lsp (SourceNode Ann) nodeAtPosition uri (lspToUPos -> pos) = do (FileSummary {termsBySymbol, testWatchSummary, exprWatchSummary}) <- getFileSummary uri @@ -300,7 +340,7 @@ nodeAtPosition uri (lspToUPos -> pos) = do ( altMap (hoistMaybe . findSmallestEnclosingNode pos . removeInferredTypeAnnotations) trms <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . removeInferredTypeAnnotations) (testWatchSummary ^.. folded . _3) <|> altMap (hoistMaybe . findSmallestEnclosingNode pos . removeInferredTypeAnnotations) (exprWatchSummary ^.. folded . _3) - <|> altMap (fmap Right . hoistMaybe . findSmallestEnclosingType pos) typs + <|> altMap (fmap TypeNode . hoistMaybe . findSmallestEnclosingType pos) typs ) where hoistMaybe :: Maybe a -> MaybeT Lsp a diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index e92bfddd0..76a98054e 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -371,7 +371,7 @@ tupleOrParenthesized :: Ord v => P v a -> (Ann -> a) -> (a -> a -> a) -> P v a tupleOrParenthesized p unit pair = seq' "(" go p where go _ [t] = t - go _ xs = foldr pair (unit External) xs + go a xs = foldr pair (unit a) xs seq :: Ord v => (Ann -> [a] -> a) -> P v a -> P v a seq = seq' "[" From f760c9878d5dc855c0aa38b93f5de8da14841655 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Thu, 2 Feb 2023 17:15:30 -0800 Subject: [PATCH 195/467] removing notes to self --- .../src/Unison/Codebase/Editor/HandleInput.hs | 17 +++++++---------- unison-src/transcripts/delete.md | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index cf17316ac..4a453d25a 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -863,7 +863,7 @@ loop e = do (Branch.toNames (Branch.head branch)) afterDelete <- do rootNames <- Branch.toNames <$> Cli.getRootBranch0 - endangerments <- Cli.runTransaction (getEndangeredDependents toDelete [] rootNames) -- hmm + endangerments <- Cli.runTransaction (getEndangeredDependents toDelete Set.empty rootNames) case (null endangerments, insistence) of (True, _) -> pure (Cli.respond Success) (False, Force) -> do @@ -2882,7 +2882,6 @@ delete input doutput getTerms getTypes hqs' = do -- filter the list of targets down to those which don't exist let notFounds = List.filter (\(_, types, terms) -> Set.null terms && Set.null types) typesTermsTuple -- if there are any entities which cannot be deleted because they don't exist, short circuit. - -- TODO: confirm this is the desired behavior if not $ null notFounds then do let first (m,_,_) = m Cli.returnEarly $ NamesNotFound $ fmap first notFounds @@ -2900,7 +2899,7 @@ toSplitName hq = do -- Takes a list of entities to delete, paired with their associated terms and types checkDeletes :: [(Path.HQSplit', Set Reference, Set Referent)] -> DeleteOutput -> Input -> Cli () checkDeletes typesTermsTuples doutput inputs = do - -- get the splits, names, with terms, and types + -- get the splits and names with terms and types splitsNames <- traverse toSplitName typesTermsTuples let toRel :: Ord ref => Set ref -> Name -> R.Relation Name ref toRel setRef name = R.fromList (fmap (name,) (toList setRef)) @@ -2943,23 +2942,21 @@ getEndangeredDependents :: Names -> -- | map from references going extinct to the set of endangered dependents Sqlite.Transaction (Map LabeledDependency (NESet LabeledDependency)) --- get the things that depend on me. root names is everything underneath my namespace getEndangeredDependents targetNamesToDelete allTermsToDelete rootNames = do - -- names of terms left over after target deletion (but not including all other names to delete) + -- names of terms left over after target deletion let remainingNames :: Names remainingNames = rootNames `Names.difference` targetNamesToDelete - -- the target for deletion, expressed as a set of LabeledDependencies let refsToDelete :: Set LabeledDependency refsToDelete = Names.labeledReferences targetNamesToDelete -- remove the target from the set of names to delete - let allOtherNamesSet :: Set LabeledDependency - allOtherNamesSet = Set.difference allTermsToDelete refsToDelete + let allOtherNamesToDelete :: Set LabeledDependency + allOtherNamesToDelete = Set.difference allTermsToDelete refsToDelete + -- left over after deleting target let remainingRefs :: Set LabeledDependency - -- refs left over after deleting target remainingRefs = Names.labeledReferences remainingNames -- remove the other targets for deletion from the remaining terms mimicking the state if transaction succeeds let remainingRefsWithoutOtherTargets :: Set LabeledDependency - remainingRefsWithoutOtherTargets = Set.difference remainingRefs allOtherNamesSet + remainingRefsWithoutOtherTargets = Set.difference remainingRefs allOtherNamesToDelete -- deleting and not left over let extinct :: Set LabeledDependency extinct = refsToDelete `Set.difference` remainingRefsWithoutOtherTargets diff --git a/unison-src/transcripts/delete.md b/unison-src/transcripts/delete.md index 255b63a59..538c826c1 100644 --- a/unison-src/transcripts/delete.md +++ b/unison-src/transcripts/delete.md @@ -147,7 +147,7 @@ c = 3 d = a + b + c ``` -```ucm +```ucm:error .> add .> delete.verbose a b c ``` @@ -190,7 +190,7 @@ g = 13 + f h = e + f + g ``` -```ucm +```ucm:error .> add .> delete.verbose e f gg ``` From 64e794c4e19c6e18e6debbe3f10528a9ae4b0a5e Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Thu, 2 Feb 2023 22:50:11 -0800 Subject: [PATCH 196/467] adds better error reporting if users try to delete term which does not exist --- .../src/Unison/Codebase/Editor/HandleInput.hs | 20 +-- .../src/Unison/Codebase/Editor/Output.hs | 2 +- .../src/Unison/CommandLine/InputPatterns.hs | 5 +- .../src/Unison/CommandLine/OutputMessages.hs | 7 +- .../transcripts/delete-silent.output.md | 3 +- unison-src/transcripts/delete.md | 15 ++- unison-src/transcripts/delete.output.md | 121 ++++++++++++++++-- 7 files changed, 147 insertions(+), 26 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 4a453d25a..82520e76c 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -213,6 +213,8 @@ import qualified Unison.Var as Var import qualified Unison.WatchKind as WK import qualified UnliftIO.STM as STM import Web.Browser (openBrowser) +import qualified Unison.Codebase.Path as HQSplit' +import qualified Unison.HashQualified' as HashQualified ------------------------------------------------------------------------------------------------------------------------ -- Main loop @@ -2883,8 +2885,10 @@ delete input doutput getTerms getTypes hqs' = do let notFounds = List.filter (\(_, types, terms) -> Set.null terms && Set.null types) typesTermsTuple -- if there are any entities which cannot be deleted because they don't exist, short circuit. if not $ null notFounds then do - let first (m,_,_) = m - Cli.returnEarly $ NamesNotFound $ fmap first notFounds + let transformNotFounds :: [(Path.HQSplit', Set Reference, Set referent)] -> [Name] + transformNotFounds notFounds = + mapMaybe (\(split,_,_) -> Path.toName' $ HashQualified.toName (HQSplit'.unsplitHQ' split)) notFounds + Cli.returnEarly $ NamesNotFound (transformNotFounds notFounds) else do checkDeletes typesTermsTuple doutput input @@ -2913,12 +2917,8 @@ checkDeletes typesTermsTuples doutput inputs = do endangered <- Cli.runTransaction $ traverse (\targetToDelete -> getEndangeredDependents targetToDelete allTermsToDelete rootNames) toDelete -- If the overall dependency map is not completely empty, there are dependencies of the deletion let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b ) False m ) endangered - if not $ null endangeredDeletions then do - ppeDecl <- currentPrettyPrintEnvDecl Backend.Within - let combineRefs = List.foldl (Map.unionWith NESet.union) Map.empty endangeredDeletions - Cli.respondNumbered (CantDeleteDefinitions ppeDecl combineRefs) - else do - let deleteTypesTerms = splitsNames >>= (\(split, _, types, terms) -> (List.map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) ++ (List.map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms )) + if null endangeredDeletions then do + let deleteTypesTerms = splitsNames >>= (\(split, _, types, terms) -> (map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) ++ (map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms )) before <- Cli.getRootBranch0 description <- inputDescription inputs Cli.stepManyAt description deleteTypesTerms @@ -2929,6 +2929,10 @@ checkDeletes typesTermsTuples doutput inputs = do Cli.respondNumbered (ShowDiffAfterDeleteDefinitions ppe diff) DeleteOutput'NoDiff -> do Cli.respond Success + else do + ppeDecl <- currentPrettyPrintEnvDecl Backend.Within + let combineRefs = List.foldl (Map.unionWith NESet.union) Map.empty endangeredDeletions + Cli.respondNumbered (CantDeleteDefinitions ppeDecl combineRefs) -- | Goal: When deleting, we might be removing the last name of a given definition (i.e. the -- definition is going "extinct"). In this case we may wish to take some action or warn the diff --git a/unison-cli/src/Unison/Codebase/Editor/Output.hs b/unison-cli/src/Unison/Codebase/Editor/Output.hs index 202df6ba5..ec32ee02b 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output.hs @@ -155,7 +155,7 @@ data Output | BranchNotFound Path' | EmptyPush Path' | NameNotFound Path.HQSplit' - | NamesNotFound [Path.HQSplit'] + | NamesNotFound [Name] | PatchNotFound Path.Split' | TypeNotFound Path.HQSplit' | TermNotFound Path.HQSplit' diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index fef18ec61..5c0f5dba2 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -606,7 +606,6 @@ renameType = "`rename.type` takes two arguments, like `rename.type oldname newname`." ) --- NOTE: mkTarget should take a list of hash qualified split arguments and create a delete target type that has been adapted to deleteGen :: Maybe String -> String -> ([Path.HQSplit'] -> DeleteTarget) -> InputPattern deleteGen suffix target mkTarget = let cmd = maybe "delete" ("delete." <>) suffix @@ -632,9 +631,9 @@ deleteGen suffix target mkTarget = [(OnePlus, exactDefinitionTermQueryArg)] info ( \case - [] -> Left . P.warnCallout $ P.wrap warn --- hmmmmmmm + [] -> Left . P.warnCallout $ P.wrap warn queries -> first fromString $ do - paths <- (traverse Path.parseHQSplit' queries) -- maybe??? not sure + paths <- traverse Path.parseHQSplit' queries pure $ Input.DeleteI (mkTarget paths) ) diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index f94745ee6..2c7b5a8d5 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -771,8 +771,11 @@ notifyUser dir o = case o of pure . P.warnCallout $ "I don't know about that patch." NameNotFound _ -> pure . P.warnCallout $ "I don't know about that name." - NamesNotFound _ -> - pure . P.warnCallout $ "I don't know about those names." + NamesNotFound hqs -> + pure $ + P.warnCallout "The following names were not found in the codebase. Check your spelling." + <> P.newline + <> (P.syntaxToColor $ P.indent " " (P.lines (fmap prettyName hqs) )) TermNotFound _ -> pure . P.warnCallout $ "I don't know about that term." TypeNotFound _ -> diff --git a/unison-src/transcripts/delete-silent.output.md b/unison-src/transcripts/delete-silent.output.md index a73cc739a..7ea6d420d 100644 --- a/unison-src/transcripts/delete-silent.output.md +++ b/unison-src/transcripts/delete-silent.output.md @@ -3,7 +3,8 @@ ⚠️ - I don't know about those names. + The following names were not found in the codebase. Check your spelling. + foo ``` ```unison diff --git a/unison-src/transcripts/delete.md b/unison-src/transcripts/delete.md index 538c826c1..fdacbf6e1 100644 --- a/unison-src/transcripts/delete.md +++ b/unison-src/transcripts/delete.md @@ -181,7 +181,7 @@ incrementFoo = cases .> delete.verbose Foo Foo.Foo incrementFoo ``` -If you mess up on one of the names of your deletion set, you cannot run the command +If you mess up on one of the names of your command, delete short circuits ```unison:hide e = 11 @@ -194,3 +194,16 @@ h = e + f + g .> add .> delete.verbose e f gg ``` + +Cyclical terms which are guarded by a lambda are allowed to be deleted + +```unison:hide +ping _ = 1 Nat.+ !pong +pong _ = 4 Nat.+ !ping +``` + +```ucm +.> add +.> delete.verbose ping +.> view pong +``` diff --git a/unison-src/transcripts/delete.output.md b/unison-src/transcripts/delete.output.md index 167cf1810..1b4d862aa 100644 --- a/unison-src/transcripts/delete.output.md +++ b/unison-src/transcripts/delete.output.md @@ -10,7 +10,8 @@ exist. ⚠️ - I don't know about those names. + The following names were not found in the codebase. Check your spelling. + foo ``` Now for some easy cases. Deleting an unambiguous term, then deleting an @@ -367,21 +368,121 @@ d = a + b + c a 2. d ``` +But you should be able to delete all terms which reference each other in a single command +```unison +e = 11 +f = 12 + e +g = 13 + f +h = e + f + g +``` +```ucm +.> add -🛑 + ⍟ I've added these definitions: + + e : Nat + f : Nat + g : Nat + h : Nat -The transcript failed due to an error in the stanza above. The error is: +.> delete.verbose e f g h + Removed definitions: + + 1. e : Nat + 2. f : Nat + 3. g : Nat + 4. h : Nat + + Tip: You can use `undo` or `reflog` to undo this change. + +``` +You should be able to delete a type and all the functions that reference it in a single command + +```unison +structural type Foo = Foo Nat + +incrementFoo : Foo -> Nat +incrementFoo = cases + (Foo n) -> n + 1 +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + structural type Foo + incrementFoo : Foo -> Nat + +.> delete.verbose Foo Foo.Foo incrementFoo + + Removed definitions: + + 1. structural type Foo + 2. Foo.Foo : Nat -> #68k40ra7l7 + 3. incrementFoo : #68k40ra7l7 -> Nat + + Tip: You can use `undo` or `reflog` to undo this change. + +``` +If you mess up on one of the names of your command, delete short circuits + +```unison +e = 11 +f = 12 + e +g = 13 + f +h = e + f + g +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + e : Nat + f : Nat + g : Nat + h : Nat + +.> delete.verbose e f gg ⚠️ - I didn't delete the following definitions because they are - still in use: - - Dependency Referenced In - c 1. d - - a 2. d + The following names were not found in the codebase. Check your spelling. + gg +``` +Cyclical terms which are guarded by a lambda are allowed to be deleted + +```unison +ping _ = 1 Nat.+ !pong +pong _ = 4 Nat.+ !ping +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + ping : 'Nat + pong : 'Nat + +.> delete.verbose ping + + Removed definitions: + + 1. ping : 'Nat + + Tip: You can use `undo` or `reflog` to undo this change. + +.> view pong + + pong : 'Nat + pong _ = + use Nat + + 4 + !#l9uq1dpl5v.1 + +``` From 3ad18e1a739fbea54615de77238b1d0ba031309d Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Thu, 2 Feb 2023 23:03:59 -0800 Subject: [PATCH 197/467] cleaning up code --- .../src/Unison/Codebase/Editor/HandleInput.hs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 82520e76c..d705f5705 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2875,7 +2875,7 @@ delete :: delete input doutput getTerms getTypes hqs' = do -- Takes the list of entities to delete and gets the absolute paths -- persists the original hash qualified term for error reporting - hq <- traverse (\t -> fmap (t,) (Cli.resolveSplit' t) ) hqs' + hq <- traverse (\t -> fmap (t,) (Cli.resolveSplit' t)) hqs' -- from the query to delete, get terms and types typesTermsTuple <- traverse (\(hashQualified, absolute) -> do types <- getTypes absolute @@ -2894,13 +2894,9 @@ delete input doutput getTerms getTypes hqs' = do toSplitName :: (Path.HQSplit', Set Reference, Set Referent) -> Cli (Path.Split, Name, Set Reference, Set Referent) toSplitName hq = do - let first (m,_,_) = m - let second (_,m,_) = m - let third (_,_,m) = m - resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> first hq) - return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), second hq, third hq) + resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> hq^._1) + return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), hq^._2, hq^._3) --- Takes a list of entities to delete, paired with their associated terms and types checkDeletes :: [(Path.HQSplit', Set Reference, Set Referent)] -> DeleteOutput -> Input -> Cli () checkDeletes typesTermsTuples doutput inputs = do -- get the splits and names with terms and types @@ -2913,12 +2909,16 @@ checkDeletes typesTermsTuples doutput inputs = do -- compute only once for the entire deletion set let allTermsToDelete :: Set LabeledDependency allTermsToDelete = Set.unions (fmap Names.labeledReferences toDelete) - -- get the set of endangered dependencies for each entity to delete + -- get the endangered dependencies for each entity to delete endangered <- Cli.runTransaction $ traverse (\targetToDelete -> getEndangeredDependents targetToDelete allTermsToDelete rootNames) toDelete - -- If the overall dependency map is not completely empty, there are dependencies of the deletion + -- If the overall dependency map is not completely empty, abort deletion let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b ) False m ) endangered if null endangeredDeletions then do - let deleteTypesTerms = splitsNames >>= (\(split, _, types, terms) -> (map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) ++ (map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms )) + let deleteTypesTerms = + splitsNames >>= (\(split, _, types, terms) -> + (map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) ++ + (map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms ) + ) before <- Cli.getRootBranch0 description <- inputDescription inputs Cli.stepManyAt description deleteTypesTerms From 10d21905d85ced1cce1763a7aeedf0f99d29d0d6 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Thu, 2 Feb 2023 23:20:49 -0800 Subject: [PATCH 198/467] more cleanup --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index d705f5705..5865c9fc5 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2873,15 +2873,12 @@ delete :: [Path.HQSplit'] -> -- targets for deletion Cli () delete input doutput getTerms getTypes hqs' = do - -- Takes the list of entities to delete and gets the absolute paths - -- persists the original hash qualified term for error reporting + -- persists the original hash qualified entity for error reporting hq <- traverse (\t -> fmap (t,) (Cli.resolveSplit' t)) hqs' - -- from the query to delete, get terms and types typesTermsTuple <- traverse (\(hashQualified, absolute) -> do types <- getTypes absolute terms <- getTerms absolute return (hashQualified, types, terms)) hq - -- filter the list of targets down to those which don't exist let notFounds = List.filter (\(_, types, terms) -> Set.null terms && Set.null types) typesTermsTuple -- if there are any entities which cannot be deleted because they don't exist, short circuit. if not $ null notFounds then do @@ -2910,7 +2907,8 @@ checkDeletes typesTermsTuples doutput inputs = do let allTermsToDelete :: Set LabeledDependency allTermsToDelete = Set.unions (fmap Names.labeledReferences toDelete) -- get the endangered dependencies for each entity to delete - endangered <- Cli.runTransaction $ traverse (\targetToDelete -> getEndangeredDependents targetToDelete allTermsToDelete rootNames) toDelete + endangered <- Cli.runTransaction $ traverse (\targetToDelete -> + getEndangeredDependents targetToDelete allTermsToDelete rootNames) toDelete -- If the overall dependency map is not completely empty, abort deletion let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b ) False m ) endangered if null endangeredDeletions then do @@ -2958,7 +2956,7 @@ getEndangeredDependents targetNamesToDelete allTermsToDelete rootNames = do -- left over after deleting target let remainingRefs :: Set LabeledDependency remainingRefs = Names.labeledReferences remainingNames - -- remove the other targets for deletion from the remaining terms mimicking the state if transaction succeeds + -- remove the other targets for deletion from the remaining terms let remainingRefsWithoutOtherTargets :: Set LabeledDependency remainingRefsWithoutOtherTargets = Set.difference remainingRefs allOtherNamesToDelete -- deleting and not left over From 3cc7af6dbce6356bb3a89eb5b5405080120c9903 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 3 Feb 2023 00:13:14 -0800 Subject: [PATCH 199/467] enclose helper function --- .../src/Unison/Codebase/Editor/HandleInput.hs | 16 +++++++++------- .../src/Unison/CommandLine/InputPatterns.hs | 2 -- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 5865c9fc5..79943c15d 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2889,21 +2889,23 @@ delete input doutput getTerms getTypes hqs' = do else do checkDeletes typesTermsTuple doutput input -toSplitName :: (Path.HQSplit', Set Reference, Set Referent) -> Cli (Path.Split, Name, Set Reference, Set Referent) -toSplitName hq = do - resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> hq^._1) - return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), hq^._2, hq^._3) checkDeletes :: [(Path.HQSplit', Set Reference, Set Referent)] -> DeleteOutput -> Input -> Cli () checkDeletes typesTermsTuples doutput inputs = do + let toSplitName :: + (Path.HQSplit', Set Reference, Set Referent) -> + Cli (Path.Split, Name, Set Reference, Set Referent) + toSplitName hq = do + resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> hq^._1) + return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), hq^._2, hq^._3) -- get the splits and names with terms and types splitsNames <- traverse toSplitName typesTermsTuples let toRel :: Ord ref => Set ref -> Name -> R.Relation Name ref toRel setRef name = R.fromList (fmap (name,) (toList setRef)) - let toDelete :: [Names] = fmap (\(_, names, types, terms) -> Names (toRel terms names) (toRel types names)) splitsNames + let toDelete = fmap (\(_, names, types, terms) -> Names (toRel terms names) (toRel types names)) splitsNames -- make sure endangered is compeletely contained in paths rootNames <- Branch.toNames <$> Cli.getRootBranch0 - -- compute only once for the entire deletion set + -- get only once for the entire deletion set let allTermsToDelete :: Set LabeledDependency allTermsToDelete = Set.unions (fmap Names.labeledReferences toDelete) -- get the endangered dependencies for each entity to delete @@ -2938,7 +2940,7 @@ checkDeletes typesTermsTuples doutput inputs = do getEndangeredDependents :: -- | Single target for deletion Names -> - -- | Which names we want to delete (including the target) + -- | All names we want to delete (including the target) Set LabeledDependency -> -- | All names from the root branch Names -> diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index 5c0f5dba2..897d6527d 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -637,8 +637,6 @@ deleteGen suffix target mkTarget = pure $ Input.DeleteI (mkTarget paths) ) - --- NOTE: creates an input pattern using deleteGen delete :: InputPattern delete = deleteGen Nothing "term or type" (DeleteTarget'TermOrType DeleteOutput'NoDiff) From e57ad9c4372185e2948a529484e3a770facdca5a Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 3 Feb 2023 01:37:20 -0800 Subject: [PATCH 200/467] reduces one extra traversal --- .../src/Unison/Codebase/Editor/HandleInput.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 79943c15d..8a7dcd96d 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2874,18 +2874,19 @@ delete :: Cli () delete input doutput getTerms getTypes hqs' = do -- persists the original hash qualified entity for error reporting - hq <- traverse (\t -> fmap (t,) (Cli.resolveSplit' t)) hqs' - typesTermsTuple <- traverse (\(hashQualified, absolute) -> do - types <- getTypes absolute - terms <- getTerms absolute - return (hashQualified, types, terms)) hq + typesTermsTuple <- traverse (\hq -> do + absolute <- Cli.resolveSplit' hq + types <- getTypes absolute + terms <- getTerms absolute + return (hq, types, terms) + ) hqs' let notFounds = List.filter (\(_, types, terms) -> Set.null terms && Set.null types) typesTermsTuple -- if there are any entities which cannot be deleted because they don't exist, short circuit. if not $ null notFounds then do - let transformNotFounds :: [(Path.HQSplit', Set Reference, Set referent)] -> [Name] - transformNotFounds notFounds = + let toName :: [(Path.HQSplit', Set Reference, Set referent)] -> [Name] + toName notFounds = mapMaybe (\(split,_,_) -> Path.toName' $ HashQualified.toName (HQSplit'.unsplitHQ' split)) notFounds - Cli.returnEarly $ NamesNotFound (transformNotFounds notFounds) + Cli.returnEarly $ NamesNotFound (toName notFounds) else do checkDeletes typesTermsTuple doutput input From 757eb7355fd62b579c3a870a76e6f5f904307865 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Fri, 3 Feb 2023 09:03:29 -0600 Subject: [PATCH 201/467] Add LSP diagnostic for arity mismatches (#3797) --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 070e9b3a1..541c4938c 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -222,9 +222,13 @@ analyseNotes fileUri ppe src notes = do (_v, locs) <- toList defns (r, rs) <- withNeighbours (locs >>= aToR) pure (r, ("duplicate definition",) <$> rs) - TypeError.Other e -> do - Debug.debugM Debug.LSP "No Diagnostic configured for type error: " e - empty + -- These type errors don't have custom type error conversions, but some + -- still have valid diagnostics. + TypeError.Other e@(Context.ErrorNote {cause}) -> case cause of + Context.PatternArityMismatch loc _typ _numArgs -> singleRange loc + _ -> do + Debug.debugM Debug.LSP "No Diagnostic configured for type error: " e + empty diags = noteDiagnostic currentPath note ranges -- Sort on match accuracy first, then name. codeActions <- case cause of From 4f817610d685baf45c36973ae462dd9f16a8ad55 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Fri, 3 Feb 2023 09:03:44 -0600 Subject: [PATCH 202/467] Work-around for Effect annotations bug. (#3789) * Failing effect list annotation tests * Workaround for incorrect effect issues --- unison-cli/src/Unison/LSP/Queries.hs | 6 ++++- unison-cli/tests/Unison/Test/LSP.hs | 39 ++++++++++++++++++++++++++++ unison-core/src/Unison/Type.hs | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index cf680c191..e34bf8348 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -174,7 +174,11 @@ findSmallestEnclosingType pos typ ABT.Tm f -> case f of Type.Ref {} -> Just typ Type.Arrow a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b - Type.Effect a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b + Type.Effect effs rhs -> + -- There's currently a bug in the annotations for effects which cause them to + -- span larger than they should. As a workaround for now we just make sure to + -- search the RHS before the effects. + findSmallestEnclosingType pos rhs <|> findSmallestEnclosingType pos effs Type.App a b -> findSmallestEnclosingType pos a <|> findSmallestEnclosingType pos b Type.Forall r -> findSmallestEnclosingType pos r Type.Ann a _kind -> findSmallestEnclosingType pos a diff --git a/unison-cli/tests/Unison/Test/LSP.hs b/unison-cli/tests/Unison/Test/LSP.hs index ef791497d..a415516e9 100644 --- a/unison-cli/tests/Unison/Test/LSP.hs +++ b/unison-cli/tests/Unison/Test/LSP.hs @@ -110,6 +110,45 @@ term = let True, Left (Term.Boolean True) ), + ( "Test annotations for types with arrows", + [here| +structural type Thing = This | That + +term : Thing -> Thing -> Thi^ng +term a b = This + |], + True, + Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) + ), + ( "Test annotations for types with effects", + [here| +unique ability Foo a where + foo : a + +unique ability Bar b where + bar : b + +structural type Thing = This | That + +term : (Thing -> {Foo a, Bar b} Th^ing) -> {Foo a, Bar b} Thing +term f = f This + |], + True, + Right (Type.Ref (Reference.unsafeFromText "#6kbe32g06nqg93cqub6ohqc4ql4o49ntgnunifds0t75qre6lacnbsr3evn8bkivj68ecbvmhkbak4dbg4fqertcpgb396rmo34tnh0")) + ), + ( "Test annotations for effects themselves", + [here| +structural ability Foo a where + foo : a + +structural type Thing = This | That + +term : () -> {F^oo a} Thing +term _ = This + |], + True, + Right (Type.Ref (Reference.unsafeFromText "#h4uhcub76va4tckj1iccnsb07rh0fhgpigqapb4jh5n07s0tugec4nm2vikuv973mab7oh4ne07o6armcnnl7mbfjtb4imphgrjgimg")) + ), -- ( "Test annotations for blocks with destructuring binds", -- [here| -- term = let diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index 9d2a0cf9c..a676a2b6a 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -279,7 +279,7 @@ mvarRef = Reference.Builtin "MVar" tvarRef = Reference.Builtin "TVar" ticketRef :: Reference -ticketRef = Reference.Builtin "Ref.Ticket" +ticketRef = Reference.Builtin "Ref.Ticket" promiseRef :: Reference promiseRef = Reference.Builtin "Promise" From 7ab047ed67bdc1ac0a07dc491cc9e83df423b8dd Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Fri, 3 Feb 2023 09:50:39 -0600 Subject: [PATCH 203/467] Use the actual lexer for detecting symbols --- unison-cli/src/Unison/LSP/VFS.hs | 10 +++------- unison-syntax/src/Unison/Syntax/Lexer.hs | 1 + 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/unison-cli/src/Unison/LSP/VFS.hs b/unison-cli/src/Unison/LSP/VFS.hs index 0fa5c42ba..a2b5ca685 100644 --- a/unison-cli/src/Unison/LSP/VFS.hs +++ b/unison-cli/src/Unison/LSP/VFS.hs @@ -9,7 +9,6 @@ import qualified Colog.Core as Colog import Control.Lens import Control.Monad.Reader import Control.Monad.State -import Data.Char import qualified Data.Map as Map import qualified Data.Set as Set import Data.Set.Lens (setOf) @@ -24,6 +23,7 @@ import Language.LSP.VFS as VFS hiding (character) import Unison.LSP.Orphans () import Unison.LSP.Types import Unison.Prelude +import qualified Unison.Syntax.Lexer as Lexer import UnliftIO -- | Some VFS combinators require Monad State, this provides it in a transactionally safe @@ -74,12 +74,8 @@ identifierSplitAtPosition uri pos = do let (before, after) = Text.splitAt (cursorPos ^. character . to fromIntegral) fullLine pure (Text.takeWhileEnd isIdentifierChar before, Text.takeWhile isIdentifierChar after) where - -- TODO: Should probably use something from the Lexer here - isIdentifierChar = \case - c - | isSpace c -> False - | elem c ("[]()`'\"" :: String) -> False - | otherwise -> True + isIdentifierChar c = + Lexer.wordyIdChar c || Lexer.symbolyIdChar c -- | Returns the prefix of the symbol at the provided location, and the range that prefix -- spans. diff --git a/unison-syntax/src/Unison/Syntax/Lexer.hs b/unison-syntax/src/Unison/Syntax/Lexer.hs index e08b866d5..670665f57 100644 --- a/unison-syntax/src/Unison/Syntax/Lexer.hs +++ b/unison-syntax/src/Unison/Syntax/Lexer.hs @@ -31,6 +31,7 @@ module Unison.Syntax.Lexer wordyIdStartChar, wordyId, symbolyId, + symbolyIdChar, wordyId0, symbolyId0, ) From fc2cf816a7afd5ba37d7a4e4e843b9b213c12bf7 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 3 Feb 2023 12:10:27 -0500 Subject: [PATCH 204/467] Expect full scheme-libs structure for 'installed' libraries - This allows just (recursively) copying the scheme-libs directory to the installed location, rather than requiring a merge of the directory structures depending on which implementation is to be used. We can even have a setting to toggle between implementations in the future. --- scheme-libs/readme.md | 7 +++++-- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scheme-libs/readme.md b/scheme-libs/readme.md index 2ab672bec..9e19af4ff 100644 --- a/scheme-libs/readme.md +++ b/scheme-libs/readme.md @@ -13,7 +13,10 @@ directory. See: https://hackage.haskell.org/package/directory/docs/System-Directory.html#t:XdgDirectory -for more information. +for more information. The full directory structure should be copied, +since the jit compilation commands supply both the common/ +subdirectory and an implementation specific subdirectory as library +search paths. UCM can also be told to look in another directory by setting the `SchemeLibs.Static` item in the unison config file. If this path is @@ -21,7 +24,7 @@ denoted by `$CUSTOM`, then the compiler commands will look in: $CUSTOM/scheme-libs/ -for the `unison/` directory containing the library files. +for the subdirectories containing the library files. The compiler commands also expect Chez Scheme to be installed separately, and for `scheme` to be callable on the user's path. The diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 5cbdd8cbb..db7791ad9 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2766,7 +2766,10 @@ runScheme file args0 = do ensureSchemeExists gendir <- getSchemeGenLibDir statdir <- getSchemeStaticLibDir - let includes = gendir ++ ":" ++ statdir + let includes = + gendir ++ ":" ++ + (statdir "common") ++ ":" ++ + (statdir "chez") lib = ["--libdirs", includes] opt = ["--optimize-level", "3"] args = "-q" : opt ++ lib ++ ["--script", file] ++ args0 From 06882aa4789d45982fced79178755ff4f72b7783 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 3 Feb 2023 09:17:40 -0800 Subject: [PATCH 205/467] updating transcript-parser-commands.output because of delete changes --- unison-src/transcripts/transcript-parser-commands.output.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unison-src/transcripts/transcript-parser-commands.output.md b/unison-src/transcripts/transcript-parser-commands.output.md index 7f92fc568..8f9abb7e3 100644 --- a/unison-src/transcripts/transcript-parser-commands.output.md +++ b/unison-src/transcripts/transcript-parser-commands.output.md @@ -39,7 +39,8 @@ z ⚠️ - I don't know about those names. + The following names were not found in the codebase. Check your spelling. + foo ``` ```ucm @@ -47,7 +48,8 @@ z ⚠️ - I don't know about those names. + The following names were not found in the codebase. Check your spelling. + lineToken.call ``` However handling of blocks of other languages should be supported. From 6f1942355918c45e4a3745c82fa4f1735ae11d4d Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 3 Feb 2023 09:17:40 -0800 Subject: [PATCH 206/467] updating transcript-parser-commands.output because of delete changes --- .gitignore | 3 +++ unison-src/transcripts/transcript-parser-commands.output.md | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6ef1f5047..04e50adb4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ dist-newstyle # GHC *.hie *.prof + +# Mac developers +**/.DS_Store diff --git a/unison-src/transcripts/transcript-parser-commands.output.md b/unison-src/transcripts/transcript-parser-commands.output.md index 7f92fc568..8f9abb7e3 100644 --- a/unison-src/transcripts/transcript-parser-commands.output.md +++ b/unison-src/transcripts/transcript-parser-commands.output.md @@ -39,7 +39,8 @@ z ⚠️ - I don't know about those names. + The following names were not found in the codebase. Check your spelling. + foo ``` ```ucm @@ -47,7 +48,8 @@ z ⚠️ - I don't know about those names. + The following names were not found in the codebase. Check your spelling. + lineToken.call ``` However handling of blocks of other languages should be supported. From ec612ed59cbe6c2c06891ccb90a5b75f608fea74 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Fri, 3 Feb 2023 12:07:25 -0800 Subject: [PATCH 207/467] adds ds store to gitignore and removes ds store file --- unison-src/.DS_Store | Bin 8196 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 unison-src/.DS_Store diff --git a/unison-src/.DS_Store b/unison-src/.DS_Store deleted file mode 100644 index ffce1097f24319eeaaff2075f523774b4505e8ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMU2GIp6u#fI(3y6j0~9H^0~-nvu;9}2SALT1pHd67vMt?~pLTXR?y0g6|&T{W_Y1oGm2qW;njDUAO#OU#8BB0}(`bP(KehEO- zD*^mQ?^Fl)HnD&v0y@sAZ%T9W>H&c%f)WGVoa8Z2ooFJUGHYeZJ^dUnZ>Xj=RZOc^+OV9eohNhFs zkuJm1?4brbXK9WVPgS zLbWteUb%e5ol!;M3O5Z3s;OMsIGHot5xGhf{WW6B>c|m|_O##Dyj3(&zCiQP>T8wN z%3)8^nANG*0)zF+-H{H5oEK%4D{hL!BOMP>PDrxDM`|Nml}=Ml>!u`Ye4QPUok~}p z$6u0L`QV<&QYDqK2L{MRN8)4kN~3bjTXvu7xNU>FPS1U@lC#%;qe?u!O zmzOK8%6?J)T+__(Lcb<_RT&C@c}8f+DOG;zFIUQ`jXO z5ZZ*4pb94hTNvgJ2nFCBEjSpAj}V>ZoFU)^=ZtXv*1(J2x3}f~*8dLht}gVURMGfi_@7XPW7zsjz$AK9<$Ps;g)Sb|F2g*at;1NP#8pX*6<;uw0-hcq+{ zz=DmFl=Y`EhKDhZM=0l?psariPvb0}#|xDCui`bljyLfZ<^B8k02lEQKE@?{8X({s z%Kx8neOgZMpPJM7ZT6hbC$pAmTgOSGfQYHabAc=3o2c~a|K{0$|DOw64fha6AdJAj z6af@BC7T*(^4X3muhx#y(?^fjJiT#FeG}^Za-67NjuV~yhatVkNY%4R1azEJ8liUE Te+ak@e|U%Ye|Z1T_51%X++CG{ From c4fe7467dfaaf93625608e1c4d6d49beaa8b6468 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Fri, 3 Feb 2023 16:36:00 -0600 Subject: [PATCH 208/467] Use existing Pattern Annotation instance. --- unison-cli/src/Unison/LSP/Queries.hs | 7 +++--- unison-core/src/Unison/Pattern.hs | 34 ++++++++++++---------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index b49e54c17..192a7b43d 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -43,6 +43,7 @@ import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Referent as Referent import Unison.Symbol (Symbol) +import Unison.Syntax.Parser (ann) import Unison.Term (MatchCase (MatchCase), Term) import qualified Unison.Term as Term import Unison.Type (Type) @@ -250,13 +251,13 @@ findSmallestEnclosingNode pos term findSmallestEnclosingPattern :: Pos -> Pattern.Pattern Ann -> Maybe (Pattern.Pattern Ann) findSmallestEnclosingPattern pos pat | Just validTargets <- cleanImplicitUnit pat = findSmallestEnclosingPattern pos validTargets - | annIsFilePosition (Pattern.annotation pat) && not (Pattern.annotation pat `Ann.contains` pos) = Nothing + | annIsFilePosition (ann pat) && not (ann pat `Ann.contains` pos) = Nothing | otherwise = do -- For leaf nodes we require that they be an in-file position, not Intrinsic or -- external. -- In some rare cases it's possible for an External/Intrinsic node to have children that -- ARE in the file, so we need to make sure we still crawl their children. - let guardInFile = guard (annIsFilePosition (Pattern.annotation pat)) + let guardInFile = guard (annIsFilePosition (ann pat)) let bestChild = case pat of Pattern.Unbound {} -> guardInFile *> Just pat Pattern.Var {} -> guardInFile *> Just pat @@ -272,7 +273,7 @@ findSmallestEnclosingPattern pos pat Pattern.EffectBind _loc _conRef pats p -> altSum (findSmallestEnclosingPattern pos <$> pats) <|> findSmallestEnclosingPattern pos p Pattern.SequenceLiteral _loc pats -> altSum (findSmallestEnclosingPattern pos <$> pats) Pattern.SequenceOp _loc p1 _op p2 -> findSmallestEnclosingPattern pos p1 <|> findSmallestEnclosingPattern pos p2 - let fallback = if annIsFilePosition (Pattern.annotation pat) then Just pat else Nothing + let fallback = if annIsFilePosition (ann pat) then Just pat else Nothing bestChild <|> fallback where -- tuple patterns always end in an implicit unit, but it's annotated with the span of the whole diff --git a/unison-core/src/Unison/Pattern.hs b/unison-core/src/Unison/Pattern.hs index d68a28a4c..72bd2a480 100644 --- a/unison-core/src/Unison/Pattern.hs +++ b/unison-core/src/Unison/Pattern.hs @@ -5,7 +5,6 @@ module Unison.Pattern where -import qualified Data.Foldable as Foldable hiding (foldMap') import Data.List (intercalate) import qualified Data.Map as Map import qualified Data.Set as Set @@ -37,23 +36,6 @@ data Pattern loc | SequenceOp loc (Pattern loc) !SeqOp (Pattern loc) deriving (Ord, Generic, Functor, Foldable, Traversable) -annotation :: Pattern loc -> loc -annotation = \case - Unbound loc -> loc - Var loc -> loc - Boolean loc _ -> loc - Int loc _ -> loc - Nat loc _ -> loc - Float loc _ -> loc - Text loc _ -> loc - Char loc _ -> loc - Constructor loc _ _ -> loc - As loc _ -> loc - EffectPure loc _ -> loc - EffectBind loc _ _ _ -> loc - SequenceLiteral loc _ -> loc - SequenceOp loc _ _ _ -> loc - data SeqOp = Cons | Snoc @@ -107,7 +89,21 @@ application (Constructor _ _ (_ : _)) = True application _ = False loc :: Pattern loc -> loc -loc p = head $ Foldable.toList p +loc = \case + Unbound loc -> loc + Var loc -> loc + Boolean loc _ -> loc + Int loc _ -> loc + Nat loc _ -> loc + Float loc _ -> loc + Text loc _ -> loc + Char loc _ -> loc + Constructor loc _ _ -> loc + As loc _ -> loc + EffectPure loc _ -> loc + EffectBind loc _ _ _ -> loc + SequenceLiteral loc _ -> loc + SequenceOp loc _ _ _ -> loc setLoc :: Pattern loc -> loc -> Pattern loc setLoc p loc = case p of From eeed325a96c95c71945d29414ecf606827e99cae Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Feb 2023 19:34:13 -0600 Subject: [PATCH 209/467] Add builtins test suite, which can be run using the JIT or interpreted --- scheme-libs/tests/.gitignore | 3 - scheme-libs/tests/Readme.md | 6 - scheme-libs/tests/base.md | 52 --------- scheme-libs/tests/base.output.md | 103 ------------------ scheme-libs/tests/basic.md | 18 --- scheme-libs/tests/basic.output.md | 39 ------- scheme-libs/tests/run-tests.sh | 13 --- scheme-libs/tests/test1.md | 16 --- scheme-libs/tests/test1.output.md | 37 ------- scheme-libs/tests/what.md | 6 - scheme-libs/tests/what.output.md | 23 ---- unison-src/builtin-tests/Readme.md | 13 +++ unison-src/builtin-tests/base.md | 5 + unison-src/builtin-tests/base.output.md | 16 +++ unison-src/builtin-tests/interpreter-tests.md | 13 +++ .../builtin-tests/interpreter-tests.output.md | 55 ++++++++++ unison-src/builtin-tests/interpreter-tests.sh | 19 ++++ unison-src/builtin-tests/jit-tests.md | 14 +++ unison-src/builtin-tests/jit-tests.output.md | 9 ++ unison-src/builtin-tests/jit-tests.sh | 19 ++++ unison-src/builtin-tests/testlib.u | 54 +++++++++ unison-src/builtin-tests/tests.u | 7 ++ 22 files changed, 224 insertions(+), 316 deletions(-) delete mode 100644 scheme-libs/tests/.gitignore delete mode 100644 scheme-libs/tests/Readme.md delete mode 100644 scheme-libs/tests/base.md delete mode 100644 scheme-libs/tests/base.output.md delete mode 100644 scheme-libs/tests/basic.md delete mode 100644 scheme-libs/tests/basic.output.md delete mode 100755 scheme-libs/tests/run-tests.sh delete mode 100644 scheme-libs/tests/test1.md delete mode 100644 scheme-libs/tests/test1.output.md delete mode 100644 scheme-libs/tests/what.md delete mode 100644 scheme-libs/tests/what.output.md create mode 100644 unison-src/builtin-tests/Readme.md create mode 100644 unison-src/builtin-tests/base.md create mode 100644 unison-src/builtin-tests/base.output.md create mode 100644 unison-src/builtin-tests/interpreter-tests.md create mode 100644 unison-src/builtin-tests/interpreter-tests.output.md create mode 100755 unison-src/builtin-tests/interpreter-tests.sh create mode 100644 unison-src/builtin-tests/jit-tests.md create mode 100644 unison-src/builtin-tests/jit-tests.output.md create mode 100755 unison-src/builtin-tests/jit-tests.sh create mode 100644 unison-src/builtin-tests/testlib.u create mode 100644 unison-src/builtin-tests/tests.u diff --git a/scheme-libs/tests/.gitignore b/scheme-libs/tests/.gitignore deleted file mode 100644 index cb18d7d9b..000000000 --- a/scheme-libs/tests/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.ss -ucm -base.unison diff --git a/scheme-libs/tests/Readme.md b/scheme-libs/tests/Readme.md deleted file mode 100644 index 00b09fc7b..000000000 --- a/scheme-libs/tests/Readme.md +++ /dev/null @@ -1,6 +0,0 @@ - -# Testing our scheme backend - -```bash -$ ./run-tests.sh -``` diff --git a/scheme-libs/tests/base.md b/scheme-libs/tests/base.md deleted file mode 100644 index 6d9c5edd8..000000000 --- a/scheme-libs/tests/base.md +++ /dev/null @@ -1,52 +0,0 @@ - -```ucm -.> builtins.merge -.> pull unison.public.base.latest.IO base.IO -.> pull unison.public.base.main.IO.Process base.IO.Process -.> pull dolio.public.internal.trunk.compiler -``` - -```unison -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../chez/unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme true link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../chez:../common", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` - -```ucm -.> add -.> run generateSchemeBuiltinLibrary -``` diff --git a/scheme-libs/tests/base.output.md b/scheme-libs/tests/base.output.md deleted file mode 100644 index 11bb176db..000000000 --- a/scheme-libs/tests/base.output.md +++ /dev/null @@ -1,103 +0,0 @@ - -```ucm -.> builtins.merge - - Done. - -.> pull unison.public.base.latest.IO base.IO - - ✅ - - ✅ Successfully pulled into newly created namespace base.IO. - -.> pull unison.public.base.main.IO.Process base.IO.Process - -.> pull dolio.public.internal.trunk.compiler - -``` -```unison -generateSchemeBuiltinLibrary _ = - fh = open (FilePath "../chez/unison/builtin-generated.ss") Write - putText fh (generateBaseFile builtinSpec) - close fh - -schemeToFile dest link = - fh = open (FilePath dest) Write - putText fh (generateScheme true link) - close fh - -a |> f = f a - -right = cases - Left _ -> None - Right a -> Some a - -orDefault a = cases - None -> a - Some a -> a - -readAll fid = - getBytes fid 1024 - |> fromUtf8.impl - |> right - |> orDefault "Not utf8 output" - -runChez fileName = - (stdin, stdout, stderr, pid) = IO.Process.start "scheme" ["--libdirs", "../chez:../common", "--script", fileName] - exitCode = match wait pid with - 0 -> "" - code -> "Non-zero exit code! " ++ (toText code) ++ "\n" - exitCode ++ readAll stdout ++ readAll stderr - -runInScheme id term = - fileName = "basic-" ++ (Nat.toText id) ++ ".ss" - schemeToFile fileName term - runChez fileName -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () - orDefault : a -> Optional a -> a - readAll : Handle - ->{IO, Exception} Text - right : Either a b -> Optional b - runChez : Text ->{IO, Exception} Text - runInScheme : Nat - -> Term - ->{IO, Exception} Text - schemeToFile : Text - -> Term - ->{IO, Exception} () - |> : a -> (a ->{g} t) ->{g} t - -``` -```ucm -.> add - - ⍟ I've added these definitions: - - generateSchemeBuiltinLibrary : ∀ _. _ ->{IO, Exception} () - orDefault : a -> Optional a -> a - readAll : Handle ->{IO, Exception} Text - right : Either a b -> Optional b - runChez : Text ->{IO, Exception} Text - runInScheme : Nat - -> Term - ->{IO, Exception} Text - schemeToFile : Text - -> Term - ->{IO, Exception} () - |> : a -> (a ->{g} t) ->{g} t - -.> run generateSchemeBuiltinLibrary - - () - -``` diff --git a/scheme-libs/tests/basic.md b/scheme-libs/tests/basic.md deleted file mode 100644 index b86a75641..000000000 --- a/scheme-libs/tests/basic.md +++ /dev/null @@ -1,18 +0,0 @@ - -Note: This should be forked off of the codebase created by base.md - -```unison -test1_term = '(printLine "Hello") -``` - -```ucm:hide -.> add -``` - -```unison -test1 = '(runInScheme 1 (termLink test1_term)) -``` - -```ucm -.> run test1 -``` diff --git a/scheme-libs/tests/basic.output.md b/scheme-libs/tests/basic.output.md deleted file mode 100644 index 526045716..000000000 --- a/scheme-libs/tests/basic.output.md +++ /dev/null @@ -1,39 +0,0 @@ - -Note: This should be forked off of the codebase created by base.md - -```unison -test1_term = '(printLine "Hello") -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - test1_term : '{IO, Exception} () - -``` -```unison -test1 = '(runInScheme 1 (termLink test1_term)) -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - test1 : '{IO, Exception} Text - -``` -```ucm -.> run test1 - - "Hello\n" - -``` diff --git a/scheme-libs/tests/run-tests.sh b/scheme-libs/tests/run-tests.sh deleted file mode 100755 index a7dcd8e49..000000000 --- a/scheme-libs/tests/run-tests.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -ex - -if [ ! -f "ucm" ]; then - ln -s $(stack exec -- which unison) ./ucm -fi - -if [ ! -d "base.unison" ]; then - ./ucm transcript -S base.unison base.md -fi - -./ucm transcript.fork -c base.unison basic.md - diff --git a/scheme-libs/tests/test1.md b/scheme-libs/tests/test1.md deleted file mode 100644 index 434755db2..000000000 --- a/scheme-libs/tests/test1.md +++ /dev/null @@ -1,16 +0,0 @@ - -```unison -test1_term = '(printLine "Hello") -``` - -```ucm:hide -.> add -``` - -```unison -test1 = '(runInScheme 1 (termLink test1_term)) -``` - -```ucm -.> run test1 -``` diff --git a/scheme-libs/tests/test1.output.md b/scheme-libs/tests/test1.output.md deleted file mode 100644 index 7857dbb54..000000000 --- a/scheme-libs/tests/test1.output.md +++ /dev/null @@ -1,37 +0,0 @@ - -```unison -test1_term = '(printLine "Hello") -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - test1_term : '{IO, Exception} () - -``` -```unison -test1 = '(runInScheme 1 (termLink test1_term)) -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - test1 : '{IO, Exception} Text - -``` -```ucm -.> run test1 - - "" - -``` diff --git a/scheme-libs/tests/what.md b/scheme-libs/tests/what.md deleted file mode 100644 index 821d3de3b..000000000 --- a/scheme-libs/tests/what.md +++ /dev/null @@ -1,6 +0,0 @@ -```unison -hello = 10 -``` -```ucm -.> add -``` \ No newline at end of file diff --git a/scheme-libs/tests/what.output.md b/scheme-libs/tests/what.output.md deleted file mode 100644 index e18069d28..000000000 --- a/scheme-libs/tests/what.output.md +++ /dev/null @@ -1,23 +0,0 @@ -```unison -hello = 10 -``` - -```ucm - - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: - - hello : ##Nat - -``` -```ucm -.> add - - ⍟ I've added these definitions: - - hello : ##Nat - -``` diff --git a/unison-src/builtin-tests/Readme.md b/unison-src/builtin-tests/Readme.md new file mode 100644 index 000000000..4e3e1e21f --- /dev/null +++ b/unison-src/builtin-tests/Readme.md @@ -0,0 +1,13 @@ +# Test suite for builtins + +Edit `tests.u` in this directory to add to the test suite. The same test suite can be run using the JIT or the interpreter, using either of the two scripts: + +```bash +$ unison-src/builtin-tests/jit-tests.sh +``` + +```bash +$ unison-src/builtin-tests/interpreter-tests.sh +``` + +The scripts will fetch a copy of base and the scheme codegen library and cache it for subsequent runs. \ No newline at end of file diff --git a/unison-src/builtin-tests/base.md b/unison-src/builtin-tests/base.md new file mode 100644 index 000000000..e5302ad07 --- /dev/null +++ b/unison-src/builtin-tests/base.md @@ -0,0 +1,5 @@ + +```ucm +.> pull unison.public.base.latest base +.> compile.native.fetch +``` \ No newline at end of file diff --git a/unison-src/builtin-tests/base.output.md b/unison-src/builtin-tests/base.output.md new file mode 100644 index 000000000..3cf1b22cd --- /dev/null +++ b/unison-src/builtin-tests/base.output.md @@ -0,0 +1,16 @@ + +```ucm +.> pull unison.public.base.latest base + + ✅ + + Successfully pulled into newly created namespace base. + +.> compile.native.fetch + + ✅ + + Successfully updated .unison.internal from + dolio.public.internal.trunk. + +``` diff --git a/unison-src/builtin-tests/interpreter-tests.md b/unison-src/builtin-tests/interpreter-tests.md new file mode 100644 index 000000000..ca2072ba1 --- /dev/null +++ b/unison-src/builtin-tests/interpreter-tests.md @@ -0,0 +1,13 @@ + +Note: This should be forked off of the codebase created by base.md + +```ucm +.> load unison-src/builtin-tests/testlib.u +.> add +.> load unison-src/builtin-tests/tests.u +.> add +``` + +```ucm +.> run tests +``` \ No newline at end of file diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md new file mode 100644 index 000000000..30aa3347f --- /dev/null +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -0,0 +1,55 @@ + +Note: This should be forked off of the codebase created by base.md + +```ucm +.> load unison-src/builtin-tests/testlib.u + + I found and typechecked these definitions in + unison-src/builtin-tests/testlib.u. If you do an `add` or + `update`, here's how your codebase would change: + + ⍟ These new definitions are ok to `add`: + + unique ability Tests + Tests.check : Text + -> '{g, Exception} Boolean + ->{g, Tests} () + Tests.checkEqual : Text -> a1 -> a1 ->{Tests} () + Tests.main : '{IO, Exception, Tests} () + -> '{IO, Exception} () + +.> add + + ⍟ I've added these definitions: + + unique ability Tests + Tests.check : Text + -> '{g, Exception} Boolean + ->{g, Tests} () + Tests.checkEqual : Text -> a1 -> a1 ->{Tests} () + Tests.main : '{IO, Exception, Tests} () + -> '{IO, Exception} () + +.> load unison-src/builtin-tests/tests.u + + I found and typechecked these definitions in + unison-src/builtin-tests/tests.u. If you do an `add` or + `update`, here's how your codebase would change: + + ⍟ These new definitions are ok to `add`: + + tests : '{IO, Exception} () + +.> add + + ⍟ I've added these definitions: + + tests : '{IO, Exception} () + +``` +```ucm +.> run tests + + () + +``` diff --git a/unison-src/builtin-tests/interpreter-tests.sh b/unison-src/builtin-tests/interpreter-tests.sh new file mode 100755 index 000000000..52e64b613 --- /dev/null +++ b/unison-src/builtin-tests/interpreter-tests.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -ex + +ucm=$(stack exec -- which unison) + +base_codebase=${XDG_CACHE_HOME:-"$HOME/.cache"}/unisonlanguage/base.unison + +if [ ! -d $base_dir ]; then + $ucm transcript -S $base_codebase unison-src/builtin-tests/base.md +fi + +dir=${XDG_DATA_HOME:-"$HOME/.local/share"}/unisonlanguage/scheme-libs +echo $dir + +mkdir -p $dir +cp -r scheme-libs/* $dir/ + +time $ucm transcript.fork -c $base_codebase unison-src/builtin-tests/interpreter-tests.md + diff --git a/unison-src/builtin-tests/jit-tests.md b/unison-src/builtin-tests/jit-tests.md new file mode 100644 index 000000000..ec36cfa59 --- /dev/null +++ b/unison-src/builtin-tests/jit-tests.md @@ -0,0 +1,14 @@ + +Note: This should be forked off of the codebase created by base.md + +```ucm:hide +.> compile.native.genlibs +.> load unison-src/builtin-tests/testlib.u +.> add +.> load unison-src/builtin-tests/tests.u +.> add +``` + +```ucm +.> run.native tests +``` \ No newline at end of file diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md new file mode 100644 index 000000000..be1cfa24c --- /dev/null +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -0,0 +1,9 @@ + +Note: This should be forked off of the codebase created by base.md + +```ucm +.> run.native tests + + Scheme evaluation failed. + +``` diff --git a/unison-src/builtin-tests/jit-tests.sh b/unison-src/builtin-tests/jit-tests.sh new file mode 100755 index 000000000..a4148b8b7 --- /dev/null +++ b/unison-src/builtin-tests/jit-tests.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -ex + +ucm=$(stack exec -- which unison) + +base_codebase=${XDG_CACHE_HOME:-"$HOME/.cache"}/unisonlanguage/base.unison + +if [ ! -d $base_dir ]; then + $ucm transcript -S $base_codebase unison-src/builtin-tests/base.md +fi + +dir=${XDG_DATA_HOME:-"$HOME/.local/share"}/unisonlanguage/scheme-libs +echo $dir + +mkdir -p $dir +cp -r scheme-libs/* $dir/ + +time $ucm transcript.fork -c $base_codebase unison-src/builtin-tests/jit-tests.md + diff --git a/unison-src/builtin-tests/testlib.u b/unison-src/builtin-tests/testlib.u new file mode 100644 index 000000000..2ed3de91c --- /dev/null +++ b/unison-src/builtin-tests/testlib.u @@ -0,0 +1,54 @@ + +unique ability Tests where + pass : Text -> () + fail : Text -> Text -> () + exception : Text -> Failure -> () + +Tests.check msg b = + match catch b with + Left e -> exception msg e + Right true -> pass msg + Right false -> fail msg "" + +Tests.checkEqual msg a1 a2 = + match catch '(a1 === a2) with + Left e -> exception msg e + Right true -> pass msg + Right false -> fail msg "not equal" + +Tests.main : '{IO,Exception,Tests} () -> '{IO,Exception} () +Tests.main suite = do + passed = IO.ref 0 + failed = IO.ref 0 + h = cases + { _ } -> () + { pass msg -> k } -> + printLine (" ✅ " ++ msg) + Ref.write passed (Ref.read passed + 1) + handle !k with h + { fail msg reason -> k } -> + printLine (" 🆘 " ++ msg ++ " " ++ reason) + Ref.write failed (Ref.read failed + 1) + handle !k with h + { exception msg failure@(Failure _ cause payload) -> k} -> + printLine (" 💥 " ++ msg ++ " " ++ cause) + Ref.write failed (Ref.read failed + 1) + handle !k with h + + printLine "" + printLine "*** Test suite ***" + printLine "" + + handle !suite with h + + printLine "" + printLine "" + printLine "Summary of results:" + printLine "" + + if Ref.read failed == 0 then + printLine (" ✅✅✅ " ++ Nat.toText (Ref.read passed) ++ " PASSED") + else + printLine (" 🆘🆘🆘 " ++ Nat.toText (Ref.read failed) ++ " FAILED, " + ++ Nat.toText (Ref.read passed) ++ " passed") + bug "test suite failed" \ No newline at end of file diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u new file mode 100644 index 000000000..211d7b84d --- /dev/null +++ b/unison-src/builtin-tests/tests.u @@ -0,0 +1,7 @@ + + +tests : '{IO,Exception} () +tests = Tests.main do + check "Nat.+" do 1 + 1 == 2 + check "Nat.*" do 10 * 100 == 1000 + check "Nat./" do 100 / 10 == 10 From 4fe10008cac38a577557a98b6e7d5c423a40bd9f Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Feb 2023 19:51:30 -0600 Subject: [PATCH 210/467] turn off echo --- unison-src/builtin-tests/interpreter-tests.sh | 2 +- unison-src/builtin-tests/jit-tests.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unison-src/builtin-tests/interpreter-tests.sh b/unison-src/builtin-tests/interpreter-tests.sh index 52e64b613..9743129b8 100755 --- a/unison-src/builtin-tests/interpreter-tests.sh +++ b/unison-src/builtin-tests/interpreter-tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -ex +#set -ex ucm=$(stack exec -- which unison) diff --git a/unison-src/builtin-tests/jit-tests.sh b/unison-src/builtin-tests/jit-tests.sh index a4148b8b7..c1895fe3d 100755 --- a/unison-src/builtin-tests/jit-tests.sh +++ b/unison-src/builtin-tests/jit-tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -ex +#set -ex ucm=$(stack exec -- which unison) From 3bd5ce3de9ad82e0ef999505fe17ffcafe589fea Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Feb 2023 19:58:24 -0600 Subject: [PATCH 211/467] fixup --- unison-src/builtin-tests/Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unison-src/builtin-tests/Readme.md b/unison-src/builtin-tests/Readme.md index 4e3e1e21f..a3aba90bc 100644 --- a/unison-src/builtin-tests/Readme.md +++ b/unison-src/builtin-tests/Readme.md @@ -3,11 +3,11 @@ Edit `tests.u` in this directory to add to the test suite. The same test suite can be run using the JIT or the interpreter, using either of the two scripts: ```bash -$ unison-src/builtin-tests/jit-tests.sh +$ ./unison-src/builtin-tests/jit-tests.sh ``` ```bash -$ unison-src/builtin-tests/interpreter-tests.sh +$ ./unison-src/builtin-tests/interpreter-tests.sh ``` The scripts will fetch a copy of base and the scheme codegen library and cache it for subsequent runs. \ No newline at end of file From b669fe4bff2628f41a82004f60059b7dd5fcde79 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 6 Feb 2023 20:13:13 -0600 Subject: [PATCH 212/467] Fix some bugs in racket/unison/core.ss It's possible I'm just not running it right, but when I tried to evaluate `core.ss` with racket there were some undefined terms, which I solved by adding some requires, and creating the isolated-string-copy.rkt file. Now `unison/core` is requirable in the racket runtime! --- scheme-libs/racket/unison/Readme.md | 9 +++++++++ scheme-libs/racket/unison/core.ss | 2 +- scheme-libs/racket/unison/isolated-string-copy.rkt | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 scheme-libs/racket/unison/Readme.md create mode 100644 scheme-libs/racket/unison/isolated-string-copy.rkt diff --git a/scheme-libs/racket/unison/Readme.md b/scheme-libs/racket/unison/Readme.md new file mode 100644 index 000000000..8b2cd0eaf --- /dev/null +++ b/scheme-libs/racket/unison/Readme.md @@ -0,0 +1,9 @@ +# Racket unison! + +To load these libraries into a racket runtime, racket should be invoked like this: +```bash +$ racket -S scheme-libs/racket +Welcome to Racket v8.7 [cs]. +> (require unison/core) +> ; now you can try out the definitions in core.ss! +``` \ No newline at end of file diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss index 8cb46daf2..8d562299d 100644 --- a/scheme-libs/racket/unison/core.ss +++ b/scheme-libs/racket/unison/core.ss @@ -28,7 +28,7 @@ freeze-bytevector! freeze-vector!) - (import (rnrs) (racket exn)) + (import (rnrs) (racket exn) (racket unsafe ops) (unison isolated-string-copy)) (define (fx1- n) (fx- n 1)) diff --git a/scheme-libs/racket/unison/isolated-string-copy.rkt b/scheme-libs/racket/unison/isolated-string-copy.rkt new file mode 100644 index 000000000..aa9d70b34 --- /dev/null +++ b/scheme-libs/racket/unison/isolated-string-copy.rkt @@ -0,0 +1,11 @@ +; This library exists solely to +; export "string-copy!" for use by "core.ss" +; +; "core.ss" can't require (racket/base) itself, +; as racket/base has name clashes with rnrs +; and the #r6rs language can't handle name +; clashes (the normal racket language can) +(module nother racket + (provide string-copy!) + + (require racket/base)) \ No newline at end of file From 531e8181e23ef2190cb3a9ec2b16a308a93370ad Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 6 Feb 2023 20:27:04 -0600 Subject: [PATCH 213/467] [racket-fixes] fix name --- scheme-libs/racket/unison/isolated-string-copy.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheme-libs/racket/unison/isolated-string-copy.rkt b/scheme-libs/racket/unison/isolated-string-copy.rkt index aa9d70b34..8c5eda303 100644 --- a/scheme-libs/racket/unison/isolated-string-copy.rkt +++ b/scheme-libs/racket/unison/isolated-string-copy.rkt @@ -5,7 +5,7 @@ ; as racket/base has name clashes with rnrs ; and the #r6rs language can't handle name ; clashes (the normal racket language can) -(module nother racket +(module isolated-string-copy racket (provide string-copy!) (require racket/base)) \ No newline at end of file From 61dc3a32d49f77705949db12d28caeb1ae790c23 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 6 Feb 2023 20:33:57 -0600 Subject: [PATCH 214/467] [racket-fixes] nicer --- scheme-libs/racket/unison/isolated-string-copy.rkt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scheme-libs/racket/unison/isolated-string-copy.rkt b/scheme-libs/racket/unison/isolated-string-copy.rkt index 8c5eda303..1dfd57e12 100644 --- a/scheme-libs/racket/unison/isolated-string-copy.rkt +++ b/scheme-libs/racket/unison/isolated-string-copy.rkt @@ -1,3 +1,4 @@ +#lang racket/base ; This library exists solely to ; export "string-copy!" for use by "core.ss" ; @@ -5,7 +6,7 @@ ; as racket/base has name clashes with rnrs ; and the #r6rs language can't handle name ; clashes (the normal racket language can) -(module isolated-string-copy racket - (provide string-copy!) - (require racket/base)) \ No newline at end of file +(provide string-copy!) + +(require racket/base) \ No newline at end of file From 98474b21df81fd5c5702998d594ca2a52da64e7f Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 6 Feb 2023 21:36:28 -0600 Subject: [PATCH 215/467] Add cryptographic hashing primitives for the racket backend The `crypto-lib` library that I'm using is published under LGPL -- does that work for us? https://docs.racket-lang.org/crypto/index.html --- scheme-libs/racket/unison/Readme.md | 13 +++++++++++ scheme-libs/racket/unison/crypto.rkt | 33 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 scheme-libs/racket/unison/crypto.rkt diff --git a/scheme-libs/racket/unison/Readme.md b/scheme-libs/racket/unison/Readme.md index 8b2cd0eaf..feaa5c8ef 100644 --- a/scheme-libs/racket/unison/Readme.md +++ b/scheme-libs/racket/unison/Readme.md @@ -6,4 +6,17 @@ $ racket -S scheme-libs/racket Welcome to Racket v8.7 [cs]. > (require unison/core) > ; now you can try out the definitions in core.ss! +``` + +## crypto +NOTE: you must have the `crypto` racket library installed, which can be optained via `raco pkg install crypto-lib`. + +```clj +$ racket -S scheme-libs/racket +> (require unison/crypto) +> (unison-FOp-crypto.hashBytes (unison-FOp-crypto.HashAlgorithm.Sha1) #"") +#"\3329\243\356^kK\r2U\277\357\225`\30\220\257\330\a\t" +> (require openssl/sha1) +> (bytes->hex-string (unison-FOp-crypto.hashBytes (unison-FOp-crypto.HashAlgorithm.Sha1) #"")) +"da39a3ee5e6b4b0d3255bfef95601890afd80709" ``` \ No newline at end of file diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt new file mode 100644 index 000000000..1af2053c8 --- /dev/null +++ b/scheme-libs/racket/unison/crypto.rkt @@ -0,0 +1,33 @@ +#lang racket/base + +(require racket crypto crypto/libcrypto crypto/b2) + +(provide + (prefix-out + unison-FOp-crypto. + (except-out (all-defined-out) lc b2) + )) + +(crypto-factories (list libcrypto-factory b2-factory)) + +(define (lc sym) + (unless (send libcrypto-factory get-version) + (send libcrypto-factory print-lib-info) + (error sym "Unable to load libcrypto")) + sym) + +(define (b2 sym) + (unless (send b2-factory get-version) + (send b2-factory print-lib-info) + (error sym "Unable to load libb2")) + sym) + +(define (HashAlgorithm.Sha1) (lc 'sha1)) +(define (HashAlgorithm.Sha2_256) (lc 'sha256)) +(define (HashAlgorithm.Sha2_512) (lc 'sha512)) +(define (HashAlgorithm.Sha3_256) (lc 'sha3-256)) +(define (HashAlgorithm.Sha3_512) (lc 'sha3-512)) +(define (HashAlgorithm.Blake2b_256) (b2 'blake2b-256)) +(define (HashAlgorithm.Blake2s_256) (b2 'blake2s-256)) +(define (HashAlgorithm.Blake2b_512) (b2 'blake2b-512)) +(define hashBytes digest) From fb5ab394591b601c4dc445aab6388c208e401952 Mon Sep 17 00:00:00 2001 From: Arya Irani Date: Tue, 7 Feb 2023 13:54:42 -0500 Subject: [PATCH 216/467] switch less args from -r to -R --- lib/unison-pretty-printer/src/Unison/Util/Less.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/unison-pretty-printer/src/Unison/Util/Less.hs b/lib/unison-pretty-printer/src/Unison/Util/Less.hs index 98c7c5a3a..c4c658edc 100644 --- a/lib/unison-pretty-printer/src/Unison/Util/Less.hs +++ b/lib/unison-pretty-printer/src/Unison/Util/Less.hs @@ -48,7 +48,7 @@ less str = do lessArgs :: [String] lessArgs = [ "--no-init", -- don't clear the screen on exit - "--raw-control-chars", -- pass through colors and stuff + "--RAW-CONTROL-CHARS", -- pass through colors and stuff "--prompt=[less] Use space/arrow keys to navigate, or 'q' to return to ucm:", "--quit-if-one-screen" -- self-explanatory ] From dbe95fb6acfaaf70133b31eabd86a2c9a6f8cfaf Mon Sep 17 00:00:00 2001 From: Stew O'Connor Date: Tue, 7 Feb 2023 13:36:17 -0800 Subject: [PATCH 217/467] Fix calling convention in Tls.send and Tls.handshake --- .../src/Unison/Runtime/Builtin.hs | 4 +- unison-src/transcripts/patternMatchTls.md | 30 ++++++++++++ .../transcripts/patternMatchTls.output.md | 49 +++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 unison-src/transcripts/patternMatchTls.md create mode 100644 unison-src/transcripts/patternMatchTls.output.md diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 5fa23695c..e994e6734 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2359,7 +2359,7 @@ declareForeigns = do declareForeign Tracked "Tls.handshake.impl.v3" boxToEF0 . mkForeignTls $ \(tls :: TLS.Context) -> TLS.handshake tls - declareForeign Tracked "Tls.send.impl.v3" boxBoxToEFBox . mkForeignTls $ + declareForeign Tracked "Tls.send.impl.v3" boxBoxToEF0 . mkForeignTls $ \( tls :: TLS.Context, bytes :: Bytes.Bytes ) -> TLS.sendData tls (Bytes.toLazyByteString bytes) @@ -2389,7 +2389,7 @@ declareForeigns = do bs <- TLS.recvData tls pure $ Bytes.fromArray bs - declareForeign Tracked "Tls.terminate.impl.v3" boxToEFBox . mkForeignTls $ + declareForeign Tracked "Tls.terminate.impl.v3" boxToEF0 . mkForeignTls $ \(tls :: TLS.Context) -> TLS.bye tls declareForeign Untracked "Code.dependencies" boxDirect diff --git a/unison-src/transcripts/patternMatchTls.md b/unison-src/transcripts/patternMatchTls.md new file mode 100644 index 000000000..6d600f535 --- /dev/null +++ b/unison-src/transcripts/patternMatchTls.md @@ -0,0 +1,30 @@ +```ucm:hide +.> builtins.merge +.> builtins.mergeio +``` + +We had bugs in the calling conventions for both send and terminate which would +cause pattern matching on the resulting (Right ()) would cause a runtime error. + + + +```unison +use builtin.io2.Tls newClient send handshake terminate + +frank: '{IO} () +frank = do + (Right socket) = clientSocket.impl "example.com" "443" + config = ClientConfig.default "example.com" 0xs + (Right tls) = newClient.impl config socket + (Right ()) = handshake.impl tls + (Right ()) = send.impl tls 0xs + (Right ()) = terminate.impl tls + () +``` + + + +```ucm +.> add +.> run frank +``` diff --git a/unison-src/transcripts/patternMatchTls.output.md b/unison-src/transcripts/patternMatchTls.output.md new file mode 100644 index 000000000..c9d97047c --- /dev/null +++ b/unison-src/transcripts/patternMatchTls.output.md @@ -0,0 +1,49 @@ +```unison +use builtin.io2.Tls newClient send handshake terminate + +frank: '{IO, Exception} () +frank = do + (Right socket) = clientSocket.impl "example.com" "443" + config = ClientConfig.default "example.com" 0xs + (Right tls) = newClient.impl config socket + (Right ()) = handshake.impl tls + (Right ()) = send.impl tls 0xs + (Right ()) = terminate.impl tls + () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + frank : '{IO, Exception} () + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + frank : '{IO, Exception} () + +.> run frank + + dumpData: bad closure: Foreign (Wrap ##Tls _) + expected type: #00nv2 + +``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + dumpData: bad closure: Foreign (Wrap ##Tls _) + expected type: #00nv2 + From 99b4b1769c2b4c2e99892766c580a58fdbee0544 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 7 Feb 2023 16:45:06 -0500 Subject: [PATCH 218/467] Various racket related fixes/changes - Put #!r6rs on common modules. This is apparently a scheme comment, but is used by racket to know which language mode to use to parse things. - Racket doesn't seem to support #vu8 syntax for bytevectors, so instead export a common (bytevector ...) function from (unison core) for creation. This has to be a rename on racket, because apparently the standard scheme bytevector is called "bytes" there. - Import (racket unsafe ops) in (unison core) for various freezing operations. - Reimplement record-case macro for racket, it seems to work now - Implement some dynamic scoping via continuation marks. This is untested as yet, but at least passes syntax checking for generated libraries. No chez equivalent yet, because that part of the continuation library hasn't been implemented. - Tweaks in HandleInput to do run.native via racket. The chez code is still there, so that there can be an option to toggle later, but right now use of racket is hard coded. The compile.native command is still using the chez commands, until I can figure out how to call the appropriate `raco` command. --- scheme-libs/chez/unison/core.ss | 4 +- scheme-libs/common/unison/boot.ss | 87 ++++++++--------- scheme-libs/common/unison/bytevector.ss | 1 + scheme-libs/common/unison/primops.ss | 1 + scheme-libs/common/unison/string.ss | 1 + scheme-libs/common/unison/vector.ss | 1 + scheme-libs/racket/unison/core.ss | 94 +++++++++++++------ .../src/Unison/Codebase/Editor/HandleInput.hs | 43 ++++++--- 8 files changed, 146 insertions(+), 86 deletions(-) diff --git a/scheme-libs/chez/unison/core.ss b/scheme-libs/chez/unison/core.ss index 614ea1204..a8ec91c49 100644 --- a/scheme-libs/chez/unison/core.ss +++ b/scheme-libs/chez/unison/core.ss @@ -28,7 +28,9 @@ string-copy! freeze-bytevector! - freeze-vector!) + freeze-vector! + + bytevector) (import (chezscheme)) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 82fe30b29..8833edd8d 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -10,6 +10,7 @@ ; has an 'arity' at which computation happens, but the function ; automatically handles being applied to fewer or more arguments than ; that arity appropriately. +#!r6rs (library (unison boot) (export name @@ -19,7 +20,7 @@ unison-force identity record-case - fluid-let) + bytevector) (import (rnrs) (unison core) @@ -46,48 +47,49 @@ ; The intent is for the scheme compiler to be able to recognize and ; optimize static, fast path calls itself, while still supporting ; unison-like automatic partial application and such. - (define-syntax (define-unison x) - ; Helper function. Turns a list of syntax objects into a - ; list-syntax object. - (define (list->syntax l) #`(#,@l)) - ; Builds partial application cases for unison functions. - ; It seems most efficient to have a case for each posible - ; under-application. - (define (build-partials name formals) - (let rec ([us formals] [acc '()]) - (syntax-case us () - [() (list->syntax (cons #`[() #,name] acc))] + (define-syntax define-unison + (lambda (x) + ; Helper function. Turns a list of syntax objects into a + ; list-syntax object. + (define (list->syntax l) #`(#,@l)) + ; Builds partial application cases for unison functions. + ; It seems most efficient to have a case for each posible + ; under-application. + (define (build-partials name formals) + (let rec ([us formals] [acc '()]) + (syntax-case us () + [() (list->syntax (cons #`[() #,name] acc))] + [(a ... z) + (rec #'(a ...) + (cons + #`[(a ... z) + (with-name + #,(datum->syntax name (syntax->datum name)) + (lambda r (apply #,name a ... z r)))] + acc))]))) + + ; Given an overall function name, a fast path name, and a list of + ; arguments, builds the case-lambda body of a unison function that + ; enables applying to arbitrary numbers of arguments. + (define (func-cases name fast args) + (syntax-case args () + [() #`(case-lambda + [() (#,fast)] + [r (apply (#,fast) r)])] [(a ... z) - (rec #'(a ...) - (cons - #`[(a ... z) - (with-name - #,(datum->syntax name (syntax->datum name)) - (lambda r (apply #,name a ... z r)))] - acc))]))) + #`(case-lambda + #,@(build-partials name #'(a ...)) + [(a ... z) (#,fast a ... z)] + [(a ... z . r) (apply (#,fast a ... z) r)])])) - ; Given an overall function name, a fast path name, and a list of - ; arguments, builds the case-lambda body of a unison function that - ; enables applying to arbitrary numbers of arguments. - (define (func-cases name fast args) - (syntax-case args () - [() #`(case-lambda - [() (#,fast)] - [r (apply (#,fast) r)])] - [(a ... z) - #`(case-lambda - #,@(build-partials name #'(a ...)) - [(a ... z) (#,fast a ... z)] - [(a ... z . r) (apply (#,fast a ... z) r)])])) + (define (func-wrap name args body) + #`(let ([fast-path (lambda (#,@args) #,@body)]) + #,(func-cases name #'fast-path args))) - (define (func-wrap name args body) - #`(let ([fast-path (lambda (#,@args) #,@body)]) - #,(func-cases name #'fast-path args))) - - (syntax-case x () - [(define-unison (name a ...) e ...) - #`(define name - #,(func-wrap #'name #'(a ...) #'(e ...)))])) + (syntax-case x () + [(define-unison (name a ...) e ...) + #`(define name + #,(func-wrap #'name #'(a ...) #'(e ...)))]))) ; call-by-name bindings (define-syntax name @@ -101,13 +103,14 @@ (define-syntax handle (syntax-rules () [(handle [r ...] h e ...) - (prompt p (fluid-let ([r (cons p h)] ...) e ...))])) + (prompt p + (let-marks (list (quote r) ...) (cons p h) e ...))])) ; wrapper that more closely matches ability requests (define-syntax request (syntax-rules () [(request r t . args) - ((cdr r) (list (quote r) t . args))])) + ((cdr (ref-mark (quote r))) (list (quote r) t . args))])) (define-record-type data diff --git a/scheme-libs/common/unison/bytevector.ss b/scheme-libs/common/unison/bytevector.ss index 9de5e94a0..c8656e53f 100644 --- a/scheme-libs/common/unison/bytevector.ss +++ b/scheme-libs/common/unison/bytevector.ss @@ -5,6 +5,7 @@ ; implements all the functions we'd want. This library exports the ; desired functionality on top of an unsafe in-place freeze ; re-exported from the (unison core) module. +#!r6rs (library (unison bytevector) (export freeze-bytevector! diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 870b9d888..20f76232e 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -21,6 +21,7 @@ ; Unison.Runtime.Builtin, so the POp/FOp implementation must ; take/return arguments that match what is expected in those wrappers. +#!r6rs (library (unison primops) (export ; unison-FOp-Bytes.decodeNat16be diff --git a/scheme-libs/common/unison/string.ss b/scheme-libs/common/unison/string.ss index a63c0d9c8..92366c5d8 100644 --- a/scheme-libs/common/unison/string.ss +++ b/scheme-libs/common/unison/string.ss @@ -4,6 +4,7 @@ ; entirely in terms of immutable strings. This module takes the ; freezing function, re-exported by (unison core) and implements the ; API needed for unison. +#!r6rs (library (unison string) (export istring diff --git a/scheme-libs/common/unison/vector.ss b/scheme-libs/common/unison/vector.ss index 2201f4184..bc237976b 100644 --- a/scheme-libs/common/unison/vector.ss +++ b/scheme-libs/common/unison/vector.ss @@ -1,4 +1,5 @@ +#!r6rs (library (unison vector) (export freeze-vector! diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss index 8cb46daf2..fb651b786 100644 --- a/scheme-libs/racket/unison/core.ss +++ b/scheme-libs/racket/unison/core.ss @@ -20,15 +20,28 @@ exception->string record-case - fluid-let + let-marks + ref-mark freeze-string! string-copy! freeze-bytevector! - freeze-vector!) + freeze-vector! + + bytevector) - (import (rnrs) (racket exn)) + (import + (rnrs) + (rename (only (racket) + string-copy! + bytes + with-continuation-mark + continuation-mark-set-first) + (string-copy! racket-string-copy!) + (bytes bytevector)) + (racket exn) + (racket unsafe ops)) (define (fx1- n) (fx- n 1)) @@ -56,37 +69,62 @@ (define exception->string exn->string) (define-syntax record-case - (syntax-rules (else) - ; no else - [(record-case expr - [(tag0 tag1 ...) (v ...) e ...] - ...) - (let ([val expr]) - (case (car val) - [(tag0 tag1 ...) - (let-values ([(v ...) (apply values (cdr val))]) - e ...)] - ...))] + (lambda (stx) + (syntax-case stx () + [(record-case scrut c ...) + (begin + (define (syntax->list stx) + (syntax-case stx () + [() '()] + [(x . xs) (cons #'x (syntax->list #'xs))])) - ; with else - [(record-case expr - [(tag0 tag1 ...) (v ...) e ...] - ... - [else ee ...]) - (let ([val expr]) - (case (car val) - [(tag0 tag1 ...) - (let-values ([(v ...) (apply values (cdr val))]) - e ...)] - ... - [else ee ...]))])) + (define (make-case cur) + (syntax-case cur (else) + [(else e ...) #'(else e ...)] + [((t ...) () e ...) #'((t ...) e ...)] + [(t () e ...) #'((t) e ...)] + [((t ...) (v ...) e ...) + #'((t ...) + (let-values ([(v ...) (apply values (cdr scrut))]) + e ...))] + [(t (v ...) e ...) + #'((t) + (let-values ([(v ...) (apply values (cdr scrut))]) + e ...))] + [((t ...) v e ...) + (identifier? #'v) + #'((t ...) + (let ([v (cdr scrut)]) + e ...))] + [(t v e ...) + (identifier? #'v) + #'((t) + (let ([v (cdr scrut)]) + e ...))])) + #`(case (car scrut) + #,@(map make-case (syntax->list #'(c ...)))))]))) - (define (fluid-let) '()) + (define (call-with-marks rs v f) + (cond + [(null? rs) (f)] + [else + (with-continuation-mark (car rs) v + (call-with-marks (cdr rs) v f))])) + + (define-syntax let-marks + (syntax-rules () + [(let-marks ks bn e ...) + (call-with-marks ks bn (lambda () e ...))])) + + (define (ref-mark k) (continuation-mark-set-first #f k)) (define freeze-string! unsafe-string->immutable-string!) (define freeze-bytevector! unsafe-bytes->immutable-bytes!) (define freeze-vector! unsafe-vector*->immutable-vector!) + ; racket string-copy! has the opposite argument order convention + ; from chez. + (define (string-copy! src soff dst doff len) + (racket-string-copy! dst doff src soff len)) ) - diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index db7791ad9..37b526000 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2761,27 +2761,40 @@ ensureSchemeExists = (True <$ readCreateProcess (shell "scheme -q") "") (\(_ :: IOException) -> pure False) -runScheme :: String -> [String] -> Cli () -runScheme file args0 = do +racketOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] +racketOpts gendir statdir file args = libs ++ [file] ++ args + where + includes = [gendir, statdir "common", statdir "racket"] + libs = concatMap (\dir -> ["-S",dir]) includes + +chezOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] +chezOpts gendir statdir file args = + "-q" : opt ++ libs ++ ["--script", file] ++ args + where + includes = [gendir, statdir "common", statdir "chez"] + libs = ["--libdirs", List.intercalate ":" includes] + opt = ["--optimize-level", "3"] + +data SchemeBackend = Racket | Chez + +runScheme :: SchemeBackend -> String -> [String] -> Cli () +runScheme bk file args0 = do ensureSchemeExists gendir <- getSchemeGenLibDir statdir <- getSchemeStaticLibDir - let includes = - gendir ++ ":" ++ - (statdir "common") ++ ":" ++ - (statdir "chez") - lib = ["--libdirs", includes] - opt = ["--optimize-level", "3"] - args = "-q" : opt ++ lib ++ ["--script", file] ++ args0 + let cmd = case bk of Racket -> "racket" ; Chez -> "scheme" + opts = case bk of + Racket -> racketOpts gendir statdir file args0 + Chez -> chezOpts gendir statdir file args0 success <- liftIO $ - (True <$ callProcess "scheme" args) `catch` \(_ :: IOException) -> - pure False + (True <$ callProcess cmd opts) + `catch` \(_ :: IOException) -> pure False unless success $ Cli.returnEarly (PrintMessage "Scheme evaluation failed.") -buildScheme :: String -> String -> Cli () -buildScheme main file = do +buildChez :: String -> String -> Cli () +buildChez main file = do ensureSchemeExists statDir <- getSchemeStaticLibDir genDir <- getSchemeGenLibDir @@ -2809,11 +2822,11 @@ buildScheme main file = do doRunAsScheme :: HQ.HashQualified Name -> [String] -> Cli () doRunAsScheme main args = do fullpath <- generateSchemeFile True (HQ.toString main) main - runScheme fullpath args + runScheme Racket fullpath args doCompileScheme :: String -> HQ.HashQualified Name -> Cli () doCompileScheme out main = - generateSchemeFile False out main >>= buildScheme out + generateSchemeFile False out main >>= buildChez out generateSchemeFile :: Bool -> String -> HQ.HashQualified Name -> Cli String generateSchemeFile exec out main = do From 5d685d848e991f7a238eecca385b38f071378046 Mon Sep 17 00:00:00 2001 From: Stew O'Connor Date: Tue, 7 Feb 2023 13:51:04 -0800 Subject: [PATCH 219/467] rerun transcript --- .../transcripts/patternMatchTls.output.md | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/unison-src/transcripts/patternMatchTls.output.md b/unison-src/transcripts/patternMatchTls.output.md index c9d97047c..b1dd77c96 100644 --- a/unison-src/transcripts/patternMatchTls.output.md +++ b/unison-src/transcripts/patternMatchTls.output.md @@ -1,7 +1,12 @@ +We had bugs in the calling conventions for both send and terminate which would +cause pattern matching on the resulting (Right ()) would cause a runtime error. + + + ```unison use builtin.io2.Tls newClient send handshake terminate -frank: '{IO, Exception} () +frank: '{IO} () frank = do (Right socket) = clientSocket.impl "example.com" "443" config = ClientConfig.default "example.com" 0xs @@ -20,7 +25,7 @@ frank = do ⍟ These new definitions are ok to `add`: - frank : '{IO, Exception} () + frank : '{IO} () ``` ```ucm @@ -28,22 +33,10 @@ frank = do ⍟ I've added these definitions: - frank : '{IO, Exception} () + frank : '{IO} () .> run frank - dumpData: bad closure: Foreign (Wrap ##Tls _) - expected type: #00nv2 + () ``` - - - -🛑 - -The transcript failed due to an error in the stanza above. The error is: - - - dumpData: bad closure: Foreign (Wrap ##Tls _) - expected type: #00nv2 - From 56e27f855f23ce63932ed11d6bdfbc8a2d3207b8 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Tue, 7 Feb 2023 18:36:24 -0500 Subject: [PATCH 220/467] Add racket (unison cont) library --- scheme-libs/racket/unison/cont.ss | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scheme-libs/racket/unison/cont.ss diff --git a/scheme-libs/racket/unison/cont.ss b/scheme-libs/racket/unison/cont.ss new file mode 100644 index 000000000..8c0a12934 --- /dev/null +++ b/scheme-libs/racket/unison/cont.ss @@ -0,0 +1,28 @@ + +#!r6rs +(library (unison cont) + (export + prompt + control) + + (import + (rnrs) + (unison core) + (only (racket) + make-continuation-prompt-tag) + (only (racket control) + prompt0-at + control0-at)) + + (define-syntax prompt + (syntax-rules () + [(prompt p e ...) + (let ([p (make-continuation-prompt-tag)]) + (prompt0-at p + e ...))])) + + (define-syntax control + (syntax-rules () + [(control r k e ...) + (control0-at (car (ref-mark r)) k e ...)]))) + From cc3fb9211b4e35ba9a74c4d11777538e7ed27b24 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Tue, 7 Feb 2023 17:50:08 -0600 Subject: [PATCH 221/467] Modified test suite runner - no longer uses IO refs Also changed jit-tests.sh to fetch latest scheme generating library --- scheme-libs/racket/unison/crypto.ss | 11 +++++++ .../builtin-tests/interpreter-tests.output.md | 4 +++ unison-src/builtin-tests/interpreter-tests.sh | 2 +- unison-src/builtin-tests/jit-tests.md | 1 + unison-src/builtin-tests/jit-tests.sh | 2 +- unison-src/builtin-tests/testlib.u | 32 +++++++++---------- 6 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 scheme-libs/racket/unison/crypto.ss diff --git a/scheme-libs/racket/unison/crypto.ss b/scheme-libs/racket/unison/crypto.ss new file mode 100644 index 000000000..70003903e --- /dev/null +++ b/scheme-libs/racket/unison/crypto.ss @@ -0,0 +1,11 @@ +#!r6rs +;; stubbed out just to avoid import error, replace with real thing +(library (unison crypto) + (export + unison-FOp-crypto.HashAlgorithm.Sha1 + unison-FOp-crypto.hashBytes) + + (import (rnrs)) + + (define (unison-FOp-crypto.HashAlgorithm.Sha1) (lambda (x) x)) + (define (unison-FOp-crypto.hashBytes algo text) (algo text))) diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index 30aa3347f..c48e31ba7 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -17,6 +17,8 @@ Note: This should be forked off of the codebase created by base.md Tests.checkEqual : Text -> a1 -> a1 ->{Tests} () Tests.main : '{IO, Exception, Tests} () -> '{IO, Exception} () + Tests.run : '{IO, Exception, Tests} () + ->{IO, Exception} Boolean .> add @@ -29,6 +31,8 @@ Note: This should be forked off of the codebase created by base.md Tests.checkEqual : Text -> a1 -> a1 ->{Tests} () Tests.main : '{IO, Exception, Tests} () -> '{IO, Exception} () + Tests.run : '{IO, Exception, Tests} () + ->{IO, Exception} Boolean .> load unison-src/builtin-tests/tests.u diff --git a/unison-src/builtin-tests/interpreter-tests.sh b/unison-src/builtin-tests/interpreter-tests.sh index 9743129b8..d8b7d3ef3 100755 --- a/unison-src/builtin-tests/interpreter-tests.sh +++ b/unison-src/builtin-tests/interpreter-tests.sh @@ -5,7 +5,7 @@ ucm=$(stack exec -- which unison) base_codebase=${XDG_CACHE_HOME:-"$HOME/.cache"}/unisonlanguage/base.unison -if [ ! -d $base_dir ]; then +if [ ! -d $base_codebase ]; then $ucm transcript -S $base_codebase unison-src/builtin-tests/base.md fi diff --git a/unison-src/builtin-tests/jit-tests.md b/unison-src/builtin-tests/jit-tests.md index ec36cfa59..ec269d9e9 100644 --- a/unison-src/builtin-tests/jit-tests.md +++ b/unison-src/builtin-tests/jit-tests.md @@ -2,6 +2,7 @@ Note: This should be forked off of the codebase created by base.md ```ucm:hide +.> compile.native.fetch .> compile.native.genlibs .> load unison-src/builtin-tests/testlib.u .> add diff --git a/unison-src/builtin-tests/jit-tests.sh b/unison-src/builtin-tests/jit-tests.sh index c1895fe3d..64f7f52ac 100755 --- a/unison-src/builtin-tests/jit-tests.sh +++ b/unison-src/builtin-tests/jit-tests.sh @@ -5,7 +5,7 @@ ucm=$(stack exec -- which unison) base_codebase=${XDG_CACHE_HOME:-"$HOME/.cache"}/unisonlanguage/base.unison -if [ ! -d $base_dir ]; then +if [ ! -d $base_codebase ]; then $ucm transcript -S $base_codebase unison-src/builtin-tests/base.md fi diff --git a/unison-src/builtin-tests/testlib.u b/unison-src/builtin-tests/testlib.u index 2ed3de91c..af5a1f59b 100644 --- a/unison-src/builtin-tests/testlib.u +++ b/unison-src/builtin-tests/testlib.u @@ -18,37 +18,37 @@ Tests.checkEqual msg a1 a2 = Tests.main : '{IO,Exception,Tests} () -> '{IO,Exception} () Tests.main suite = do - passed = IO.ref 0 - failed = IO.ref 0 - h = cases - { _ } -> () + if Tests.run suite then () + else bug "test suite failed" + +Tests.run : '{IO,Exception,Tests} () ->{IO,Exception} Boolean +Tests.run suite = + h passed failed = cases + { _ } -> (passed, failed) { pass msg -> k } -> printLine (" ✅ " ++ msg) - Ref.write passed (Ref.read passed + 1) - handle !k with h + handle !k with h (passed + 1) failed { fail msg reason -> k } -> printLine (" 🆘 " ++ msg ++ " " ++ reason) - Ref.write failed (Ref.read failed + 1) - handle !k with h + handle !k with h passed (failed + 1) { exception msg failure@(Failure _ cause payload) -> k} -> printLine (" 💥 " ++ msg ++ " " ++ cause) - Ref.write failed (Ref.read failed + 1) - handle !k with h + handle !k with h passed (failed + 1) printLine "" printLine "*** Test suite ***" printLine "" - handle !suite with h + (passed, failed) = handle !suite with h 0 0 printLine "" printLine "" printLine "Summary of results:" printLine "" - if Ref.read failed == 0 then - printLine (" ✅✅✅ " ++ Nat.toText (Ref.read passed) ++ " PASSED") + if failed == 0 then + printLine (" ✅✅✅ " ++ Nat.toText passed ++ " PASSED") else - printLine (" 🆘🆘🆘 " ++ Nat.toText (Ref.read failed) ++ " FAILED, " - ++ Nat.toText (Ref.read passed) ++ " passed") - bug "test suite failed" \ No newline at end of file + printLine (" 🆘🆘🆘 " ++ Nat.toText failed ++ " FAILED, " + ++ Nat.toText passed ++ " passed") + failed == 0 \ No newline at end of file From 5fe0f5ead6b25ec9033288dbd10cdf4df38c414b Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Wed, 8 Feb 2023 09:55:03 -0600 Subject: [PATCH 222/467] Added some type signatures and comments to the builtin testing transcript --- unison-src/builtin-tests/interpreter-tests.md | 9 +++- .../builtin-tests/interpreter-tests.output.md | 52 ++----------------- unison-src/builtin-tests/jit-tests.md | 7 +++ unison-src/builtin-tests/jit-tests.output.md | 4 ++ unison-src/builtin-tests/testlib.u | 2 + 5 files changed, 24 insertions(+), 50 deletions(-) diff --git a/unison-src/builtin-tests/interpreter-tests.md b/unison-src/builtin-tests/interpreter-tests.md index ca2072ba1..95088dbb9 100644 --- a/unison-src/builtin-tests/interpreter-tests.md +++ b/unison-src/builtin-tests/interpreter-tests.md @@ -1,9 +1,16 @@ Note: This should be forked off of the codebase created by base.md -```ucm +```ucm:hide .> load unison-src/builtin-tests/testlib.u .> add +``` + +If you want to define more complex tests somewhere other than `tests.u`, just `load my-tests.u` then `add`, +then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls +to `Tests.check` and `Tests.checkEqual`). + +```ucm:hide .> load unison-src/builtin-tests/tests.u .> add ``` diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index c48e31ba7..947c5941a 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -1,56 +1,10 @@ Note: This should be forked off of the codebase created by base.md -```ucm -.> load unison-src/builtin-tests/testlib.u +If you want to define more complex tests somewhere other than `tests.u`, just `load my-tests.u` then `add`, +then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls +to `Tests.check` and `Tests.checkEqual`). - I found and typechecked these definitions in - unison-src/builtin-tests/testlib.u. If you do an `add` or - `update`, here's how your codebase would change: - - ⍟ These new definitions are ok to `add`: - - unique ability Tests - Tests.check : Text - -> '{g, Exception} Boolean - ->{g, Tests} () - Tests.checkEqual : Text -> a1 -> a1 ->{Tests} () - Tests.main : '{IO, Exception, Tests} () - -> '{IO, Exception} () - Tests.run : '{IO, Exception, Tests} () - ->{IO, Exception} Boolean - -.> add - - ⍟ I've added these definitions: - - unique ability Tests - Tests.check : Text - -> '{g, Exception} Boolean - ->{g, Tests} () - Tests.checkEqual : Text -> a1 -> a1 ->{Tests} () - Tests.main : '{IO, Exception, Tests} () - -> '{IO, Exception} () - Tests.run : '{IO, Exception, Tests} () - ->{IO, Exception} Boolean - -.> load unison-src/builtin-tests/tests.u - - I found and typechecked these definitions in - unison-src/builtin-tests/tests.u. If you do an `add` or - `update`, here's how your codebase would change: - - ⍟ These new definitions are ok to `add`: - - tests : '{IO, Exception} () - -.> add - - ⍟ I've added these definitions: - - tests : '{IO, Exception} () - -``` ```ucm .> run tests diff --git a/unison-src/builtin-tests/jit-tests.md b/unison-src/builtin-tests/jit-tests.md index ec269d9e9..782ba77f6 100644 --- a/unison-src/builtin-tests/jit-tests.md +++ b/unison-src/builtin-tests/jit-tests.md @@ -6,6 +6,13 @@ Note: This should be forked off of the codebase created by base.md .> compile.native.genlibs .> load unison-src/builtin-tests/testlib.u .> add +``` + +If you want to define more complex tests somewhere other than `tests.u`, just `load my-tests.u` then `add`, +then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls +to `Tests.check` and `Tests.checkEqual`). + +```ucm:hide .> load unison-src/builtin-tests/tests.u .> add ``` diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index be1cfa24c..f4277ee45 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -1,6 +1,10 @@ Note: This should be forked off of the codebase created by base.md +If you want to define more complex tests somewhere other than `tests.u`, just `load my-tests.u` then `add`, +then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls +to `Tests.check` and `Tests.checkEqual`). + ```ucm .> run.native tests diff --git a/unison-src/builtin-tests/testlib.u b/unison-src/builtin-tests/testlib.u index af5a1f59b..c0ed2dd35 100644 --- a/unison-src/builtin-tests/testlib.u +++ b/unison-src/builtin-tests/testlib.u @@ -4,12 +4,14 @@ unique ability Tests where fail : Text -> Text -> () exception : Text -> Failure -> () +Tests.check : Text -> '{g, Exception} Boolean ->{g, Tests} () Tests.check msg b = match catch b with Left e -> exception msg e Right true -> pass msg Right false -> fail msg "" +Tests.checkEqual : Text -> a -> a ->{Tests} () Tests.checkEqual msg a1 a2 = match catch '(a1 === a2) with Left e -> exception msg e From 860f6ec5f2973d4bad1ebfe4bdadf8dabb305d27 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 8 Feb 2023 10:26:26 -0600 Subject: [PATCH 223/467] Move scoped name lookups into UCM migration --- .../U/Codebase/Sqlite/Operations.hs | 1 - .../U/Codebase/Sqlite/Queries.hs | 125 +--------------- .../Codebase/SqliteCodebase/Migrations.hs | 4 +- .../Migrations/MigrateSchema7To8.hs | 135 ++++++++++++++++++ 4 files changed, 139 insertions(+), 126 deletions(-) create mode 100644 parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema7To8.hs diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index 636170180..1ca7df50d 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -1096,7 +1096,6 @@ buildNameLookupForBranchHash :: ([S.NamedRef C.Reference], [S.NamedRef C.Reference]) -> Transaction () buildNameLookupForBranchHash mayExistingBranchIndex newBranchHash (newTermNames, removedTermNames) (newTypeNames, removedTypeNames) = do - Q.ensureScopedNameLookupTables newBranchHashId <- Q.saveBranchHash newBranchHash Q.trackNewBranchHashNameLookup newBranchHashId case mayExistingBranchIndex of diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 51c68fc17..c3d75178f 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -135,7 +135,6 @@ module U.Codebase.Sqlite.Queries -- * Name Lookup ensureNameLookupTables, - ensureScopedNameLookupTables, copyScopedNameLookup, dropNameLookupTables, insertTermNames, @@ -294,7 +293,7 @@ import qualified Unison.Util.Lens as Lens -- * main squeeze currentSchemaVersion :: SchemaVersion -currentSchemaVersion = 7 +currentSchemaVersion = 8 createSchema :: Transaction () createSchema = do @@ -1641,128 +1640,6 @@ ensureNameLookupTables = do CREATE INDEX IF NOT EXISTS type_names_by_namespace ON type_name_lookup(namespace) |] --- | Ensure the scoped name lookup tables exist. --- this will eventually replace the tables in 'ensureNameLookupTables' after all the indexes --- have been migrated over. -ensureScopedNameLookupTables :: Transaction () -ensureScopedNameLookupTables = do - -- This table allows us to look up which causal hashes have a name lookup. - execute_ - [here| - CREATE TABLE IF NOT EXISTS name_lookups ( - root_branch_hash_id INTEGER PRIMARY KEY REFERENCES hash(id) ON DELETE CASCADE - ) - |] - - execute_ - [here| - CREATE TABLE IF NOT EXISTS scoped_term_name_lookup ( - root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id) ON DELETE CASCADE, - - -- The name of the term in reversed form, with a trailing '.': - -- E.g. map.List.base. - -- - -- The trailing '.' is helpful when performing suffix queries where we may not know - -- whether the suffix is complete or not, e.g. we could suffix search using any of the - -- following globs and it would still find 'map.List.base.': - -- map.List.base.* - -- map.List.* - -- map.* - reversed_name TEXT NOT NULL, - - -- The last name segment of the name. This is used when looking up names for - -- suffixification when building PPEs. - -- E.g. for the name 'base.List.map' this would be 'map' - last_name_segment TEXT NOT NULL, - - -- The namespace containing this definition, not reversed, with a trailing '.' - -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in - -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where - -- clauses which in turn helps the sqlite query planner use indexes more effectively. - -- - -- example value: 'base.List.' - namespace TEXT NOT NULL, - referent_builtin TEXT NULL, - referent_component_hash TEXT NULL, - referent_component_index INTEGER NULL, - referent_constructor_index INTEGER NULL, - referent_constructor_type INTEGER NULL, - PRIMARY KEY (root_branch_hash_id, reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) - ) - |] - - -- This index allows finding all names we need to consider within a given namespace for - -- suffixification of a name. - -- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; - -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search - -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and - -- then glob search on the namespace prefix, and have SQLite do the final glob search on - -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. - execute_ - [here| - CREATE INDEX IF NOT EXISTS scoped_term_names_by_namespace_and_last_name_segment ON scoped_term_name_lookup(root_branch_hash_id, last_name_segment, namespace) - |] - -- This index allows us to find all names with a given ref within a specific namespace - execute_ - [here| - CREATE INDEX IF NOT EXISTS scoped_term_name_by_referent_lookup ON scoped_term_name_lookup(root_branch_hash_id, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, namespace) - |] - - -- Allows fetching ALL names within a specific namespace prefix. We currently use this to - -- pretty-print on share, but will be replaced with a more precise set of queries soon. - execute_ - [here| - CREATE INDEX IF NOT EXISTS scoped_term_names_by_namespace ON scoped_term_name_lookup(root_branch_hash_id, namespace) - |] - execute_ - [here| - CREATE TABLE IF NOT EXISTS scoped_type_name_lookup ( - root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id), - -- The name of the term: E.g. List.base - reversed_name TEXT NOT NULL, - -- The last name segment of the name. This is used when looking up names for - -- suffixification when building PPEs. - -- E.g. for the name 'base.List.map' this would be 'map' - last_name_segment TEXT NOT NULL, - -- The namespace containing this definition, not reversed, with a trailing '.' - -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in - -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where - -- clauses which in turn helps the sqlite query planner use indexes more effectively. - -- - -- example value: 'base.List.' - namespace TEXT NOT NULL, - reference_builtin TEXT NULL, - reference_component_hash INTEGER NULL, - reference_component_index INTEGER NULL, - PRIMARY KEY (reversed_name, reference_builtin, reference_component_hash, reference_component_index) - ); - |] - - -- This index allows finding all names we need to consider within a given namespace for - -- suffixification of a name. - -- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; - -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search - -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and - -- then glob search on the namespace prefix, and have SQLite do the final glob search on - -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. - execute_ - [here| - CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace_and_last_name_segment ON scoped_type_name_lookup(root_branch_hash_id, last_name_segment, namespace) - |] - - -- This index allows us to find all names with a given ref within a specific namespace. - execute_ - [here| - CREATE INDEX IF NOT EXISTS scoped_type_name_by_reference_lookup ON scoped_type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace) - |] - - -- Allows fetching ALL names within a specific namespace prefix. We currently use this to - -- pretty-print on share, but will be replaced with a more precise set of queries soon. - execute_ - [here| - CREATE INDEX IF NOT EXISTS scoped_type_names_by_namespace ON scoped_type_name_lookup(root_branch_hash_id, namespace) - |] - -- | Copies existing name lookup rows but replaces their branch hash id; -- This is a low-level operation used as part of deriving a new name lookup index -- from an existing one as performantly as possible. diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs index 368fd415d..58157a7e7 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs @@ -26,6 +26,7 @@ import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema3To4 (migrateSchem import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema4To5 (migrateSchema4To5) import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema5To6 (migrateSchema5To6) import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema6To7 (migrateSchema6To7) +import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema7To8 (migrateSchema7To8) import qualified Unison.Codebase.SqliteCodebase.Operations as Ops2 import Unison.Codebase.SqliteCodebase.Paths (backupCodebasePath, codebasePath) import Unison.Codebase.Type (LocalOrRemote (..)) @@ -55,7 +56,8 @@ migrations getDeclType termBuffer declBuffer rootCodebasePath = (4, migrateSchema3To4), (5, migrateSchema4To5), (6, migrateSchema5To6 rootCodebasePath), - (7, migrateSchema6To7) + (7, migrateSchema6To7), + (8, migrateSchema7To8) ] data CodebaseVersionStatus diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema7To8.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema7To8.hs new file mode 100644 index 000000000..b4fe19d0f --- /dev/null +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema7To8.hs @@ -0,0 +1,135 @@ +{-# LANGUAGE QuasiQuotes #-} + +module Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema7To8 (migrateSchema7To8) where + +import Data.String.Here.Uninterpolated (here) +import qualified U.Codebase.Sqlite.Queries as Q +import qualified Unison.Sqlite as Sqlite + +-- | Adds a table for tracking namespace statistics +-- Adds stats for all existing namespaces, even though missing stats are computed on-demand if missing. +migrateSchema7To8 :: Sqlite.Transaction () +migrateSchema7To8 = do + Q.expectSchemaVersion 7 + createScopedNameLookupTables + Q.setSchemaVersion 8 + +-- | Create the scoped name lookup tables. +createScopedNameLookupTables :: Sqlite.Transaction () +createScopedNameLookupTables = do + -- This table allows us to look up which causal hashes have a name lookup. + Sqlite.execute_ + [here| + CREATE TABLE name_lookups ( + root_branch_hash_id INTEGER PRIMARY KEY REFERENCES hash(id) ON DELETE CASCADE + ) + |] + + Sqlite.execute_ + [here| + CREATE TABLE scoped_term_name_lookup ( + root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id) ON DELETE CASCADE, + + -- The name of the term in reversed form, with a trailing '.': + -- E.g. map.List.base. + -- + -- The trailing '.' is helpful when performing suffix queries where we may not know + -- whether the suffix is complete or not, e.g. we could suffix search using any of the + -- following globs and it would still find 'map.List.base.': + -- map.List.base.* + -- map.List.* + -- map.* + reversed_name TEXT NOT NULL, + + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' + last_name_segment TEXT NOT NULL, + + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' + namespace TEXT NOT NULL, + referent_builtin TEXT NULL, + referent_component_hash TEXT NULL, + referent_component_index INTEGER NULL, + referent_constructor_index INTEGER NULL, + referent_constructor_type INTEGER NULL, + PRIMARY KEY (root_branch_hash_id, reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) + ) + |] + + -- This index allows finding all names we need to consider within a given namespace for + -- suffixification of a name. + -- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; + -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search + -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and + -- then glob search on the namespace prefix, and have SQLite do the final glob search on + -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. + Sqlite.execute_ + [here| + CREATE INDEX scoped_term_names_by_namespace_and_last_name_segment ON scoped_term_name_lookup(root_branch_hash_id, last_name_segment, namespace) + |] + -- This index allows us to find all names with a given ref within a specific namespace + Sqlite.execute_ + [here| + CREATE INDEX scoped_term_name_by_referent_lookup ON scoped_term_name_lookup(root_branch_hash_id, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, namespace) + |] + + -- Allows fetching ALL names within a specific namespace prefix. We currently use this to + -- pretty-print on share, but will be replaced with a more precise set of queries soon. + Sqlite.execute_ + [here| + CREATE INDEX scoped_term_names_by_namespace ON scoped_term_name_lookup(root_branch_hash_id, namespace) + |] + Sqlite.execute_ + [here| + CREATE TABLE scoped_type_name_lookup ( + root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id), + -- The name of the term: E.g. List.base + reversed_name TEXT NOT NULL, + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' + last_name_segment TEXT NOT NULL, + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' + namespace TEXT NOT NULL, + reference_builtin TEXT NULL, + reference_component_hash INTEGER NULL, + reference_component_index INTEGER NULL, + PRIMARY KEY (reversed_name, reference_builtin, reference_component_hash, reference_component_index) + ); + |] + + -- This index allows finding all names we need to consider within a given namespace for + -- suffixification of a name. + -- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; + -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search + -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and + -- then glob search on the namespace prefix, and have SQLite do the final glob search on + -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. + Sqlite.execute_ + [here| + CREATE INDEX scoped_type_names_by_namespace_and_last_name_segment ON scoped_type_name_lookup(root_branch_hash_id, last_name_segment, namespace) + |] + + -- This index allows us to find all names with a given ref within a specific namespace. + Sqlite.execute_ + [here| + CREATE INDEX scoped_type_name_by_reference_lookup ON scoped_type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace) + |] + + -- Allows fetching ALL names within a specific namespace prefix. We currently use this to + -- pretty-print on share, but will be replaced with a more precise set of queries soon. + Sqlite.execute_ + [here| + CREATE INDEX scoped_type_names_by_namespace ON scoped_type_name_lookup(root_branch_hash_id, namespace) + |] From 6873962863c3bb78b309bd75edfd9bfcd2429ebb Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 8 Feb 2023 10:40:29 -0600 Subject: [PATCH 224/467] Don't run integrity checks after a simple table create. --- .../Codebase/SqliteCodebase/Migrations.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs index 58157a7e7..86fdddc11 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs @@ -36,11 +36,11 @@ import Unison.Prelude import qualified Unison.Sqlite as Sqlite import qualified Unison.Sqlite.Connection as Sqlite.Connection import Unison.Util.Monoid (foldMapM) +import qualified Unison.Util.Monoid as Monoid import qualified Unison.Util.Pretty as Pretty import qualified UnliftIO -- | Mapping from schema version to the migration required to get there. --- Each migration may only be run on a schema of its immediate predecessor, -- E.g. The migration at index 2 must be run on a codebase at version 1. migrations :: -- | A 'getDeclType'-like lookup, possibly backed by a cache. @@ -136,13 +136,16 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh putMVar regionVar region pure region result <- do + -- Ideally we'd check everything here, but certain codebases are known to have objects + -- with missing Hash Objects, we'll want to clean that up in a future migration. + -- integrityCheckAllHashObjects, let checks = - [ -- Ideally we'd check everything here, but certain codebases are known to have objects - -- with missing Hash Objects, we'll want to clean that up in a future migration. - -- integrityCheckAllHashObjects, - integrityCheckAllBranches, - integrityCheckAllCausals - ] + Monoid.whenM + (schemaVersion < 7) -- Only certain migrations actually make changes which reasonably need to be checked + [ integrityCheckAllBranches, + integrityCheckAllCausals + ] + zip [(1 :: Int) ..] checks & foldMapM \(i, check) -> do Region.setConsoleRegion region From dc4242020e7a0b8fe2122b1188396012e421e22f Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 8 Feb 2023 11:15:28 -0600 Subject: [PATCH 225/467] Ensure new tables are added in create.sql --- codebase2/codebase-sqlite/sql/create.sql | 98 +++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/codebase2/codebase-sqlite/sql/create.sql b/codebase2/codebase-sqlite/sql/create.sql index 39491710b..91fd3b650 100644 --- a/codebase2/codebase-sqlite/sql/create.sql +++ b/codebase2/codebase-sqlite/sql/create.sql @@ -229,7 +229,103 @@ CREATE INDEX dependents_by_dependency ON dependents_index ( CREATE INDEX dependencies_by_dependent ON dependents_index ( dependent_object_id, dependent_component_index -) +); + + +-- This table allows us to look up which branch hashes have a name lookup. +CREATE TABLE name_lookups ( + root_branch_hash_id INTEGER PRIMARY KEY REFERENCES hash(id) ON DELETE CASCADE +); + +CREATE TABLE scoped_term_name_lookup ( + root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id) ON DELETE CASCADE, + + -- The name of the term in reversed form, with a trailing '.': + -- E.g. map.List.base. + -- + -- The trailing '.' is helpful when performing suffix queries where we may not know + -- whether the suffix is complete or not, e.g. we could suffix search using any of the + -- following globs and it would still find 'map.List.base.': + -- map.List.base.* + -- map.List.* + -- map.* + reversed_name TEXT NOT NULL, + + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' + last_name_segment TEXT NOT NULL, + + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' + namespace TEXT NOT NULL, + referent_builtin TEXT NULL, + referent_component_hash TEXT NULL, + referent_component_index INTEGER NULL, + referent_constructor_index INTEGER NULL, + referent_constructor_type INTEGER NULL, + PRIMARY KEY (root_branch_hash_id, reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) +); + +-- This index allows finding all names we need to consider within a given namespace for +-- suffixification of a name. +-- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; +-- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search +-- over both namespace and reversed_name, but we can EXACT match on last_name_segment and +-- then glob search on the namespace prefix, and have SQLite do the final glob search on +-- reversed_name over rows with a matching last segment without using an index and should be plenty fast. +CREATE INDEX scoped_term_names_by_namespace_and_last_name_segment ON scoped_term_name_lookup(root_branch_hash_id, last_name_segment, namespace); + +-- This index allows us to find all names with a given ref within a specific namespace +CREATE INDEX scoped_term_name_by_referent_lookup ON scoped_term_name_lookup(root_branch_hash_id, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, namespace); + +-- Allows fetching ALL names within a specific namespace prefix. We currently use this to +-- pretty-print on share, but will be replaced with a more precise set of queries soon. +CREATE INDEX scoped_term_names_by_namespace ON scoped_term_name_lookup(root_branch_hash_id, namespace); + + +CREATE TABLE scoped_type_name_lookup ( + root_branch_hash_id INTEGER NOT NULL REFERENCES hash(id), + -- The name of the term: E.g. List.base + reversed_name TEXT NOT NULL, + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' + last_name_segment TEXT NOT NULL, + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' + namespace TEXT NOT NULL, + reference_builtin TEXT NULL, + reference_component_hash INTEGER NULL, + reference_component_index INTEGER NULL, + PRIMARY KEY (reversed_name, reference_builtin, reference_component_hash, reference_component_index) +); + +-- This index allows finding all names we need to consider within a given namespace for +-- suffixification of a name. +-- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; +-- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search +-- over both namespace and reversed_name, but we can EXACT match on last_name_segment and +-- then glob search on the namespace prefix, and have SQLite do the final glob search on +-- reversed_name over rows with a matching last segment without using an index and should be plenty fast. +CREATE INDEX scoped_type_names_by_namespace_and_last_name_segment ON scoped_type_name_lookup(root_branch_hash_id, last_name_segment, namespace) + + +-- This index allows us to find all names with a given ref within a specific namespace. +CREATE INDEX scoped_type_name_by_reference_lookup ON scoped_type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace) + + +-- Allows fetching ALL names within a specific namespace prefix. We currently use this to +-- pretty-print on share, but will be replaced with a more precise set of queries soon. +CREATE INDEX scoped_type_names_by_namespace ON scoped_type_name_lookup(root_branch_hash_id, namespace) -- Semicolon intentionally omitted, for the same reason -- semicolons in comments will blow up codebase initialization. From add97138fb08532727770f8121e4b32ebfb06d54 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 8 Feb 2023 11:22:58 -0600 Subject: [PATCH 226/467] Fix semicolons in create.sql --- codebase2/codebase-sqlite/sql/create.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codebase2/codebase-sqlite/sql/create.sql b/codebase2/codebase-sqlite/sql/create.sql index 91fd3b650..7c1977d4f 100644 --- a/codebase2/codebase-sqlite/sql/create.sql +++ b/codebase2/codebase-sqlite/sql/create.sql @@ -273,7 +273,7 @@ CREATE TABLE scoped_term_name_lookup ( -- This index allows finding all names we need to consider within a given namespace for -- suffixification of a name. --- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; +-- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name her -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and -- then glob search on the namespace prefix, and have SQLite do the final glob search on @@ -311,16 +311,16 @@ CREATE TABLE scoped_type_name_lookup ( -- This index allows finding all names we need to consider within a given namespace for -- suffixification of a name. --- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here; +-- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here -- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search -- over both namespace and reversed_name, but we can EXACT match on last_name_segment and -- then glob search on the namespace prefix, and have SQLite do the final glob search on -- reversed_name over rows with a matching last segment without using an index and should be plenty fast. -CREATE INDEX scoped_type_names_by_namespace_and_last_name_segment ON scoped_type_name_lookup(root_branch_hash_id, last_name_segment, namespace) +CREATE INDEX scoped_type_names_by_namespace_and_last_name_segment ON scoped_type_name_lookup(root_branch_hash_id, last_name_segment, namespace); -- This index allows us to find all names with a given ref within a specific namespace. -CREATE INDEX scoped_type_name_by_reference_lookup ON scoped_type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace) +CREATE INDEX scoped_type_name_by_reference_lookup ON scoped_type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace); -- Allows fetching ALL names within a specific namespace prefix. We currently use this to From 050ba1fd5127a0268616979bcdac18ccc7af8626 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 8 Feb 2023 12:24:12 -0600 Subject: [PATCH 227/467] Cabal files --- .../unison-pretty-printer.cabal | 8 ++++---- parser-typechecker/unison-parser-typechecker.cabal | 7 ++++--- unison-cli/unison-cli.cabal | 12 ++++++------ unison-core/unison-core1.cabal | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/unison-pretty-printer/unison-pretty-printer.cabal b/lib/unison-pretty-printer/unison-pretty-printer.cabal index f23faeed9..813774eff 100644 --- a/lib/unison-pretty-printer/unison-pretty-printer.cabal +++ b/lib/unison-pretty-printer/unison-pretty-printer.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -68,9 +68,9 @@ library , unison-prelude , unison-syntax , unliftio + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 executable prettyprintdemo main-is: Main.hs @@ -103,9 +103,9 @@ executable prettyprintdemo , safe , text , unison-pretty-printer + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 test-suite pretty-printer-tests type: exitcode-stdio-1.0 @@ -146,6 +146,6 @@ test-suite pretty-printer-tests , raw-strings-qq , unison-pretty-printer , unison-syntax + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 - default-language: Haskell2010 diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 67a44d262..45a5ae71c 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -82,6 +82,7 @@ library Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema4To5 Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema5To6 Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema6To7 + Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema7To8 Unison.Codebase.SqliteCodebase.Operations Unison.Codebase.SqliteCodebase.Paths Unison.Codebase.SqliteCodebase.SyncEphemeral @@ -308,11 +309,11 @@ library , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 test-suite parser-typechecker-tests type: exitcode-stdio-1.0 @@ -500,8 +501,8 @@ test-suite parser-typechecker-tests , x509-system , yaml , zlib + default-language: Haskell2010 if flag(optimized) ghc-options: -funbox-strict-fields -O2 if flag(arraychecks) cpp-options: -DARRAY_CHECK - default-language: Haskell2010 diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 7c59e5b8a..9573c1eca 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -203,12 +203,12 @@ library , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields if !os(windows) build-depends: unix - default-language: Haskell2010 executable cli-integration-tests main-is: Suite.hs @@ -331,9 +331,9 @@ executable cli-integration-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable transcripts main-is: Transcripts.hs @@ -453,9 +453,9 @@ executable transcripts , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 executable unison main-is: Main.hs @@ -582,9 +582,9 @@ executable unison , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 test-suite cli-tests type: exitcode-stdio-1.0 @@ -714,6 +714,6 @@ test-suite cli-tests , wai , warp , witherable + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 diff --git a/unison-core/unison-core1.cabal b/unison-core/unison-core1.cabal index 1261b0ded..48eac1036 100644 --- a/unison-core/unison-core1.cabal +++ b/unison-core/unison-core1.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -106,6 +106,6 @@ library , unison-util-base32hex , unison-util-relation , vector + default-language: Haskell2010 if flag(optimized) ghc-options: -O2 -funbox-strict-fields - default-language: Haskell2010 From d5f06ee1697052d34914de89575e7ec8baf5b2cd Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 8 Feb 2023 13:01:01 -0600 Subject: [PATCH 228/467] Regen cabal --- parser-typechecker/unison-parser-typechecker.cabal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index be5d33018..45a5ae71c 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -240,6 +240,7 @@ library , mmorph , monad-validate , mtl + , murmur-hash , mutable-containers , mwc-random , natural-transformation @@ -429,6 +430,7 @@ test-suite parser-typechecker-tests , mmorph , monad-validate , mtl + , murmur-hash , mutable-containers , mwc-random , natural-transformation From 02d6519113fe49afaa2489cc730f629265160c39 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Wed, 8 Feb 2023 19:08:31 -0500 Subject: [PATCH 229/467] Fix some issues with the scheme abilities implementation - The pure case of a handler was not being called on the way out. - ANF -> Scheme code generation for ability matching was introducing a scheme variable that had no corresponding ANF variable, which was making the simple mapping used between the two erroneous. This is fixed by introducing a macro that more closely corresponds to the surface syntax, variable-wise. --- scheme-libs/common/unison/boot.ss | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 8833edd8d..8f44ead97 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -20,6 +20,7 @@ unison-force identity record-case + request-case bytevector) (import (rnrs) @@ -104,7 +105,8 @@ (syntax-rules () [(handle [r ...] h e ...) (prompt p - (let-marks (list (quote r) ...) (cons p h) e ...))])) + (let ([v (let-marks (list (quote r) ...) (cons p h) e ...)]) + (h (list 0 v))))])) ; wrapper that more closely matches ability requests (define-syntax request @@ -112,6 +114,29 @@ [(request r t . args) ((cdr (ref-mark (quote r))) (list (quote r) t . args))])) + ; Wrapper around record-case that more closely matches request + ; matching. This gets around having to manage an intermediate + ; variable name during code emission that doesn't correspond to an + ; actual ANF name, which was causing variable numbering problems in + ; the code emitter. Hygienic macros are a much more convenient + ; mechanism for this. + (define-syntax request-case + (syntax-rules (pure) + [(request-case scrut + [pure (pv ...) pe ...] + [ability + [effect (ev ...) ee ...] + ...] + ...) + + (record-case scrut + [0 (pv ...) pe ...] + [ability subscrut + (record-case subscrut + [effect (ev ...) ee ...] + ...)] + ...)])) + (define-record-type data (fields type-ref payload)) From 13c5af887217cd7f1a7199759e114c328386d22d Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 8 Feb 2023 21:15:12 -0600 Subject: [PATCH 230/467] [racket-crypto] test! --- scheme-libs/racket/unison/Readme.md | 19 ++- scheme-libs/racket/unison/crypto.rkt | 168 ++++++++++++++++++++++----- 2 files changed, 151 insertions(+), 36 deletions(-) diff --git a/scheme-libs/racket/unison/Readme.md b/scheme-libs/racket/unison/Readme.md index feaa5c8ef..a90fc4976 100644 --- a/scheme-libs/racket/unison/Readme.md +++ b/scheme-libs/racket/unison/Readme.md @@ -9,14 +9,13 @@ Welcome to Racket v8.7 [cs]. ``` ## crypto -NOTE: you must have the `crypto` racket library installed, which can be optained via `raco pkg install crypto-lib`. +NOTE: Our crypto functions require on both `libcrypto` (from openssl) and `libb2`. You may have to tell racket where to find `libb2`, by adding an entry to the hash table in your [`config.rktd` file](https://docs.racket-lang.org/raco/config-file.html). This is what I had, for an M1 mac w/ libb2 installed via Homebrew: +``` +(lib-search-dirs . (#f "/opt/homebrew/Cellar/libb2/0.98.1/lib/")) +``` -```clj -$ racket -S scheme-libs/racket -> (require unison/crypto) -> (unison-FOp-crypto.hashBytes (unison-FOp-crypto.HashAlgorithm.Sha1) #"") -#"\3329\243\356^kK\r2U\277\357\225`\30\220\257\330\a\t" -> (require openssl/sha1) -> (bytes->hex-string (unison-FOp-crypto.hashBytes (unison-FOp-crypto.HashAlgorithm.Sha1) #"")) -"da39a3ee5e6b4b0d3255bfef95601890afd80709" -``` \ No newline at end of file +You can then run the tests with +```bash +$ raco test scheme-libs/racket/unison/crypto.rkt +``` +On success, it has no output. diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index 1af2053c8..98f7039c8 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -1,33 +1,149 @@ #lang racket/base +(require ffi/unsafe + ffi/unsafe/define + racket/exn + ) -(require racket crypto crypto/libcrypto crypto/b2) +(provide (prefix-out unison-FOp-crypto. + (combine-out + HashAlgorithm.Sha1 + HashAlgorithm.Sha2_256 + HashAlgorithm.Sha2_512 + HashAlgorithm.Sha3_256 + HashAlgorithm.Sha3_512 + HashAlgorithm.Blake2s_256 + HashAlgorithm.Blake2b_256 + HashAlgorithm.Blake2b_512 + hashBytes))) -(provide - (prefix-out - unison-FOp-crypto. - (except-out (all-defined-out) lc b2) - )) +(define libcrypto + (with-handlers [[exn:fail? exn->string]] (ffi-lib "libcrypto.1.1"))) -(crypto-factories (list libcrypto-factory b2-factory)) +(define libb2 + (with-handlers [[exn:fail? exn->string]] (ffi-lib "libb2"))) -(define (lc sym) - (unless (send libcrypto-factory get-version) - (send libcrypto-factory print-lib-info) - (error sym "Unable to load libcrypto")) - sym) +(define _EVP-pointer (_cpointer 'EVP)) -(define (b2 sym) - (unless (send b2-factory get-version) - (send b2-factory print-lib-info) - (error sym "Unable to load libb2")) - sym) +; returns a function that, when called, either +; 1) raises an exception, if libcrypto failed to load, or +; 2) returns a pair of (_EVP-pointer bits) +(define (lc-algo name bits) + (if (string? libcrypto) + (lambda _ (raise (error 'libcrypto "~a\n~a" name libcrypto))) + (let ([getter (get-ffi-obj name libcrypto (_fun -> _EVP-pointer))]) + (lambda [] + (cons (getter) bits))))) -(define (HashAlgorithm.Sha1) (lc 'sha1)) -(define (HashAlgorithm.Sha2_256) (lc 'sha256)) -(define (HashAlgorithm.Sha2_512) (lc 'sha512)) -(define (HashAlgorithm.Sha3_256) (lc 'sha3-256)) -(define (HashAlgorithm.Sha3_512) (lc 'sha3-512)) -(define (HashAlgorithm.Blake2b_256) (b2 'blake2b-256)) -(define (HashAlgorithm.Blake2s_256) (b2 'blake2s-256)) -(define (HashAlgorithm.Blake2b_512) (b2 'blake2b-512)) -(define hashBytes digest) +(define (check v who) + (unless (= 1 v) + (error who "failed with return value ~a" v))) + +(define EVP_Digest + (if (string? libcrypto) + (lambda _ (raise (error 'libcrypto "EVP_Digest\n~a" libcrypto))) + (get-ffi-obj "EVP_Digest" libcrypto + (_fun + _pointer ; input + _int ; input-len + _pointer ; output + _pointer ; null + _EVP-pointer ; algorithm + _pointer ; null + -> (r : _int) + -> (unless (= 1 r) + (error 'EVP_Digest "failed with return value ~a" r)))))) + +(define (libb2-raw fn) + (if (string? libb2) + (lambda _ (raise (error 'libb2 "~a\n~a" fn libb2))) + (get-ffi-obj fn libb2 + (_fun + _pointer ; output + _pointer ; input + _pointer ; key + _int ; output-len + _int ; input-len + _int ; key-len + -> (r : _int) + -> (unless (= 0 r) + (error 'blake2 "~a failed with return value ~a" fn r)))))) + +(define blake2s-raw (libb2-raw "blake2s")) +(define blake2b-raw (libb2-raw "blake2b")) + +; (define (make-blake2 raw name) (lambda (text size) +; (let ([buffer (make-bytevector (/ size 8))]) +; (if (= 0 (raw buffer text #f (/ size 8) (string-length text) 0)) +; buffer +; (error "crypto.ss" "libb2 ~a was unable to hash the data for some reason" name))))) + +; (define blake2s (make-blake2 blake2s-raw "blake2s")) +; (define blake2b (make-blake2 blake2b-raw "blake2b")) + +(define HashAlgorithm.Sha1 (lc-algo "EVP_sha1" 160)) +(define HashAlgorithm.Sha2_256 (lc-algo "EVP_sha256" 256)) +(define HashAlgorithm.Sha2_512 (lc-algo "EVP_sha512" 512)) +(define HashAlgorithm.Sha3_256 (lc-algo "EVP_sha3_256" 256)) +(define HashAlgorithm.Sha3_512 (lc-algo "EVP_sha3_512" 512)) +(define (HashAlgorithm.Blake2s_256) (cons 'blake2s 256)) +(define (HashAlgorithm.Blake2b_256) (cons 'blake2b 256)) +(define (HashAlgorithm.Blake2b_512) (cons 'blake2b 512)) + +(define (hashBytes input kind) + (let* ([bytes (/ (cdr kind) 8)] + [output (make-bytes bytes)] + [algo (car kind)]) + (case algo + ['blake2s (blake2s-raw output input #f bytes (bytes-length input) 0)] + ['blake2b (blake2b-raw output input #f bytes (bytes-length input) 0)] + [else (EVP_Digest input (bytes-length input) output #f algo #f)]) + + output)) + +; These will only be evaluated by `raco test` +(module+ test + (require rackunit + (only-in openssl/sha1 bytes->hex-string hex-string->bytes)) + + (check-eq? 1 100) + (test-case "sha1 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha1))) + "da39a3ee5e6b4b0d3255bfef95601890afd80709")) + + (test-case "sha2-256 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha2_256))) + "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) + + (test-case "sha2-512 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha2_512))) + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e")) + + (test-case "sha3-256 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha3_256))) + "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a")) + + (test-case "sha3-512 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha3_512))) + "a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26")) + + (test-case "blake2s_256 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Blake2s_256))) + "69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9")) + + (test-case "blake2b_256 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Blake2b_256))) + "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8")) + + (test-case "blake2b_512 basic" + (check-equal? + (bytes->hex-string (hashBytes #"" (HashAlgorithm.Blake2b_512))) + "786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce")) + +) From 65dba3f85a769734bf66c74d56200969ac244d30 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 8 Feb 2023 21:16:50 -0600 Subject: [PATCH 231/467] [racket-crypto] cleanup --- scheme-libs/racket/unison/crypto.rkt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index 98f7039c8..7383d3bf5 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -71,15 +71,6 @@ (define blake2s-raw (libb2-raw "blake2s")) (define blake2b-raw (libb2-raw "blake2b")) -; (define (make-blake2 raw name) (lambda (text size) -; (let ([buffer (make-bytevector (/ size 8))]) -; (if (= 0 (raw buffer text #f (/ size 8) (string-length text) 0)) -; buffer -; (error "crypto.ss" "libb2 ~a was unable to hash the data for some reason" name))))) - -; (define blake2s (make-blake2 blake2s-raw "blake2s")) -; (define blake2b (make-blake2 blake2b-raw "blake2b")) - (define HashAlgorithm.Sha1 (lc-algo "EVP_sha1" 160)) (define HashAlgorithm.Sha2_256 (lc-algo "EVP_sha256" 256)) (define HashAlgorithm.Sha2_512 (lc-algo "EVP_sha512" 512)) @@ -89,6 +80,9 @@ (define (HashAlgorithm.Blake2b_256) (cons 'blake2b 256)) (define (HashAlgorithm.Blake2b_512) (cons 'blake2b 512)) +; kind is a pair of (algorithm bits) +; where algorithm is either an EVP_pointer for libcrypto functions, +; or the tag 'blake2s or 'blake2b for libb2 functions. (define (hashBytes input kind) (let* ([bytes (/ (cdr kind) 8)] [output (make-bytes bytes)] From 72a49fc8be3beea7f74c799bf0bc0320e8844efe Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 8 Feb 2023 21:16:50 -0600 Subject: [PATCH 232/467] [racket-crypto] hmac --- scheme-libs/racket/unison/crypto.rkt | 57 ++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index 7383d3bf5..b94970213 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -14,7 +14,8 @@ HashAlgorithm.Blake2s_256 HashAlgorithm.Blake2b_256 HashAlgorithm.Blake2b_512 - hashBytes))) + hashBytes + hmacBytes))) (define libcrypto (with-handlers [[exn:fail? exn->string]] (ffi-lib "libcrypto.1.1"))) @@ -53,6 +54,24 @@ -> (unless (= 1 r) (error 'EVP_Digest "failed with return value ~a" r)))))) +(define HMAC + (if (string? libcrypto) + (lambda _ (raise (error 'libcrypto "HMAC\n~a" libcrypto))) + (get-ffi-obj "HMAC" libcrypto + (_fun + _EVP-pointer ; algorithm + _pointer ; key + _int ; key-len + _pointer ; input + _int ; input-len + _pointer ; md + _pointer ; null + -> (r : _int) + ; TODO: the return value is actually an unsigned char, and + ; I'm not sure what it means, or how to tell if it failed + -> (when (= 0 r) + (error 'HMAC "failed with return value ~a" r)))))) + (define (libb2-raw fn) (if (string? libb2) (lambda _ (raise (error 'libb2 "~a\n~a" fn libb2))) @@ -83,7 +102,7 @@ ; kind is a pair of (algorithm bits) ; where algorithm is either an EVP_pointer for libcrypto functions, ; or the tag 'blake2s or 'blake2b for libb2 functions. -(define (hashBytes input kind) +(define (hashBytes kind input) (let* ([bytes (/ (cdr kind) 8)] [output (make-bytes bytes)] [algo (car kind)]) @@ -94,50 +113,66 @@ output)) +(define (hmacBytes kind key input) + (let* ([bytes (/ (cdr kind) 8)] + [output (make-bytes bytes)] + [algo (car kind)]) + (case algo + ['blake2s (blake2s-raw output input key bytes (bytes-length input) (bytes-length key))] + ['blake2b (blake2b-raw output input key bytes (bytes-length input) (bytes-length key))] + [else (HMAC algo key (bytes-length key) input (bytes-length input) output #f)]) + + output)) + + ; These will only be evaluated by `raco test` (module+ test (require rackunit (only-in openssl/sha1 bytes->hex-string hex-string->bytes)) - (check-eq? 1 100) + (test-case "sha1 hmac" + (check-equal? + (bytes->hex-string (hmacBytes (HashAlgorithm.Sha1) #"key" #"message")) + "2088df74d5f2146b48146caf4965377e9d0be3a4")) + (test-case "sha1 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha1))) + (bytes->hex-string (hashBytes (HashAlgorithm.Sha1) #"")) "da39a3ee5e6b4b0d3255bfef95601890afd80709")) (test-case "sha2-256 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha2_256))) + (bytes->hex-string (hashBytes (HashAlgorithm.Sha2_256) #"")) "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) (test-case "sha2-512 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha2_512))) + (bytes->hex-string (hashBytes (HashAlgorithm.Sha2_512) #"")) "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e")) (test-case "sha3-256 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha3_256))) + (bytes->hex-string (hashBytes (HashAlgorithm.Sha3_256) #"")) "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a")) (test-case "sha3-512 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Sha3_512))) + (bytes->hex-string (hashBytes (HashAlgorithm.Sha3_512) #"")) "a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26")) (test-case "blake2s_256 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Blake2s_256))) + (bytes->hex-string (hashBytes (HashAlgorithm.Blake2s_256) #"")) "69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9")) (test-case "blake2b_256 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Blake2b_256))) + (bytes->hex-string (hashBytes (HashAlgorithm.Blake2b_256) #"")) "0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8")) (test-case "blake2b_512 basic" (check-equal? - (bytes->hex-string (hashBytes #"" (HashAlgorithm.Blake2b_512))) + (bytes->hex-string (hashBytes (HashAlgorithm.Blake2b_512) #"")) "786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce")) ) From bf496e01036938c702acd0f45ba778f57d530ee8 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 8 Feb 2023 21:16:50 -0600 Subject: [PATCH 233/467] [racket-crypto] fix --- scheme-libs/racket/unison/crypto.rkt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index b94970213..0e811393a 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -66,11 +66,8 @@ _int ; input-len _pointer ; md _pointer ; null - -> (r : _int) - ; TODO: the return value is actually an unsigned char, and - ; I'm not sure what it means, or how to tell if it failed - -> (when (= 0 r) - (error 'HMAC "failed with return value ~a" r)))))) + -> _pointer ; unused + )))) (define (libb2-raw fn) (if (string? libb2) From 4445e977b72033c062fbe775289ae9cc278bbbb3 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 8 Feb 2023 21:16:50 -0600 Subject: [PATCH 234/467] [racket-crypto] failing blake2 hmac --- scheme-libs/racket/unison/crypto.rkt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index 0e811393a..bd0245ccd 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -132,6 +132,11 @@ (bytes->hex-string (hmacBytes (HashAlgorithm.Sha1) #"key" #"message")) "2088df74d5f2146b48146caf4965377e9d0be3a4")) + (test-case "blake2b-256 hmac" + (check-equal? + (bytes->hex-string (hmacBytes (HashAlgorithm.Blake2b_256) #"key" #"message")) + "442d98a3872d3f56220f89e2b23d0645610b37c33dd3315ef224d0e39ada6751")) + (test-case "sha1 basic" (check-equal? (bytes->hex-string (hashBytes (HashAlgorithm.Sha1) #"")) From fec71ea80597c2bc15c3211208c5092a12aa5bce Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 8 Feb 2023 21:16:50 -0600 Subject: [PATCH 235/467] [racket-crypto] hmac working --- scheme-libs/racket/unison/crypto.rkt | 61 ++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index bd0245ccd..9b915834f 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -110,16 +110,49 @@ output)) -(define (hmacBytes kind key input) - (let* ([bytes (/ (cdr kind) 8)] - [output (make-bytes bytes)] - [algo (car kind)]) - (case algo - ['blake2s (blake2s-raw output input key bytes (bytes-length input) (bytes-length key))] - ['blake2b (blake2b-raw output input key bytes (bytes-length input) (bytes-length key))] - [else (HMAC algo key (bytes-length key) input (bytes-length input) output #f)]) +; Mutates and returns the first argument +(define (xor one two) + (for ([i (in-range (bytes-length one))]) + (bytes-set! one i + (bitwise-xor + (bytes-ref one i) + (bytes-ref two i)))) + one) - output)) +; doing the blake hmac by hand. libcrypto +; supports hmac natively, so we just defer to that +(define (hmacBlake kind key input) + (let* ( + [bytes (/ (cdr kind) 8)] + [blocksize (case (car kind) ['blake2b 128] ['blake2s 64])] + + [key_ + (let ([key_ (make-bytes blocksize 0)]) + (bytes-copy! key_ 0 + (if (< blocksize (bytes-length key)) + (hashBytes kind key) + key)) + key_)] + + [opad (xor (make-bytes blocksize #x5c) key_)] + [ipad (xor (make-bytes blocksize #x36) key_)] + + [full (bytes-append + opad + (hashBytes kind (bytes-append ipad input)))]) + (hashBytes kind full))) + +(define (hmacBytes kind key input) + (case (car kind) + ['blake2s (hmacBlake kind key input)] + ['blake2b (hmacBlake kind key input)] + [else + (let* ([bytes (/ (cdr kind) 8)] + [output (make-bytes bytes)] + [algo (car kind)]) + (HMAC algo key (bytes-length key) input (bytes-length input) output #f) + output + )])) ; These will only be evaluated by `raco test` @@ -137,6 +170,16 @@ (bytes->hex-string (hmacBytes (HashAlgorithm.Blake2b_256) #"key" #"message")) "442d98a3872d3f56220f89e2b23d0645610b37c33dd3315ef224d0e39ada6751")) + (test-case "blake2b-512 hmac" + (check-equal? + (bytes->hex-string (hmacBytes (HashAlgorithm.Blake2b_512) #"key" #"message")) + "04e9ada930688cde75eec939782eed653073dd621d7643f813702976257cf037d325b50eedd417c01b6ad1f978fbe2980a93d27d854044e8626df6fa279d6680")) + + (test-case "blake2s-256 hmac" + (check-equal? + (bytes->hex-string (hmacBytes (HashAlgorithm.Blake2s_256) #"key" #"message")) + "bba8fa28708ae80d249e317318c95c859f3f77512be23910d5094d9110454d6f")) + (test-case "sha1 basic" (check-equal? (bytes->hex-string (hashBytes (HashAlgorithm.Sha1) #"")) From 4893429dbf2965aba8ace309b141db1147570c36 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 9 Feb 2023 10:53:07 -0500 Subject: [PATCH 236/467] Adjust cont API to fix some ability problems - Makes the API essentially the raw underlying control operators. Mediation between that and unison constructs is moved to boot. - Reworks the implementation of ability handlers/requests in the boot module. It's necessary to be able to discard some of the 'dynamic' scoping information used to keep track of which handlers are in play, so the `handle` macro uses two delimiters now, and the surface-facing `control` macro does two underlying control operations to match. - Documents the above more, since it's a bit complicated. --- scheme-libs/common/unison/boot.ss | 61 +++++++++++++++++++++++++++---- scheme-libs/racket/unison/cont.ss | 32 +++++++--------- 2 files changed, 67 insertions(+), 26 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 8f44ead97..d0a3ae902 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -13,15 +13,16 @@ #!r6rs (library (unison boot) (export - name + bytevector + control define-unison handle - request - unison-force identity + name record-case + request request-case - bytevector) + unison-force) (import (rnrs) (unison core) @@ -100,13 +101,43 @@ ...) body)))) - ; wrapper that more closely matches `handle` constructs + ; Wrapper that more closely matches `handle` constructs + ; + ; Note: this uses the prompt _twice_ to achieve the sort of dynamic + ; scoping we want. First we push an outer delimiter, then install + ; the continuation marks corresponding to the handled abilities + ; (which tells which propt to use for that ability and which + ; functions to use for each request). Then we re-delimit by the same + ; prompt. + ; + ; If we just used one delimiter, we'd have a problem. If we pushed + ; the marks _after_ the delimiter, then the continuation captured + ; when handling would contain those marks, and would effectively + ; retain the handler for requests within the continuation. If the + ; marks were outside the prompt, we'd be in a similar situation, + ; except where the handler would be automatically handling requests + ; within its own implementation (although, in both these cases we'd + ; get control errors, because we would be using the _function_ part + ; of the handler without the necessary delimiters existing on the + ; continuation). Both of these situations are wrong for _shallow_ + ; handlers. + ; + ; Instead, what we need to be able to do is capture the continuation + ; _up to_ the marks, then _discard_ the marks, and this is what the + ; multiple delimiters accomplish. There might be more efficient ways + ; to accomplish this with some specialized mark functions, but I'm + ; uncertain of what pitfalls there are with regard to that (whehter + ; they work might depend on exact frame structure of the + ; metacontinuation). (define-syntax handle (syntax-rules () [(handle [r ...] h e ...) - (prompt p - (let ([v (let-marks (list (quote r) ...) (cons p h) e ...)]) - (h (list 0 v))))])) + (let ([p (make-prompt)]) + (prompt0-at p + (let-marks (list (quote r) ...) (cons p h) + (prompt0-at p + (let ([v (begin e ...)]) + (h (list 0 v)))))))])) ; wrapper that more closely matches ability requests (define-syntax request @@ -114,6 +145,20 @@ [(request r t . args) ((cdr (ref-mark (quote r))) (list (quote r) t . args))])) + ; See the explanation of `handle` for a more thorough understanding + ; of why this is doing two control operations. + ; + ; In-unison 'control' corresponds to a (shallow) handler jump, so we + ; need to capture the continuation _and_ discard some dynamic scope + ; information. The capture is accomplished via control0-at, and then + ; abort-to does the discard, based on the convention used in + ; `handle`. + (define-syntax control + (syntax-rules () + [(control r k e ...) + (let ([p (car (ref-mark r))]) + (control0-at p k (abort-to p e ...)))])) + ; Wrapper around record-case that more closely matches request ; matching. This gets around having to manage an intermediate ; variable name during code emission that doesn't correspond to an diff --git a/scheme-libs/racket/unison/cont.ss b/scheme-libs/racket/unison/cont.ss index 8c0a12934..d6218c575 100644 --- a/scheme-libs/racket/unison/cont.ss +++ b/scheme-libs/racket/unison/cont.ss @@ -2,27 +2,23 @@ #!r6rs (library (unison cont) (export - prompt - control) + abort-to + make-prompt + prompt0-at + control0-at) (import (rnrs) (unison core) - (only (racket) - make-continuation-prompt-tag) - (only (racket control) - prompt0-at - control0-at)) - (define-syntax prompt - (syntax-rules () - [(prompt p e ...) - (let ([p (make-continuation-prompt-tag)]) - (prompt0-at p - e ...))])) - - (define-syntax control - (syntax-rules () - [(control r k e ...) - (control0-at (car (ref-mark r)) k e ...)]))) + (rename + (only (racket) + make-continuation-prompt-tag) + (make-continuation-prompt-tag make-prompt)) + (rename + (only (racket control) + abort/cc + prompt0-at + control0-at) + (abort/cc abort-to)))) From 8a1797f482bc83ffc2b099e41e804f4ee1ead952 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Thu, 9 Feb 2023 10:25:38 -0600 Subject: [PATCH 237/467] libcrypto for some blake2 --- scheme-libs/racket/unison/crypto.rkt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index 9b915834f..6569f916a 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -84,7 +84,6 @@ -> (unless (= 0 r) (error 'blake2 "~a failed with return value ~a" fn r)))))) -(define blake2s-raw (libb2-raw "blake2s")) (define blake2b-raw (libb2-raw "blake2b")) (define HashAlgorithm.Sha1 (lc-algo "EVP_sha1" 160)) @@ -92,19 +91,20 @@ (define HashAlgorithm.Sha2_512 (lc-algo "EVP_sha512" 512)) (define HashAlgorithm.Sha3_256 (lc-algo "EVP_sha3_256" 256)) (define HashAlgorithm.Sha3_512 (lc-algo "EVP_sha3_512" 512)) -(define (HashAlgorithm.Blake2s_256) (cons 'blake2s 256)) +(define HashAlgorithm.Blake2s_256 (lc-algo "EVP_blake2s256" 256)) +(define HashAlgorithm.Blake2b_512 (lc-algo "EVP_blake2b512" 512)) + +; This one isn't provided by libcrypto, for some reason (define (HashAlgorithm.Blake2b_256) (cons 'blake2b 256)) -(define (HashAlgorithm.Blake2b_512) (cons 'blake2b 512)) ; kind is a pair of (algorithm bits) ; where algorithm is either an EVP_pointer for libcrypto functions, -; or the tag 'blake2s or 'blake2b for libb2 functions. +; or the tag 'blake2b for libb2 function. (define (hashBytes kind input) (let* ([bytes (/ (cdr kind) 8)] [output (make-bytes bytes)] [algo (car kind)]) (case algo - ['blake2s (blake2s-raw output input #f bytes (bytes-length input) 0)] ['blake2b (blake2b-raw output input #f bytes (bytes-length input) 0)] [else (EVP_Digest input (bytes-length input) output #f algo #f)]) @@ -144,7 +144,6 @@ (define (hmacBytes kind key input) (case (car kind) - ['blake2s (hmacBlake kind key input)] ['blake2b (hmacBlake kind key input)] [else (let* ([bytes (/ (cdr kind) 8)] From 384906d035ac03b671f4e71072b65f427a220c4b Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 9 Feb 2023 11:30:35 -0600 Subject: [PATCH 238/467] Acquire and persist user information on login. --- unison-cli/src/Unison/Auth/Discovery.hs | 3 ++ unison-cli/src/Unison/Auth/Tokens.hs | 13 +++--- unison-cli/src/Unison/Auth/Types.hs | 40 ++++++++++++++++--- unison-cli/src/Unison/Auth/UserInfo.hs | 19 +++++++++ .../src/Unison/Codebase/Editor/HandleInput.hs | 10 ++--- .../Codebase/Editor/HandleInput/AuthLogin.hs | 27 ++++++++----- .../src/Unison/CommandLine/OutputMessages.hs | 6 +++ unison-cli/unison-cli.cabal | 1 + 8 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 unison-cli/src/Unison/Auth/UserInfo.hs diff --git a/unison-cli/src/Unison/Auth/Discovery.hs b/unison-cli/src/Unison/Auth/Discovery.hs index 4c2c07d4b..a243afe96 100644 --- a/unison-cli/src/Unison/Auth/Discovery.hs +++ b/unison-cli/src/Unison/Auth/Discovery.hs @@ -23,3 +23,6 @@ fetchDiscoveryDoc discoveryURI = liftIO . UnliftIO.try @_ @CredentialFailure $ d case Aeson.eitherDecode (HTTP.responseBody $ resp) of Left err -> UnliftIO.throwIO $ InvalidDiscoveryDocument discoveryURI (Text.pack err) Right doc -> pure doc + +-- fetchUserInfo :: MonadIO m => DiscoveryDoc -> AccessToken -> m (Either CredentialFailure UserInfo) +-- fetchUserInfo = do _ diff --git a/unison-cli/src/Unison/Auth/Tokens.hs b/unison-cli/src/Unison/Auth/Tokens.hs index 412e2ae24..b3ea8c8bc 100644 --- a/unison-cli/src/Unison/Auth/Tokens.hs +++ b/unison-cli/src/Unison/Auth/Tokens.hs @@ -8,10 +8,10 @@ import Data.Time.Clock.POSIX (getPOSIXTime) import qualified Network.HTTP.Client as HTTP import qualified Network.HTTP.Client.TLS as HTTP import qualified Network.HTTP.Types as Network -import Network.URI (URI) import Unison.Auth.CredentialManager import Unison.Auth.Discovery (fetchDiscoveryDoc) import Unison.Auth.Types +import Unison.Auth.UserInfo (getUserInfo) import Unison.Prelude import Unison.Share.Types (CodeserverId) import qualified UnliftIO @@ -40,21 +40,22 @@ newTokenProvider manager host = UnliftIO.try @_ @CredentialFailure $ do expired <- isExpired currentAccessToken if expired then do - newTokens@(Tokens {accessToken = newAccessToken}) <- throwEitherM $ performTokenRefresh discoveryURI tokens - saveCredentials manager host (codeserverCredentials discoveryURI newTokens) + discoveryDoc <- throwEitherM $ fetchDiscoveryDoc discoveryURI + newTokens@(Tokens {accessToken = newAccessToken}) <- throwEitherM $ performTokenRefresh discoveryDoc tokens + userInfo <- throwEitherM $ getUserInfo discoveryDoc newAccessToken + saveCredentials manager host (codeserverCredentials discoveryURI newTokens userInfo) pure $ newAccessToken else pure currentAccessToken -- | Don't yet support automatically refreshing tokens. -- -- Specification: https://datatracker.ietf.org/doc/html/rfc6749#section-6 -performTokenRefresh :: MonadIO m => URI -> Tokens -> m (Either CredentialFailure Tokens) -performTokenRefresh discoveryURI (Tokens {refreshToken = currentRefreshToken}) = runExceptT $ +performTokenRefresh :: MonadIO m => DiscoveryDoc -> Tokens -> m (Either CredentialFailure Tokens) +performTokenRefresh DiscoveryDoc {tokenEndpoint} (Tokens {refreshToken = currentRefreshToken}) = runExceptT $ case currentRefreshToken of Nothing -> throwError $ (RefreshFailure . Text.pack $ "Unable to refresh authentication, please run auth.login and try again.") Just rt -> do - DiscoveryDoc {tokenEndpoint} <- ExceptT $ fetchDiscoveryDoc discoveryURI req <- liftIO $ HTTP.requestFromURI tokenEndpoint let addFormData = HTTP.urlEncodedBody diff --git a/unison-cli/src/Unison/Auth/Types.hs b/unison-cli/src/Unison/Auth/Types.hs index 0b07dbbe4..b6e903182 100644 --- a/unison-cli/src/Unison/Auth/Types.hs +++ b/unison-cli/src/Unison/Auth/Types.hs @@ -15,6 +15,7 @@ module Unison.Auth.Types ProfileName, CredentialFailure (..), CodeserverCredentials (..), + UserInfo (..), getCodeserverCredentials, setCodeserverCredentials, codeserverCredentials, @@ -44,6 +45,7 @@ data CredentialFailure | RefreshFailure Text | InvalidTokenResponse URI Text | InvalidHost CodeserverURI + | FailedToFetchUserInfo URI Text deriving stock (Show, Eq) deriving anyclass (Exception) @@ -148,18 +150,45 @@ instance Aeson.FromJSON Credentials where activeProfile <- obj .: "active_profile" pure Credentials {..} +data UserInfo = UserInfo + { userId :: Text, -- E.g. U-1234-5678 + name :: Maybe Text, + handle :: Text -- The user's handle, no @ sign, e.g. "JohnSmith" + } + deriving (Show, Eq) + +instance ToJSON UserInfo where + toJSON (UserInfo userId name handle) = + Aeson.object + [ "user_id" .= userId, + "name" .= name, + "handle" .= handle + ] + +instance FromJSON UserInfo where + parseJSON = Aeson.withObject "UserInfo" $ \obj -> do + userId <- obj .: "user_id" + name <- obj .:? "name" + handle <- obj .: "handle" + pure (UserInfo {..}) + -- | Credentials for a specific codeserver data CodeserverCredentials = CodeserverCredentials { -- The most recent set of authentication tokens tokens :: Tokens, -- URI where the discovery document for this codeserver can be fetched. - discoveryURI :: URI + discoveryURI :: URI, + userInfo :: UserInfo } deriving (Eq) instance ToJSON CodeserverCredentials where - toJSON (CodeserverCredentials tokens discoveryURI) = - Aeson.object ["tokens" .= tokens, "discovery_uri" .= show discoveryURI] + toJSON (CodeserverCredentials tokens discoveryURI mayUserInfo) = + Aeson.object + [ "tokens" .= tokens, + "discovery_uri" .= show discoveryURI, + "user_info" .= mayUserInfo + ] instance FromJSON CodeserverCredentials where parseJSON = @@ -170,13 +199,14 @@ instance FromJSON CodeserverCredentials where discoveryURI <- case parseURI discoveryURIString of Nothing -> fail "discovery_uri is not a valid URI" Just uri -> pure uri + userInfo <- v .: "user_info" pure $ CodeserverCredentials {..} emptyCredentials :: Credentials emptyCredentials = Credentials mempty defaultProfileName -codeserverCredentials :: URI -> Tokens -> CodeserverCredentials -codeserverCredentials discoveryURI tokens = CodeserverCredentials {discoveryURI, tokens} +codeserverCredentials :: URI -> Tokens -> UserInfo -> CodeserverCredentials +codeserverCredentials discoveryURI tokens userInfo = CodeserverCredentials {discoveryURI, tokens, userInfo} getCodeserverCredentials :: CodeserverId -> Credentials -> Either CredentialFailure CodeserverCredentials getCodeserverCredentials host (Credentials {credentials, activeProfile}) = diff --git a/unison-cli/src/Unison/Auth/UserInfo.hs b/unison-cli/src/Unison/Auth/UserInfo.hs new file mode 100644 index 000000000..758c55f76 --- /dev/null +++ b/unison-cli/src/Unison/Auth/UserInfo.hs @@ -0,0 +1,19 @@ +module Unison.Auth.UserInfo where + +import qualified Data.Aeson as Aeson +import qualified Data.Text as Text +import qualified Data.Text.Encoding as Text +import qualified Network.HTTP.Client as HTTP +import qualified Network.HTTP.Client.TLS as HTTP +import Unison.Auth.Types +import Unison.Prelude + +-- | Get user info for an authenticated user. +getUserInfo :: MonadIO m => DiscoveryDoc -> AccessToken -> m (Either CredentialFailure UserInfo) +getUserInfo (DiscoveryDoc {userInfoEndpoint}) accessToken = liftIO $ do + unauthenticatedHttpClient <- HTTP.getGlobalManager + req <- HTTP.requestFromURI userInfoEndpoint <&> HTTP.applyBearerAuth (Text.encodeUtf8 accessToken) + resp <- HTTP.httpLbs req unauthenticatedHttpClient + case Aeson.eitherDecode (HTTP.responseBody resp) of + Left err -> pure . Left $ FailedToFetchUserInfo userInfoEndpoint (Text.pack err) + Right userInfo -> pure . Right $ userInfo diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 37b526000..94908fae7 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1399,7 +1399,7 @@ loop e = do UpdateBuiltinsI -> Cli.respond NotImplemented QuitI -> Cli.haltRepl GistI input -> handleGist input - AuthLoginI -> authLogin (Codeserver.resolveCodeserver RemoteRepo.DefaultCodeserver) + AuthLoginI -> void $ authLogin (Codeserver.resolveCodeserver RemoteRepo.DefaultCodeserver) VersionI -> do Cli.Env {ucmVersion} <- ask Cli.respond $ PrintVersion ucmVersion @@ -1999,7 +1999,7 @@ handlePushToUnisonShare remote@WriteShareRemotePath {server, repo, path = remote let codeserver = Codeserver.resolveCodeserver server let baseURL = codeserverBaseURL codeserver let sharePath = Share.Path (shareUserHandleToText repo Nel.:| pathToSegments remotePath) - ensureAuthenticatedWithCodeserver codeserver + _userInfo <- ensureAuthenticatedWithCodeserver codeserver -- doesn't handle the case where a non-existent path is supplied localCausalHash <- @@ -2300,7 +2300,7 @@ importRemoteShareBranch rrn@(ReadShareRemoteNamespace {server, repo, path}) = do let codeserver = Codeserver.resolveCodeserver server let baseURL = codeserverBaseURL codeserver -- Auto-login to share if pulling from a non-public path - when (not $ RemoteRepo.isPublic rrn) $ ensureAuthenticatedWithCodeserver codeserver + when (not $ RemoteRepo.isPublic rrn) . void $ ensureAuthenticatedWithCodeserver codeserver let shareFlavoredPath = Share.Path (shareUserHandleToText repo Nel.:| coerce @[NameSegment] @[Text] (Path.toList path)) Cli.Env {codebase} <- ask causalHash <- @@ -2765,7 +2765,7 @@ racketOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] racketOpts gendir statdir file args = libs ++ [file] ++ args where includes = [gendir, statdir "common", statdir "racket"] - libs = concatMap (\dir -> ["-S",dir]) includes + libs = concatMap (\dir -> ["-S", dir]) includes chezOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] chezOpts gendir statdir file args = @@ -2782,7 +2782,7 @@ runScheme bk file args0 = do ensureSchemeExists gendir <- getSchemeGenLibDir statdir <- getSchemeStaticLibDir - let cmd = case bk of Racket -> "racket" ; Chez -> "scheme" + let cmd = case bk of Racket -> "racket"; Chez -> "scheme" opts = case bk of Racket -> racketOpts gendir statdir file args0 Chez -> chezOpts gendir statdir file args0 diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs index 9faed3bcf..39df1b62b 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs @@ -25,14 +25,17 @@ import Unison.Auth.CredentialManager (getCredentials, saveCredentials) import Unison.Auth.Discovery (discoveryURIForCodeserver, fetchDiscoveryDoc) import Unison.Auth.Types ( Code, + CodeserverCredentials (..), CredentialFailure (..), DiscoveryDoc (..), OAuthState, PKCEChallenge, PKCEVerifier, - Tokens, + Tokens (..), + UserInfo, codeserverCredentials, ) +import Unison.Auth.UserInfo (getUserInfo) import Unison.Cli.Monad (Cli) import qualified Unison.Cli.Monad as Cli import qualified Unison.Codebase.Editor.Output as Output @@ -46,23 +49,21 @@ ucmOAuthClientID = "ucm" -- | Checks if the user has valid auth for the given codeserver, -- and runs through an authentication flow if not. -ensureAuthenticatedWithCodeserver :: CodeserverURI -> Cli () +ensureAuthenticatedWithCodeserver :: CodeserverURI -> Cli UserInfo ensureAuthenticatedWithCodeserver codeserverURI = do Cli.Env {credentialManager} <- ask getCredentials credentialManager (codeserverIdFromCodeserverURI codeserverURI) >>= \case - Right _ -> pure () + Right (CodeserverCredentials {userInfo}) -> pure userInfo Left _ -> authLogin codeserverURI -- | Direct the user through an authentication flow with the given server and store the credentials in the provided -- credential manager. -authLogin :: CodeserverURI -> Cli () +authLogin :: CodeserverURI -> Cli UserInfo authLogin host = do Cli.Env {credentialManager} <- ask httpClient <- liftIO HTTP.getGlobalManager let discoveryURI = discoveryURIForCodeserver host - doc@(DiscoveryDoc {authorizationEndpoint, tokenEndpoint}) <- - Cli.ioE (fetchDiscoveryDoc discoveryURI) \err -> do - Cli.returnEarly (Output.CredentialFailureMsg err) + doc@(DiscoveryDoc {authorizationEndpoint, tokenEndpoint}) <- bailOnFailure (fetchDiscoveryDoc discoveryURI) Debug.debugM Debug.Auth "Discovery Doc" doc authResultVar <- liftIO (newEmptyMVar @(Either CredentialFailure Tokens)) -- The redirect_uri depends on the port, so we need to spin up the server first, but @@ -92,19 +93,23 @@ authLogin host = do -- otherwise the server will shut down prematurely. putMVar authResultVar result pure respReceived - tokens <- + tokens@(Tokens {accessToken}) <- Cli.with (Warp.withApplication (pure $ authTransferServer codeHandler)) \port -> do let redirectURI = "http://localhost:" <> show port <> "/redirect" liftIO (putMVar redirectURIVar redirectURI) let authorizationKickoff = authURI authorizationEndpoint redirectURI state challenge void . liftIO $ Web.openBrowser (show authorizationKickoff) Cli.respond . Output.InitiateAuthFlow $ authorizationKickoff - Cli.ioE (readMVar authResultVar) \err -> do - Cli.returnEarly (Output.CredentialFailureMsg err) + bailOnFailure (readMVar authResultVar) + userInfo <- bailOnFailure (getUserInfo doc accessToken) let codeserverId = codeserverIdFromCodeserverURI host - let creds = codeserverCredentials discoveryURI tokens + let creds = codeserverCredentials discoveryURI tokens userInfo liftIO (saveCredentials credentialManager codeserverId creds) Cli.respond Output.Success + pure userInfo + where + bailOnFailure action = Cli.ioE action \err -> do + Cli.returnEarly (Output.CredentialFailureMsg err) -- | A server in the format expected for a Wai Application -- This is a temporary server which is spun up only until we get a code back from the diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index c0e02e1ec..120ace150 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -1695,6 +1695,12 @@ notifyUser dir o = case o of [ "Failed to parse a URI from the hostname: " <> P.shown host <> ".", "Host names should NOT include a schema or path." ] + Auth.FailedToFetchUserInfo userInfoEndpoint err -> + P.lines + [ "Failed to parse the response from user info endpoint: " <> P.shown userInfoEndpoint <> ".", + P.text err, + "Please `auth.login` then try again, if this error persists please file a bug report and include the above error message." + ] PrintVersion ucmVersion -> pure (P.text ucmVersion) ShareError x -> (pure . P.fatalCallout) case x of ShareErrorCheckAndSetPush e -> case e of diff --git a/unison-cli/unison-cli.cabal b/unison-cli/unison-cli.cabal index 9573c1eca..6417c69b5 100644 --- a/unison-cli/unison-cli.cabal +++ b/unison-cli/unison-cli.cabal @@ -30,6 +30,7 @@ library Unison.Auth.HTTPClient Unison.Auth.Tokens Unison.Auth.Types + Unison.Auth.UserInfo Unison.Cli.Monad Unison.Cli.MonadUtils Unison.Cli.NamesUtils From 5ce94c0447ad2ac16595873c0ddb5d8815a3ac08 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 9 Feb 2023 11:58:28 -0600 Subject: [PATCH 239/467] Fix some JSON deserializers --- unison-cli/src/Unison/Auth/CredentialFile.hs | 10 +++++++--- unison-cli/src/Unison/Auth/UserInfo.hs | 19 ++++++++++++++++++- .../src/Unison/CommandLine/OutputMessages.hs | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/unison-cli/src/Unison/Auth/CredentialFile.hs b/unison-cli/src/Unison/Auth/CredentialFile.hs index 4437258a0..ae90ea58f 100644 --- a/unison-cli/src/Unison/Auth/CredentialFile.hs +++ b/unison-cli/src/Unison/Auth/CredentialFile.hs @@ -3,12 +3,11 @@ module Unison.Auth.CredentialFile (atomicallyModifyCredentialsFile) where import qualified Data.Aeson as Aeson -import qualified Data.Text as Text import System.FilePath (takeDirectory, ()) import System.IO.LockFile import Unison.Auth.Types +import qualified Unison.Debug as Debug import Unison.Prelude -import qualified UnliftIO import UnliftIO.Directory lockfileConfig :: LockingParameters @@ -39,7 +38,12 @@ atomicallyModifyCredentialsFile f = liftIO $ do withLockFile lockfileConfig (withLockExt credentialJSONPath) $ do credentials <- Aeson.eitherDecodeFileStrict credentialJSONPath >>= \case - Left err -> UnliftIO.throwIO $ CredentialParseFailure credentialJSONPath (Text.pack err) + -- If something goes wrong, just wipe the credentials file so we're in a clean slate. + -- In the worst case the user will simply need to log in again. + Left err -> do + Debug.debugM Debug.Auth "Error decoding credentials file" err + Aeson.encodeFile credentialJSONPath emptyCredentials + pure emptyCredentials Right creds -> pure creds let newCredentials = f credentials when (newCredentials /= credentials) $ do diff --git a/unison-cli/src/Unison/Auth/UserInfo.hs b/unison-cli/src/Unison/Auth/UserInfo.hs index 758c55f76..51de0bbaa 100644 --- a/unison-cli/src/Unison/Auth/UserInfo.hs +++ b/unison-cli/src/Unison/Auth/UserInfo.hs @@ -1,6 +1,8 @@ module Unison.Auth.UserInfo where import qualified Data.Aeson as Aeson +import qualified Data.Aeson.Types as Aeson +import qualified Data.ByteString.Lazy.Char8 as BL import qualified Data.Text as Text import qualified Data.Text.Encoding as Text import qualified Network.HTTP.Client as HTTP @@ -14,6 +16,21 @@ getUserInfo (DiscoveryDoc {userInfoEndpoint}) accessToken = liftIO $ do unauthenticatedHttpClient <- HTTP.getGlobalManager req <- HTTP.requestFromURI userInfoEndpoint <&> HTTP.applyBearerAuth (Text.encodeUtf8 accessToken) resp <- HTTP.httpLbs req unauthenticatedHttpClient - case Aeson.eitherDecode (HTTP.responseBody resp) of + case decodeUserInfo (HTTP.responseBody resp) of Left err -> pure . Left $ FailedToFetchUserInfo userInfoEndpoint (Text.pack err) Right userInfo -> pure . Right $ userInfo + +decodeUserInfo :: BL.ByteString -> Either String UserInfo +decodeUserInfo bs = do + obj <- Aeson.eitherDecode bs + flip Aeson.parseEither obj $ + Aeson.withObject "UserInfo" $ \o -> do + userId <- o Aeson..: "sub" + name <- o Aeson..:? "name" + handle <- o Aeson..: "handle" + pure + UserInfo + { userId, + name, + handle + } diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 120ace150..6d2ce4fbd 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -1697,7 +1697,7 @@ notifyUser dir o = case o of ] Auth.FailedToFetchUserInfo userInfoEndpoint err -> P.lines - [ "Failed to parse the response from user info endpoint: " <> P.shown userInfoEndpoint <> ".", + [ "Failed to parse the response from user info endpoint: " <> P.shown userInfoEndpoint, P.text err, "Please `auth.login` then try again, if this error persists please file a bug report and include the above error message." ] From 2d5ab38cf36016ee8526fff6ce02e95e97ce5f2c Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 9 Feb 2023 13:46:56 -0600 Subject: [PATCH 240/467] PR cleanup --- unison-cli/src/Unison/Auth/Discovery.hs | 3 --- unison-cli/src/Unison/Auth/Types.hs | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/unison-cli/src/Unison/Auth/Discovery.hs b/unison-cli/src/Unison/Auth/Discovery.hs index a243afe96..4c2c07d4b 100644 --- a/unison-cli/src/Unison/Auth/Discovery.hs +++ b/unison-cli/src/Unison/Auth/Discovery.hs @@ -23,6 +23,3 @@ fetchDiscoveryDoc discoveryURI = liftIO . UnliftIO.try @_ @CredentialFailure $ d case Aeson.eitherDecode (HTTP.responseBody $ resp) of Left err -> UnliftIO.throwIO $ InvalidDiscoveryDocument discoveryURI (Text.pack err) Right doc -> pure doc - --- fetchUserInfo :: MonadIO m => DiscoveryDoc -> AccessToken -> m (Either CredentialFailure UserInfo) --- fetchUserInfo = do _ diff --git a/unison-cli/src/Unison/Auth/Types.hs b/unison-cli/src/Unison/Auth/Types.hs index b6e903182..a9efb3d33 100644 --- a/unison-cli/src/Unison/Auth/Types.hs +++ b/unison-cli/src/Unison/Auth/Types.hs @@ -183,11 +183,11 @@ data CodeserverCredentials = CodeserverCredentials deriving (Eq) instance ToJSON CodeserverCredentials where - toJSON (CodeserverCredentials tokens discoveryURI mayUserInfo) = + toJSON (CodeserverCredentials tokens discoveryURI userInfo) = Aeson.object [ "tokens" .= tokens, "discovery_uri" .= show discoveryURI, - "user_info" .= mayUserInfo + "user_info" .= userInfo ] instance FromJSON CodeserverCredentials where From e4c1970550cde21e4753c18474658ad0ed5587e6 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Thu, 9 Feb 2023 13:16:34 -0800 Subject: [PATCH 241/467] simplifies set arithmetic by one subtraction --- .../src/Unison/Codebase/Editor/HandleInput.hs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index a40f678a6..a5147c684 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2936,7 +2936,7 @@ checkDeletes typesTermsTuples doutput inputs = do allTermsToDelete = Set.unions (fmap Names.labeledReferences toDelete) -- get the endangered dependencies for each entity to delete endangered <- Cli.runTransaction $ traverse (\targetToDelete -> - getEndangeredDependents targetToDelete allTermsToDelete rootNames) toDelete + getEndangeredDependents targetToDelete (allTermsToDelete) rootNames) toDelete -- If the overall dependency map is not completely empty, abort deletion let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b ) False m ) endangered if null endangeredDeletions then do @@ -2964,7 +2964,7 @@ checkDeletes typesTermsTuples doutput inputs = do -- definition is going "extinct"). In this case we may wish to take some action or warn the -- user about these "endangered" definitions which would now contain unnamed references. getEndangeredDependents :: - -- | Single target for deletion + -- | Prospective target for deletion Names -> -- | All names we want to delete (including the target) Set LabeledDependency -> @@ -2972,24 +2972,22 @@ getEndangeredDependents :: Names -> -- | map from references going extinct to the set of endangered dependents Sqlite.Transaction (Map LabeledDependency (NESet LabeledDependency)) -getEndangeredDependents targetNamesToDelete allTermsToDelete rootNames = do +getEndangeredDependents targetToDelete othersToDelete rootNames = do -- names of terms left over after target deletion let remainingNames :: Names - remainingNames = rootNames `Names.difference` targetNamesToDelete + remainingNames = rootNames `Names.difference` targetToDelete + -- target refs for deletion let refsToDelete :: Set LabeledDependency - refsToDelete = Names.labeledReferences targetNamesToDelete - -- remove the target from the set of names to delete - let allOtherNamesToDelete :: Set LabeledDependency - allOtherNamesToDelete = Set.difference allTermsToDelete refsToDelete - -- left over after deleting target + refsToDelete = Names.labeledReferences targetToDelete + -- refs left over after deleting target let remainingRefs :: Set LabeledDependency remainingRefs = Names.labeledReferences remainingNames -- remove the other targets for deletion from the remaining terms let remainingRefsWithoutOtherTargets :: Set LabeledDependency - remainingRefsWithoutOtherTargets = Set.difference remainingRefs allOtherNamesToDelete + remainingRefsWithoutOtherTargets = Set.difference remainingRefs othersToDelete -- deleting and not left over let extinct :: Set LabeledDependency - extinct = refsToDelete `Set.difference` remainingRefsWithoutOtherTargets + extinct = refsToDelete `Set.difference` remainingRefs let accumulateDependents :: LabeledDependency -> Sqlite.Transaction (Map LabeledDependency (Set LabeledDependency)) accumulateDependents ld = let ref = LD.fold id Referent.toReference ld From 36a8b59a30ea327039358e95750d8a22bc613e9f Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Thu, 9 Feb 2023 13:26:07 -0800 Subject: [PATCH 242/467] rename and update comment for clarity --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index a5147c684..d4378d2ea 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2963,16 +2963,19 @@ checkDeletes typesTermsTuples doutput inputs = do -- | Goal: When deleting, we might be removing the last name of a given definition (i.e. the -- definition is going "extinct"). In this case we may wish to take some action or warn the -- user about these "endangered" definitions which would now contain unnamed references. +-- The argument `otherDesiredDeletions` is included in this function because the user might want to +-- delete a term and all its dependencies in one command, so we give this function access to +-- the full set of entities that the user wishes to delete. getEndangeredDependents :: -- | Prospective target for deletion Names -> - -- | All names we want to delete (including the target) + -- | All entities we want to delete (including the target) Set LabeledDependency -> -- | All names from the root branch Names -> -- | map from references going extinct to the set of endangered dependents Sqlite.Transaction (Map LabeledDependency (NESet LabeledDependency)) -getEndangeredDependents targetToDelete othersToDelete rootNames = do +getEndangeredDependents targetToDelete otherDesiredDeletions rootNames = do -- names of terms left over after target deletion let remainingNames :: Names remainingNames = rootNames `Names.difference` targetToDelete @@ -2984,7 +2987,7 @@ getEndangeredDependents targetToDelete othersToDelete rootNames = do remainingRefs = Names.labeledReferences remainingNames -- remove the other targets for deletion from the remaining terms let remainingRefsWithoutOtherTargets :: Set LabeledDependency - remainingRefsWithoutOtherTargets = Set.difference remainingRefs othersToDelete + remainingRefsWithoutOtherTargets = Set.difference remainingRefs otherDesiredDeletions -- deleting and not left over let extinct :: Set LabeledDependency extinct = refsToDelete `Set.difference` remainingRefs From 9e7652cfece92f3bdc043fe3d84ef641cdb40776 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 10 Feb 2023 01:31:23 -0500 Subject: [PATCH 243/467] Make up more unique names for 'fast paths' - Includes the name of the enclosing definition, for improved debugging information. --- scheme-libs/common/unison/boot.ss | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index d0a3ae902..169659ff5 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -51,6 +51,15 @@ ; unison-like automatic partial application and such. (define-syntax define-unison (lambda (x) + (define (fast-path-symbol name) + (string->symbol + (string-append + "fast-path-" + (symbol->string name)))) + + (define (fast-path-name name) + (datum->syntax name (fast-path-symbol (syntax->datum name)))) + ; Helper function. Turns a list of syntax objects into a ; list-syntax object. (define (list->syntax l) #`(#,@l)) @@ -85,8 +94,9 @@ [(a ... z . r) (apply (#,fast a ... z) r)])])) (define (func-wrap name args body) - #`(let ([fast-path (lambda (#,@args) #,@body)]) - #,(func-cases name #'fast-path args))) + (with-syntax ([fp (fast-path-name name)]) + #`(let ([fp (lambda (#,@args) #,@body)]) + #,(func-cases name #'fp args)))) (syntax-case x () [(define-unison (name a ...) e ...) From 68532621a33d3edf2b0be2066771b2e21f02c0d3 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 10 Feb 2023 01:33:21 -0500 Subject: [PATCH 244/467] Allow multiple statements in `name` macro - Not used in compiler output, but can be useful for annotating with debug tracing. --- scheme-libs/common/unison/boot.ss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 169659ff5..51cf34e41 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -106,10 +106,10 @@ ; call-by-name bindings (define-syntax name (syntax-rules () - ((name ([v (f . args)] ...) body) + ((name ([v (f . args)] ...) body ...) (let ([v (lambda r (apply f (append (list . args) r)))] ...) - body)))) + body ...)))) ; Wrapper that more closely matches `handle` constructs ; From be29f651fc4af5962a00b001f248afe24bba8430 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 10 Feb 2023 01:34:49 -0500 Subject: [PATCH 245/467] Appropriately implement surface `control` - Using `abort/cc` won't work naturally, because it allows a (racket) 'handler' to be run, which by default reinstalls the prompt. This isn't what we want, we just want to discard the continuation. So, the easiest way seems to be another control0. - This stymied me for quite a while, because the handler expects to be called with a procedure, but abort just provides it with the values provided to it. So I was getting errors about trying to apply a non-procedure and couldn't figure out where they were coming from. --- scheme-libs/common/unison/boot.ss | 15 +++++++-------- scheme-libs/racket/unison/cont.ss | 5 +---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 51cf34e41..eb7217d91 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -144,10 +144,9 @@ [(handle [r ...] h e ...) (let ([p (make-prompt)]) (prompt0-at p - (let-marks (list (quote r) ...) (cons p h) - (prompt0-at p - (let ([v (begin e ...)]) - (h (list 0 v)))))))])) + (let ([v (let-marks (list (quote r) ...) (cons p h) + (prompt0-at p e ...))]) + (h (list 0 v)))))])) ; wrapper that more closely matches ability requests (define-syntax request @@ -160,14 +159,14 @@ ; ; In-unison 'control' corresponds to a (shallow) handler jump, so we ; need to capture the continuation _and_ discard some dynamic scope - ; information. The capture is accomplished via control0-at, and then - ; abort-to does the discard, based on the convention used in - ; `handle`. + ; information. The capture is accomplished via the first + ; control0-at, while the second does the discard, based on the + ; convention used in `handle`. (define-syntax control (syntax-rules () [(control r k e ...) (let ([p (car (ref-mark r))]) - (control0-at p k (abort-to p e ...)))])) + (control0-at p k (control0-at p _k e ...)))])) ; Wrapper around record-case that more closely matches request ; matching. This gets around having to manage an intermediate diff --git a/scheme-libs/racket/unison/cont.ss b/scheme-libs/racket/unison/cont.ss index d6218c575..9e37af226 100644 --- a/scheme-libs/racket/unison/cont.ss +++ b/scheme-libs/racket/unison/cont.ss @@ -2,7 +2,6 @@ #!r6rs (library (unison cont) (export - abort-to make-prompt prompt0-at control0-at) @@ -18,7 +17,5 @@ (rename (only (racket control) - abort/cc prompt0-at - control0-at) - (abort/cc abort-to)))) + control0-at)))) From 271cf25ad27ec562bf0a247161c7f1b00cfcd5db Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Fri, 10 Feb 2023 07:01:56 -0600 Subject: [PATCH 246/467] [racket-crypto] add to tests.u --- unison-src/builtin-tests/base.output.md | 4 ++-- unison-src/builtin-tests/interpreter-tests.md | 1 + .../builtin-tests/interpreter-tests.output.md | 4 ++++ unison-src/builtin-tests/testlib.u | 1 + unison-src/builtin-tests/tests.u | 22 ++++++++++++++++++- 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/unison-src/builtin-tests/base.output.md b/unison-src/builtin-tests/base.output.md index 3cf1b22cd..ea906338b 100644 --- a/unison-src/builtin-tests/base.output.md +++ b/unison-src/builtin-tests/base.output.md @@ -4,13 +4,13 @@ ✅ - Successfully pulled into newly created namespace base. + ✅ Successfully pulled into newly created namespace base. .> compile.native.fetch ✅ - Successfully updated .unison.internal from + ✅ Successfully updated .unison.internal from dolio.public.internal.trunk. ``` diff --git a/unison-src/builtin-tests/interpreter-tests.md b/unison-src/builtin-tests/interpreter-tests.md index ca2072ba1..3d428f262 100644 --- a/unison-src/builtin-tests/interpreter-tests.md +++ b/unison-src/builtin-tests/interpreter-tests.md @@ -2,6 +2,7 @@ Note: This should be forked off of the codebase created by base.md ```ucm +.> builtins.merge .> load unison-src/builtin-tests/testlib.u .> add .> load unison-src/builtin-tests/tests.u diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index 30aa3347f..876ec50c3 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -2,6 +2,10 @@ Note: This should be forked off of the codebase created by base.md ```ucm +.> builtins.merge + + Done. + .> load unison-src/builtin-tests/testlib.u I found and typechecked these definitions in diff --git a/unison-src/builtin-tests/testlib.u b/unison-src/builtin-tests/testlib.u index 2ed3de91c..9916b7a7f 100644 --- a/unison-src/builtin-tests/testlib.u +++ b/unison-src/builtin-tests/testlib.u @@ -1,3 +1,4 @@ +use builtin.Universal == unique ability Tests where pass : Text -> () diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 211d7b84d..184aecf06 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -1,7 +1,27 @@ - +use builtin.Universal == tests : '{IO,Exception} () tests = Tests.main do check "Nat.+" do 1 + 1 == 2 check "Nat.*" do 10 * 100 == 1000 check "Nat./" do 100 / 10 == 10 + + -- cryptographic hashing + check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") == 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 + check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") == 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") == 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e + check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") == 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a + check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") == 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 + check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") == 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 + check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") == 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 + check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") == 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce + + -- hmacs + check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") == 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f + check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") == 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 + check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") == 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e + check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") == 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 + check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") == 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 + check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") == 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be + check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") == 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 + check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") == 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 \ No newline at end of file From 4a3e8db582ffa288adb152d1142b1468e3b4d9af Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Fri, 10 Feb 2023 07:08:53 -0600 Subject: [PATCH 247/467] [racket-crypto] fix scripts --- unison-src/builtin-tests/interpreter-tests.sh | 2 +- unison-src/builtin-tests/jit-tests.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unison-src/builtin-tests/interpreter-tests.sh b/unison-src/builtin-tests/interpreter-tests.sh index 9743129b8..d8b7d3ef3 100755 --- a/unison-src/builtin-tests/interpreter-tests.sh +++ b/unison-src/builtin-tests/interpreter-tests.sh @@ -5,7 +5,7 @@ ucm=$(stack exec -- which unison) base_codebase=${XDG_CACHE_HOME:-"$HOME/.cache"}/unisonlanguage/base.unison -if [ ! -d $base_dir ]; then +if [ ! -d $base_codebase ]; then $ucm transcript -S $base_codebase unison-src/builtin-tests/base.md fi diff --git a/unison-src/builtin-tests/jit-tests.sh b/unison-src/builtin-tests/jit-tests.sh index c1895fe3d..64f7f52ac 100755 --- a/unison-src/builtin-tests/jit-tests.sh +++ b/unison-src/builtin-tests/jit-tests.sh @@ -5,7 +5,7 @@ ucm=$(stack exec -- which unison) base_codebase=${XDG_CACHE_HOME:-"$HOME/.cache"}/unisonlanguage/base.unison -if [ ! -d $base_dir ]; then +if [ ! -d $base_codebase ]; then $ucm transcript -S $base_codebase unison-src/builtin-tests/base.md fi From 57f90a0e52e5aaf3ac43ae85de5cb056c5c4e0f4 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Fri, 10 Feb 2023 10:03:28 -0500 Subject: [PATCH 248/467] Update jit tests output --- unison-src/builtin-tests/jit-tests.output.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index be1cfa24c..579376c8f 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -4,6 +4,4 @@ Note: This should be forked off of the codebase created by base.md ```ucm .> run.native tests - Scheme evaluation failed. - ``` From ef55109aa642e5ff4906a766102c369141ad90d8 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 00:08:41 +0000 Subject: [PATCH 249/467] Add stub for concurrency library --- scheme-libs/racket/unison/concurrency.ss | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 scheme-libs/racket/unison/concurrency.ss diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss new file mode 100644 index 000000000..5aaaee627 --- /dev/null +++ b/scheme-libs/racket/unison/concurrency.ss @@ -0,0 +1,7 @@ +#!r6rs + +(library (unison concurrency) + (export ok) + (import (rnrs)) + +(define (ok) "getting started")) From dbba20de7ad6f9334ff8134443efe2857ee8c66f Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 00:59:08 +0000 Subject: [PATCH 250/467] Add internal option type for promise --- scheme-libs/racket/unison/concurrency.ss | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 5aaaee627..276628e4b 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -1,7 +1,13 @@ #!r6rs (library (unison concurrency) - (export ok) - (import (rnrs)) + (export ok) -(define (ok) "getting started")) + (import (rnrs)) + + (define none '(0)) + (define (some a) `(1 . ,a)) + (define (some? option) (eq? 1 (car option))) + (define (get option) (cdr option)) + + (define (ok) "getting started")) From af7b8da319718b810c499755f95a1cb5dbe43633 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:04:53 +0000 Subject: [PATCH 251/467] Add Promise --- scheme-libs/racket/unison/concurrency.ss | 50 ++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 276628e4b..2e505483d 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -1,13 +1,57 @@ #!r6rs (library (unison concurrency) - (export ok) + (export + promise + make-promise + promise-read + promise-write + promise-try-read) - (import (rnrs)) + (import (rnrs) + (rnrs records syntactic) + (only (racket base) + make-semaphore + semaphore-peek-evt + sync/enable-break + semaphore-post + parameterize-break + thread + printf + sleep) + (only (racket unsafe ops) unsafe-struct*-cas!)) (define none '(0)) (define (some a) `(1 . ,a)) (define (some? option) (eq? 1 (car option))) (define (get option) (cdr option)) - (define (ok) "getting started")) + (define-record-type + (promise new-promise promise?) + (fields semaphore event (mutable value))) + + (define (make-promise) + (let* ([sem (make-semaphore)] + [evt (semaphore-peek-evt sem)] + [value none]) + (new-promise sem evt value))) + + (define (promise-try-read promise) (promise-value promise)) + + (define (promise-read promise) + (let loop () + (let* ([value (promise-value promise)]) + (cond + [(some? value) (get value)] + [else (sync/enable-break (promise-event promise)) (loop)])))) + + (define (promise-write promise new-value) + (let loop () + (let* ([value (promise-value promise)] + [cas! (lambda () (unsafe-struct*-cas! promise 2 value (some new-value)))] + [awake-readers (lambda () (semaphore-post (promise-semaphore promise)))]) + (cond + [(some? value) #f] + [else + (let ([ok (parameterize-break #f (if (cas!) (awake-readers) #f))]) + (if ok #t (loop)))]))))) From f40e630175b818099408af7cd32537f54fc4e48e Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:13:55 +0000 Subject: [PATCH 252/467] Add fork --- scheme-libs/racket/unison/concurrency.ss | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 2e505483d..3addfc4c2 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -6,19 +6,22 @@ make-promise promise-read promise-write - promise-try-read) + promise-try-read + fork) (import (rnrs) (rnrs records syntactic) - (only (racket base) - make-semaphore - semaphore-peek-evt - sync/enable-break - semaphore-post - parameterize-break - thread - printf - sleep) + (rename + (only (racket base) + make-semaphore + semaphore-peek-evt + sync/enable-break + semaphore-post + parameterize-break + thread + printf + sleep) + (thread fork)) (only (racket unsafe ops) unsafe-struct*-cas!)) (define none '(0)) From 5d568214aba9ae0f65a07036c88e54ba03452df9 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:18:33 +0000 Subject: [PATCH 253/467] Add note on dotted pairs vs lists for Option --- scheme-libs/racket/unison/concurrency.ss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 3addfc4c2..6e31bedf4 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -25,6 +25,8 @@ (only (racket unsafe ops) unsafe-struct*-cas!)) (define none '(0)) + ;; cdr returns a single elem in dotted pair, but check that Unison + ;; doesn't break since this isn't a list (define (some a) `(1 . ,a)) (define (some? option) (eq? 1 (car option))) (define (get option) (cdr option)) From 72897359eea8ea60914592314e2634fef0ff235c Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:18:45 +0000 Subject: [PATCH 254/467] Add inline tests for now --- scheme-libs/racket/unison/concurrency.ss | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 6e31bedf4..ca3e6e4cc 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -59,4 +59,26 @@ [(some? value) #f] [else (let ([ok (parameterize-break #f (if (cas!) (awake-readers) #f))]) - (if ok #t (loop)))]))))) + (if ok #t (loop)))])))) + + ;;; tests + + (define (spawn-promise-reader name p) + (fork + (lambda () + (printf "Thread ~a started ~n" name) + (printf "Thread ~a finished with result ~a ~n" name (promise-read p))))) + + (define (test-promise) + (let ([p (make-promise)]) + (printf "Main thread started ~n") + (printf "Current promise is ~a ~n" (promise-try-read p)) + (spawn-promise-reader "foo" p) + (spawn-promise-reader "bar" p) + (sleep 3) + (promise-write p 42) + (sleep 1) + (promise-write p 73) + (spawn-promise-reader "baz" p) + (printf "Current promise is ~a ~n" (promise-try-read p)) + (printf "Main thread finished ~n")))) From c600bb10699507844c991c3902c78370460efdbe Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:24:31 +0000 Subject: [PATCH 255/467] Use cons --- scheme-libs/racket/unison/concurrency.ss | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index ca3e6e4cc..70bf7df6a 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -24,10 +24,8 @@ (thread fork)) (only (racket unsafe ops) unsafe-struct*-cas!)) - (define none '(0)) - ;; cdr returns a single elem in dotted pair, but check that Unison - ;; doesn't break since this isn't a list - (define (some a) `(1 . ,a)) + (define none (cons 0 ())) + (define (some a) (cons 1 a)) (define (some? option) (eq? 1 (car option))) (define (get option) (cdr option)) From 613a7f336bf41c5e1c65b2c59255d3b04beb3316 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:38:05 +0000 Subject: [PATCH 256/467] Add thread kill --- scheme-libs/racket/unison/concurrency.ss | 1 + 1 file changed, 1 insertion(+) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 70bf7df6a..54cae509c 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -21,6 +21,7 @@ thread printf sleep) + (break-thread kill) ; TODO need to see whether the compiler wraps the exception for me (thread fork)) (only (racket unsafe ops) unsafe-struct*-cas!)) From 889634709b50aa7b4b025fcedaaf4c053a4fc28f Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:43:18 +0000 Subject: [PATCH 257/467] Export concurrent.kill --- scheme-libs/racket/unison/concurrency.ss | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 54cae509c..aef5b526e 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -7,7 +7,8 @@ promise-read promise-write promise-try-read - fork) + fork + kill) (import (rnrs) (rnrs records syntactic) @@ -15,12 +16,13 @@ (only (racket base) make-semaphore semaphore-peek-evt - sync/enable-break semaphore-post - parameterize-break + sync/enable-break thread - printf - sleep) + break-thread + parameterize-break + sleep + printf) (break-thread kill) ; TODO need to see whether the compiler wraps the exception for me (thread fork)) (only (racket unsafe ops) unsafe-struct*-cas!)) From ea7a6bb2845516f5ce0829d39ff1892dcbeee1c9 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 01:59:27 +0000 Subject: [PATCH 258/467] Add sleep --- scheme-libs/racket/unison/concurrency.ss | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index aef5b526e..db93af1a5 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -24,7 +24,8 @@ sleep printf) (break-thread kill) ; TODO need to see whether the compiler wraps the exception for me - (thread fork)) + (thread fork) + (sleep sleep-secs)) (only (racket unsafe ops) unsafe-struct*-cas!)) (define none (cons 0 ())) @@ -62,6 +63,8 @@ (let ([ok (parameterize-break #f (if (cas!) (awake-readers) #f))]) (if ok #t (loop)))])))) + (define (sleep n) (sleep-secs (/ n 1000000))) + ;;; tests (define (spawn-promise-reader name p) @@ -76,9 +79,9 @@ (printf "Current promise is ~a ~n" (promise-try-read p)) (spawn-promise-reader "foo" p) (spawn-promise-reader "bar" p) - (sleep 3) + (sleep-secs 3) (promise-write p 42) - (sleep 1) + (sleep-secs 1) (promise-write p 73) (spawn-promise-reader "baz" p) (printf "Current promise is ~a ~n" (promise-try-read p)) From 1ed39abc3d9e707506a5aff3c87c1baff6a2f070 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 02:10:18 +0000 Subject: [PATCH 259/467] Add ref primitives --- scheme-libs/racket/unison/concurrency.ss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index db93af1a5..fdfd2aa05 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -14,6 +14,10 @@ (rnrs records syntactic) (rename (only (racket base) + box + unbox + set-box! + box-cas! make-semaphore semaphore-peek-evt semaphore-post @@ -23,6 +27,10 @@ parameterize-break sleep printf) + (box ref-new) + (unbox ref-read) + (set-box! ref-write) + (box-cas! ref-cas) (break-thread kill) ; TODO need to see whether the compiler wraps the exception for me (thread fork) (sleep sleep-secs)) From a77d40d6e1a14ca4d0994bcbafc340e1a429920b Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 02:12:03 +0000 Subject: [PATCH 260/467] Name promise constructor consistently --- scheme-libs/racket/unison/concurrency.ss | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index fdfd2aa05..2ba4ee66e 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -3,7 +3,7 @@ (library (unison concurrency) (export promise - make-promise + promise-new promise-read promise-write promise-try-read @@ -41,15 +41,13 @@ (define (some? option) (eq? 1 (car option))) (define (get option) (cdr option)) - (define-record-type - (promise new-promise promise?) - (fields semaphore event (mutable value))) + (define-record-type promise (fields semaphore event (mutable value))) - (define (make-promise) + (define (promise-new) (let* ([sem (make-semaphore)] [evt (semaphore-peek-evt sem)] [value none]) - (new-promise sem evt value))) + (make-promise sem evt value))) (define (promise-try-read promise) (promise-value promise)) @@ -82,7 +80,7 @@ (printf "Thread ~a finished with result ~a ~n" name (promise-read p))))) (define (test-promise) - (let ([p (make-promise)]) + (let ([p (promise-new)]) (printf "Main thread started ~n") (printf "Current promise is ~a ~n" (promise-try-read p)) (spawn-promise-reader "foo" p) From 922004362a723750aee4afd27636f1212871fb7a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 02:14:20 +0000 Subject: [PATCH 261/467] Add exports --- scheme-libs/racket/unison/concurrency.ss | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 2ba4ee66e..3c865e239 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -2,13 +2,18 @@ (library (unison concurrency) (export - promise + ref-new + ref-read + ref-write + ref-cas + promise ; TODO do I need to export the type? promise-new promise-read promise-write promise-try-read fork - kill) + kill + sleep) (import (rnrs) (rnrs records syntactic) From af122fcc8713dccac9c3d5e70eeb538d58e31c49 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 02:19:49 +0000 Subject: [PATCH 262/467] Remove promise tests --- scheme-libs/racket/unison/concurrency.ss | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrency.ss index 3c865e239..d59042b40 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrency.ss @@ -74,26 +74,4 @@ (let ([ok (parameterize-break #f (if (cas!) (awake-readers) #f))]) (if ok #t (loop)))])))) - (define (sleep n) (sleep-secs (/ n 1000000))) - - ;;; tests - - (define (spawn-promise-reader name p) - (fork - (lambda () - (printf "Thread ~a started ~n" name) - (printf "Thread ~a finished with result ~a ~n" name (promise-read p))))) - - (define (test-promise) - (let ([p (promise-new)]) - (printf "Main thread started ~n") - (printf "Current promise is ~a ~n" (promise-try-read p)) - (spawn-promise-reader "foo" p) - (spawn-promise-reader "bar" p) - (sleep-secs 3) - (promise-write p 42) - (sleep-secs 1) - (promise-write p 73) - (spawn-promise-reader "baz" p) - (printf "Current promise is ~a ~n" (promise-try-read p)) - (printf "Main thread finished ~n")))) + (define (sleep n) (sleep-secs (/ n 1000000)))) From 4ea0a33a9e8a7ee15bf2c50fe31edca0c65273f9 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 02:22:28 +0000 Subject: [PATCH 263/467] Rename to concurrent --- scheme-libs/racket/unison/{concurrency.ss => concurrent.ss} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename scheme-libs/racket/unison/{concurrency.ss => concurrent.ss} (98%) diff --git a/scheme-libs/racket/unison/concurrency.ss b/scheme-libs/racket/unison/concurrent.ss similarity index 98% rename from scheme-libs/racket/unison/concurrency.ss rename to scheme-libs/racket/unison/concurrent.ss index d59042b40..58b21097b 100644 --- a/scheme-libs/racket/unison/concurrency.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -1,6 +1,6 @@ #!r6rs -(library (unison concurrency) +(library (unison concurrent) (export ref-new ref-read From 9c9aa41c99e7f16ab4145d938b5d15d263ec6686 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 8 Feb 2023 14:54:30 +0000 Subject: [PATCH 264/467] Export concurrent library from unison boot --- scheme-libs/chez/unison/concurrent.ss | 29 +++++++++++++++++++++++++ scheme-libs/racket/unison/concurrent.ss | 1 - 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 scheme-libs/chez/unison/concurrent.ss diff --git a/scheme-libs/chez/unison/concurrent.ss b/scheme-libs/chez/unison/concurrent.ss new file mode 100644 index 000000000..e49a0c27d --- /dev/null +++ b/scheme-libs/chez/unison/concurrent.ss @@ -0,0 +1,29 @@ +(library (unison concurrent) + (export + ref-new + ref-read + ref-write + ref-cas + promise-new + promise-read + promise-write + promise-try-read + fork + kill + sleep) + + + (define err "This operation is not supported on the pure Chez Scheme +backend, use the Racket over Chez Scheme backend") + + ;; TODO feels like there is a macro waiting to happen here + (define (ref-new a) (error err)) + (define (ref-read ref) (error err)) + (define (ref-write ref a) (error err)) + (define (ref-cas ref old-value new-value) (error err)) + (define (promise-new) (error err)) + (define (promise-read promise) (error err)) + (define (promise-try-read promise) (error err)) + (define (fork thread-thunk) (error err)) + (define (kill thread-id) (error err))) + diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 58b21097b..3ed3eb2b0 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -6,7 +6,6 @@ ref-read ref-write ref-cas - promise ; TODO do I need to export the type? promise-new promise-read promise-write From f8f65bfbc63ab9ce2e3d2469ba256a6d5d70fb85 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 9 Feb 2023 02:29:23 +0000 Subject: [PATCH 265/467] Add library to encode calling convention --- scheme-libs/racket/unison/data.ss | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 scheme-libs/racket/unison/data.ss diff --git a/scheme-libs/racket/unison/data.ss b/scheme-libs/racket/unison/data.ss new file mode 100644 index 000000000..b119529ee --- /dev/null +++ b/scheme-libs/racket/unison/data.ss @@ -0,0 +1,52 @@ +;; Helpers for building data that conform to the compiler calling convention + +#!r6rs +(library (unison data) + (export + some + none + some? + none? + option-get + right + left + right? + left? + either-get + either-get) + + ; Option a + (define none (cons 0 ())) + + ; a -> Option a + (define (some a) (cons 1 a)) + + ; Option a -> Bool + (define (some? option) (eq? 1 (car option))) + + ; Option a -> Bool + (define (none? option) (eq? 0 (car option))) + + ; Option a -> a (or #f) + (define (option-get option) + (cond + ([(some? option) (cdr option)] + [else #f]))) + + ; Unit + (define unit (cons 0 ())) + + ; a -> Either b a + (define (right a)(cons 1 a)) + + ; b -> Either b a + (define (left b) (cons 0 b)) + + ; Either a b -> Boolean + (define (right? either) (eq? 1 (car either))) + + ; Either a b -> Boolean + (define (left? either) (eq? 0 (car either))) + + ; Either a b -> a | b + (define (either-get either) (cdr either))) From 4734fe145aac8ba91f781ea390ede741d8395295 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 9 Feb 2023 02:31:36 +0000 Subject: [PATCH 266/467] Use option from data library in promise --- scheme-libs/racket/unison/concurrent.ss | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 3ed3eb2b0..c5e47ca29 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -1,5 +1,9 @@ #!r6rs +;; TODO some ops return Either Failure (fork, kill, sleep) +;; ^ separate point, they shouldn't +;; TODO some others are in the exception ability (tryEval) +;; I'm not handling the mapping right now (library (unison concurrent) (export ref-new @@ -16,6 +20,7 @@ (import (rnrs) (rnrs records syntactic) + (unison data) (rename (only (racket base) box @@ -38,12 +43,8 @@ (break-thread kill) ; TODO need to see whether the compiler wraps the exception for me (thread fork) (sleep sleep-secs)) - (only (racket unsafe ops) unsafe-struct*-cas!)) - - (define none (cons 0 ())) - (define (some a) (cons 1 a)) - (define (some? option) (eq? 1 (car option))) - (define (get option) (cdr option)) + (only (racket unsafe ops) unsafe-struct*-cas!) + (unison data)) (define-record-type promise (fields semaphore event (mutable value))) @@ -59,7 +60,7 @@ (let loop () (let* ([value (promise-value promise)]) (cond - [(some? value) (get value)] + [(some? value) (option-get value)] [else (sync/enable-break (promise-event promise)) (loop)])))) (define (promise-write promise new-value) From 4af388f5e840bed7a9d02f276ab0d2105c90ffdc Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 9 Feb 2023 02:35:51 +0000 Subject: [PATCH 267/467] Export unit --- scheme-libs/racket/unison/data.ss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scheme-libs/racket/unison/data.ss b/scheme-libs/racket/unison/data.ss index b119529ee..d1c691487 100644 --- a/scheme-libs/racket/unison/data.ss +++ b/scheme-libs/racket/unison/data.ss @@ -13,7 +13,8 @@ right? left? either-get - either-get) + either-get + unit) ; Option a (define none (cons 0 ())) From 3182d150e3190ce1232ceaf9606b542131df556f Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 9 Feb 2023 15:56:07 +0000 Subject: [PATCH 268/467] Add basic scaffolding for concurrency tests --- unison-src/builtin-tests/concurrency-tests.u | 150 ++++++++++++++++++ unison-src/builtin-tests/interpreter-tests.md | 12 +- .../builtin-tests/interpreter-tests.output.md | 36 +++++ 3 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 unison-src/builtin-tests/concurrency-tests.u diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u new file mode 100644 index 000000000..c19953d1d --- /dev/null +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -0,0 +1,150 @@ +concurrency.tests = Tests.main do checkEqual "scaffolding" 2 3 + +-- # tests for Promise and CAS on Refs + +-- Ref support a CAS operation that can be used as a building block to +-- change state atomically without locks. + +-- ```unison +-- casTest: '{io2.IO} [Result] +-- casTest = do +-- test = do +-- ref = IO.ref 0 +-- ticket = Ref.readForCas ref +-- v1 = Ref.cas ref ticket 5 +-- check "CAS is successful is there were no conflicting writes" v1 +-- Ref.write ref 10 +-- v2 = Ref.cas ref ticket 15 +-- check "CAS fails when there was an intervening write" (not v2) + +-- runTest test +-- ``` + +-- ```ucm +-- .> add +-- .> io.test casTest +-- ``` + +-- Promise is a simple one-shot awaitable condition. + +-- ```unison +-- promiseSequentialTest : '{IO} [Result] +-- promiseSequentialTest = do +-- test = do +-- use Nat eq +-- use Promise read write +-- p = !Promise.new +-- write p 0 |> void +-- v1 = read p +-- check "Should read a value that's been written" (eq v1 0) +-- write p 1 |> void +-- v2 = read p +-- check "Promise can only be written to once" (eq v2 0) + +-- runTest test + +-- promiseConcurrentTest : '{IO} [Result] +-- promiseConcurrentTest = do +-- use Nat eq +-- test = do +-- p = !Promise.new +-- _ = forkComp '(Promise.write p 5) +-- v = Promise.read p +-- check "Reads awaits for completion of the Promise" (eq v 5) + +-- runTest test +-- ``` + +-- ```ucm +-- .> add +-- .> io.test promiseSequentialTest +-- .> io.test promiseConcurrentTest +-- ``` + +-- CAS can be used to write an atomic update function. + +-- ```unison +-- atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () +-- atomicUpdate ref f = +-- ticket = Ref.readForCas ref +-- value = f (Ticket.read ticket) +-- if Ref.cas ref ticket value then () else atomicUpdate ref f +-- ``` + +-- ```ucm +-- .> add +-- ``` + +-- Promise can be used to write an operation that spawns N concurrent +-- tasks and collects their results + +-- ```unison +-- spawnN : Nat -> '{IO} a ->{IO} [a] +-- spawnN n fa = +-- use Nat eq drop +-- go i acc = +-- if eq i 0 +-- then acc +-- else +-- value = !Promise.new +-- _ = forkComp do Promise.write value !fa +-- go (drop i 1) (acc :+ value) + +-- map Promise.read (go n []) +-- ``` +-- ```ucm +-- .> add +-- ``` + +-- We can use these primitives to write a more interesting example, where +-- multiple threads repeatedly update an atomic counter, we check that +-- the value of the counter is correct after all threads are done. + +-- ```unison +-- fullTest : '{IO} [Result] +-- fullTest = do +-- use Nat * + eq drop + +-- numThreads = 100 +-- iterations = 100 +-- expected = numThreads * iterations + +-- test = do +-- state = IO.ref 0 +-- thread n = +-- if eq n 0 +-- then () +-- else +-- atomicUpdate state (v -> v + 1) +-- thread (drop n 1) +-- void (spawnN numThreads '(thread iterations)) +-- result = Ref.read state +-- check "The state of the counter is consistent "(eq result expected) + +-- runTest test +-- ``` + +-- ```ucm +-- .> add +-- .> io.test fullTest +-- ``` + + +-- A short script to test mutable references with local scope. + +-- ```ucm:hide +-- .> builtins.mergeio +-- ``` + +-- ```unison +-- test = Scope.run 'let +-- r = Scope.ref 0 +-- Ref.write r 1 +-- i = Ref.read r +-- Ref.write r 2 +-- j = Ref.read r +-- Ref.write r 5 +-- (i, j, Ref.read r) + +-- > test +-- ``` diff --git a/unison-src/builtin-tests/interpreter-tests.md b/unison-src/builtin-tests/interpreter-tests.md index 95088dbb9..7f94009be 100644 --- a/unison-src/builtin-tests/interpreter-tests.md +++ b/unison-src/builtin-tests/interpreter-tests.md @@ -17,4 +17,14 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run tests -``` \ No newline at end of file +``` + +```ucm:hide +.> load unison-src/builtin-tests/concurrency-tests.u +.> add +``` + +```ucm +.> run concurrency.tests +``` + diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index 947c5941a..56dbb5139 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -11,3 +11,39 @@ to `Tests.check` and `Tests.checkEqual`). () ``` +```ucm +.> run concurrency.tests + + 💔💥 + + I've encountered a call to builtin.bug with the following + value: + + "test suite failed" + + + Stack trace: + bug + #ghf0c4cddk + +``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + 💔💥 + + I've encountered a call to builtin.bug with the following + value: + + "test suite failed" + + + Stack trace: + bug + #ghf0c4cddk + From a0a0a5e77b3e4c0880dddd4bd6ebab866d924a30 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 9 Feb 2023 16:56:48 +0000 Subject: [PATCH 269/467] Include concurrency tests in test script for native --- unison-src/builtin-tests/jit-tests.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/unison-src/builtin-tests/jit-tests.md b/unison-src/builtin-tests/jit-tests.md index 782ba77f6..b44da5dc0 100644 --- a/unison-src/builtin-tests/jit-tests.md +++ b/unison-src/builtin-tests/jit-tests.md @@ -19,4 +19,13 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native tests -``` \ No newline at end of file +``` + +```ucm:hide +.> load unison-src/builtin-tests/concurrency-tests.u +.> add +``` + +```ucm +.> run.native concurrency.tests +``` From 35db23190ca32c11c29014b559e70719ab9e703a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 9 Feb 2023 17:02:53 +0000 Subject: [PATCH 270/467] Notes on test for fork, sleep, kill and tryEval --- unison-src/builtin-tests/concurrency-tests.u | 48 ++++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index c19953d1d..83b486023 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,5 +1,28 @@ concurrency.tests = Tests.main do checkEqual "scaffolding" 2 3 + + + +-- A short script to test mutable references with local scope. + +-- ```ucm:hide +-- .> builtins.mergeio +-- ``` + +-- ```unison +-- test = Scope.run 'let +-- r = Scope.ref 0 +-- Ref.write r 1 +-- i = Ref.read r +-- Ref.write r 2 +-- j = Ref.read r +-- Ref.write r 5 +-- (i, j, Ref.read r) + +-- > test +-- ``` + + -- # tests for Promise and CAS on Refs -- Ref support a CAS operation that can be used as a building block to @@ -25,6 +48,11 @@ concurrency.tests = Tests.main do checkEqual "scaffolding" 2 3 -- .> io.test casTest -- ``` +-- TODO here: insert test to exercise fork, sleep and tryEval +-- fork a thread that sleeps and changes a Ref when interrupted (sets "completed" or "interrupted") +-- main thread sleeps a bit less, then kills it +-- assert by spinning on the ref + -- Promise is a simple one-shot awaitable condition. -- ```unison @@ -128,23 +156,3 @@ concurrency.tests = Tests.main do checkEqual "scaffolding" 2 3 -- .> add -- .> io.test fullTest -- ``` - - --- A short script to test mutable references with local scope. - --- ```ucm:hide --- .> builtins.mergeio --- ``` - --- ```unison --- test = Scope.run 'let --- r = Scope.ref 0 --- Ref.write r 1 --- i = Ref.read r --- Ref.write r 2 --- j = Ref.read r --- Ref.write r 5 --- (i, j, Ref.read r) - --- > test --- ``` From 743ea77d3899d99556519bf3fad37e0615569022 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 12:28:52 +0000 Subject: [PATCH 271/467] Fill in concurrency tests --- unison-src/builtin-tests/concurrency-tests.u | 211 ++++++------------- 1 file changed, 69 insertions(+), 142 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 83b486023..25fffcce5 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,158 +1,85 @@ concurrency.tests = Tests.main do checkEqual "scaffolding" 2 3 +simpleRefTest = do + Scope.run do + r = Scope.ref 0 + Ref.write r 1 + i = Ref.read r + Ref.write r 2 + j = Ref.read r + Ref.write r 5 + checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) - - --- A short script to test mutable references with local scope. - --- ```ucm:hide --- .> builtins.mergeio --- ``` - --- ```unison --- test = Scope.run 'let --- r = Scope.ref 0 --- Ref.write r 1 --- i = Ref.read r --- Ref.write r 2 --- j = Ref.read r --- Ref.write r 5 --- (i, j, Ref.read r) - --- > test --- ``` - - --- # tests for Promise and CAS on Refs - --- Ref support a CAS operation that can be used as a building block to --- change state atomically without locks. - --- ```unison --- casTest: '{io2.IO} [Result] --- casTest = do --- test = do --- ref = IO.ref 0 --- ticket = Ref.readForCas ref --- v1 = Ref.cas ref ticket 5 --- check "CAS is successful is there were no conflicting writes" v1 --- Ref.write ref 10 --- v2 = Ref.cas ref ticket 15 --- check "CAS fails when there was an intervening write" (not v2) - --- runTest test --- ``` - --- ```ucm --- .> add --- .> io.test casTest --- ``` +casTest = do + ref = IO.ref 0 + ticket = Ref.readForCas ref + v1 = Ref.cas ref ticket 5 + check "CAS is successful is there were no conflicting writes" 'v1 + Ref.write ref 10 + v2 = Ref.cas ref ticket 15 + check "CAS fails when there was an intervening write" '(not v2) -- TODO here: insert test to exercise fork, sleep and tryEval -- fork a thread that sleeps and changes a Ref when interrupted (sets "completed" or "interrupted") -- main thread sleeps a bit less, then kills it --- assert by spinning on the ref --- Promise is a simple one-shot awaitable condition. --- ```unison --- promiseSequentialTest : '{IO} [Result] --- promiseSequentialTest = do --- test = do --- use Nat eq --- use Promise read write --- p = !Promise.new --- write p 0 |> void --- v1 = read p --- check "Should read a value that's been written" (eq v1 0) --- write p 1 |> void --- v2 = read p --- check "Promise can only be written to once" (eq v2 0) --- runTest test +promiseSequentialTest = do + use Nat eq + use Promise read write + p = !Promise.new + ignore (write p 0) + v1 = read p + checkEqual "Promise should read a value that's been written" v1 0 + ignore(write p 1) + v2 = read p + checkEqual "Promise can only be written to once" v2 0 --- promiseConcurrentTest : '{IO} [Result] --- promiseConcurrentTest = do --- use Nat eq --- test = do --- p = !Promise.new --- _ = forkComp '(Promise.write p 5) --- v = Promise.read p --- check "Reads awaits for completion of the Promise" (eq v 5) +promiseConcurrentTest = do + use Nat eq + use concurrent fork + p = !Promise.new + _ = fork '(Promise.write p 5) + v = Promise.read p + checkEqual "Reads awaits for completion of the Promise" v 5 --- runTest test --- ``` +atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () +atomicUpdate ref f = + ticket = Ref.readForCas ref + value = f (Ticket.read ticket) + if Ref.cas ref ticket value then () else atomicUpdate ref f --- ```ucm --- .> add --- .> io.test promiseSequentialTest --- .> io.test promiseConcurrentTest --- ``` - --- CAS can be used to write an atomic update function. - --- ```unison --- atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () --- atomicUpdate ref f = --- ticket = Ref.readForCas ref --- value = f (Ticket.read ticket) --- if Ref.cas ref ticket value then () else atomicUpdate ref f --- ``` - --- ```ucm --- .> add --- ``` - --- Promise can be used to write an operation that spawns N concurrent --- tasks and collects their results - --- ```unison --- spawnN : Nat -> '{IO} a ->{IO} [a] --- spawnN n fa = --- use Nat eq drop --- go i acc = --- if eq i 0 --- then acc --- else --- value = !Promise.new --- _ = forkComp do Promise.write value !fa --- go (drop i 1) (acc :+ value) - --- map Promise.read (go n []) --- ``` --- ```ucm --- .> add --- ``` - --- We can use these primitives to write a more interesting example, where --- multiple threads repeatedly update an atomic counter, we check that --- the value of the counter is correct after all threads are done. - --- ```unison --- fullTest : '{IO} [Result] --- fullTest = do --- use Nat * + eq drop +spawnN : Nat -> '{IO} a ->{IO} [a] +spawnN n fa = + use Nat eq - + use concurrent fork --- numThreads = 100 --- iterations = 100 --- expected = numThreads * iterations + go i acc = + if eq i 0 + then acc + else + value = !Promise.new + _ = fork do Promise.write value !fa + go (i - 1) (acc :+ value) --- test = do --- state = IO.ref 0 --- thread n = --- if eq n 0 --- then () --- else --- atomicUpdate state (v -> v + 1) --- thread (drop n 1) --- void (spawnN numThreads '(thread iterations)) --- result = Ref.read state --- check "The state of the counter is consistent "(eq result expected) - --- runTest test --- ``` + map Promise.read (go n []) + +fullTest = do + use Nat * + eq - + + numThreads = 100 + iterations = 100 + expected = numThreads * iterations + + state = IO.ref 0 + thread n = + if eq n 0 + then () + else + atomicUpdate state (v -> v + 1) + thread (n - 1) + ignore (spawnN numThreads '(thread iterations)) + result = Ref.read state + checkEqual "The state of the counter is consistent " result expected --- ```ucm --- .> add --- .> io.test fullTest --- ``` From 3d6b57bfd7d80a199fa0db0bf2b9309afa57d4b7 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 13:10:39 +0000 Subject: [PATCH 272/467] Add test for fork, sleep and tryEval --- unison-src/builtin-tests/concurrency-tests.u | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 25fffcce5..e9b673689 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -23,6 +23,18 @@ casTest = do -- fork a thread that sleeps and changes a Ref when interrupted (sets "completed" or "interrupted") -- main thread sleeps a bit less, then kills it +threadTest = do + ref = IO.ref None + seconds = 1000000 + thread = do + match catchAll do sleep (3 * seconds) with + Left _ -> Ref.write ref (Some "interrupted") + Right _ -> Ref.write ref (Some "completed") + t = fork thread + sleep (2 * seconds) + kill t + r = while (Optional.isNone) do Ref.read ref + checkEqual "Thread has been interrupted" r (Some "interrupted") promiseSequentialTest = do From e5ddb125a386a175ff30f73489ca1743e29c482e Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 13:14:15 +0000 Subject: [PATCH 273/467] Shorter sleeps in concurrency tests --- unison-src/builtin-tests/concurrency-tests.u | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index e9b673689..cba344fcb 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -25,13 +25,13 @@ casTest = do threadTest = do ref = IO.ref None - seconds = 1000000 + millis = 1000 thread = do - match catchAll do sleep (3 * seconds) with + match catchAll do sleep (500 * millis) with Left _ -> Ref.write ref (Some "interrupted") Right _ -> Ref.write ref (Some "completed") t = fork thread - sleep (2 * seconds) + sleep (200 * millis) kill t r = while (Optional.isNone) do Ref.read ref checkEqual "Thread has been interrupted" r (Some "interrupted") From cb7ebb0b890da0845f94e516dfae0dda3d38ae3e Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 13:14:28 +0000 Subject: [PATCH 274/467] Add test suite for concurrency --- unison-src/builtin-tests/concurrency-tests.u | 8 ++++- .../builtin-tests/interpreter-tests.output.md | 32 +------------------ 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index cba344fcb..f2b164425 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,4 +1,10 @@ -concurrency.tests = Tests.main do checkEqual "scaffolding" 2 3 +concurrency.tests = Tests.main do + !simpleRefTest + !casTest + !threadTest + !promiseSequentialTest + !promiseConcurrentTest + !fullTest simpleRefTest = do Scope.run do diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index 56dbb5139..311b77b6d 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -14,36 +14,6 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run concurrency.tests - 💔💥 - - I've encountered a call to builtin.bug with the following - value: - - "test suite failed" - - - Stack trace: - bug - #ghf0c4cddk + () ``` - - - -🛑 - -The transcript failed due to an error in the stanza above. The error is: - - - 💔💥 - - I've encountered a call to builtin.bug with the following - value: - - "test suite failed" - - - Stack trace: - bug - #ghf0c4cddk - From fb40dfdc5e0d925cda2f425414ccd61541f277e2 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 13:59:40 +0000 Subject: [PATCH 275/467] Move unison-data scheme library to common --- scheme-libs/{racket => common}/unison/data.ss | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scheme-libs/{racket => common}/unison/data.ss (100%) diff --git a/scheme-libs/racket/unison/data.ss b/scheme-libs/common/unison/data.ss similarity index 100% rename from scheme-libs/racket/unison/data.ss rename to scheme-libs/common/unison/data.ss From 346a42e5b6c4a82325f8ba73ebe9ff521680e3ac Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 14:18:24 +0000 Subject: [PATCH 276/467] Fix compilation errors in data.ss --- scheme-libs/common/unison/data.ss | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index d1c691487..d76f3902b 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -16,6 +16,8 @@ either-get unit) + (import (rnrs)) + ; Option a (define none (cons 0 ())) @@ -30,9 +32,10 @@ ; Option a -> a (or #f) (define (option-get option) - (cond - ([(some? option) (cdr option)] - [else #f]))) + (if + (some? option) + (cdr option) + (raise "Cannot get the value of an empty option "))) ; Unit (define unit (cons 0 ())) From 7228f01d2275d4b7c30c90c38d316bfb26931189 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 14:24:26 +0000 Subject: [PATCH 277/467] Start incrementally porting concurrency tests to scheme --- scheme-libs/common/unison/primops.ss | 7 +++++-- unison-src/builtin-tests/concurrency-tests.u | 10 +++++----- unison-src/builtin-tests/jit-tests.output.md | 6 ++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 20f76232e..afdc8be3a 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -120,7 +120,8 @@ (unison string) (unison crypto) (unison bytevector) - (unison vector)) + (unison vector) + (unison concurrent)) (define unison-POp-UPKB bytevector->u8-list) (define unison-POp-ADDI +) @@ -299,5 +300,7 @@ (define (unison-FOp-Scope.bytearray n) (make-bytevector n)) (define (unison-FOp-Scope.array n) (make-vector n)) - ) + (define (unison-FOp-Scope.ref a) (ref-new a)) + (define (unison-FOp-Ref.read ref) (ref-read ref)) + (define (unison-FOp-Ref.write ref a) (ref-write ref a))) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index f2b164425..c843fc7e2 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,10 +1,10 @@ concurrency.tests = Tests.main do !simpleRefTest - !casTest - !threadTest - !promiseSequentialTest - !promiseConcurrentTest - !fullTest + -- !casTest + -- !threadTest + -- !promiseSequentialTest + -- !promiseConcurrentTest + -- !fullTest simpleRefTest = do Scope.run do diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 016ea7e65..b40715c5c 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -9,3 +9,9 @@ to `Tests.check` and `Tests.checkEqual`). .> run.native tests ``` +```ucm +.> run.native concurrency.tests + + Scheme evaluation failed. + +``` From 93474042fd40233466ddc99de0a92585fa431b21 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 14:53:04 +0000 Subject: [PATCH 278/467] Export Ref operations --- scheme-libs/common/unison/primops.ss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index afdc8be3a..0720a8c1d 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -56,6 +56,10 @@ unison-FOp-Scope.bytearray unison-FOp-Scope.array + unison-FOp-Scope.ref + + unison-FOp-Ref.read + unison-FOp-Ref.write unison-POp-ADDN unison-POp-ANDN From 73d5e994c91dcbe7e45905bd2c8a3c7192fc52d0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 14:58:12 +0000 Subject: [PATCH 279/467] Remove stale comment --- unison-src/builtin-tests/concurrency-tests.u | 4 ---- 1 file changed, 4 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index c843fc7e2..49859aed8 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -25,10 +25,6 @@ casTest = do v2 = Ref.cas ref ticket 15 check "CAS fails when there was an intervening write" '(not v2) --- TODO here: insert test to exercise fork, sleep and tryEval --- fork a thread that sleeps and changes a Ref when interrupted (sets "completed" or "interrupted") --- main thread sleeps a bit less, then kills it - threadTest = do ref = IO.ref None millis = 1000 From 2a78cb2deab07fdf533d4d80b6c44b8451d2b5b0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 15:02:31 +0000 Subject: [PATCH 280/467] Start with IO based version of Ref test --- scheme-libs/common/unison/primops.ss | 2 ++ unison-src/builtin-tests/concurrency-tests.u | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 0720a8c1d..7b3dd3686 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -58,6 +58,7 @@ unison-FOp-Scope.array unison-FOp-Scope.ref + unison-FOp-IO.ref unison-FOp-Ref.read unison-FOp-Ref.write @@ -305,6 +306,7 @@ (define (unison-FOp-Scope.array n) (make-vector n)) (define (unison-FOp-Scope.ref a) (ref-new a)) + (define (unison-FOp-IO.ref a) (ref-new a)) (define (unison-FOp-Ref.read ref) (ref-read ref)) (define (unison-FOp-Ref.write ref a) (ref-write ref a))) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 49859aed8..58a43f094 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,5 +1,6 @@ concurrency.tests = Tests.main do !simpleRefTest + -- !simpleRefTestScope -- !casTest -- !threadTest -- !promiseSequentialTest @@ -7,6 +8,15 @@ concurrency.tests = Tests.main do -- !fullTest simpleRefTest = do + r = IO.ref 0 + Ref.write r 1 + i = Ref.read r + Ref.write r 2 + j = Ref.read r + Ref.write r 5 + checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) + +simpleRefTestScope = do Scope.run do r = Scope.ref 0 Ref.write r 1 From 71d424d21ae8c00fb27ad50a632e4bf32e8ae837 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 15:23:34 +0000 Subject: [PATCH 281/467] First bunch of tests pass! --- unison-src/builtin-tests/concurrency-tests.u | 2 +- unison-src/builtin-tests/jit-tests.output.md | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 58a43f094..9738691a1 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,6 +1,6 @@ concurrency.tests = Tests.main do !simpleRefTest - -- !simpleRefTestScope + !simpleRefTestScope -- !casTest -- !threadTest -- !promiseSequentialTest diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index b40715c5c..19ddeec19 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -12,6 +12,4 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native concurrency.tests - Scheme evaluation failed. - ``` From 2b9f6203b0919fa8b985477e4ee549a30358a16c Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Fri, 10 Feb 2023 11:07:29 -0600 Subject: [PATCH 282/467] [racket-crypto] simpler --- unison-src/builtin-tests/testlib.u | 1 - unison-src/builtin-tests/tests.u | 33 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/unison-src/builtin-tests/testlib.u b/unison-src/builtin-tests/testlib.u index 9b659bd81..c0ed2dd35 100644 --- a/unison-src/builtin-tests/testlib.u +++ b/unison-src/builtin-tests/testlib.u @@ -1,4 +1,3 @@ -use builtin.Universal == unique ability Tests where pass : Text -> () diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 184aecf06..550585352 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -1,4 +1,3 @@ -use builtin.Universal == tests : '{IO,Exception} () tests = Tests.main do @@ -7,21 +6,21 @@ tests = Tests.main do check "Nat./" do 100 / 10 == 10 -- cryptographic hashing - check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") == 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 - check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") == 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") == 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e - check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") == 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a - check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") == 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 - check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") == 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 - check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") == 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 - check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") == 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce + check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") === 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 + check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") === 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") === 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e + check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") === 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a + check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") === 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 + check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") === 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 + check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") === 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 + check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") === 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce -- hmacs - check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") == 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f - check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") == 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 - check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") == 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e - check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") == 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 - check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") == 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 - check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") == 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be - check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") == 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 - check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") == 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 \ No newline at end of file + check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") === 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f + check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") === 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 + check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") === 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e + check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") === 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 + check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") === 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 + check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") === 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be + check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 + check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 \ No newline at end of file From 963d39e17467092341b1491216f3eb6cc45364ae Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Fri, 10 Feb 2023 11:07:29 -0600 Subject: [PATCH 283/467] [racket-crypto] rm --- scheme-libs/racket/unison/isolated-string-copy.rkt | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 scheme-libs/racket/unison/isolated-string-copy.rkt diff --git a/scheme-libs/racket/unison/isolated-string-copy.rkt b/scheme-libs/racket/unison/isolated-string-copy.rkt deleted file mode 100644 index 1dfd57e12..000000000 --- a/scheme-libs/racket/unison/isolated-string-copy.rkt +++ /dev/null @@ -1,12 +0,0 @@ -#lang racket/base -; This library exists solely to -; export "string-copy!" for use by "core.ss" -; -; "core.ss" can't require (racket/base) itself, -; as racket/base has name clashes with rnrs -; and the #r6rs language can't handle name -; clashes (the normal racket language can) - -(provide string-copy!) - -(require racket/base) \ No newline at end of file From ddb22cca10e1e70a28548971e7134076d1293a30 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Fri, 10 Feb 2023 11:07:29 -0600 Subject: [PATCH 284/467] [racket-crypto] test passing! --- scheme-libs/common/unison/boot.ss | 3 ++- scheme-libs/common/unison/primops.ss | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index eb7217d91..43ec4022a 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -26,7 +26,8 @@ (import (rnrs) (unison core) - (unison cont)) + (unison cont) + (unison crypto)) ; Computes a symbol for automatically generated partial application ; cases, based on number of arguments applied. The partial diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 20f76232e..a6dc285d0 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -103,6 +103,7 @@ unison-POp-VWLS unison-POp-UPKB + unison-POp-PAKB unison-POp-ADDI unison-POp-DIVI unison-POp-EQLI @@ -111,8 +112,16 @@ unison-POp-POWN unison-POp-VWRS - unison-FOp-crypto.HashAlgorithm.Sha1 unison-FOp-crypto.hashBytes + unison-FOp-crypto.hmacBytes + unison-FOp-crypto.HashAlgorithm.Sha1 + unison-FOp-crypto.HashAlgorithm.Sha2_256 + unison-FOp-crypto.HashAlgorithm.Sha2_512 + unison-FOp-crypto.HashAlgorithm.Sha3_256 + unison-FOp-crypto.HashAlgorithm.Sha3_512 + unison-FOp-crypto.HashAlgorithm.Blake2s_256 + unison-FOp-crypto.HashAlgorithm.Blake2b_256 + unison-FOp-crypto.HashAlgorithm.Blake2b_512 ) (import (rnrs) From 13e089a318826c9c5f4f380d9d31d247e580f5f4 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 17:10:24 +0000 Subject: [PATCH 285/467] Add note on testing paths for threads --- unison-src/builtin-tests/concurrency-tests.u | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 9738691a1..43e9c1bce 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -35,6 +35,8 @@ casTest = do v2 = Ref.cas ref ticket 15 check "CAS fails when there was an intervening write" '(not v2) +-- TODO test both Left and Right on the catchAll +-- and try access the failure as well threadTest = do ref = IO.ref None millis = 1000 From 55b6b817a8f73a3bc522b0f688c12fcb044b12a0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 17:27:46 +0000 Subject: [PATCH 286/467] Add binding for readCas --- scheme-libs/common/unison/primops.ss | 4 +++- unison-src/builtin-tests/concurrency-tests.u | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 7b3dd3686..20d30d784 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -61,6 +61,7 @@ unison-FOp-IO.ref unison-FOp-Ref.read unison-FOp-Ref.write + unison-FOp-Ref.readForCas unison-POp-ADDN unison-POp-ANDN @@ -308,5 +309,6 @@ (define (unison-FOp-Scope.ref a) (ref-new a)) (define (unison-FOp-IO.ref a) (ref-new a)) (define (unison-FOp-Ref.read ref) (ref-read ref)) - (define (unison-FOp-Ref.write ref a) (ref-write ref a))) + (define (unison-FOp-Ref.write ref a) (ref-write ref a)) + (define (unison-FOp-Ref.readForCas ref) (ref-read ref))) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 43e9c1bce..3a29e4423 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,6 +1,7 @@ concurrency.tests = Tests.main do !simpleRefTest !simpleRefTestScope + !ticketTest -- !casTest -- !threadTest -- !promiseSequentialTest @@ -26,6 +27,11 @@ simpleRefTestScope = do Ref.write r 5 checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) +ticketTest = do + r = IO.ref 3 + t = Ref.readForCas r + checkEqual "Ticket test stub" true true + casTest = do ref = IO.ref 0 ticket = Ref.readForCas ref From e73d34e8e6cba98dec53ecf1627e3cea620c75a9 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 17:32:03 +0000 Subject: [PATCH 287/467] Add bindings for Ref.Ticket --- scheme-libs/common/unison/primops.ss | 4 +++- unison-src/builtin-tests/concurrency-tests.u | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 20d30d784..00cdda1a0 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -62,6 +62,7 @@ unison-FOp-Ref.read unison-FOp-Ref.write unison-FOp-Ref.readForCas + unison-FOp-Ref.Ticket.read unison-POp-ADDN unison-POp-ANDN @@ -310,5 +311,6 @@ (define (unison-FOp-IO.ref a) (ref-new a)) (define (unison-FOp-Ref.read ref) (ref-read ref)) (define (unison-FOp-Ref.write ref a) (ref-write ref a)) - (define (unison-FOp-Ref.readForCas ref) (ref-read ref))) + (define (unison-FOp-Ref.readForCas ref) (ref-read ref)) + (define (unison-FOp-Ref.Ticket.read ticket) ticket)) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 3a29e4423..f4797a024 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -30,7 +30,8 @@ simpleRefTestScope = do ticketTest = do r = IO.ref 3 t = Ref.readForCas r - checkEqual "Ticket test stub" true true + v = Ticket.read t + checkEqual "Ticket contains the Ref value" v 3 casTest = do ref = IO.ref 0 From 8d855e3019b0df3c3406d82355cb3d4d59fd4605 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 18:06:06 +0000 Subject: [PATCH 288/467] Add comment on wrapper for unit --- scheme-libs/common/unison/data.ss | 1 + 1 file changed, 1 insertion(+) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index d76f3902b..518c2a9ed 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -37,6 +37,7 @@ (cdr option) (raise "Cannot get the value of an empty option "))) + ; TODO this might be reduntant, # works ; Unit (define unit (cons 0 ())) From 17b3708f019f2149088fcee350171b7c7dbc5d6e Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 18:06:21 +0000 Subject: [PATCH 289/467] Broken: add bindings for Ref.cas --- scheme-libs/common/unison/data.ss | 8 ++++- scheme-libs/common/unison/primops.ss | 4 ++- scheme-libs/racket/unison/concurrent.ss | 4 ++- unison-src/builtin-tests/concurrency-tests.u | 7 ++++ unison-src/builtin-tests/jit-tests.output.md | 34 ++++++++++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index 518c2a9ed..76f1a1c3d 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -14,7 +14,9 @@ left? either-get either-get - unit) + unit + false + true) (import (rnrs)) @@ -41,6 +43,10 @@ ; Unit (define unit (cons 0 ())) + ; Booleans are represented as numbers + (define false 0) + (define true 1) + ; a -> Either b a (define (right a)(cons 1 a)) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 00cdda1a0..641152786 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -63,6 +63,7 @@ unison-FOp-Ref.write unison-FOp-Ref.readForCas unison-FOp-Ref.Ticket.read + unison-FOp-Ref.cas unison-POp-ADDN unison-POp-ANDN @@ -312,5 +313,6 @@ (define (unison-FOp-Ref.read ref) (ref-read ref)) (define (unison-FOp-Ref.write ref a) (ref-write ref a)) (define (unison-FOp-Ref.readForCas ref) (ref-read ref)) - (define (unison-FOp-Ref.Ticket.read ticket) ticket)) + (define (unison-FOp-Ref.Ticket.read ticket) ticket) + (define (unison-FOp-Ref.cas ref ticket value) (ref-cas ref ticket value))) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index c5e47ca29..598b8bceb 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -39,7 +39,6 @@ (box ref-new) (unbox ref-read) (set-box! ref-write) - (box-cas! ref-cas) (break-thread kill) ; TODO need to see whether the compiler wraps the exception for me (thread fork) (sleep sleep-secs)) @@ -74,4 +73,7 @@ (let ([ok (parameterize-break #f (if (cas!) (awake-readers) #f))]) (if ok #t (loop)))])))) + (define (ref-cas ref ticket value) + (if (box-cas! ref ticket value) true false)) + (define (sleep n) (sleep-secs (/ n 1000000)))) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index f4797a024..7abbd83f7 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -2,12 +2,19 @@ concurrency.tests = Tests.main do !simpleRefTest !simpleRefTestScope !ticketTest + !minimal -- !casTest -- !threadTest -- !promiseSequentialTest -- !promiseConcurrentTest -- !fullTest +minimal = do + r = IO.ref 0 + t = Ref.readForCas r + _ = Ref.cas r t 3 + () + simpleRefTest = do r = IO.ref 0 Ref.write r 1 diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 19ddeec19..fab701541 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -12,4 +12,38 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native concurrency.tests + 💔💥 + + The program halted with an unhandled exception: + + Failure + (typeLink CompileError) + "couldn't determine unboxed type" + (Any (4, Var 0, 3, [])) + + + Stack trace: + ##raise + ``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + 💔💥 + + The program halted with an unhandled exception: + + Failure + (typeLink CompileError) + "couldn't determine unboxed type" + (Any (4, Var 0, 3, [])) + + + Stack trace: + ##raise + From 2ceb3e969a1c4768cc47b0d90d42ea3aef8a5ad9 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 10 Feb 2023 20:07:28 +0000 Subject: [PATCH 290/467] CAS tests fixed by upstream change --- unison-src/builtin-tests/concurrency-tests.u | 9 +----- unison-src/builtin-tests/jit-tests.output.md | 34 -------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 7abbd83f7..ad4d8c26a 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -2,19 +2,12 @@ concurrency.tests = Tests.main do !simpleRefTest !simpleRefTestScope !ticketTest - !minimal - -- !casTest + !casTest -- !threadTest -- !promiseSequentialTest -- !promiseConcurrentTest -- !fullTest -minimal = do - r = IO.ref 0 - t = Ref.readForCas r - _ = Ref.cas r t 3 - () - simpleRefTest = do r = IO.ref 0 Ref.write r 1 diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index fab701541..19ddeec19 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -12,38 +12,4 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native concurrency.tests - 💔💥 - - The program halted with an unhandled exception: - - Failure - (typeLink CompileError) - "couldn't determine unboxed type" - (Any (4, Var 0, 3, [])) - - - Stack trace: - ##raise - ``` - - - -🛑 - -The transcript failed due to an error in the stanza above. The error is: - - - 💔💥 - - The program halted with an unhandled exception: - - Failure - (typeLink CompileError) - "couldn't determine unboxed type" - (Any (4, Var 0, 3, [])) - - - Stack trace: - ##raise - From 2418c292bd0745ddf3847ae414aec71aee432a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Fri, 10 Feb 2023 15:29:10 -0500 Subject: [PATCH 291/467] Add character class builtin and functions --- parser-typechecker/src/Unison/Builtin.hs | 98 ++++++++-- .../src/Unison/Runtime/Builtin.hs | 176 ++++++++++++------ .../src/Unison/Runtime/Foreign.hs | 20 +- .../src/Unison/Util/Text/Pattern.hs | 138 +++++++------- unison-core/src/Unison/Type.hs | 5 +- 5 files changed, 286 insertions(+), 151 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index f261fe79e..9491a6333 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -165,7 +165,11 @@ builtinTypes = Rename' r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to rename `" <> r <> "` to `" <> name <> "`, " + "tried to rename `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -175,7 +179,11 @@ builtinTypes = Alias' r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to alias `" <> r <> "` to `" <> name <> "`, " + "tried to alias `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -245,7 +253,8 @@ builtinTypesSrc = B' "ImmutableArray" CT.Data, B' "MutableArray" CT.Data, B' "ImmutableByteArray" CT.Data, - B' "MutableByteArray" CT.Data + B' "MutableByteArray" CT.Data, + B' "Char.Class" CT.Data ] -- rename these to "builtin" later, when builtin means intrinsic as opposed to @@ -294,7 +303,11 @@ termNameRefs = Map.mapKeys Name.unsafeFromText $ foldl' go mempty (stripVersion Rename r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to rename `" <> r <> "` to `" <> name <> "`, " + "tried to rename `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -304,7 +317,11 @@ termNameRefs = Map.mapKeys Name.unsafeFromText $ foldl' go mempty (stripVersion Alias r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to alias `" <> r <> "` to `" <> name <> "`, " + "tried to alias `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -569,10 +586,18 @@ builtinsSrc = B "ImmutableArray.size" . forall1 "a" $ \a -> iarrayt a --> nat, B "ImmutableByteArray.size" $ ibytearrayt --> nat, B "MutableArray.copyTo!" . forall2 "g" "a" $ \g a -> - marrayt g a --> nat --> marrayt g a --> nat --> nat + marrayt g a + --> nat + --> marrayt g a + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "MutableByteArray.copyTo!" . forall1 "g" $ \g -> - mbytearrayt g --> nat --> mbytearrayt g --> nat --> nat + mbytearrayt g + --> nat + --> mbytearrayt g + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "MutableArray.read" . forall2 "g" "a" $ \g a -> marrayt g a --> nat --> Type.effect () [g, DD.exceptionType ()] a, @@ -599,10 +624,18 @@ builtinsSrc = B "MutableByteArray.write64be" . forall1 "g" $ \g -> mbytearrayt g --> nat --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "ImmutableArray.copyTo!" . forall2 "g" "a" $ \g a -> - marrayt g a --> nat --> iarrayt a --> nat --> nat + marrayt g a + --> nat + --> iarrayt a + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "ImmutableByteArray.copyTo!" . forall1 "g" $ \g -> - mbytearrayt g --> nat --> ibytearrayt --> nat --> nat + mbytearrayt g + --> nat + --> ibytearrayt + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "ImmutableArray.read" . forall1 "a" $ \a -> iarrayt a --> nat --> Type.effect1 () (DD.exceptionType ()) a, @@ -633,7 +666,32 @@ builtinsSrc = B "Scope.bytearray" . forall1 "s" $ \s -> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)), B "Scope.bytearrayOf" . forall1 "s" $ \s -> - nat --> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)) + nat --> nat --> Type.effect1 () (scopet s) (mbytearrayt (scopet s)), + B "Char.Class.any" charClass, + B "Char.Class.not" $ charClass --> charClass, + B "Char.Class.and" $ charClass --> charClass --> charClass, + B "Char.Class.or" $ charClass --> charClass --> charClass, + B "Char.Class.range" $ char --> char --> charClass, + B "Char.Class.anyOf" $ list char --> charClass, + B "Char.Class.alphanumeric" charClass, + B "Char.Class.upper" charClass, + B "Char.Class.lower" charClass, + B "Char.Class.whitespace" charClass, + B "Char.Class.control" charClass, + B "Char.Class.printable" charClass, + B "Char.Class.mark" charClass, + B "Char.Class.number" charClass, + B "Char.Class.punctuation" charClass, + B "Char.Class.symbol" charClass, + B "Char.Class.separator" charClass, + B "Char.Class.letter" charClass, + B "Char.Class.is" $ + charClass + --> char + --> boolean, + B + "Text.patterns.char" + $ charClass --> pat text ] ++ -- avoid name conflicts with Universal == < > <= >= @@ -762,13 +820,15 @@ ioBuiltins = forall1 "a" $ \a -> a --> io (reft iot a) ), - ( "IO.process.call", text --> list text --> io nat), + ("IO.process.call", text --> list text --> io nat), ( "IO.process.start", - text --> list text --> - io (tuple [handle, handle, handle, phandle])), - ( "IO.process.kill", phandle --> io unit), - ( "IO.process.wait", phandle --> io nat), - ( "IO.process.exitCode", phandle --> io (optionalt nat)), + text + --> list text + --> io (tuple [handle, handle, handle, phandle]) + ), + ("IO.process.kill", phandle --> io unit), + ("IO.process.wait", phandle --> io nat), + ("IO.process.exitCode", phandle --> io (optionalt nat)), ( "validateSandboxed", forall1 "a" $ \a -> list termLink --> a --> boolean ), @@ -868,7 +928,7 @@ stmBuiltins = refPromiseBuiltins :: [(Text, Type)] refPromiseBuiltins = [ ("Ref.Ticket.read", forall1 "a" $ \a -> ticket a --> a), - ("Ref.readForCas", forall1 "a" $ \a -> reft iot a --> io (ticket a)), + ("Ref.readForCas", forall1 "a" $ \a -> reft iot a --> io (ticket a)), ("Ref.cas", forall1 "a" $ \a -> reft iot a --> ticket a --> a --> io boolean), ("Promise.new", forall1 "a" $ \a -> unit --> io (promise a)), ("Promise.read", forall1 "a" $ \a -> promise a --> io a), @@ -937,6 +997,7 @@ infixr 9 --> io, iof :: Type -> Type io = Type.effect1 () (Type.builtinIO ()) iof = io . eithert failure + iot :: Type iot = (Type.effects () [Type.builtinIO ()]) @@ -1006,5 +1067,8 @@ stm = Type.effect1 () (Type.ref () Type.stmRef) tvar a = Type.ref () Type.tvarRef `app` a pat a = Type.ref () Type.patternRef `app` a +charClass :: Type +charClass = Type.ref () Type.charClassRef + timeSpec :: Type timeSpec = Type.ref () Type.timeSpecRef diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index b269018d5..8707ab1f5 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -36,7 +36,6 @@ import Control.Monad.Catch (MonadCatch) import qualified Control.Monad.Primitive as PA import Control.Monad.Reader (ReaderT (..), ask, runReaderT) import Control.Monad.State.Strict (State, execState, modify) -import Data.Digest.Murmur64 (hash64, asWord64) import qualified Crypto.Hash as Hash import qualified Crypto.MAC.HMAC as HMAC import Data.Bits (shiftL, shiftR, (.|.)) @@ -44,6 +43,7 @@ import qualified Data.ByteArray as BA import Data.ByteString (hGet, hGetSome, hPut) import qualified Data.ByteString.Lazy as L import Data.Default (def) +import Data.Digest.Murmur64 (asWord64, hash64) import Data.IORef as SYS ( IORef, newIORef, @@ -101,7 +101,7 @@ import System.Environment as SYS ( getArgs, getEnv, ) -import System.Exit as SYS (ExitCode(..)) +import System.Exit as SYS (ExitCode (..)) import System.FilePath (isPathSeparator) import System.IO (Handle) import System.IO as SYS @@ -130,7 +130,7 @@ import System.Process as SYS runInteractiveProcess, terminateProcess, waitForProcess, - withCreateProcess + withCreateProcess, ) import qualified System.X509 as X import Unison.ABT.Normalized hiding (TTm) @@ -153,23 +153,24 @@ import Unison.Runtime.Foreign.Function import Unison.Runtime.Stack (Closure) import qualified Unison.Runtime.Stack as Closure import Unison.Symbol +import Unison.Type (charRef) import qualified Unison.Type as Ty import qualified Unison.Util.Bytes as Bytes import Unison.Util.EnumContainers as EC -import Unison.Util.Text (Text) -import qualified Unison.Util.Text as Util.Text -import qualified Unison.Util.Text.Pattern as TPat import Unison.Util.RefPromise ( Promise, Ticket, - peekTicket, - readForCAS, casIORef, newPromise, + peekTicket, + readForCAS, readPromise, tryReadPromise, - writePromise + writePromise, ) +import Unison.Util.Text (Text) +import qualified Unison.Util.Text as Util.Text +import qualified Unison.Util.Text.Pattern as TPat import Unison.Var type Failure = F.Failure Closure @@ -892,14 +893,15 @@ gen'trace = debug'text :: SuperNormal Symbol debug'text = - unop0 3 $ \[c,r,t,e] -> - TLetD r UN (TPrm DBTX [c]) . - TMatch r . MatchSum $ - mapFromList [ - (0, ([], none)), - (1, ([BX], TAbs t . TLetD e BX (left t) $ some e)), - (2, ([BX], TAbs t . TLetD e BX (right t) $ some e)) - ] + unop0 3 $ \[c, r, t, e] -> + TLetD r UN (TPrm DBTX [c]) + . TMatch r + . MatchSum + $ mapFromList + [ (0, ([], none)), + (1, ([BX], TAbs t . TLetD e BX (left t) $ some e)), + (2, ([BX], TAbs t . TLetD e BX (right t) $ some e)) + ] code'missing :: SuperNormal Symbol code'missing = @@ -1027,14 +1029,14 @@ start'process :: ForeignOp start'process instr = ([BX, BX],) . TAbss [exe, args] - . TLets Direct [hin,hout,herr,hproc] [BX,BX,BX,BX] (TFOp instr [exe, args]) + . TLets Direct [hin, hout, herr, hproc] [BX, BX, BX, BX] (TFOp instr [exe, args]) . TLetD un BX (TCon Ty.unitRef 0 []) . TLetD p3 BX (TCon Ty.pairRef 0 [hproc, un]) . TLetD p2 BX (TCon Ty.pairRef 0 [herr, p3]) . TLetD p1 BX (TCon Ty.pairRef 0 [hout, p2]) $ TCon Ty.pairRef 0 [hin, p1] where - (exe,args,hin,hout,herr,hproc,un,p3,p2,p1) = fresh + (exe, args, hin, hout, herr, hproc, un, p3, p2, p1) = fresh set'buffering :: ForeignOp set'buffering instr = @@ -1046,12 +1048,16 @@ set'buffering instr = [ no'buf --> [] --> k1 no'buf, line'buf --> [] --> k1 line'buf, block'buf --> [] --> k1 block'buf, - sblock'buf --> [BX] - --> TAbs n . TMatch n . MatchDataCover Ty.bufferModeRef + sblock'buf + --> [BX] + --> TAbs n + . TMatch n + . MatchDataCover Ty.bufferModeRef $ mapFromList - [ 0 --> [UN] + [ 0 + --> [UN] --> TAbs w - . TLetD tag UN (TLit (N sblock'buf)) + . TLetD tag UN (TLit (N sblock'buf)) $ k2 [tag, w] ] ] @@ -1075,19 +1081,23 @@ get'buffering'output eitherResult stack1 stack2 stack3 resultTag anyVar failVar . TMatch resultTag . MatchSum $ mapFromList - [ no'buf --> [] + [ no'buf + --> [] --> TLetD successVar BX (TCon Ty.bufferModeRef no'buf []) $ right successVar, - line'buf --> [] + line'buf + --> [] --> TLetD successVar BX (TCon Ty.bufferModeRef line'buf []) $ right successVar, - block'buf --> [] + block'buf + --> [] --> TLetD successVar BX (TCon Ty.bufferModeRef block'buf []) $ right successVar, - sblock'buf --> [UN] + sblock'buf + --> [UN] --> TAbs stack1 - . TLetD stack2 BX (TCon Ty.natRef 0 [stack1]) - . TLetD successVar BX (TCon Ty.bufferModeRef sblock'buf [stack2]) + . TLetD stack2 BX (TCon Ty.natRef 0 [stack1]) + . TLetD successVar BX (TCon Ty.bufferModeRef sblock'buf [stack2]) $ right successVar ] ) @@ -1119,7 +1129,6 @@ murmur'hash instr = where (x, vl, result) = fresh - crypto'hmac :: ForeignOp crypto'hmac instr = ([BX, BX, BX],) @@ -1237,7 +1246,6 @@ inBxIomr arg1 arg2 fm result cont instr = . unenum 4 arg2 Ty.fileModeRef fm $ TLetD result UN (TFOp instr [arg1, fm]) cont - -- Output Shape -- these will represent different ways of translating -- the result of a foreign call to a Unison Term -- @@ -1263,9 +1271,13 @@ outMaybeNat tag result n = TMatch tag . MatchSum $ mapFromList [ (0, ([], none)), - (1, ([UN], - TAbs result . - TLetD n BX (TCon Ty.natRef 0 [n]) $ some n)) + ( 1, + ( [UN], + TAbs result + . TLetD n BX (TCon Ty.natRef 0 [n]) + $ some n + ) + ) ] outMaybeNTup :: forall v. Var v => v -> v -> v -> v -> v -> v -> v -> ANormal v @@ -1338,7 +1350,8 @@ outIoFailChar stack1 stack2 stack3 fail extra result = failureCase :: Var v => v -> v -> v -> v -> v -> (Word64, ([Mem], ANormal v)) failureCase stack1 stack2 stack3 any fail = - (0,) . ([BX, BX, BX],) + (0,) + . ([BX, BX, BX],) . TAbss [stack1, stack2, stack3] . TLetD any BX (TCon Ty.anyRef 0 [stack3]) . TLetD fail BX (TCon Ty.failureRef 0 [stack1, stack2, any]) @@ -1347,7 +1360,8 @@ failureCase stack1 stack2 stack3 any fail = exnCase :: Var v => v -> v -> v -> v -> v -> (Word64, ([Mem], ANormal v)) exnCase stack1 stack2 stack3 any fail = - (0,) . ([BX, BX, BX],) + (0,) + . ([BX, BX, BX],) . TAbss [stack1, stack2, stack3] . TLetD any BX (TCon Ty.anyRef 0 [stack3]) . TLetD fail BX (TCon Ty.failureRef 0 [stack1, stack2, any]) @@ -1574,6 +1588,16 @@ wordDirect wordType instr = where (b1, ub1) = fresh +-- Nat -> Bool +boxWordToBool :: Reference -> ForeignOp +boxWordToBool wordType instr = + ([BX, BX],) + . TAbss [b1, w1] + . unbox w1 wordType uw1 + $ TLetD result UN (TFOp instr [b1, uw1]) (boolift result) + where + (b1, w1, uw1, result) = fresh + -- Nat -> Nat -> c wordWordDirect :: Reference -> Reference -> ForeignOp wordWordDirect word1 word2 instr = @@ -2177,22 +2201,28 @@ declareForeigns = do declareForeign Tracked "IO.putBytes.impl.v3" boxBoxToEF0 . mkForeignIOF $ \(h, bs) -> hPut h (Bytes.toArray bs) declareForeign Tracked "IO.systemTime.impl.v3" unitToEFNat $ - mkForeignIOF $ \() -> getPOSIXTime + mkForeignIOF $ + \() -> getPOSIXTime declareForeign Tracked "IO.systemTimeMicroseconds.v1" unitToInt $ - mkForeign $ \() -> fmap (1e6 *) getPOSIXTime + mkForeign $ + \() -> fmap (1e6 *) getPOSIXTime declareForeign Tracked "Clock.internals.monotonic.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime Monotonic + mkForeignIOF $ + \() -> getTime Monotonic declareForeign Tracked "Clock.internals.realtime.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime Realtime + mkForeignIOF $ + \() -> getTime Realtime declareForeign Tracked "Clock.internals.processCPUTime.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime ProcessCPUTime + mkForeignIOF $ + \() -> getTime ProcessCPUTime declareForeign Tracked "Clock.internals.threadCPUTime.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime ThreadCPUTime + mkForeignIOF $ + \() -> getTime ThreadCPUTime declareForeign Tracked "Clock.internals.sec.v1" boxToInt $ mkForeign (\n -> pure (fromIntegral $ sec n :: Word64)) @@ -2205,7 +2235,8 @@ declareForeigns = do let chop = reverse . dropWhile isPathSeparator . reverse declareForeign Tracked "IO.getTempDirectory.impl.v3" unitToEFBox $ - mkForeignIOF $ \() -> chop <$> getTemporaryDirectory + mkForeignIOF $ + \() -> chop <$> getTemporaryDirectory declareForeign Tracked "IO.createTempDirectory.impl.v3" boxToEFBox $ mkForeignIOF $ \prefix -> do @@ -2226,28 +2257,33 @@ declareForeigns = do mkForeignIOF getEnv declareForeign Tracked "IO.getArgs.impl.v1" unitToEFBox $ - mkForeignIOF $ \() -> fmap Util.Text.pack <$> SYS.getArgs + mkForeignIOF $ + \() -> fmap Util.Text.pack <$> SYS.getArgs declareForeign Tracked "IO.isDirectory.impl.v3" boxToEFBool $ mkForeignIOF doesDirectoryExist declareForeign Tracked "IO.createDirectory.impl.v3" boxToEF0 $ - mkForeignIOF $ createDirectoryIfMissing True + mkForeignIOF $ + createDirectoryIfMissing True declareForeign Tracked "IO.removeDirectory.impl.v3" boxToEF0 $ mkForeignIOF removeDirectoryRecursive declareForeign Tracked "IO.renameDirectory.impl.v3" boxBoxToEF0 $ - mkForeignIOF $ uncurry renameDirectory + mkForeignIOF $ + uncurry renameDirectory declareForeign Tracked "IO.directoryContents.impl.v3" boxToEFBox $ - mkForeignIOF $ (fmap Util.Text.pack <$>) . getDirectoryContents + mkForeignIOF $ + (fmap Util.Text.pack <$>) . getDirectoryContents declareForeign Tracked "IO.removeFile.impl.v3" boxToEF0 $ mkForeignIOF removeFile declareForeign Tracked "IO.renameFile.impl.v3" boxBoxToEF0 $ - mkForeignIOF $ uncurry renameFile + mkForeignIOF $ + uncurry renameFile declareForeign Tracked "IO.getFileTimestamp.impl.v3" boxToEFNat . mkForeignIOF @@ -2875,32 +2911,32 @@ declareForeigns = do declareForeign Untracked "Text.patterns.literal" boxDirect . mkForeign $ \txt -> evaluate . TPat.cpattern $ TPat.Literal txt declareForeign Untracked "Text.patterns.digit" direct . mkForeign $ - let v = TPat.cpattern TPat.Digit in \() -> pure v + let v = TPat.cpattern (TPat.Char (TPat.CharRange '0' '9')) in \() -> pure v declareForeign Untracked "Text.patterns.letter" direct . mkForeign $ - let v = TPat.cpattern TPat.Letter in \() -> pure v + let v = TPat.cpattern (TPat.Char (TPat.CharClass TPat.Letter)) in \() -> pure v declareForeign Untracked "Text.patterns.space" direct . mkForeign $ - let v = TPat.cpattern TPat.Space in \() -> pure v + let v = TPat.cpattern (TPat.Char (TPat.CharClass TPat.Whitespace)) in \() -> pure v declareForeign Untracked "Text.patterns.punctuation" direct . mkForeign $ - let v = TPat.cpattern TPat.Punctuation in \() -> pure v + let v = TPat.cpattern (TPat.Char (TPat.CharClass TPat.Punctuation)) in \() -> pure v declareForeign Untracked "Text.patterns.anyChar" direct . mkForeign $ - let v = TPat.cpattern TPat.AnyChar in \() -> pure v + let v = TPat.cpattern (TPat.Char TPat.Any) in \() -> pure v declareForeign Untracked "Text.patterns.eof" direct . mkForeign $ let v = TPat.cpattern TPat.Eof in \() -> pure v let ccd = wordWordDirect Ty.charRef Ty.charRef declareForeign Untracked "Text.patterns.charRange" ccd . mkForeign $ - \(beg, end) -> evaluate . TPat.cpattern $ TPat.CharRange beg end + \(beg, end) -> evaluate . TPat.cpattern . TPat.Char $ TPat.CharRange beg end declareForeign Untracked "Text.patterns.notCharRange" ccd . mkForeign $ - \(beg, end) -> evaluate . TPat.cpattern $ TPat.NotCharRange beg end + \(beg, end) -> evaluate . TPat.cpattern . TPat.Char . TPat.Not $ TPat.CharRange beg end declareForeign Untracked "Text.patterns.charIn" boxDirect . mkForeign $ \ccs -> do cs <- for ccs $ \case Closure.DataU1 _ _ i -> pure (toEnum i) _ -> die "Text.patterns.charIn: non-character closure" - evaluate . TPat.cpattern $ TPat.CharIn cs + evaluate . TPat.cpattern . TPat.Char $ TPat.CharSet cs declareForeign Untracked "Text.patterns.notCharIn" boxDirect . mkForeign $ \ccs -> do cs <- for ccs $ \case Closure.DataU1 _ _ i -> pure (toEnum i) _ -> die "Text.patterns.notCharIn: non-character closure" - evaluate . TPat.cpattern $ TPat.NotCharIn cs + evaluate . TPat.cpattern . TPat.Char . TPat.Not $ TPat.CharSet cs declareForeign Untracked "Pattern.many" boxDirect . mkForeign $ \(TPat.CP p _) -> evaluate . TPat.cpattern $ TPat.Many p declareForeign Untracked "Pattern.capture" boxDirect . mkForeign $ @@ -2920,6 +2956,32 @@ declareForeigns = do declareForeign Untracked "Pattern.isMatch" boxBoxToBool . mkForeign $ \(TPat.CP _ matcher, input :: Text) -> pure . isJust $ matcher input + declareForeign Untracked "Char.Class.any" direct . mkForeign $ \() -> pure TPat.Any + declareForeign Untracked "Char.Class.not" boxDirect . mkForeign $ pure . TPat.Not + declareForeign Untracked "Char.Class.and" boxBoxDirect . mkForeign $ \(a, b) -> pure $ TPat.Intersect a b + declareForeign Untracked "Char.Class.or" boxBoxDirect . mkForeign $ \(a, b) -> pure $ TPat.Union a b + declareForeign Untracked "Char.Class.range" (wordWordDirect charRef charRef) . mkForeign $ \(a, b) -> pure $ TPat.CharRange a b + declareForeign Untracked "Char.Class.anyOf" boxDirect . mkForeign $ \ccs -> do + cs <- for ccs $ \case + Closure.DataU1 _ _ i -> pure (toEnum i) + _ -> die "Text.patterns.charIn: non-character closure" + evaluate $ TPat.CharSet cs + declareForeign Untracked "Char.Class.alphanumeric" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.AlphaNum) + declareForeign Untracked "Char.Class.upper" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Upper) + declareForeign Untracked "Char.Class.lower" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Lower) + declareForeign Untracked "Char.Class.whitespace" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Whitespace) + declareForeign Untracked "Char.Class.control" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Control) + declareForeign Untracked "Char.Class.printable" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Printable) + declareForeign Untracked "Char.Class.mark" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.MarkChar) + declareForeign Untracked "Char.Class.number" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Number) + declareForeign Untracked "Char.Class.punctuation" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Punctuation) + declareForeign Untracked "Char.Class.symbol" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Symbol) + declareForeign Untracked "Char.Class.separator" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Separator) + declareForeign Untracked "Char.Class.letter" direct . mkForeign $ \() -> pure (TPat.CharClass TPat.Letter) + declareForeign Untracked "Char.Class.is" (boxWordToBool charRef) . mkForeign $ \(cl, c) -> evaluate $ TPat.charPatternPred cl c + declareForeign Untracked "Text.patterns.char" boxDirect . mkForeign $ \c -> + let v = TPat.cpattern (TPat.Char c) in pure v + type RW = PA.PrimState IO checkedRead :: diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index 81b7b2a2a..c29e7ee5c 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -1,5 +1,6 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE GADTs #-} +{-# LANGUAGE InstanceSigs #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} @@ -36,7 +37,7 @@ import Unison.Symbol (Symbol) import qualified Unison.Type as Ty import Unison.Util.Bytes (Bytes) import Unison.Util.Text (Text) -import Unison.Util.Text.Pattern (CPattern) +import Unison.Util.Text.Pattern (CPattern, CharPattern) import Unsafe.Coerce data Foreign where @@ -111,6 +112,14 @@ cpatCmp :: CPattern -> CPattern -> Ordering cpatCmp l r = compare l r {-# NOINLINE cpatCmp #-} +charClassEq :: CharPattern -> CharPattern -> Bool +charClassEq l r = l == r +{-# NOINLINE charClassEq #-} + +charClassCmp :: CharPattern -> CharPattern -> Ordering +charClassCmp = compare +{-# NOINLINE charClassCmp #-} + tylEq :: Reference -> Reference -> Bool tylEq r l = r == l {-# NOINLINE tylEq #-} @@ -144,6 +153,7 @@ ref2eq r | r == Ty.mbytearrayRef = Just $ promote mbarrEq | r == Ty.ibytearrayRef = Just $ promote barrEq | r == Ty.patternRef = Just $ promote cpatEq + | r == Ty.charClassRef = Just $ promote charClassEq | otherwise = Nothing ref2cmp :: Reference -> Maybe (a -> b -> Ordering) @@ -155,6 +165,7 @@ ref2cmp r | r == Ty.threadIdRef = Just $ promote tidCmp | r == Ty.ibytearrayRef = Just $ promote barrCmp | r == Ty.patternRef = Just $ promote cpatCmp + | r == Ty.charClassRef = Just $ promote charClassCmp | otherwise = Nothing instance Eq Foreign where @@ -194,7 +205,9 @@ maybeUnwrapForeign rt (Wrap r e) class BuiltinForeign f where foreignRef :: Tagged f Reference -instance BuiltinForeign Text where foreignRef = Tagged Ty.textRef +instance BuiltinForeign Text where + foreignRef :: Tagged Text Reference + foreignRef = Tagged Ty.textRef instance BuiltinForeign Bytes where foreignRef = Tagged Ty.bytesRef @@ -238,6 +251,9 @@ instance BuiltinForeign HashAlgorithm where foreignRef = Tagged Ty.hashAlgorithm instance BuiltinForeign CPattern where foreignRef = Tagged Ty.patternRef +instance BuiltinForeign CharPattern where + foreignRef = Tagged Ty.charClassRef + wrapBuiltin :: forall f. BuiltinForeign f => f -> Foreign wrapBuiltin x = Wrap r x where diff --git a/parser-typechecker/src/Unison/Util/Text/Pattern.hs b/parser-typechecker/src/Unison/Util/Text/Pattern.hs index ebed0da48..0b2b3d2e4 100644 --- a/parser-typechecker/src/Unison/Util/Text/Pattern.hs +++ b/parser-typechecker/src/Unison/Util/Text/Pattern.hs @@ -2,7 +2,7 @@ module Unison.Util.Text.Pattern where -import Data.Char (isDigit, isLetter, isPunctuation, isSpace) +import Data.Char (isAlphaNum, isControl, isLetter, isLower, isMark, isNumber, isPrint, isPunctuation, isSeparator, isSpace, isSymbol, isUpper) import qualified Data.Text as DT import Unison.Util.Text (Text) import qualified Unison.Util.Text as Text @@ -13,18 +13,35 @@ data Pattern | Capture Pattern -- capture all the text consumed by the inner pattern, discarding its subcaptures | Many Pattern -- zero or more repetitions (at least 1 can be written: Join [p, Many p]) | Replicate Int Int Pattern -- m to n occurrences of a pattern, optional = 0-1 - | AnyChar -- consume a single char | Eof -- succeed if given the empty text, fail otherwise | Literal Text -- succeed if input starts with the given text, advance by that text - | CharRange Char Char -- consume 1 char in the given range, or fail - | CharIn [Char] -- consume 1 char in the given set, or fail - | NotCharIn [Char] -- consume 1 char NOT in the given set, or fail - | NotCharRange Char Char -- consume 1 char NOT in the given range, or fail - | Digit -- consume 1 digit (according to Char.isDigit) - | Letter -- consume 1 letter (according to Char.isLetter) - | Space -- consume 1 space character (according to Char.isSpace) - | Punctuation -- consume 1 punctuation char (according to Char.isPunctuation) - deriving (Eq, Ord) + | Char CharPattern -- succeed if input starts with a char matching the given pattern, advance by 1 char + deriving (Show, Eq, Ord) + +data CharPattern + = Any -- any char + | Not CharPattern -- negation of the given pattern + | Union CharPattern CharPattern -- match if either pattern matches + | Intersect CharPattern CharPattern -- match if both patterns match + | CharRange Char Char -- match if char is in the given range + | CharSet [Char] -- match if char is in the given set + | CharClass CharClass -- match if char is in the given class + deriving (Show, Eq, Ord) + +data CharClass + = AlphaNum -- alphabetic or numeric characters + | Upper -- uppercase alphabetic characters + | Lower -- lowercase alphabetic characters + | Whitespace -- whitespace characters (space, tab, newline, etc.) + | Control -- non-printing control characters + | Printable -- letters, numbers, punctuation, symbols, spaces + | MarkChar -- accents, diacritics, etc. + | Number -- numeric characters in any script + | Punctuation -- connectors, brackets, quotes + | Symbol -- symbols (math, currency, etc.) + | Separator -- spaces, line separators, paragraph separators + | Letter -- letters in any script + deriving (Show, Eq, Ord) -- Wrapper type. Holds a pattern together with its compilation. This is used as -- the semantic value of a unison `Pattern a`. Laziness avoids building the @@ -98,13 +115,13 @@ compile (Literal txt) !err !success = go go acc t | Text.take (Text.size txt) t == txt = success acc (Text.drop (Text.size txt) t) | otherwise = err acc t -compile AnyChar !err !success = go +compile (Char Any) !err !success = go where go acc t = case Text.drop 1 t of rem | Text.size t > Text.size rem -> success acc rem | otherwise -> err acc rem -compile (Capture (Many AnyChar)) !_ !success = \acc t -> success (pushCapture t acc) Text.empty +compile (Capture (Many (Char Any))) !_ !success = \acc t -> success (pushCapture t acc) Text.empty compile (Capture c) !err !success = go where err' _ _ acc0 t0 = err acc0 t0 @@ -122,38 +139,15 @@ compile (Join ps) !err !success = go ps let pc = compile p err psc psc = compile (Join ps) err success in pc -compile (NotCharIn cs) !err !success = go +compile (Char cp) !err !success = go where - ok = charNotInPred cs + ok = charPatternPred cp go acc t = case Text.uncons t of Just (ch, rem) | ok ch -> success acc rem _ -> err acc t -compile (CharIn cs) !err !success = go - where - ok = charInPred cs - go acc t = case Text.uncons t of - Just (ch, rem) | ok ch -> success acc rem - _ -> err acc t -compile (CharRange c1 c2) !err !success = go - where - go acc t = case Text.uncons t of - Just (ch, rem) | ch >= c1 && ch <= c2 -> success acc rem - _ -> err acc t -compile (NotCharRange c1 c2) !err !success = go - where - go acc t = case Text.uncons t of - Just (ch, rem) | not (ch >= c1 && ch <= c2) -> success acc rem - _ -> err acc t compile (Many p) !_ !success = case p of - AnyChar -> (\acc _ -> success acc Text.empty) - CharIn cs -> walker (charInPred cs) - NotCharIn cs -> walker (charNotInPred cs) - CharRange c1 c2 -> walker (\ch -> ch >= c1 && ch <= c2) - NotCharRange c1 c2 -> walker (\ch -> ch < c1 || ch > c2) - Digit -> walker isDigit - Letter -> walker isLetter - Punctuation -> walker isPunctuation - Space -> walker isSpace + Char Any -> (\acc _ -> success acc Text.empty) + Char cp -> walker (charPatternPred cp) p -> go where go = compile p success success' @@ -169,25 +163,18 @@ compile (Many p) !_ !success = case p of rem | DT.null rem -> go acc t | otherwise -> - -- moving the remainder to the root of the tree is much more efficient - -- since the next uncons will be O(1) rather than O(log n) - -- this can't unbalance the tree too badly since these promoted chunks - -- are being consumed and will get removed by a subsequent uncons - success acc (Text.appendUnbalanced (Text.fromText rem) t) + -- moving the remainder to the root of the tree is much more efficient + -- since the next uncons will be O(1) rather than O(log n) + -- this can't unbalance the tree too badly since these promoted chunks + -- are being consumed and will get removed by a subsequent uncons + success acc (Text.appendUnbalanced (Text.fromText rem) t) {-# INLINE walker #-} compile (Replicate m n p) !err !success = case p of - AnyChar -> \acc t -> + Char Any -> \acc t -> if Text.size t < m then err acc t else success acc (Text.drop n t) - CharIn cs -> dropper (charInPred cs) - NotCharIn cs -> dropper (charNotInPred cs) - CharRange c1 c2 -> dropper (\ch -> ch >= c1 && c1 <= c2) - NotCharRange c1 c2 -> dropper (\ch -> ch < c1 || ch > c2) - Digit -> dropper isDigit - Letter -> dropper isLetter - Punctuation -> dropper isPunctuation - Space -> dropper isSpace + Char cp -> dropper (charPatternPred cp) _ -> try "Replicate" (go1 m) err (go2 (n - m)) where go1 0 = \_err success stk rem -> success stk rem @@ -198,26 +185,6 @@ compile (Replicate m n p) !err !success = case p of dropper ok acc t | (i, rest) <- Text.dropWhileMax ok n t, i >= m = success acc rest | otherwise = err acc t -compile Digit !err !success = go - where - go acc t = case Text.uncons t of - Just (ch, rem) | isDigit ch -> success acc rem - _ -> err acc t -compile Letter !err !success = go - where - go acc t = case Text.uncons t of - Just (ch, rem) | isLetter ch -> success acc rem - _ -> err acc t -compile Punctuation !err !success = go - where - go acc t = case Text.uncons t of - Just (ch, rem) | isPunctuation ch -> success acc rem - _ -> err acc t -compile Space !err !success = go - where - go acc t = case Text.uncons t of - Just (ch, rem) | isSpace ch -> success acc rem - _ -> err acc t charInPred, charNotInPred :: [Char] -> Char -> Bool charInPred [] = const False @@ -225,6 +192,29 @@ charInPred (c : chs) = let ok = charInPred chs in \ci -> ci == c || ok ci charNotInPred [] = const True charNotInPred (c : chs) = let ok = charNotInPred chs in (\ci -> ci /= c && ok ci) +charPatternPred :: CharPattern -> Char -> Bool +charPatternPred Any = const True +charPatternPred (Not cp) = let notOk = charPatternPred cp in \ci -> not (notOk ci) +charPatternPred (Union cp1 cp2) = let ok1 = charPatternPred cp1; ok2 = charPatternPred cp2 in \ci -> ok1 ci || ok2 ci +charPatternPred (Intersect cp1 cp2) = let ok1 = charPatternPred cp1; ok2 = charPatternPred cp2 in \ci -> ok1 ci && ok2 ci +charPatternPred (CharRange c1 c2) = \ci -> ci >= c1 && ci <= c2 +charPatternPred (CharSet cs) = charInPred cs +charPatternPred (CharClass cc) = charClassPred cc + +charClassPred :: CharClass -> Char -> Bool +charClassPred AlphaNum = isAlphaNum +charClassPred Upper = isUpper +charClassPred Lower = isLower +charClassPred Whitespace = isSpace +charClassPred Control = isControl +charClassPred Printable = isPrint +charClassPred MarkChar = isMark +charClassPred Number = isNumber +charClassPred Punctuation = isPunctuation +charClassPred Symbol = isSymbol +charClassPred Separator = isSeparator +charClassPred Letter = isLetter + -- runs c and if it fails, restores state to what it was before try :: String -> Compiled r -> Compiled r try msg c err success stk rem = diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index a676a2b6a..05858262a 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -293,6 +293,9 @@ stmRef = Reference.Builtin "STM" patternRef :: Reference patternRef = Reference.Builtin "Pattern" +charClassRef :: Reference +charClassRef = Reference.Builtin "Char.Class" + tlsClientConfigRef :: Reference tlsClientConfigRef = Reference.Builtin "Tls.ClientConfig" @@ -641,7 +644,7 @@ removePureEffects :: ABT.Var v => Type v a -> Type v a removePureEffects t | not Settings.removePureEffects = t | otherwise = - generalize vs $ removeEffectVars fvs tu + generalize vs $ removeEffectVars fvs tu where (vs, tu) = unforall' t vss = Set.fromList vs From 8b8dcc085e460f5d2e2227f8045c264e5d3cf8c0 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 10 Feb 2023 15:15:45 -0600 Subject: [PATCH 292/467] Improved scheme-libs/readme.md to be up to date --- scheme-libs/readme.md | 99 ++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 52 deletions(-) diff --git a/scheme-libs/readme.md b/scheme-libs/readme.md index 9e19af4ff..e337cfc13 100644 --- a/scheme-libs/readme.md +++ b/scheme-libs/readme.md @@ -1,77 +1,72 @@ This directory contains libraries necessary for building and running -unison programs via Chez Scheme. At the moment, they need to be -manually installed in the expected location. The default location is -the `unisonlanguage` directory in the XDG data directory. -Specifically, the `unison` subdirectory should be (recursively) copied -to: +unison programs via Racket Scheme. - $XDG_DATA_DIRECTORY/unisonlanguage/scheme-libs +**Prerequisites** -On unix systems, the XDG directory is ~/.local/share by default, ~ -being the home directory. On Windows, this is instead the %APPDATA% -directory. See: +You'll need to have a couple things installed on your system: - https://hackage.haskell.org/package/directory/docs/System-Directory.html#t:XdgDirectory +* [libcrypto](https://github.com/openssl/openssl) (you probably already have this installed) +* [Racket](https://racket-lang.org/), with the executable `racket` on your path somewhere +* [BLAKE2](https://github.com/BLAKE2/libb2) (you may need to install this manually) -for more information. The full directory structure should be copied, -since the jit compilation commands supply both the common/ -subdirectory and an implementation specific subdirectory as library -search paths. +To run the test suite, first `stack build` (or `stack build --fast`), then: -UCM can also be told to look in another directory by setting the -`SchemeLibs.Static` item in the unison config file. If this path is -denoted by `$CUSTOM`, then the compiler commands will look in: +``` +./unison-src/builtin-tests/jit-tests.sh +``` - $CUSTOM/scheme-libs/ +OR if you want to run the same tests in interpreted mode: -for the subdirectories containing the library files. +``` +./unison-src/builtin-tests/interpreter-tests.sh +``` -The compiler commands also expect Chez Scheme to be installed -separately, and for `scheme` to be callable on the user's path. The -continuation library now makes use of features in the Racket fork of -Chez. For information on how to install, see: +The above scripts fetch and cache a copy of base and the scheme-generating libraries, and copy this directory to `$XDG_DATA_DIRECTORY/unisonlanguage/scheme-libs`. - https://github.com/racket/ChezScheme/blob/master/BUILDING +## Iterating more quickly -For more information on Chez Scheme in general, see: +If running the above transcripts is too slow for you, here's a few things you can do instead: - https://cisco.github.io/ChezScheme/csug9.5/csug.html +### Run without needing to bounce ucm -There are two ways to run code via scheme. The first is to use -`run.native`, which compiles and immediately runs a given unison -definition. The second is `compile.native`, which produces a Chez -scheme `.boot` file with a specified name. The boot file can then be -used with the scheme binary to run the precompiled program, like so: +First, tell UCM to load scheme files from this directory, by adding +a `SchemeLibs.Static` item to your `~/.unisonConfig`. - scheme -b ./my-program.boot +``` +SchemeLibs.Static = "/path/to/unisoncode" +``` -It is also possible to install the boot file in a particular -directory, and make a renamed copy of the scheme binary, which will -automatically execute the boot file with the corresponding name on -start up. For more information on how to accomplish that, see: +With this set, the compiler commands will look in `/path/to/somewhere/scheme-libs/` for the subdirectories containing the library files. - https://cisco.github.io/ChezScheme/csug9.5/use.html#./use:h8 +Once that's done, you can load the testing library and tests: ---- +``` +.jit> load unison-src/builtin-tests/testlib.u +.jit> add +.jit> load unison-src/builtin-tests/tests.u +.jit> add +``` -A tip for working on files in this directory: +And then, without needing to bounce `ucm` every time you edit your scheme files, you can do: -Assuming your are doing so by creating a unison test case, it can be -faster to have scheme code for that test case generated once, and then -just work on filling out the library functionality here. To do this, -you can run the ucm command: +``` +.jit> run.native tests +``` - run.native +### Run without needing to regenerate the scheme -This will cause a corresponding scheme file to be created in: +`run.native` produces a scheme file in `$XDG_CACHE_DIRECTORY/unisonlanguage/scheme-tmp`, so going one step further, you can grab these files and run them directly using Racket, bypassing `ucm` entirely. - $XDG_CACHE_DIRECTORY/unisonlanguage +``` +~/unison » ls ~/.cache/unisonlanguage/scheme-tmp +testSuite.scm tests.scm +``` -This can be copied back to the unison directory, and then run directly -with something like: +When running `tests.scm` directly with Racket, you'll need to add this `scheme-libs` directory and the generated builtins library to the path. - scheme --libdirs chez-libs:~/.cache/unisonlanguage/scheme-libs --script foo.scm - -Then you can test directly against any changes to chez-libs, instead -of having to copy them to a different location, restart ucm, etc. +``` +~/unison » ls ~/.cache/unisonlanguage/scheme-libs/unison +boot-generated.ss builtin-generated.ss +``` +TODO: what is the actual `racket` flags to pass to do this? \ No newline at end of file From 848bbe100221dd1740b3bedea1bec41743752218 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 10 Feb 2023 15:54:50 -0600 Subject: [PATCH 293/467] filled in todo, thanks @jaredly! --- scheme-libs/readme.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scheme-libs/readme.md b/scheme-libs/readme.md index e337cfc13..6e54181f2 100644 --- a/scheme-libs/readme.md +++ b/scheme-libs/readme.md @@ -65,8 +65,5 @@ testSuite.scm tests.scm When running `tests.scm` directly with Racket, you'll need to add this `scheme-libs` directory and the generated builtins library to the path. ``` -~/unison » ls ~/.cache/unisonlanguage/scheme-libs/unison -boot-generated.ss builtin-generated.ss -``` - -TODO: what is the actual `racket` flags to pass to do this? \ No newline at end of file +racket -S ~/.cache/unisonlanguage/scheme-libs/ -S ~/.local/share/unisonlanguage/scheme-libs/racket/ -S ~/.local/share/unisonlanguage/scheme-libs/common/ ~/.cache/unisonlanguage/scheme-tmp/tests.scm +``` \ No newline at end of file From 5a7b323df76b15c266750292b700a31dc53b9e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Fri, 10 Feb 2023 21:51:49 -0500 Subject: [PATCH 294/467] Fix test --- .../tests/Unison/Test/Util/Text.hs | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/parser-typechecker/tests/Unison/Test/Util/Text.hs b/parser-typechecker/tests/Unison/Test/Util/Text.hs index 04f3bf58b..081d16e4c 100644 --- a/parser-typechecker/tests/Unison/Test/Util/Text.hs +++ b/parser-typechecker/tests/Unison/Test/Util/Text.hs @@ -4,6 +4,7 @@ module Unison.Test.Util.Text where import Control.Monad import Data.List (foldl', unfoldr) +import Data.Maybe (isNothing) import qualified Data.Text as T import EasyTest import qualified Unison.Util.Rope as R @@ -45,8 +46,10 @@ test = scope "<>" . expect' $ Text.toText (t1s <> t2s <> t3s) == t1 <> t2 <> t3 scope "Ord" . expect' $ - (t1 <> t2 <> t3) `compare` t3 - == (t1s <> t2s <> t3s) `compare` t3s + (t1 <> t2 <> t3) + `compare` t3 + == (t1s <> t2s <> t3s) + `compare` t3s scope "take" . expect' $ Text.toText (Text.take k (t1s <> t2s)) == T.take k (t1 <> t2) scope "drop" . expect' $ @@ -102,36 +105,36 @@ test = ok, scope "patterns" $ do expect' (P.run P.Eof "" == Just ([], "")) - expect' (P.run P.AnyChar "a" == Just ([], "")) - expect' (P.run (P.CharRange 'a' 'z') "a" == Just ([], "")) - expect' (P.run (P.NotCharRange 'a' 'z') "a" == Nothing) - expect' (P.run (P.Or (P.NotCharRange 'a' 'z') P.AnyChar) "abc" == Just ([], "bc")) + expect' (P.run (P.Char P.Any) "a" == Just ([], "")) + expect' (P.run (P.Char (P.CharRange 'a' 'z')) "a" == Just ([], "")) + expect' . isNothing $ P.run (P.Char (P.Not (P.CharRange 'a' 'z'))) "a" + expect' (P.run (P.Or (P.Char (P.Not (P.CharRange 'a' 'z'))) (P.Char P.Any)) "abc" == Just ([], "bc")) -- this shows that we ignore subcaptures - expect' (P.run (P.Join [P.Capture (P.Join [P.Capture P.AnyChar, P.Capture P.AnyChar]), P.AnyChar]) "abcdef" == Just (["ab"], "def")) - expect' (P.run (P.CharIn "0123") "3ab" == Just ([], "ab")) - expect' (P.run (P.NotCharIn "0123") "a3b" == Just ([], "3b")) - expect' (P.run (P.Capture (P.NotCharIn "0123")) "a3b" == Just (["a"], "3b")) - expect' (P.run (P.Many (P.CharIn "abcd")) "babbababac123" == Just ([], "123")) - expect' (P.run (P.Capture (P.Many (P.CharIn "abcd"))) "babbababac123" == Just (["babbababac"], "123")) - expect' (P.run (P.Capture (P.Many (P.Digit))) "012345abc" == Just (["012345"], "abc")) - expect' (P.run (P.Join [P.Capture (P.Many (P.Digit)), P.Literal ",", P.Capture (P.Many P.AnyChar)]) "012345,abc" == Just (["012345", "abc"], "")) + expect' (P.run (P.Join [P.Capture (P.Join [P.Capture (P.Char P.Any), P.Capture (P.Char P.Any)]), P.Char P.Any]) "abcdef" == Just (["ab"], "def")) + expect' (P.run (P.Char (P.CharSet "0123")) "3ab" == Just ([], "ab")) + expect' (P.run (P.Char (P.Not (P.CharSet "0123"))) "a3b" == Just ([], "3b")) + expect' (P.run (P.Capture (P.Char (P.Not (P.CharSet "0123")))) "a3b" == Just (["a"], "3b")) + expect' (P.run (P.Many (P.Char (P.CharSet "abcd"))) "babbababac123" == Just ([], "123")) + expect' (P.run (P.Capture (P.Many (P.Char (P.CharSet "abcd")))) "babbababac123" == Just (["babbababac"], "123")) + expect' (P.run (P.Capture (P.Many (P.Char (P.CharClass P.Number)))) "012345abc" == Just (["012345"], "abc")) + expect' (P.run (P.Join [P.Capture (P.Many (P.Char (P.CharClass P.Number))), P.Literal ",", P.Capture (P.Many (P.Char P.Any))]) "012345,abc" == Just (["012345", "abc"], "")) expect' - ( P.run (P.Many (P.Join [P.Capture (P.Many (P.Digit)), P.Many P.Space])) "01 10 20 1123 292 110 10" + ( P.run (P.Many (P.Join [P.Capture (P.Many (P.Char (P.CharClass P.Number))), P.Many (P.Char (P.CharClass P.Whitespace))])) "01 10 20 1123 292 110 10" == Just (["01", "10", "20", "1123", "292", "110", "10"], "") ) expect' $ - let part = P.Capture (P.Replicate 1 3 (P.Digit)) + let part = P.Capture (P.Replicate 1 3 (P.Char (P.CharClass P.Number))) dpart = P.Join [P.Literal ".", part] ip = P.Join [part, P.Replicate 3 3 dpart, P.Eof] in P.run ip "127.0.0.1" == Just (["127", "0", "0", "1"], "") expect' $ - let p = P.Replicate 5 8 (P.Capture P.Digit) + let p = P.Replicate 5 8 (P.Capture (P.Char (P.CharClass P.Number))) in P.run p "12345" == Just (["1", "2", "3", "4", "5"], "") expect' $ - let p = P.Replicate 5 8 (P.Capture P.Digit) `P.Or` P.Join [] + let p = P.Replicate 5 8 (P.Capture (P.Char (P.CharClass P.Number))) `P.Or` P.Join [] in P.run p "1234" == Just ([], "1234") expect' $ - let p = P.Replicate 5 8 (P.Capture (P.Join [P.Digit, P.Literal "z"])) `P.Or` P.Join [] + let p = P.Replicate 5 8 (P.Capture (P.Join [P.Char (P.CharClass P.Number), P.Literal "z"])) `P.Or` P.Join [] in P.run p "1z2z3z4z5z6a" == Just (["1z", "2z", "3z", "4z", "5z"], "6a") -- https://github.com/unisonweb/unison/issues/3530 expectEqual Nothing $ @@ -154,10 +157,10 @@ test = -- this is just making sure we don't duplicate captures to our left -- when entering an `Or` node expectEqual (Just (["@"], "")) $ - let p = P.Join [P.Capture P.AnyChar, P.Or (P.Literal "c") (P.Join []), P.Literal "d"] + let p = P.Join [P.Capture (P.Char P.Any), P.Or (P.Literal "c") (P.Join []), P.Literal "d"] in P.run p "@cd" expectEqual (Just (["%", "c"], "")) $ - let p = P.Join [P.Capture P.AnyChar, (P.Or (P.Capture (P.Literal "c")) (P.Join [])), P.Literal "d"] + let p = P.Join [P.Capture (P.Char P.Any), (P.Or (P.Capture (P.Literal "c")) (P.Join [])), P.Literal "d"] in P.run p "%cd" expectEqual (Just ([""], "ac")) $ let p = P.Capture (P.Or (P.Join [P.Literal "a", P.Literal "b"]) (P.Join [])) From 9873a6b32c026449a77270f62ec402bfb0555a3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Fri, 10 Feb 2023 22:51:45 -0500 Subject: [PATCH 295/467] Fix transcript output --- .../all-base-hashes.output.md | 1491 +++++++++-------- unison-src/transcripts/alias-many.output.md | 951 ++++++----- .../transcripts/builtins-merge.output.md | 4 +- .../transcripts/emptyCodebase.output.md | 4 +- unison-src/transcripts/fix1063.md | 2 + unison-src/transcripts/fix1063.output.md | 6 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 28 +- .../transcripts/name-selection.output.md | 989 +++++------ unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 +- 11 files changed, 1820 insertions(+), 1697 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index b84630eb1..ce3b7bc36 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -239,579 +239,639 @@ This transcript is intended to make visible accidental changes to the hashing al 74. -- ##Char builtin type builtin.Char - 75. -- ##Char.fromNat + 75. -- ##Char.Class + builtin type builtin.Char.Class + + 76. -- ##Char.Class.alphanumeric + builtin.Char.Class.alphanumeric : Class + + 77. -- ##Char.Class.and + builtin.Char.Class.and : Class -> Class -> Class + + 78. -- ##Char.Class.any + builtin.Char.Class.any : Class + + 79. -- ##Char.Class.anyOf + builtin.Char.Class.anyOf : [Char] -> Class + + 80. -- ##Char.Class.control + builtin.Char.Class.control : Class + + 81. -- ##Char.Class.is + builtin.Char.Class.is : Class -> Char -> Boolean + + 82. -- ##Char.Class.letter + builtin.Char.Class.letter : Class + + 83. -- ##Char.Class.lower + builtin.Char.Class.lower : Class + + 84. -- ##Char.Class.mark + builtin.Char.Class.mark : Class + + 85. -- ##Char.Class.not + builtin.Char.Class.not : Class -> Class + + 86. -- ##Char.Class.number + builtin.Char.Class.number : Class + + 87. -- ##Char.Class.or + builtin.Char.Class.or : Class -> Class -> Class + + 88. -- ##Char.Class.printable + builtin.Char.Class.printable : Class + + 89. -- ##Char.Class.punctuation + builtin.Char.Class.punctuation : Class + + 90. -- ##Char.Class.range + builtin.Char.Class.range : Char -> Char -> Class + + 91. -- ##Char.Class.separator + builtin.Char.Class.separator : Class + + 92. -- ##Char.Class.symbol + builtin.Char.Class.symbol : Class + + 93. -- ##Char.Class.upper + builtin.Char.Class.upper : Class + + 94. -- ##Char.Class.whitespace + builtin.Char.Class.whitespace : Class + + 95. -- ##Char.fromNat builtin.Char.fromNat : Nat -> Char - 76. -- ##Char.toNat + 96. -- ##Char.toNat builtin.Char.toNat : Char -> Nat - 77. -- ##Char.toText + 97. -- ##Char.toText builtin.Char.toText : Char -> Text - 78. -- ##Code + 98. -- ##Code builtin type builtin.Code - 79. -- ##Code.cache_ + 99. -- ##Code.cache_ builtin.Code.cache_ : [(Link.Term, Code)] ->{IO} [Link.Term] - 80. -- ##Code.dependencies + 100. -- ##Code.dependencies builtin.Code.dependencies : Code -> [Link.Term] - 81. -- ##Code.deserialize + 101. -- ##Code.deserialize builtin.Code.deserialize : Bytes -> Either Text Code - 82. -- ##Code.display + 102. -- ##Code.display builtin.Code.display : Text -> Code -> Text - 83. -- ##Code.isMissing + 103. -- ##Code.isMissing builtin.Code.isMissing : Link.Term ->{IO} Boolean - 84. -- ##Code.lookup + 104. -- ##Code.lookup builtin.Code.lookup : Link.Term ->{IO} Optional Code - 85. -- ##Code.serialize + 105. -- ##Code.serialize builtin.Code.serialize : Code -> Bytes - 86. -- ##Code.validate + 106. -- ##Code.validate builtin.Code.validate : [(Link.Term, Code)] ->{IO} Optional Failure - 87. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0 + 107. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0 unique type builtin.ConsoleText - 88. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#5 + 108. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#5 builtin.ConsoleText.Background : Color -> ConsoleText -> ConsoleText - 89. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#0 + 109. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#0 builtin.ConsoleText.Bold : ConsoleText -> ConsoleText - 90. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#4 + 110. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#4 builtin.ConsoleText.Foreground : Color -> ConsoleText -> ConsoleText - 91. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#2 + 111. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#2 builtin.ConsoleText.Invert : ConsoleText -> ConsoleText - 92. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#3 + 112. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#3 builtin.ConsoleText.Plain : Text -> ConsoleText - 93. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#1 + 113. -- #ldqsht5qvddaabskcad3idka4nqkv6lfncrp0s0o4rqbbnk1qvq269bueu7qobhvaf7gpluqtpn9bgp9u69jsntv0u6o4qtbktnfrs0#1 builtin.ConsoleText.Underline : ConsoleText -> ConsoleText - 94. -- #pgornst1pqaea8qmf8ckbtvrm7f6hn49djhffgebajmo12faf4jku63ftc9fp0r4k58e0qcdi77g08f34b2ihvsu97s48du6mfn7vko + 114. -- #pgornst1pqaea8qmf8ckbtvrm7f6hn49djhffgebajmo12faf4jku63ftc9fp0r4k58e0qcdi77g08f34b2ihvsu97s48du6mfn7vko unique type builtin.CopyrightHolder - 95. -- #pgornst1pqaea8qmf8ckbtvrm7f6hn49djhffgebajmo12faf4jku63ftc9fp0r4k58e0qcdi77g08f34b2ihvsu97s48du6mfn7vko#0 + 115. -- #pgornst1pqaea8qmf8ckbtvrm7f6hn49djhffgebajmo12faf4jku63ftc9fp0r4k58e0qcdi77g08f34b2ihvsu97s48du6mfn7vko#0 builtin.CopyrightHolder.CopyrightHolder : GUID -> Text -> CopyrightHolder - 96. -- #9jpkv5bb0d680ffs4f2j4lntj54m1iq9kaei8foqv5973i04jq9fugbn9msmpeiorjh4umhdeak625u53hejkvkm3buruj33msd1p6g + 116. -- #9jpkv5bb0d680ffs4f2j4lntj54m1iq9kaei8foqv5973i04jq9fugbn9msmpeiorjh4umhdeak625u53hejkvkm3buruj33msd1p6g builtin.CopyrightHolder.guid : CopyrightHolder -> GUID - 97. -- #6fhjsi02lnhvotndl6ufqnnsv20f3b9b4eg45n0rgo96m8f21dpqe5erb2dtn9nhdlp028vkock07r0foqune3jojhcrnmti9srsmdg + 117. -- #6fhjsi02lnhvotndl6ufqnnsv20f3b9b4eg45n0rgo96m8f21dpqe5erb2dtn9nhdlp028vkock07r0foqune3jojhcrnmti9srsmdg builtin.CopyrightHolder.guid.modify : (GUID ->{g} GUID) -> CopyrightHolder ->{g} CopyrightHolder - 98. -- #1lk04okan4prc9kkh7julshv5l2q331pa5tf5f0ghm7ob5vkep3t6dnqejc8aju4i2vob6b5seliccer3a1kmtq4481i36alivhgdr0 + 118. -- #1lk04okan4prc9kkh7julshv5l2q331pa5tf5f0ghm7ob5vkep3t6dnqejc8aju4i2vob6b5seliccer3a1kmtq4481i36alivhgdr0 builtin.CopyrightHolder.guid.set : GUID -> CopyrightHolder -> CopyrightHolder - 99. -- #u1k741o71gg743tr5o7fc3joeqdm14qkd58cf2h2tmkpejr2uj3qhclvugqsgoighd7o4ijlrp17i6iadgsuhhhb56vi4j22i6c2lbo + 119. -- #u1k741o71gg743tr5o7fc3joeqdm14qkd58cf2h2tmkpejr2uj3qhclvugqsgoighd7o4ijlrp17i6iadgsuhhhb56vi4j22i6c2lbo builtin.CopyrightHolder.name : CopyrightHolder -> Text - 100. -- #3845ei99ci6p7dh3bcsctodd0otjtsntik5n0q7fpafo3s7v45a8nl7mk6ae7qot87jr9p4q3857tm4jtvmkb4s3rtn77t7goaphmf8 + 120. -- #3845ei99ci6p7dh3bcsctodd0otjtsntik5n0q7fpafo3s7v45a8nl7mk6ae7qot87jr9p4q3857tm4jtvmkb4s3rtn77t7goaphmf8 builtin.CopyrightHolder.name.modify : (Text ->{g} Text) -> CopyrightHolder ->{g} CopyrightHolder - 101. -- #2ehufgpsgnd2jq0i1topsir6dvv2m132dp2phs2bncnm6n9qrf7oaod6pbmvs9muihlq9dckpnughb3pajrmit7chdr67qco6tsd8j0 + 121. -- #2ehufgpsgnd2jq0i1topsir6dvv2m132dp2phs2bncnm6n9qrf7oaod6pbmvs9muihlq9dckpnughb3pajrmit7chdr67qco6tsd8j0 builtin.CopyrightHolder.name.set : Text -> CopyrightHolder -> CopyrightHolder - 102. -- ##crypto.hash + 122. -- ##crypto.hash builtin.crypto.hash : HashAlgorithm -> a -> Bytes - 103. -- ##crypto.HashAlgorithm + 123. -- ##crypto.HashAlgorithm builtin type builtin.crypto.HashAlgorithm - 104. -- ##crypto.HashAlgorithm.Blake2b_256 + 124. -- ##crypto.HashAlgorithm.Blake2b_256 builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm - 105. -- ##crypto.HashAlgorithm.Blake2b_512 + 125. -- ##crypto.HashAlgorithm.Blake2b_512 builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm - 106. -- ##crypto.HashAlgorithm.Blake2s_256 + 126. -- ##crypto.HashAlgorithm.Blake2s_256 builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 107. -- ##crypto.HashAlgorithm.Sha1 + 127. -- ##crypto.HashAlgorithm.Sha1 builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm - 108. -- ##crypto.HashAlgorithm.Sha2_256 + 128. -- ##crypto.HashAlgorithm.Sha2_256 builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 109. -- ##crypto.HashAlgorithm.Sha2_512 + 129. -- ##crypto.HashAlgorithm.Sha2_512 builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 110. -- ##crypto.HashAlgorithm.Sha3_256 + 130. -- ##crypto.HashAlgorithm.Sha3_256 builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 111. -- ##crypto.HashAlgorithm.Sha3_512 + 131. -- ##crypto.HashAlgorithm.Sha3_512 builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 112. -- ##crypto.hashBytes + 132. -- ##crypto.hashBytes builtin.crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 113. -- ##crypto.hmac + 133. -- ##crypto.hmac builtin.crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 114. -- ##crypto.hmacBytes + 134. -- ##crypto.hmacBytes builtin.crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 115. -- ##Debug.toText + 135. -- ##Debug.toText builtin.Debug.toText : a -> Optional (Either Text Text) - 116. -- ##Debug.trace + 136. -- ##Debug.trace builtin.Debug.trace : Text -> a -> () - 117. -- ##Debug.watch + 137. -- ##Debug.watch builtin.Debug.watch : Text -> a -> a - 118. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8 + 138. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8 unique type builtin.Doc - 119. -- #baiqeiovdrs4ju0grn5q5akq64k4kuhgifqno52smkkttqg31jkgm3qa9o3ohe54fgpiigd1tj0an7rfveopfg622sjj9v9g44n27go + 139. -- #baiqeiovdrs4ju0grn5q5akq64k4kuhgifqno52smkkttqg31jkgm3qa9o3ohe54fgpiigd1tj0an7rfveopfg622sjj9v9g44n27go builtin.Doc.++ : Doc2 -> Doc2 -> Doc2 - 120. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#0 + 140. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#0 builtin.Doc.Blob : Text -> Doc - 121. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#4 + 141. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#4 builtin.Doc.Evaluate : Link.Term -> Doc - 122. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#5 + 142. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#5 builtin.Doc.Join : [Doc] -> Doc - 123. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#1 + 143. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#1 builtin.Doc.Link : Link -> Doc - 124. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#3 + 144. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#3 builtin.Doc.Signature : Link.Term -> Doc - 125. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#2 + 145. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#2 builtin.Doc.Source : Link -> Doc - 126. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0 + 146. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0 unique type builtin.Doc2 - 127. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#27 + 147. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#27 builtin.Doc2.Anchor : Text -> Doc2 -> Doc2 - 128. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#11 + 148. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#11 builtin.Doc2.Aside : Doc2 -> Doc2 - 129. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#15 + 149. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#15 builtin.Doc2.Blankline : Doc2 - 130. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#10 + 150. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#10 builtin.Doc2.Blockquote : Doc2 -> Doc2 - 131. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#7 + 151. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#7 builtin.Doc2.Bold : Doc2 -> Doc2 - 132. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#21 + 152. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#21 builtin.Doc2.BulletedList : [Doc2] -> Doc2 - 133. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#3 + 153. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#3 builtin.Doc2.Callout : Optional Doc2 -> Doc2 -> Doc2 - 134. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#6 + 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#6 builtin.Doc2.Code : Doc2 -> Doc2 - 135. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#25 + 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#25 builtin.Doc2.CodeBlock : Text -> Doc2 -> Doc2 - 136. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#24 + 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#24 builtin.Doc2.Column : [Doc2] -> Doc2 - 137. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#0 + 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#0 builtin.Doc2.Folded : Boolean -> Doc2 -> Doc2 -> Doc2 - 138. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68 + 158. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68 unique type builtin.Doc2.FrontMatter - 139. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68#0 + 159. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68#0 builtin.Doc2.FrontMatter.FrontMatter : [(Text, Text)] -> FrontMatter - 140. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#12 + 160. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#12 builtin.Doc2.Group : Doc2 -> Doc2 - 141. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#14 + 161. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#14 builtin.Doc2.Image : Doc2 -> Doc2 -> Optional Doc2 -> Doc2 - 142. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#8 + 162. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#8 builtin.Doc2.Italic : Doc2 -> Doc2 - 143. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 + 163. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 builtin.Doc2.Join : [Doc2] -> Doc2 - 144. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto + 164. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto unique type builtin.Doc2.LaTeXInline - 145. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto#0 + 165. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto#0 builtin.Doc2.LaTeXInline.LaTeXInline : Text -> LaTeXInline - 146. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 + 166. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 builtin.Doc2.Linebreak : Doc2 - 147. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 + 167. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 unique type builtin.Doc2.MediaSource - 148. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 + 168. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 builtin.Doc2.MediaSource.MediaSource : Text -> Optional Text -> MediaSource - 149. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so + 169. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so builtin.Doc2.MediaSource.mimeType : MediaSource -> Optional Text - 150. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg + 170. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg builtin.Doc2.MediaSource.mimeType.modify : (Optional Text ->{g} Optional Text) -> MediaSource ->{g} MediaSource - 151. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 + 171. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 builtin.Doc2.MediaSource.mimeType.set : Optional Text -> MediaSource -> MediaSource - 152. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg + 172. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg builtin.Doc2.MediaSource.sourceUrl : MediaSource -> Text - 153. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 + 173. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 builtin.Doc2.MediaSource.sourceUrl.modify : (Text ->{g} Text) -> MediaSource ->{g} MediaSource - 154. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo + 174. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo builtin.Doc2.MediaSource.sourceUrl.set : Text -> MediaSource -> MediaSource - 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 + 175. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 builtin.Doc2.NamedLink : Doc2 -> Doc2 -> Doc2 - 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 + 176. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 builtin.Doc2.NumberedList : Nat -> [Doc2] -> Doc2 - 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 + 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 builtin.Doc2.Paragraph : [Doc2] -> Doc2 - 158. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 + 178. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 builtin.Doc2.Section : Doc2 -> [Doc2] -> Doc2 - 159. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 + 179. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 builtin.Doc2.SectionBreak : Doc2 - 160. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 + 180. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 builtin.Doc2.Special : SpecialForm -> Doc2 - 161. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 + 181. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 unique type builtin.Doc2.SpecialForm - 162. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 + 182. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 builtin.Doc2.SpecialForm.Embed : Any -> SpecialForm - 163. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 + 183. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 builtin.Doc2.SpecialForm.EmbedInline : Any -> SpecialForm - 164. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 + 184. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 builtin.Doc2.SpecialForm.Eval : Doc2.Term -> SpecialForm - 165. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 + 185. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 builtin.Doc2.SpecialForm.EvalInline : Doc2.Term -> SpecialForm - 166. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 + 186. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 builtin.Doc2.SpecialForm.Example : Nat -> Doc2.Term -> SpecialForm - 167. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 + 187. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 builtin.Doc2.SpecialForm.ExampleBlock : Nat -> Doc2.Term -> SpecialForm - 168. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 + 188. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 builtin.Doc2.SpecialForm.FoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 169. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 + 189. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 builtin.Doc2.SpecialForm.Link : Either Type Doc2.Term -> SpecialForm - 170. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 + 190. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 builtin.Doc2.SpecialForm.Signature : [Doc2.Term] -> SpecialForm - 171. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 + 191. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 builtin.Doc2.SpecialForm.SignatureInline : Doc2.Term -> SpecialForm - 172. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 + 192. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 builtin.Doc2.SpecialForm.Source : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 173. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 + 193. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 builtin.Doc2.Strikethrough : Doc2 -> Doc2 - 174. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 + 194. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 builtin.Doc2.Style : Text -> Doc2 -> Doc2 - 175. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg + 195. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg unique type builtin.Doc2.Svg - 176. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg#0 + 196. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg#0 builtin.Doc2.Svg.Svg : Text -> Svg - 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 + 197. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 builtin.Doc2.Table : [[Doc2]] -> Doc2 - 178. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg + 198. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg unique type builtin.Doc2.Term - 179. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 + 199. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 builtin.Doc2.term : '{g} a -> Doc2.Term - 180. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 + 200. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 builtin.Doc2.Term.Term : Any -> Doc2.Term - 181. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 + 201. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 builtin.Doc2.Tooltip : Doc2 -> Doc2 -> Doc2 - 182. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 + 202. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 builtin.Doc2.UntitledSection : [Doc2] -> Doc2 - 183. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 + 203. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 unique type builtin.Doc2.Video - 184. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 + 204. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 builtin.Doc2.Video.config : Video -> [(Text, Text)] - 185. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g + 205. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g builtin.Doc2.Video.config.modify : ([(Text, Text)] ->{g} [(Text, Text)]) -> Video ->{g} Video - 186. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 + 206. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 builtin.Doc2.Video.config.set : [(Text, Text)] -> Video -> Video - 187. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o + 207. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o builtin.Doc2.Video.sources : Video -> [MediaSource] - 188. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo + 208. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo builtin.Doc2.Video.sources.modify : ([MediaSource] ->{g} [MediaSource]) -> Video ->{g} Video - 189. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 + 209. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 builtin.Doc2.Video.sources.set : [MediaSource] -> Video -> Video - 190. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 + 210. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 builtin.Doc2.Video.Video : [MediaSource] -> [(Text, Text)] -> Video - 191. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 + 211. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 builtin.Doc2.Word : Text -> Doc2 - 192. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 + 212. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 structural type builtin.Either a b - 193. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 + 213. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 builtin.Either.Left : a -> Either a b - 194. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g + 214. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g builtin.Either.mapRight : (a ->{g} b) -> Either e a ->{g} Either e b - 195. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 + 215. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 builtin.Either.Right : b -> Either a b - 196. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 216. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability builtin.Exception structural ability Exception - 197. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 217. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 builtin.Exception.raise, Exception.raise : Failure ->{Exception} x - 198. -- ##Float + 218. -- ##Float builtin type builtin.Float - 199. -- ##Float.* + 219. -- ##Float.* builtin.Float.* : Float -> Float -> Float - 200. -- ##Float.+ + 220. -- ##Float.+ builtin.Float.+ : Float -> Float -> Float - 201. -- ##Float.- + 221. -- ##Float.- builtin.Float.- : Float -> Float -> Float - 202. -- ##Float./ + 222. -- ##Float./ builtin.Float./ : Float -> Float -> Float - 203. -- ##Float.abs + 223. -- ##Float.abs builtin.Float.abs : Float -> Float - 204. -- ##Float.acos + 224. -- ##Float.acos builtin.Float.acos : Float -> Float - 205. -- ##Float.acosh + 225. -- ##Float.acosh builtin.Float.acosh : Float -> Float - 206. -- ##Float.asin + 226. -- ##Float.asin builtin.Float.asin : Float -> Float - 207. -- ##Float.asinh + 227. -- ##Float.asinh builtin.Float.asinh : Float -> Float - 208. -- ##Float.atan + 228. -- ##Float.atan builtin.Float.atan : Float -> Float - 209. -- ##Float.atan2 + 229. -- ##Float.atan2 builtin.Float.atan2 : Float -> Float -> Float - 210. -- ##Float.atanh + 230. -- ##Float.atanh builtin.Float.atanh : Float -> Float - 211. -- ##Float.ceiling + 231. -- ##Float.ceiling builtin.Float.ceiling : Float -> Int - 212. -- ##Float.cos + 232. -- ##Float.cos builtin.Float.cos : Float -> Float - 213. -- ##Float.cosh + 233. -- ##Float.cosh builtin.Float.cosh : Float -> Float - 214. -- ##Float.== + 234. -- ##Float.== builtin.Float.eq : Float -> Float -> Boolean - 215. -- ##Float.exp + 235. -- ##Float.exp builtin.Float.exp : Float -> Float - 216. -- ##Float.floor + 236. -- ##Float.floor builtin.Float.floor : Float -> Int - 217. -- ##Float.fromRepresentation + 237. -- ##Float.fromRepresentation builtin.Float.fromRepresentation : Nat -> Float - 218. -- ##Float.fromText + 238. -- ##Float.fromText builtin.Float.fromText : Text -> Optional Float - 219. -- ##Float.> + 239. -- ##Float.> builtin.Float.gt : Float -> Float -> Boolean - 220. -- ##Float.>= + 240. -- ##Float.>= builtin.Float.gteq : Float -> Float -> Boolean - 221. -- ##Float.log + 241. -- ##Float.log builtin.Float.log : Float -> Float - 222. -- ##Float.logBase + 242. -- ##Float.logBase builtin.Float.logBase : Float -> Float -> Float - 223. -- ##Float.< + 243. -- ##Float.< builtin.Float.lt : Float -> Float -> Boolean - 224. -- ##Float.<= + 244. -- ##Float.<= builtin.Float.lteq : Float -> Float -> Boolean - 225. -- ##Float.max + 245. -- ##Float.max builtin.Float.max : Float -> Float -> Float - 226. -- ##Float.min + 246. -- ##Float.min builtin.Float.min : Float -> Float -> Float - 227. -- ##Float.pow + 247. -- ##Float.pow builtin.Float.pow : Float -> Float -> Float - 228. -- ##Float.round + 248. -- ##Float.round builtin.Float.round : Float -> Int - 229. -- ##Float.sin + 249. -- ##Float.sin builtin.Float.sin : Float -> Float - 230. -- ##Float.sinh + 250. -- ##Float.sinh builtin.Float.sinh : Float -> Float - 231. -- ##Float.sqrt + 251. -- ##Float.sqrt builtin.Float.sqrt : Float -> Float - 232. -- ##Float.tan + 252. -- ##Float.tan builtin.Float.tan : Float -> Float - 233. -- ##Float.tanh + 253. -- ##Float.tanh builtin.Float.tanh : Float -> Float - 234. -- ##Float.toRepresentation + 254. -- ##Float.toRepresentation builtin.Float.toRepresentation : Float -> Nat - 235. -- ##Float.toText + 255. -- ##Float.toText builtin.Float.toText : Float -> Text - 236. -- ##Float.truncate + 256. -- ##Float.truncate builtin.Float.truncate : Float -> Int - 237. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 + 257. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 unique type builtin.GUID - 238. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 + 258. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 builtin.GUID.GUID : Bytes -> GUID - 239. -- ##Handle.toText + 259. -- ##Handle.toText builtin.Handle.toText : Handle -> Text - 240. -- ##ImmutableArray + 260. -- ##ImmutableArray builtin type builtin.ImmutableArray - 241. -- ##ImmutableArray.copyTo! + 261. -- ##ImmutableArray.copyTo! builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray a @@ -819,18 +879,18 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 242. -- ##ImmutableArray.read + 262. -- ##ImmutableArray.read builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 243. -- ##ImmutableArray.size + 263. -- ##ImmutableArray.size builtin.ImmutableArray.size : ImmutableArray a -> Nat - 244. -- ##ImmutableByteArray + 264. -- ##ImmutableByteArray builtin type builtin.ImmutableByteArray - 245. -- ##ImmutableByteArray.copyTo! + 265. -- ##ImmutableByteArray.copyTo! builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -838,864 +898,864 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 246. -- ##ImmutableByteArray.read16be + 266. -- ##ImmutableByteArray.read16be builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 247. -- ##ImmutableByteArray.read24be + 267. -- ##ImmutableByteArray.read24be builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 248. -- ##ImmutableByteArray.read32be + 268. -- ##ImmutableByteArray.read32be builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 249. -- ##ImmutableByteArray.read40be + 269. -- ##ImmutableByteArray.read40be builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 250. -- ##ImmutableByteArray.read64be + 270. -- ##ImmutableByteArray.read64be builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 251. -- ##ImmutableByteArray.read8 + 271. -- ##ImmutableByteArray.read8 builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 252. -- ##ImmutableByteArray.size + 272. -- ##ImmutableByteArray.size builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 253. -- ##Int + 273. -- ##Int builtin type builtin.Int - 254. -- ##Int.* + 274. -- ##Int.* builtin.Int.* : Int -> Int -> Int - 255. -- ##Int.+ + 275. -- ##Int.+ builtin.Int.+ : Int -> Int -> Int - 256. -- ##Int.- + 276. -- ##Int.- builtin.Int.- : Int -> Int -> Int - 257. -- ##Int./ + 277. -- ##Int./ builtin.Int./ : Int -> Int -> Int - 258. -- ##Int.and + 278. -- ##Int.and builtin.Int.and : Int -> Int -> Int - 259. -- ##Int.complement + 279. -- ##Int.complement builtin.Int.complement : Int -> Int - 260. -- ##Int.== + 280. -- ##Int.== builtin.Int.eq : Int -> Int -> Boolean - 261. -- ##Int.fromRepresentation + 281. -- ##Int.fromRepresentation builtin.Int.fromRepresentation : Nat -> Int - 262. -- ##Int.fromText + 282. -- ##Int.fromText builtin.Int.fromText : Text -> Optional Int - 263. -- ##Int.> + 283. -- ##Int.> builtin.Int.gt : Int -> Int -> Boolean - 264. -- ##Int.>= + 284. -- ##Int.>= builtin.Int.gteq : Int -> Int -> Boolean - 265. -- ##Int.increment + 285. -- ##Int.increment builtin.Int.increment : Int -> Int - 266. -- ##Int.isEven + 286. -- ##Int.isEven builtin.Int.isEven : Int -> Boolean - 267. -- ##Int.isOdd + 287. -- ##Int.isOdd builtin.Int.isOdd : Int -> Boolean - 268. -- ##Int.leadingZeros + 288. -- ##Int.leadingZeros builtin.Int.leadingZeros : Int -> Nat - 269. -- ##Int.< + 289. -- ##Int.< builtin.Int.lt : Int -> Int -> Boolean - 270. -- ##Int.<= + 290. -- ##Int.<= builtin.Int.lteq : Int -> Int -> Boolean - 271. -- ##Int.mod + 291. -- ##Int.mod builtin.Int.mod : Int -> Int -> Int - 272. -- ##Int.negate + 292. -- ##Int.negate builtin.Int.negate : Int -> Int - 273. -- ##Int.or + 293. -- ##Int.or builtin.Int.or : Int -> Int -> Int - 274. -- ##Int.popCount + 294. -- ##Int.popCount builtin.Int.popCount : Int -> Nat - 275. -- ##Int.pow + 295. -- ##Int.pow builtin.Int.pow : Int -> Nat -> Int - 276. -- ##Int.shiftLeft + 296. -- ##Int.shiftLeft builtin.Int.shiftLeft : Int -> Nat -> Int - 277. -- ##Int.shiftRight + 297. -- ##Int.shiftRight builtin.Int.shiftRight : Int -> Nat -> Int - 278. -- ##Int.signum + 298. -- ##Int.signum builtin.Int.signum : Int -> Int - 279. -- ##Int.toFloat + 299. -- ##Int.toFloat builtin.Int.toFloat : Int -> Float - 280. -- ##Int.toRepresentation + 300. -- ##Int.toRepresentation builtin.Int.toRepresentation : Int -> Nat - 281. -- ##Int.toText + 301. -- ##Int.toText builtin.Int.toText : Int -> Text - 282. -- ##Int.trailingZeros + 302. -- ##Int.trailingZeros builtin.Int.trailingZeros : Int -> Nat - 283. -- ##Int.truncate0 + 303. -- ##Int.truncate0 builtin.Int.truncate0 : Int -> Nat - 284. -- ##Int.xor + 304. -- ##Int.xor builtin.Int.xor : Int -> Int -> Int - 285. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 + 305. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 unique type builtin.io2.ArithmeticFailure - 286. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag + 306. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag unique type builtin.io2.ArrayFailure - 287. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 + 307. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 unique type builtin.io2.BufferMode - 288. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 + 308. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 builtin.io2.BufferMode.BlockBuffering : BufferMode - 289. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 + 309. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 builtin.io2.BufferMode.LineBuffering : BufferMode - 290. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 + 310. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 builtin.io2.BufferMode.NoBuffering : BufferMode - 291. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 + 311. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 292. -- ##Clock.internals.monotonic.v1 + 312. -- ##Clock.internals.monotonic.v1 builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 293. -- ##Clock.internals.nsec.v1 + 313. -- ##Clock.internals.nsec.v1 builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 294. -- ##Clock.internals.processCPUTime.v1 + 314. -- ##Clock.internals.processCPUTime.v1 builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 295. -- ##Clock.internals.realtime.v1 + 315. -- ##Clock.internals.realtime.v1 builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 296. -- ##Clock.internals.sec.v1 + 316. -- ##Clock.internals.sec.v1 builtin.io2.Clock.internals.sec : TimeSpec -> Int - 297. -- ##Clock.internals.threadCPUTime.v1 + 317. -- ##Clock.internals.threadCPUTime.v1 builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 298. -- ##TimeSpec + 318. -- ##TimeSpec builtin type builtin.io2.Clock.internals.TimeSpec - 299. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 + 319. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 unique type builtin.io2.Failure - 300. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 + 320. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 301. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 + 321. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 unique type builtin.io2.FileMode - 302. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 + 322. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 builtin.io2.FileMode.Append : FileMode - 303. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 + 323. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 builtin.io2.FileMode.Read : FileMode - 304. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 + 324. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 builtin.io2.FileMode.ReadWrite : FileMode - 305. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 + 325. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 builtin.io2.FileMode.Write : FileMode - 306. -- ##Handle + 326. -- ##Handle builtin type builtin.io2.Handle - 307. -- ##IO + 327. -- ##IO builtin type builtin.io2.IO - 308. -- ##IO.array + 328. -- ##IO.array builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 309. -- ##IO.arrayOf + 329. -- ##IO.arrayOf builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 310. -- ##IO.bytearray + 330. -- ##IO.bytearray builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 311. -- ##IO.bytearrayOf + 331. -- ##IO.bytearrayOf builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 312. -- ##IO.clientSocket.impl.v3 + 332. -- ##IO.clientSocket.impl.v3 builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 313. -- ##IO.closeFile.impl.v3 + 333. -- ##IO.closeFile.impl.v3 builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 314. -- ##IO.closeSocket.impl.v3 + 334. -- ##IO.closeSocket.impl.v3 builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 315. -- ##IO.createDirectory.impl.v3 + 335. -- ##IO.createDirectory.impl.v3 builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 316. -- ##IO.createTempDirectory.impl.v3 + 336. -- ##IO.createTempDirectory.impl.v3 builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 317. -- ##IO.delay.impl.v3 + 337. -- ##IO.delay.impl.v3 builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 318. -- ##IO.directoryContents.impl.v3 + 338. -- ##IO.directoryContents.impl.v3 builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 319. -- ##IO.fileExists.impl.v3 + 339. -- ##IO.fileExists.impl.v3 builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 320. -- ##IO.forkComp.v2 + 340. -- ##IO.forkComp.v2 builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 321. -- ##IO.getArgs.impl.v1 + 341. -- ##IO.getArgs.impl.v1 builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 322. -- ##IO.getBuffering.impl.v3 + 342. -- ##IO.getBuffering.impl.v3 builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 323. -- ##IO.getBytes.impl.v3 + 343. -- ##IO.getBytes.impl.v3 builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 324. -- ##IO.getChar.impl.v1 + 344. -- ##IO.getChar.impl.v1 builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 325. -- ##IO.getCurrentDirectory.impl.v3 + 345. -- ##IO.getCurrentDirectory.impl.v3 builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 326. -- ##IO.getEcho.impl.v1 + 346. -- ##IO.getEcho.impl.v1 builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 327. -- ##IO.getEnv.impl.v1 + 347. -- ##IO.getEnv.impl.v1 builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 328. -- ##IO.getFileSize.impl.v3 + 348. -- ##IO.getFileSize.impl.v3 builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 329. -- ##IO.getFileTimestamp.impl.v3 + 349. -- ##IO.getFileTimestamp.impl.v3 builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 330. -- ##IO.getLine.impl.v1 + 350. -- ##IO.getLine.impl.v1 builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 331. -- ##IO.getSomeBytes.impl.v1 + 351. -- ##IO.getSomeBytes.impl.v1 builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 332. -- ##IO.getTempDirectory.impl.v3 + 352. -- ##IO.getTempDirectory.impl.v3 builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 333. -- ##IO.handlePosition.impl.v3 + 353. -- ##IO.handlePosition.impl.v3 builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 334. -- ##IO.isDirectory.impl.v3 + 354. -- ##IO.isDirectory.impl.v3 builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 335. -- ##IO.isFileEOF.impl.v3 + 355. -- ##IO.isFileEOF.impl.v3 builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 336. -- ##IO.isFileOpen.impl.v3 + 356. -- ##IO.isFileOpen.impl.v3 builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 337. -- ##IO.isSeekable.impl.v3 + 357. -- ##IO.isSeekable.impl.v3 builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 338. -- ##IO.kill.impl.v3 + 358. -- ##IO.kill.impl.v3 builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 339. -- ##IO.listen.impl.v3 + 359. -- ##IO.listen.impl.v3 builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 340. -- ##IO.openFile.impl.v3 + 360. -- ##IO.openFile.impl.v3 builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 341. -- ##IO.process.call + 361. -- ##IO.process.call builtin.io2.IO.process.call : Text -> [Text] ->{IO} Nat - 342. -- ##IO.process.exitCode + 362. -- ##IO.process.exitCode builtin.io2.IO.process.exitCode : ProcessHandle ->{IO} Optional Nat - 343. -- ##IO.process.kill + 363. -- ##IO.process.kill builtin.io2.IO.process.kill : ProcessHandle ->{IO} () - 344. -- ##IO.process.start + 364. -- ##IO.process.start builtin.io2.IO.process.start : Text -> [Text] ->{IO} (Handle, Handle, Handle, ProcessHandle) - 345. -- ##IO.process.wait + 365. -- ##IO.process.wait builtin.io2.IO.process.wait : ProcessHandle ->{IO} Nat - 346. -- ##IO.putBytes.impl.v3 + 366. -- ##IO.putBytes.impl.v3 builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 347. -- ##IO.ready.impl.v1 + 367. -- ##IO.ready.impl.v1 builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 348. -- ##IO.ref + 368. -- ##IO.ref builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 349. -- ##IO.removeDirectory.impl.v3 + 369. -- ##IO.removeDirectory.impl.v3 builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 350. -- ##IO.removeFile.impl.v3 + 370. -- ##IO.removeFile.impl.v3 builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 351. -- ##IO.renameDirectory.impl.v3 + 371. -- ##IO.renameDirectory.impl.v3 builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 352. -- ##IO.renameFile.impl.v3 + 372. -- ##IO.renameFile.impl.v3 builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 353. -- ##IO.seekHandle.impl.v3 + 373. -- ##IO.seekHandle.impl.v3 builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 354. -- ##IO.serverSocket.impl.v3 + 374. -- ##IO.serverSocket.impl.v3 builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 355. -- ##IO.setBuffering.impl.v3 + 375. -- ##IO.setBuffering.impl.v3 builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 356. -- ##IO.setCurrentDirectory.impl.v3 + 376. -- ##IO.setCurrentDirectory.impl.v3 builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 357. -- ##IO.setEcho.impl.v1 + 377. -- ##IO.setEcho.impl.v1 builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 358. -- ##IO.socketAccept.impl.v3 + 378. -- ##IO.socketAccept.impl.v3 builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 359. -- ##IO.socketPort.impl.v3 + 379. -- ##IO.socketPort.impl.v3 builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 360. -- ##IO.socketReceive.impl.v3 + 380. -- ##IO.socketReceive.impl.v3 builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 361. -- ##IO.socketSend.impl.v3 + 381. -- ##IO.socketSend.impl.v3 builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 362. -- ##IO.stdHandle + 382. -- ##IO.stdHandle builtin.io2.IO.stdHandle : StdHandle -> Handle - 363. -- ##IO.systemTime.impl.v3 + 383. -- ##IO.systemTime.impl.v3 builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 364. -- ##IO.systemTimeMicroseconds.v1 + 384. -- ##IO.systemTimeMicroseconds.v1 builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 365. -- ##IO.tryEval + 385. -- ##IO.tryEval builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 366. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 + 386. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 unique type builtin.io2.IOError - 367. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 + 387. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 builtin.io2.IOError.AlreadyExists : IOError - 368. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 + 388. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 builtin.io2.IOError.EOF : IOError - 369. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 + 389. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 builtin.io2.IOError.IllegalOperation : IOError - 370. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 + 390. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 builtin.io2.IOError.NoSuchThing : IOError - 371. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 + 391. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 builtin.io2.IOError.PermissionDenied : IOError - 372. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 + 392. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 builtin.io2.IOError.ResourceBusy : IOError - 373. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 + 393. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 builtin.io2.IOError.ResourceExhausted : IOError - 374. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 + 394. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 builtin.io2.IOError.UserError : IOError - 375. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g + 395. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g unique type builtin.io2.IOFailure - 376. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg + 396. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg unique type builtin.io2.MiscFailure - 377. -- ##MVar + 397. -- ##MVar builtin type builtin.io2.MVar - 378. -- ##MVar.isEmpty + 398. -- ##MVar.isEmpty builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 379. -- ##MVar.new + 399. -- ##MVar.new builtin.io2.MVar.new : a ->{IO} MVar a - 380. -- ##MVar.newEmpty.v2 + 400. -- ##MVar.newEmpty.v2 builtin.io2.MVar.newEmpty : '{IO} MVar a - 381. -- ##MVar.put.impl.v3 + 401. -- ##MVar.put.impl.v3 builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 382. -- ##MVar.read.impl.v3 + 402. -- ##MVar.read.impl.v3 builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 383. -- ##MVar.swap.impl.v3 + 403. -- ##MVar.swap.impl.v3 builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 384. -- ##MVar.take.impl.v3 + 404. -- ##MVar.take.impl.v3 builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 385. -- ##MVar.tryPut.impl.v3 + 405. -- ##MVar.tryPut.impl.v3 builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 386. -- ##MVar.tryRead.impl.v3 + 406. -- ##MVar.tryRead.impl.v3 builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 387. -- ##MVar.tryTake + 407. -- ##MVar.tryTake builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 388. -- ##ProcessHandle + 408. -- ##ProcessHandle builtin type builtin.io2.ProcessHandle - 389. -- ##Promise + 409. -- ##Promise builtin type builtin.io2.Promise - 390. -- ##Promise.new + 410. -- ##Promise.new builtin.io2.Promise.new : '{IO} Promise a - 391. -- ##Promise.read + 411. -- ##Promise.read builtin.io2.Promise.read : Promise a ->{IO} a - 392. -- ##Promise.tryRead + 412. -- ##Promise.tryRead builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 393. -- ##Promise.write + 413. -- ##Promise.write builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 394. -- ##Ref.cas + 414. -- ##Ref.cas builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 395. -- ##Ref.readForCas + 415. -- ##Ref.readForCas builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 396. -- ##Ref.Ticket + 416. -- ##Ref.Ticket builtin type builtin.io2.Ref.Ticket - 397. -- ##Ref.Ticket.read + 417. -- ##Ref.Ticket.read builtin.io2.Ref.Ticket.read : Ticket a -> a - 398. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 + 418. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 unique type builtin.io2.RuntimeFailure - 399. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 + 419. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 unique type builtin.io2.SeekMode - 400. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 + 420. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 401. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 + 421. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 builtin.io2.SeekMode.RelativeSeek : SeekMode - 402. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 + 422. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 builtin.io2.SeekMode.SeekFromEnd : SeekMode - 403. -- ##Socket + 423. -- ##Socket builtin type builtin.io2.Socket - 404. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 + 424. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 unique type builtin.io2.StdHandle - 405. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 + 425. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 builtin.io2.StdHandle.StdErr : StdHandle - 406. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 + 426. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 builtin.io2.StdHandle.StdIn : StdHandle - 407. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 + 427. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 builtin.io2.StdHandle.StdOut : StdHandle - 408. -- ##STM + 428. -- ##STM builtin type builtin.io2.STM - 409. -- ##STM.atomically + 429. -- ##STM.atomically builtin.io2.STM.atomically : '{STM} a ->{IO} a - 410. -- ##STM.retry + 430. -- ##STM.retry builtin.io2.STM.retry : '{STM} a - 411. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g + 431. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g unique type builtin.io2.STMFailure - 412. -- ##ThreadId + 432. -- ##ThreadId builtin type builtin.io2.ThreadId - 413. -- ##Tls + 433. -- ##Tls builtin type builtin.io2.Tls - 414. -- ##Tls.Cipher + 434. -- ##Tls.Cipher builtin type builtin.io2.Tls.Cipher - 415. -- ##Tls.ClientConfig + 435. -- ##Tls.ClientConfig builtin type builtin.io2.Tls.ClientConfig - 416. -- ##Tls.ClientConfig.certificates.set + 436. -- ##Tls.ClientConfig.certificates.set builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 417. -- ##TLS.ClientConfig.ciphers.set + 437. -- ##TLS.ClientConfig.ciphers.set builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 418. -- ##Tls.ClientConfig.default + 438. -- ##Tls.ClientConfig.default builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 419. -- ##Tls.ClientConfig.versions.set + 439. -- ##Tls.ClientConfig.versions.set builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 420. -- ##Tls.decodeCert.impl.v3 + 440. -- ##Tls.decodeCert.impl.v3 builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 421. -- ##Tls.decodePrivateKey + 441. -- ##Tls.decodePrivateKey builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 422. -- ##Tls.encodeCert + 442. -- ##Tls.encodeCert builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 423. -- ##Tls.encodePrivateKey + 443. -- ##Tls.encodePrivateKey builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 424. -- ##Tls.handshake.impl.v3 + 444. -- ##Tls.handshake.impl.v3 builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 425. -- ##Tls.newClient.impl.v3 + 445. -- ##Tls.newClient.impl.v3 builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 426. -- ##Tls.newServer.impl.v3 + 446. -- ##Tls.newServer.impl.v3 builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 427. -- ##Tls.PrivateKey + 447. -- ##Tls.PrivateKey builtin type builtin.io2.Tls.PrivateKey - 428. -- ##Tls.receive.impl.v3 + 448. -- ##Tls.receive.impl.v3 builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 429. -- ##Tls.send.impl.v3 + 449. -- ##Tls.send.impl.v3 builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 430. -- ##Tls.ServerConfig + 450. -- ##Tls.ServerConfig builtin type builtin.io2.Tls.ServerConfig - 431. -- ##Tls.ServerConfig.certificates.set + 451. -- ##Tls.ServerConfig.certificates.set builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 432. -- ##Tls.ServerConfig.ciphers.set + 452. -- ##Tls.ServerConfig.ciphers.set builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 433. -- ##Tls.ServerConfig.default + 453. -- ##Tls.ServerConfig.default builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 434. -- ##Tls.ServerConfig.versions.set + 454. -- ##Tls.ServerConfig.versions.set builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 435. -- ##Tls.SignedCert + 455. -- ##Tls.SignedCert builtin type builtin.io2.Tls.SignedCert - 436. -- ##Tls.terminate.impl.v3 + 456. -- ##Tls.terminate.impl.v3 builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 437. -- ##Tls.Version + 457. -- ##Tls.Version builtin type builtin.io2.Tls.Version - 438. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + 458. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 unique type builtin.io2.TlsFailure - 439. -- ##TVar + 459. -- ##TVar builtin type builtin.io2.TVar - 440. -- ##TVar.new + 460. -- ##TVar.new builtin.io2.TVar.new : a ->{STM} TVar a - 441. -- ##TVar.newIO + 461. -- ##TVar.newIO builtin.io2.TVar.newIO : a ->{IO} TVar a - 442. -- ##TVar.read + 462. -- ##TVar.read builtin.io2.TVar.read : TVar a ->{STM} a - 443. -- ##TVar.readIO + 463. -- ##TVar.readIO builtin.io2.TVar.readIO : TVar a ->{IO} a - 444. -- ##TVar.swap + 464. -- ##TVar.swap builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 445. -- ##TVar.write + 465. -- ##TVar.write builtin.io2.TVar.write : TVar a -> a ->{STM} () - 446. -- ##validateSandboxed + 466. -- ##validateSandboxed builtin.io2.validateSandboxed : [Link.Term] -> a -> Boolean - 447. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + 467. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 unique type builtin.IsPropagated - 448. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + 468. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 builtin.IsPropagated.IsPropagated : IsPropagated - 449. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + 469. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 unique type builtin.IsTest - 450. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + 470. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 builtin.IsTest.IsTest : IsTest - 451. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + 471. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g unique type builtin.License - 452. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + 472. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 builtin.License.copyrightHolders : License -> [CopyrightHolder] - 453. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + 473. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo builtin.License.copyrightHolders.modify : ([CopyrightHolder] ->{g} [CopyrightHolder]) -> License ->{g} License - 454. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + 474. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro builtin.License.copyrightHolders.set : [CopyrightHolder] -> License -> License - 455. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + 475. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 builtin.License.License : [CopyrightHolder] -> [Year] -> LicenseType -> License - 456. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + 476. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g builtin.License.licenseType : License -> LicenseType - 457. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + 477. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo builtin.License.licenseType.modify : (LicenseType ->{g} LicenseType) -> License ->{g} License - 458. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + 478. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o builtin.License.licenseType.set : LicenseType -> License -> License - 459. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + 479. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig builtin.License.years : License -> [Year] - 460. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + 480. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 builtin.License.years.modify : ([Year] ->{g} [Year]) -> License ->{g} License - 461. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + 481. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo builtin.License.years.set : [Year] -> License -> License - 462. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + 482. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 unique type builtin.LicenseType - 463. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + 483. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 builtin.LicenseType.LicenseType : Doc -> LicenseType - 464. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + 484. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 unique type builtin.Link - 465. -- ##Link.Term + 485. -- ##Link.Term builtin type builtin.Link.Term - 466. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + 486. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 builtin.Link.Term : Link.Term -> Link - 467. -- ##Link.Term.toText + 487. -- ##Link.Term.toText builtin.Link.Term.toText : Link.Term -> Text - 468. -- ##Link.Type + 488. -- ##Link.Type builtin type builtin.Link.Type - 469. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + 489. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 builtin.Link.Type : Type -> Link - 470. -- ##Sequence + 490. -- ##Sequence builtin type builtin.List - 471. -- ##List.++ + 491. -- ##List.++ builtin.List.++ : [a] -> [a] -> [a] - 472. -- ##List.cons + 492. -- ##List.cons builtin.List.+:, builtin.List.cons : a -> [a] -> [a] - 473. -- ##List.snoc + 493. -- ##List.snoc builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] - 474. -- ##List.at + 494. -- ##List.at builtin.List.at : Nat -> [a] -> Optional a - 475. -- ##List.cons + 495. -- ##List.cons builtin.List.cons, builtin.List.+: : a -> [a] -> [a] - 476. -- ##List.drop + 496. -- ##List.drop builtin.List.drop : Nat -> [a] -> [a] - 477. -- ##List.empty + 497. -- ##List.empty builtin.List.empty : [a] - 478. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + 498. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] - 479. -- ##List.size + 499. -- ##List.size builtin.List.size : [a] -> Nat - 480. -- ##List.snoc + 500. -- ##List.snoc builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] - 481. -- ##List.take + 501. -- ##List.take builtin.List.take : Nat -> [a] -> [a] - 482. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + 502. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g builtin.metadata.isPropagated : IsPropagated - 483. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + 503. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko builtin.metadata.isTest : IsTest - 484. -- ##MutableArray + 504. -- ##MutableArray builtin type builtin.MutableArray - 485. -- ##MutableArray.copyTo! + 505. -- ##MutableArray.copyTo! builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a @@ -1703,34 +1763,34 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 486. -- ##MutableArray.freeze + 506. -- ##MutableArray.freeze builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 487. -- ##MutableArray.freeze! + 507. -- ##MutableArray.freeze! builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 488. -- ##MutableArray.read + 508. -- ##MutableArray.read builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 489. -- ##MutableArray.size + 509. -- ##MutableArray.size builtin.MutableArray.size : MutableArray g a -> Nat - 490. -- ##MutableArray.write + 510. -- ##MutableArray.write builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 491. -- ##MutableByteArray + 511. -- ##MutableByteArray builtin type builtin.MutableByteArray - 492. -- ##MutableByteArray.copyTo! + 512. -- ##MutableByteArray.copyTo! builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g @@ -1738,685 +1798,688 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 493. -- ##MutableByteArray.freeze + 513. -- ##MutableByteArray.freeze builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 494. -- ##MutableByteArray.freeze! + 514. -- ##MutableByteArray.freeze! builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 495. -- ##MutableByteArray.read16be + 515. -- ##MutableByteArray.read16be builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 496. -- ##MutableByteArray.read24be + 516. -- ##MutableByteArray.read24be builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 497. -- ##MutableByteArray.read32be + 517. -- ##MutableByteArray.read32be builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 498. -- ##MutableByteArray.read40be + 518. -- ##MutableByteArray.read40be builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 499. -- ##MutableByteArray.read64be + 519. -- ##MutableByteArray.read64be builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 500. -- ##MutableByteArray.read8 + 520. -- ##MutableByteArray.read8 builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 501. -- ##MutableByteArray.size + 521. -- ##MutableByteArray.size builtin.MutableByteArray.size : MutableByteArray g -> Nat - 502. -- ##MutableByteArray.write16be + 522. -- ##MutableByteArray.write16be builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 503. -- ##MutableByteArray.write32be + 523. -- ##MutableByteArray.write32be builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 504. -- ##MutableByteArray.write64be + 524. -- ##MutableByteArray.write64be builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 505. -- ##MutableByteArray.write8 + 525. -- ##MutableByteArray.write8 builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 506. -- ##Nat + 526. -- ##Nat builtin type builtin.Nat - 507. -- ##Nat.* + 527. -- ##Nat.* builtin.Nat.* : Nat -> Nat -> Nat - 508. -- ##Nat.+ + 528. -- ##Nat.+ builtin.Nat.+ : Nat -> Nat -> Nat - 509. -- ##Nat./ + 529. -- ##Nat./ builtin.Nat./ : Nat -> Nat -> Nat - 510. -- ##Nat.and + 530. -- ##Nat.and builtin.Nat.and : Nat -> Nat -> Nat - 511. -- ##Nat.complement + 531. -- ##Nat.complement builtin.Nat.complement : Nat -> Nat - 512. -- ##Nat.drop + 532. -- ##Nat.drop builtin.Nat.drop : Nat -> Nat -> Nat - 513. -- ##Nat.== + 533. -- ##Nat.== builtin.Nat.eq : Nat -> Nat -> Boolean - 514. -- ##Nat.fromText + 534. -- ##Nat.fromText builtin.Nat.fromText : Text -> Optional Nat - 515. -- ##Nat.> + 535. -- ##Nat.> builtin.Nat.gt : Nat -> Nat -> Boolean - 516. -- ##Nat.>= + 536. -- ##Nat.>= builtin.Nat.gteq : Nat -> Nat -> Boolean - 517. -- ##Nat.increment + 537. -- ##Nat.increment builtin.Nat.increment : Nat -> Nat - 518. -- ##Nat.isEven + 538. -- ##Nat.isEven builtin.Nat.isEven : Nat -> Boolean - 519. -- ##Nat.isOdd + 539. -- ##Nat.isOdd builtin.Nat.isOdd : Nat -> Boolean - 520. -- ##Nat.leadingZeros + 540. -- ##Nat.leadingZeros builtin.Nat.leadingZeros : Nat -> Nat - 521. -- ##Nat.< + 541. -- ##Nat.< builtin.Nat.lt : Nat -> Nat -> Boolean - 522. -- ##Nat.<= + 542. -- ##Nat.<= builtin.Nat.lteq : Nat -> Nat -> Boolean - 523. -- ##Nat.mod + 543. -- ##Nat.mod builtin.Nat.mod : Nat -> Nat -> Nat - 524. -- ##Nat.or + 544. -- ##Nat.or builtin.Nat.or : Nat -> Nat -> Nat - 525. -- ##Nat.popCount + 545. -- ##Nat.popCount builtin.Nat.popCount : Nat -> Nat - 526. -- ##Nat.pow + 546. -- ##Nat.pow builtin.Nat.pow : Nat -> Nat -> Nat - 527. -- ##Nat.shiftLeft + 547. -- ##Nat.shiftLeft builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 528. -- ##Nat.shiftRight + 548. -- ##Nat.shiftRight builtin.Nat.shiftRight : Nat -> Nat -> Nat - 529. -- ##Nat.sub + 549. -- ##Nat.sub builtin.Nat.sub : Nat -> Nat -> Int - 530. -- ##Nat.toFloat + 550. -- ##Nat.toFloat builtin.Nat.toFloat : Nat -> Float - 531. -- ##Nat.toInt + 551. -- ##Nat.toInt builtin.Nat.toInt : Nat -> Int - 532. -- ##Nat.toText + 552. -- ##Nat.toText builtin.Nat.toText : Nat -> Text - 533. -- ##Nat.trailingZeros + 553. -- ##Nat.trailingZeros builtin.Nat.trailingZeros : Nat -> Nat - 534. -- ##Nat.xor + 554. -- ##Nat.xor builtin.Nat.xor : Nat -> Nat -> Nat - 535. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + 555. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg structural type builtin.Optional a - 536. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + 556. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 builtin.Optional.None : Optional a - 537. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + 557. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 builtin.Optional.Some : a -> Optional a - 538. -- ##Pattern + 558. -- ##Pattern builtin type builtin.Pattern - 539. -- ##Pattern.capture + 559. -- ##Pattern.capture builtin.Pattern.capture : Pattern a -> Pattern a - 540. -- ##Pattern.isMatch + 560. -- ##Pattern.isMatch builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 541. -- ##Pattern.join + 561. -- ##Pattern.join builtin.Pattern.join : [Pattern a] -> Pattern a - 542. -- ##Pattern.many + 562. -- ##Pattern.many builtin.Pattern.many : Pattern a -> Pattern a - 543. -- ##Pattern.or + 563. -- ##Pattern.or builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 544. -- ##Pattern.replicate + 564. -- ##Pattern.replicate builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 545. -- ##Pattern.run + 565. -- ##Pattern.run builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) - 546. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + 566. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg structural type builtin.Pretty txt - 547. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + 567. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 unique type builtin.Pretty.Annotated w txt - 548. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + 568. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 builtin.Pretty.Annotated.Append : w -> [Annotated w txt] -> Annotated w txt - 549. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + 569. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 builtin.Pretty.Annotated.Empty : Annotated w txt - 550. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + 570. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 builtin.Pretty.Annotated.Group : w -> Annotated w txt -> Annotated w txt - 551. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + 571. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 builtin.Pretty.Annotated.Indent : w -> Annotated w txt -> Annotated w txt -> Annotated w txt -> Annotated w txt - 552. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + 572. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 builtin.Pretty.Annotated.Lit : w -> txt -> Annotated w txt - 553. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + 573. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 builtin.Pretty.Annotated.OrElse : w -> Annotated w txt -> Annotated w txt -> Annotated w txt - 554. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + 574. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 builtin.Pretty.Annotated.Table : w -> [[Annotated w txt]] -> Annotated w txt - 555. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + 575. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 builtin.Pretty.Annotated.Wrap : w -> Annotated w txt -> Annotated w txt - 556. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + 576. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg builtin.Pretty.append : Pretty txt -> Pretty txt -> Pretty txt - 557. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + 577. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 builtin.Pretty.empty : Pretty txt - 558. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + 578. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo builtin.Pretty.get : Pretty txt -> Annotated () txt - 559. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + 579. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 builtin.Pretty.group : Pretty txt -> Pretty txt - 560. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + 580. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno builtin.Pretty.indent : Pretty txt -> Pretty txt -> Pretty txt - 561. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + 581. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug builtin.Pretty.indent' : Pretty txt -> Pretty txt -> Pretty txt -> Pretty txt - 562. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + 582. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo builtin.Pretty.join : [Pretty txt] -> Pretty txt - 563. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + 583. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 564. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + 584. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 - 565. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + 585. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 builtin.Pretty.orElse : Pretty txt -> Pretty txt -> Pretty txt - 566. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + 586. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 builtin.Pretty.Pretty : Annotated () txt -> Pretty txt - 567. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + 587. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g builtin.Pretty.sepBy : Pretty txt -> [Pretty txt] -> Pretty txt - 568. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + 588. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro builtin.Pretty.table : [[Pretty txt]] -> Pretty txt - 569. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + 589. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 builtin.Pretty.wrap : Pretty txt -> Pretty txt - 570. -- ##Ref + 590. -- ##Ref builtin type builtin.Ref - 571. -- ##Ref.read + 591. -- ##Ref.read builtin.Ref.read : Ref g a ->{g} a - 572. -- ##Ref.write + 592. -- ##Ref.write builtin.Ref.write : Ref g a -> a ->{g} () - 573. -- ##Effect + 593. -- ##Effect builtin type builtin.Request - 574. -- ##Scope + 594. -- ##Scope builtin type builtin.Scope - 575. -- ##Scope.array + 595. -- ##Scope.array builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 576. -- ##Scope.arrayOf + 596. -- ##Scope.arrayOf builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 577. -- ##Scope.bytearray + 597. -- ##Scope.bytearray builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 578. -- ##Scope.bytearrayOf + 598. -- ##Scope.bytearrayOf builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 579. -- ##Scope.ref + 599. -- ##Scope.ref builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 580. -- ##Scope.run + 600. -- ##Scope.run builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 581. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + 601. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 structural type builtin.SeqView a b - 582. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + 602. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 builtin.SeqView.VElem : a -> b -> SeqView a b - 583. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + 603. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 builtin.SeqView.VEmpty : SeqView a b - 584. -- ##Socket.toText + 604. -- ##Socket.toText builtin.Socket.toText : Socket -> Text - 585. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + 605. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo builtin.syntax.docAside : Doc2 -> Doc2 - 586. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + 606. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 builtin.syntax.docBlockquote : Doc2 -> Doc2 - 587. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + 607. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 builtin.syntax.docBold : Doc2 -> Doc2 - 588. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + 608. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg builtin.syntax.docBulletedList : [Doc2] -> Doc2 - 589. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + 609. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 - 590. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + 610. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo builtin.syntax.docCode : Doc2 -> Doc2 - 591. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + 611. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 builtin.syntax.docCodeBlock : Text -> Text -> Doc2 - 592. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + 612. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 builtin.syntax.docColumn : [Doc2] -> Doc2 - 593. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + 613. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term - 594. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + 614. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg builtin.syntax.docEmbedAnnotations : tms -> tms - 595. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + 615. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 builtin.syntax.docEmbedSignatureLink : '{g} t -> Doc2.Term - 596. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + 616. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao builtin.syntax.docEmbedTermLink : '{g} t -> Either a Doc2.Term - 597. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + 617. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 builtin.syntax.docEmbedTypeLink : typ -> Either typ b - 598. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + 618. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg builtin.syntax.docEval : 'a -> Doc2 - 599. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + 619. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g builtin.syntax.docEvalInline : 'a -> Doc2 - 600. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + 620. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 builtin.syntax.docExample : Nat -> '{g} t -> Doc2 - 601. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + 621. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 - 602. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + 622. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 603. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + 623. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) - 604. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + 624. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 builtin.syntax.docGroup : Doc2 -> Doc2 - 605. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + 625. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 builtin.syntax.docItalic : Doc2 -> Doc2 - 606. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + 626. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 builtin.syntax.docJoin : [Doc2] -> Doc2 - 607. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + 627. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 - 608. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + 628. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 - 609. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + 629. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 - 610. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + 630. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 builtin.syntax.docParagraph : [Doc2] -> Doc2 - 611. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + 631. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 - 612. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + 632. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 builtin.syntax.docSignature : [Doc2.Term] -> Doc2 - 613. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + 633. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 - 614. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + 634. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 builtin.syntax.docSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 615. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + 635. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 builtin.syntax.docSourceElement : link -> annotations -> (link, annotations) - 616. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + 636. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag builtin.syntax.docStrikethrough : Doc2 -> Doc2 - 617. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + 637. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g builtin.syntax.docTable : [[Doc2]] -> Doc2 - 618. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + 638. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 - 619. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + 639. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 builtin.syntax.docTransclude : d -> d - 620. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + 640. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 builtin.syntax.docUntitledSection : [Doc2] -> Doc2 - 621. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + 641. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo builtin.syntax.docVerbatim : Doc2 -> Doc2 - 622. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + 642. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 builtin.syntax.docWord : Text -> Doc2 - 623. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + 643. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 unique type builtin.Test.Result - 624. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + 644. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 builtin.Test.Result.Fail : Text -> Result - 625. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + 645. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 builtin.Test.Result.Ok : Text -> Result - 626. -- ##Text + 646. -- ##Text builtin type builtin.Text - 627. -- ##Text.!= + 647. -- ##Text.!= builtin.Text.!= : Text -> Text -> Boolean - 628. -- ##Text.++ + 648. -- ##Text.++ builtin.Text.++ : Text -> Text -> Text - 629. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + 649. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text - 630. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + 650. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg builtin.Text.alignRightWith : Nat -> Char -> Text -> Text - 631. -- ##Text.drop + 651. -- ##Text.drop builtin.Text.drop : Nat -> Text -> Text - 632. -- ##Text.empty + 652. -- ##Text.empty builtin.Text.empty : Text - 633. -- ##Text.== + 653. -- ##Text.== builtin.Text.eq : Text -> Text -> Boolean - 634. -- ##Text.fromCharList + 654. -- ##Text.fromCharList builtin.Text.fromCharList : [Char] -> Text - 635. -- ##Text.fromUtf8.impl.v3 + 655. -- ##Text.fromUtf8.impl.v3 builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 636. -- ##Text.> + 656. -- ##Text.> builtin.Text.gt : Text -> Text -> Boolean - 637. -- ##Text.>= + 657. -- ##Text.>= builtin.Text.gteq : Text -> Text -> Boolean - 638. -- ##Text.< + 658. -- ##Text.< builtin.Text.lt : Text -> Text -> Boolean - 639. -- ##Text.<= + 659. -- ##Text.<= builtin.Text.lteq : Text -> Text -> Boolean - 640. -- ##Text.patterns.anyChar + 660. -- ##Text.patterns.anyChar builtin.Text.patterns.anyChar : Pattern Text - 641. -- ##Text.patterns.charIn + 661. -- ##Text.patterns.char + builtin.Text.patterns.char : Class -> Pattern Text + + 662. -- ##Text.patterns.charIn builtin.Text.patterns.charIn : [Char] -> Pattern Text - 642. -- ##Text.patterns.charRange + 663. -- ##Text.patterns.charRange builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 643. -- ##Text.patterns.digit + 664. -- ##Text.patterns.digit builtin.Text.patterns.digit : Pattern Text - 644. -- ##Text.patterns.eof + 665. -- ##Text.patterns.eof builtin.Text.patterns.eof : Pattern Text - 645. -- ##Text.patterns.letter + 666. -- ##Text.patterns.letter builtin.Text.patterns.letter : Pattern Text - 646. -- ##Text.patterns.literal + 667. -- ##Text.patterns.literal builtin.Text.patterns.literal : Text -> Pattern Text - 647. -- ##Text.patterns.notCharIn + 668. -- ##Text.patterns.notCharIn builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 648. -- ##Text.patterns.notCharRange + 669. -- ##Text.patterns.notCharRange builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 649. -- ##Text.patterns.punctuation + 670. -- ##Text.patterns.punctuation builtin.Text.patterns.punctuation : Pattern Text - 650. -- ##Text.patterns.space + 671. -- ##Text.patterns.space builtin.Text.patterns.space : Pattern Text - 651. -- ##Text.repeat + 672. -- ##Text.repeat builtin.Text.repeat : Nat -> Text -> Text - 652. -- ##Text.reverse + 673. -- ##Text.reverse builtin.Text.reverse : Text -> Text - 653. -- ##Text.size + 674. -- ##Text.size builtin.Text.size : Text -> Nat - 654. -- ##Text.take + 675. -- ##Text.take builtin.Text.take : Nat -> Text -> Text - 655. -- ##Text.toCharList + 676. -- ##Text.toCharList builtin.Text.toCharList : Text -> [Char] - 656. -- ##Text.toLowercase + 677. -- ##Text.toLowercase builtin.Text.toLowercase : Text -> Text - 657. -- ##Text.toUppercase + 678. -- ##Text.toUppercase builtin.Text.toUppercase : Text -> Text - 658. -- ##Text.toUtf8 + 679. -- ##Text.toUtf8 builtin.Text.toUtf8 : Text -> Bytes - 659. -- ##Text.uncons + 680. -- ##Text.uncons builtin.Text.uncons : Text -> Optional (Char, Text) - 660. -- ##Text.unsnoc + 681. -- ##Text.unsnoc builtin.Text.unsnoc : Text -> Optional (Text, Char) - 661. -- ##ThreadId.toText + 682. -- ##ThreadId.toText builtin.ThreadId.toText : ThreadId -> Text - 662. -- ##todo + 683. -- ##todo builtin.todo : a -> b - 663. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + 684. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 structural type builtin.Tuple a b - 664. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + 685. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 builtin.Tuple.Cons : a -> b -> Tuple a b - 665. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + 686. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g structural type builtin.Unit - 666. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + 687. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 builtin.Unit.Unit : () - 667. -- ##Universal.< + 688. -- ##Universal.< builtin.Universal.< : a -> a -> Boolean - 668. -- ##Universal.<= + 689. -- ##Universal.<= builtin.Universal.<= : a -> a -> Boolean - 669. -- ##Universal.== + 690. -- ##Universal.== builtin.Universal.== : a -> a -> Boolean - 670. -- ##Universal.> + 691. -- ##Universal.> builtin.Universal.> : a -> a -> Boolean - 671. -- ##Universal.>= + 692. -- ##Universal.>= builtin.Universal.>= : a -> a -> Boolean - 672. -- ##Universal.compare + 693. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 673. -- ##Universal.murmurHash + 694. -- ##Universal.murmurHash builtin.Universal.murmurHash : a -> Nat - 674. -- ##unsafe.coerceAbilities + 695. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 675. -- ##Value + 696. -- ##Value builtin type builtin.Value - 676. -- ##Value.dependencies + 697. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 677. -- ##Value.deserialize + 698. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 678. -- ##Value.load + 699. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 679. -- ##Value.serialize + 700. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 680. -- ##Value.value + 701. -- ##Value.value builtin.Value.value : a -> Value - 681. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 702. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 682. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 703. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 683. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 704. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 684. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 705. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 685. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 706. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 686. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 707. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 687. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 708. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 688. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 709. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 689. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 710. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 690. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 711. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 691. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 712. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2424,7 +2487,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 692. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 713. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2433,318 +2496,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 693. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 714. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 694. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 715. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 695. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 716. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 696. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 717. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 697. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 718. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 698. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 719. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 699. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 720. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 700. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 721. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 701. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 722. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 702. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 723. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 703. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 724. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 704. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 725. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 705. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 726. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 706. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 727. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 707. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 728. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 708. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 729. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 709. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 730. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 710. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 731. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 711. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 732. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 712. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 733. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 713. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 734. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 714. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 735. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 715. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 736. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 716. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 737. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 717. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 738. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 718. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 739. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 719. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 740. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 720. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 741. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 721. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 742. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 722. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 743. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 723. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 744. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 724. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 745. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 725. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 746. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 726. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 747. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 727. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 748. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 728. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 749. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 729. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 750. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 730. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 751. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 731. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 752. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 732. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 753. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 733. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 754. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 734. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 755. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 735. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 756. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 736. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 757. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 737. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 758. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 738. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 759. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 739. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 760. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 740. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 761. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 741. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 762. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 742. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 763. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 743. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 764. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 744. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 765. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 745. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 766. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 746. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 767. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 747. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 768. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 748. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 769. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 749. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 770. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 750. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 771. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 751. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 772. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 752. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 773. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 753. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 774. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 754. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 775. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 755. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 776. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 756. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 777. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 757. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 778. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o saveSelfContained : a -> Text ->{IO, Exception} () - 758. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 779. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 759. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 780. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 760. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 781. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 761. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 782. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 762. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 783. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 763. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 784. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 764. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 785. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 765. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 786. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 766. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 787. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 767. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 788. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 768. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 789. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 769. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 790. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 770. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 791. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 771. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 792. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 772. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 793. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 773. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 794. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 774. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 795. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 775. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 796. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 776. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 797. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 777. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 798. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 778. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 799. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 779. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 800. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 780. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 801. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 781. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 802. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 782. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 803. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 783. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 804. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 784. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 805. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 785. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 806. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 786. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 807. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 787. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 808. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 788. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 809. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index e78db5d5c..e33cc9565 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -59,613 +59,634 @@ Let's try it! 39. Bytes.zlib.compress : Bytes -> Bytes 40. Bytes.zlib.decompress : Bytes -> Either Text Bytes 41. builtin type Char - 42. Char.fromNat : Nat -> Char - 43. Char.toNat : Char -> Nat - 44. Char.toText : Char -> Text - 45. builtin type Code - 46. Code.cache_ : [(Term, Code)] ->{IO} [Term] - 47. Code.dependencies : Code -> [Term] - 48. Code.deserialize : Bytes -> Either Text Code - 49. Code.display : Text -> Code -> Text - 50. Code.isMissing : Term ->{IO} Boolean - 51. Code.lookup : Term ->{IO} Optional Code - 52. Code.serialize : Code -> Bytes - 53. Code.validate : [(Term, Code)] ->{IO} Optional Failure - 54. crypto.hash : HashAlgorithm -> a -> Bytes - 55. builtin type crypto.HashAlgorithm - 56. crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm - 57. crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm - 58. crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 59. crypto.HashAlgorithm.Sha1 : HashAlgorithm - 60. crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 61. crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 62. crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 63. crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 64. crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 65. crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 66. crypto.hmacBytes : HashAlgorithm + 42. builtin type Char.Class + 43. Char.Class.alphanumeric : Class + 44. Char.Class.and : Class -> Class -> Class + 45. Char.Class.any : Class + 46. Char.Class.anyOf : [Char] -> Class + 47. Char.Class.control : Class + 48. Char.Class.is : Class -> Char -> Boolean + 49. Char.Class.letter : Class + 50. Char.Class.lower : Class + 51. Char.Class.mark : Class + 52. Char.Class.not : Class -> Class + 53. Char.Class.number : Class + 54. Char.Class.or : Class -> Class -> Class + 55. Char.Class.printable : Class + 56. Char.Class.punctuation : Class + 57. Char.Class.range : Char -> Char -> Class + 58. Char.Class.separator : Class + 59. Char.Class.symbol : Class + 60. Char.Class.upper : Class + 61. Char.Class.whitespace : Class + 62. Char.fromNat : Nat -> Char + 63. Char.toNat : Char -> Nat + 64. Char.toText : Char -> Text + 65. builtin type Code + 66. Code.cache_ : [(Term, Code)] ->{IO} [Term] + 67. Code.dependencies : Code -> [Term] + 68. Code.deserialize : Bytes -> Either Text Code + 69. Code.display : Text -> Code -> Text + 70. Code.isMissing : Term ->{IO} Boolean + 71. Code.lookup : Term ->{IO} Optional Code + 72. Code.serialize : Code -> Bytes + 73. Code.validate : [(Term, Code)] ->{IO} Optional Failure + 74. crypto.hash : HashAlgorithm -> a -> Bytes + 75. builtin type crypto.HashAlgorithm + 76. crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm + 77. crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm + 78. crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm + 79. crypto.HashAlgorithm.Sha1 : HashAlgorithm + 80. crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + 81. crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + 82. crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + 83. crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + 84. crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes + 85. crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes + 86. crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 67. Debug.toText : a -> Optional (Either Text Text) - 68. Debug.trace : Text -> a -> () - 69. Debug.watch : Text -> a -> a - 70. unique type Doc - 71. Doc.Blob : Text -> Doc - 72. Doc.Evaluate : Term -> Doc - 73. Doc.Join : [Doc] -> Doc - 74. Doc.Link : Link -> Doc - 75. Doc.Signature : Term -> Doc - 76. Doc.Source : Link -> Doc - 77. structural type Either a b - 78. Either.Left : a -> Either a b - 79. Either.Right : b -> Either a b - 80. structural ability Exception - 81. Exception.raise : Failure ->{Exception} x - 82. builtin type Float - 83. Float.* : Float -> Float -> Float - 84. Float.+ : Float -> Float -> Float - 85. Float.- : Float -> Float -> Float - 86. Float./ : Float -> Float -> Float - 87. Float.abs : Float -> Float - 88. Float.acos : Float -> Float - 89. Float.acosh : Float -> Float - 90. Float.asin : Float -> Float - 91. Float.asinh : Float -> Float - 92. Float.atan : Float -> Float - 93. Float.atan2 : Float -> Float -> Float - 94. Float.atanh : Float -> Float - 95. Float.ceiling : Float -> Int - 96. Float.cos : Float -> Float - 97. Float.cosh : Float -> Float - 98. Float.eq : Float -> Float -> Boolean - 99. Float.exp : Float -> Float - 100. Float.floor : Float -> Int - 101. Float.fromRepresentation : Nat -> Float - 102. Float.fromText : Text -> Optional Float - 103. Float.gt : Float -> Float -> Boolean - 104. Float.gteq : Float -> Float -> Boolean - 105. Float.log : Float -> Float - 106. Float.logBase : Float -> Float -> Float - 107. Float.lt : Float -> Float -> Boolean - 108. Float.lteq : Float -> Float -> Boolean - 109. Float.max : Float -> Float -> Float - 110. Float.min : Float -> Float -> Float - 111. Float.pow : Float -> Float -> Float - 112. Float.round : Float -> Int - 113. Float.sin : Float -> Float - 114. Float.sinh : Float -> Float - 115. Float.sqrt : Float -> Float - 116. Float.tan : Float -> Float - 117. Float.tanh : Float -> Float - 118. Float.toRepresentation : Float -> Nat - 119. Float.toText : Float -> Text - 120. Float.truncate : Float -> Int - 121. Handle.toText : Handle -> Text - 122. builtin type ImmutableArray - 123. ImmutableArray.copyTo! : MutableArray g a + 87. Debug.toText : a -> Optional (Either Text Text) + 88. Debug.trace : Text -> a -> () + 89. Debug.watch : Text -> a -> a + 90. unique type Doc + 91. Doc.Blob : Text -> Doc + 92. Doc.Evaluate : Term -> Doc + 93. Doc.Join : [Doc] -> Doc + 94. Doc.Link : Link -> Doc + 95. Doc.Signature : Term -> Doc + 96. Doc.Source : Link -> Doc + 97. structural type Either a b + 98. Either.Left : a -> Either a b + 99. Either.Right : b -> Either a b + 100. structural ability Exception + 101. Exception.raise : Failure ->{Exception} x + 102. builtin type Float + 103. Float.* : Float -> Float -> Float + 104. Float.+ : Float -> Float -> Float + 105. Float.- : Float -> Float -> Float + 106. Float./ : Float -> Float -> Float + 107. Float.abs : Float -> Float + 108. Float.acos : Float -> Float + 109. Float.acosh : Float -> Float + 110. Float.asin : Float -> Float + 111. Float.asinh : Float -> Float + 112. Float.atan : Float -> Float + 113. Float.atan2 : Float -> Float -> Float + 114. Float.atanh : Float -> Float + 115. Float.ceiling : Float -> Int + 116. Float.cos : Float -> Float + 117. Float.cosh : Float -> Float + 118. Float.eq : Float -> Float -> Boolean + 119. Float.exp : Float -> Float + 120. Float.floor : Float -> Int + 121. Float.fromRepresentation : Nat -> Float + 122. Float.fromText : Text -> Optional Float + 123. Float.gt : Float -> Float -> Boolean + 124. Float.gteq : Float -> Float -> Boolean + 125. Float.log : Float -> Float + 126. Float.logBase : Float -> Float -> Float + 127. Float.lt : Float -> Float -> Boolean + 128. Float.lteq : Float -> Float -> Boolean + 129. Float.max : Float -> Float -> Float + 130. Float.min : Float -> Float -> Float + 131. Float.pow : Float -> Float -> Float + 132. Float.round : Float -> Int + 133. Float.sin : Float -> Float + 134. Float.sinh : Float -> Float + 135. Float.sqrt : Float -> Float + 136. Float.tan : Float -> Float + 137. Float.tanh : Float -> Float + 138. Float.toRepresentation : Float -> Nat + 139. Float.toText : Float -> Text + 140. Float.truncate : Float -> Int + 141. Handle.toText : Handle -> Text + 142. builtin type ImmutableArray + 143. ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray a -> Nat -> Nat ->{g, Exception} () - 124. ImmutableArray.read : ImmutableArray a + 144. ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 125. ImmutableArray.size : ImmutableArray a -> Nat - 126. builtin type ImmutableByteArray - 127. ImmutableByteArray.copyTo! : MutableByteArray g + 145. ImmutableArray.size : ImmutableArray a -> Nat + 146. builtin type ImmutableByteArray + 147. ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray -> Nat -> Nat ->{g, Exception} () - 128. ImmutableByteArray.read16be : ImmutableByteArray + 148. ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 129. ImmutableByteArray.read24be : ImmutableByteArray + 149. ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 130. ImmutableByteArray.read32be : ImmutableByteArray + 150. ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 131. ImmutableByteArray.read40be : ImmutableByteArray + 151. ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 132. ImmutableByteArray.read64be : ImmutableByteArray + 152. ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 133. ImmutableByteArray.read8 : ImmutableByteArray + 153. ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 134. ImmutableByteArray.size : ImmutableByteArray -> Nat - 135. builtin type Int - 136. Int.* : Int -> Int -> Int - 137. Int.+ : Int -> Int -> Int - 138. Int.- : Int -> Int -> Int - 139. Int./ : Int -> Int -> Int - 140. Int.and : Int -> Int -> Int - 141. Int.complement : Int -> Int - 142. Int.eq : Int -> Int -> Boolean - 143. Int.fromRepresentation : Nat -> Int - 144. Int.fromText : Text -> Optional Int - 145. Int.gt : Int -> Int -> Boolean - 146. Int.gteq : Int -> Int -> Boolean - 147. Int.increment : Int -> Int - 148. Int.isEven : Int -> Boolean - 149. Int.isOdd : Int -> Boolean - 150. Int.leadingZeros : Int -> Nat - 151. Int.lt : Int -> Int -> Boolean - 152. Int.lteq : Int -> Int -> Boolean - 153. Int.mod : Int -> Int -> Int - 154. Int.negate : Int -> Int - 155. Int.or : Int -> Int -> Int - 156. Int.popCount : Int -> Nat - 157. Int.pow : Int -> Nat -> Int - 158. Int.shiftLeft : Int -> Nat -> Int - 159. Int.shiftRight : Int -> Nat -> Int - 160. Int.signum : Int -> Int - 161. Int.toFloat : Int -> Float - 162. Int.toRepresentation : Int -> Nat - 163. Int.toText : Int -> Text - 164. Int.trailingZeros : Int -> Nat - 165. Int.truncate0 : Int -> Nat - 166. Int.xor : Int -> Int -> Int - 167. unique type io2.ArithmeticFailure - 168. unique type io2.ArrayFailure - 169. unique type io2.BufferMode - 170. io2.BufferMode.BlockBuffering : BufferMode - 171. io2.BufferMode.LineBuffering : BufferMode - 172. io2.BufferMode.NoBuffering : BufferMode - 173. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 174. io2.Clock.internals.monotonic : '{IO} Either + 154. ImmutableByteArray.size : ImmutableByteArray -> Nat + 155. builtin type Int + 156. Int.* : Int -> Int -> Int + 157. Int.+ : Int -> Int -> Int + 158. Int.- : Int -> Int -> Int + 159. Int./ : Int -> Int -> Int + 160. Int.and : Int -> Int -> Int + 161. Int.complement : Int -> Int + 162. Int.eq : Int -> Int -> Boolean + 163. Int.fromRepresentation : Nat -> Int + 164. Int.fromText : Text -> Optional Int + 165. Int.gt : Int -> Int -> Boolean + 166. Int.gteq : Int -> Int -> Boolean + 167. Int.increment : Int -> Int + 168. Int.isEven : Int -> Boolean + 169. Int.isOdd : Int -> Boolean + 170. Int.leadingZeros : Int -> Nat + 171. Int.lt : Int -> Int -> Boolean + 172. Int.lteq : Int -> Int -> Boolean + 173. Int.mod : Int -> Int -> Int + 174. Int.negate : Int -> Int + 175. Int.or : Int -> Int -> Int + 176. Int.popCount : Int -> Nat + 177. Int.pow : Int -> Nat -> Int + 178. Int.shiftLeft : Int -> Nat -> Int + 179. Int.shiftRight : Int -> Nat -> Int + 180. Int.signum : Int -> Int + 181. Int.toFloat : Int -> Float + 182. Int.toRepresentation : Int -> Nat + 183. Int.toText : Int -> Text + 184. Int.trailingZeros : Int -> Nat + 185. Int.truncate0 : Int -> Nat + 186. Int.xor : Int -> Int -> Int + 187. unique type io2.ArithmeticFailure + 188. unique type io2.ArrayFailure + 189. unique type io2.BufferMode + 190. io2.BufferMode.BlockBuffering : BufferMode + 191. io2.BufferMode.LineBuffering : BufferMode + 192. io2.BufferMode.NoBuffering : BufferMode + 193. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode + 194. io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 175. io2.Clock.internals.nsec : TimeSpec -> Nat - 176. io2.Clock.internals.processCPUTime : '{IO} Either + 195. io2.Clock.internals.nsec : TimeSpec -> Nat + 196. io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 177. io2.Clock.internals.realtime : '{IO} Either + 197. io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 178. io2.Clock.internals.sec : TimeSpec -> Int - 179. io2.Clock.internals.threadCPUTime : '{IO} Either + 198. io2.Clock.internals.sec : TimeSpec -> Int + 199. io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 180. builtin type io2.Clock.internals.TimeSpec - 181. unique type io2.Failure - 182. io2.Failure.Failure : Type -> Text -> Any -> Failure - 183. unique type io2.FileMode - 184. io2.FileMode.Append : FileMode - 185. io2.FileMode.Read : FileMode - 186. io2.FileMode.ReadWrite : FileMode - 187. io2.FileMode.Write : FileMode - 188. builtin type io2.Handle - 189. builtin type io2.IO - 190. io2.IO.array : Nat ->{IO} MutableArray {IO} a - 191. io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 192. io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 193. io2.IO.bytearrayOf : Nat + 200. builtin type io2.Clock.internals.TimeSpec + 201. unique type io2.Failure + 202. io2.Failure.Failure : Type -> Text -> Any -> Failure + 203. unique type io2.FileMode + 204. io2.FileMode.Append : FileMode + 205. io2.FileMode.Read : FileMode + 206. io2.FileMode.ReadWrite : FileMode + 207. io2.FileMode.Write : FileMode + 208. builtin type io2.Handle + 209. builtin type io2.IO + 210. io2.IO.array : Nat ->{IO} MutableArray {IO} a + 211. io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a + 212. io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} + 213. io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 194. io2.IO.clientSocket.impl : Text + 214. io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 195. io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 196. io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 197. io2.IO.createDirectory.impl : Text + 215. io2.IO.closeFile.impl : Handle ->{IO} Either Failure () + 216. io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () + 217. io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 198. io2.IO.createTempDirectory.impl : Text + 218. io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 199. io2.IO.delay.impl : Nat ->{IO} Either Failure () - 200. io2.IO.directoryContents.impl : Text + 219. io2.IO.delay.impl : Nat ->{IO} Either Failure () + 220. io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 201. io2.IO.fileExists.impl : Text + 221. io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 202. io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 203. io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 204. io2.IO.getBuffering.impl : Handle + 222. io2.IO.forkComp : '{IO} a ->{IO} ThreadId + 223. io2.IO.getArgs.impl : '{IO} Either Failure [Text] + 224. io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 205. io2.IO.getBytes.impl : Handle + 225. io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 206. io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 207. io2.IO.getCurrentDirectory.impl : '{IO} Either + 226. io2.IO.getChar.impl : Handle ->{IO} Either Failure Char + 227. io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 208. io2.IO.getEcho.impl : Handle + 228. io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 209. io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 210. io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 211. io2.IO.getFileTimestamp.impl : Text + 229. io2.IO.getEnv.impl : Text ->{IO} Either Failure Text + 230. io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat + 231. io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 212. io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 213. io2.IO.getSomeBytes.impl : Handle + 232. io2.IO.getLine.impl : Handle ->{IO} Either Failure Text + 233. io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 214. io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 215. io2.IO.handlePosition.impl : Handle + 234. io2.IO.getTempDirectory.impl : '{IO} Either Failure Text + 235. io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 216. io2.IO.isDirectory.impl : Text + 236. io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 217. io2.IO.isFileEOF.impl : Handle + 237. io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 218. io2.IO.isFileOpen.impl : Handle + 238. io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 219. io2.IO.isSeekable.impl : Handle + 239. io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 220. io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 221. io2.IO.listen.impl : Socket ->{IO} Either Failure () - 222. io2.IO.openFile.impl : Text + 240. io2.IO.kill.impl : ThreadId ->{IO} Either Failure () + 241. io2.IO.listen.impl : Socket ->{IO} Either Failure () + 242. io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 223. io2.IO.process.call : Text -> [Text] ->{IO} Nat - 224. io2.IO.process.exitCode : ProcessHandle + 243. io2.IO.process.call : Text -> [Text] ->{IO} Nat + 244. io2.IO.process.exitCode : ProcessHandle ->{IO} Optional Nat - 225. io2.IO.process.kill : ProcessHandle ->{IO} () - 226. io2.IO.process.start : Text + 245. io2.IO.process.kill : ProcessHandle ->{IO} () + 246. io2.IO.process.start : Text -> [Text] ->{IO} ( Handle, Handle, Handle, ProcessHandle) - 227. io2.IO.process.wait : ProcessHandle ->{IO} Nat - 228. io2.IO.putBytes.impl : Handle + 247. io2.IO.process.wait : ProcessHandle ->{IO} Nat + 248. io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 229. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 230. io2.IO.ref : a ->{IO} Ref {IO} a - 231. io2.IO.removeDirectory.impl : Text + 249. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean + 250. io2.IO.ref : a ->{IO} Ref {IO} a + 251. io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 232. io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 233. io2.IO.renameDirectory.impl : Text + 252. io2.IO.removeFile.impl : Text ->{IO} Either Failure () + 253. io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 234. io2.IO.renameFile.impl : Text + 254. io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 235. io2.IO.seekHandle.impl : Handle + 255. io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 236. io2.IO.serverSocket.impl : Optional Text + 256. io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 237. io2.IO.setBuffering.impl : Handle + 257. io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 238. io2.IO.setCurrentDirectory.impl : Text + 258. io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 239. io2.IO.setEcho.impl : Handle + 259. io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 240. io2.IO.socketAccept.impl : Socket + 260. io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 241. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 242. io2.IO.socketReceive.impl : Socket + 261. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat + 262. io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 243. io2.IO.socketSend.impl : Socket + 263. io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 244. io2.IO.stdHandle : StdHandle -> Handle - 245. io2.IO.systemTime.impl : '{IO} Either Failure Nat - 246. io2.IO.systemTimeMicroseconds : '{IO} Int - 247. io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 248. unique type io2.IOError - 249. io2.IOError.AlreadyExists : IOError - 250. io2.IOError.EOF : IOError - 251. io2.IOError.IllegalOperation : IOError - 252. io2.IOError.NoSuchThing : IOError - 253. io2.IOError.PermissionDenied : IOError - 254. io2.IOError.ResourceBusy : IOError - 255. io2.IOError.ResourceExhausted : IOError - 256. io2.IOError.UserError : IOError - 257. unique type io2.IOFailure - 258. unique type io2.MiscFailure - 259. builtin type io2.MVar - 260. io2.MVar.isEmpty : MVar a ->{IO} Boolean - 261. io2.MVar.new : a ->{IO} MVar a - 262. io2.MVar.newEmpty : '{IO} MVar a - 263. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 264. io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 265. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 266. io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 267. io2.MVar.tryPut.impl : MVar a + 264. io2.IO.stdHandle : StdHandle -> Handle + 265. io2.IO.systemTime.impl : '{IO} Either Failure Nat + 266. io2.IO.systemTimeMicroseconds : '{IO} Int + 267. io2.IO.tryEval : '{IO} a ->{IO, Exception} a + 268. unique type io2.IOError + 269. io2.IOError.AlreadyExists : IOError + 270. io2.IOError.EOF : IOError + 271. io2.IOError.IllegalOperation : IOError + 272. io2.IOError.NoSuchThing : IOError + 273. io2.IOError.PermissionDenied : IOError + 274. io2.IOError.ResourceBusy : IOError + 275. io2.IOError.ResourceExhausted : IOError + 276. io2.IOError.UserError : IOError + 277. unique type io2.IOFailure + 278. unique type io2.MiscFailure + 279. builtin type io2.MVar + 280. io2.MVar.isEmpty : MVar a ->{IO} Boolean + 281. io2.MVar.new : a ->{IO} MVar a + 282. io2.MVar.newEmpty : '{IO} MVar a + 283. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () + 284. io2.MVar.read.impl : MVar a ->{IO} Either Failure a + 285. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a + 286. io2.MVar.take.impl : MVar a ->{IO} Either Failure a + 287. io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 268. io2.MVar.tryRead.impl : MVar a + 288. io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 269. io2.MVar.tryTake : MVar a ->{IO} Optional a - 270. builtin type io2.ProcessHandle - 271. builtin type io2.Promise - 272. io2.Promise.new : '{IO} Promise a - 273. io2.Promise.read : Promise a ->{IO} a - 274. io2.Promise.tryRead : Promise a ->{IO} Optional a - 275. io2.Promise.write : Promise a -> a ->{IO} Boolean - 276. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 277. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 278. builtin type io2.Ref.Ticket - 279. io2.Ref.Ticket.read : Ticket a -> a - 280. unique type io2.RuntimeFailure - 281. unique type io2.SeekMode - 282. io2.SeekMode.AbsoluteSeek : SeekMode - 283. io2.SeekMode.RelativeSeek : SeekMode - 284. io2.SeekMode.SeekFromEnd : SeekMode - 285. builtin type io2.Socket - 286. unique type io2.StdHandle - 287. io2.StdHandle.StdErr : StdHandle - 288. io2.StdHandle.StdIn : StdHandle - 289. io2.StdHandle.StdOut : StdHandle - 290. builtin type io2.STM - 291. io2.STM.atomically : '{STM} a ->{IO} a - 292. io2.STM.retry : '{STM} a - 293. unique type io2.STMFailure - 294. builtin type io2.ThreadId - 295. builtin type io2.Tls - 296. builtin type io2.Tls.Cipher - 297. builtin type io2.Tls.ClientConfig - 298. io2.Tls.ClientConfig.certificates.set : [SignedCert] + 289. io2.MVar.tryTake : MVar a ->{IO} Optional a + 290. builtin type io2.ProcessHandle + 291. builtin type io2.Promise + 292. io2.Promise.new : '{IO} Promise a + 293. io2.Promise.read : Promise a ->{IO} a + 294. io2.Promise.tryRead : Promise a ->{IO} Optional a + 295. io2.Promise.write : Promise a -> a ->{IO} Boolean + 296. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean + 297. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a + 298. builtin type io2.Ref.Ticket + 299. io2.Ref.Ticket.read : Ticket a -> a + 300. unique type io2.RuntimeFailure + 301. unique type io2.SeekMode + 302. io2.SeekMode.AbsoluteSeek : SeekMode + 303. io2.SeekMode.RelativeSeek : SeekMode + 304. io2.SeekMode.SeekFromEnd : SeekMode + 305. builtin type io2.Socket + 306. unique type io2.StdHandle + 307. io2.StdHandle.StdErr : StdHandle + 308. io2.StdHandle.StdIn : StdHandle + 309. io2.StdHandle.StdOut : StdHandle + 310. builtin type io2.STM + 311. io2.STM.atomically : '{STM} a ->{IO} a + 312. io2.STM.retry : '{STM} a + 313. unique type io2.STMFailure + 314. builtin type io2.ThreadId + 315. builtin type io2.Tls + 316. builtin type io2.Tls.Cipher + 317. builtin type io2.Tls.ClientConfig + 318. io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 299. io2.TLS.ClientConfig.ciphers.set : [Cipher] + 319. io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 300. io2.Tls.ClientConfig.default : Text + 320. io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 301. io2.Tls.ClientConfig.versions.set : [Version] + 321. io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 302. io2.Tls.decodeCert.impl : Bytes + 322. io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 303. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 304. io2.Tls.encodeCert : SignedCert -> Bytes - 305. io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 306. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 307. io2.Tls.newClient.impl : ClientConfig + 323. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] + 324. io2.Tls.encodeCert : SignedCert -> Bytes + 325. io2.Tls.encodePrivateKey : PrivateKey -> Bytes + 326. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () + 327. io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 308. io2.Tls.newServer.impl : ServerConfig + 328. io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 309. builtin type io2.Tls.PrivateKey - 310. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 311. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 312. builtin type io2.Tls.ServerConfig - 313. io2.Tls.ServerConfig.certificates.set : [SignedCert] + 329. builtin type io2.Tls.PrivateKey + 330. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes + 331. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () + 332. builtin type io2.Tls.ServerConfig + 333. io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 314. io2.Tls.ServerConfig.ciphers.set : [Cipher] + 334. io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 315. io2.Tls.ServerConfig.default : [SignedCert] + 335. io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 316. io2.Tls.ServerConfig.versions.set : [Version] + 336. io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 317. builtin type io2.Tls.SignedCert - 318. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 319. builtin type io2.Tls.Version - 320. unique type io2.TlsFailure - 321. builtin type io2.TVar - 322. io2.TVar.new : a ->{STM} TVar a - 323. io2.TVar.newIO : a ->{IO} TVar a - 324. io2.TVar.read : TVar a ->{STM} a - 325. io2.TVar.readIO : TVar a ->{IO} a - 326. io2.TVar.swap : TVar a -> a ->{STM} a - 327. io2.TVar.write : TVar a -> a ->{STM} () - 328. io2.validateSandboxed : [Term] -> a -> Boolean - 329. unique type IsPropagated - 330. IsPropagated.IsPropagated : IsPropagated - 331. unique type IsTest - 332. IsTest.IsTest : IsTest - 333. unique type Link - 334. builtin type Link.Term - 335. Link.Term : Term -> Link - 336. Link.Term.toText : Term -> Text - 337. builtin type Link.Type - 338. Link.Type : Type -> Link - 339. builtin type List - 340. List.++ : [a] -> [a] -> [a] - 341. List.+: : a -> [a] -> [a] - 342. List.:+ : [a] -> a -> [a] - 343. List.at : Nat -> [a] -> Optional a - 344. List.cons : a -> [a] -> [a] - 345. List.drop : Nat -> [a] -> [a] - 346. List.empty : [a] - 347. List.size : [a] -> Nat - 348. List.snoc : [a] -> a -> [a] - 349. List.take : Nat -> [a] -> [a] - 350. metadata.isPropagated : IsPropagated - 351. metadata.isTest : IsTest - 352. builtin type MutableArray - 353. MutableArray.copyTo! : MutableArray g a + 337. builtin type io2.Tls.SignedCert + 338. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () + 339. builtin type io2.Tls.Version + 340. unique type io2.TlsFailure + 341. builtin type io2.TVar + 342. io2.TVar.new : a ->{STM} TVar a + 343. io2.TVar.newIO : a ->{IO} TVar a + 344. io2.TVar.read : TVar a ->{STM} a + 345. io2.TVar.readIO : TVar a ->{IO} a + 346. io2.TVar.swap : TVar a -> a ->{STM} a + 347. io2.TVar.write : TVar a -> a ->{STM} () + 348. io2.validateSandboxed : [Term] -> a -> Boolean + 349. unique type IsPropagated + 350. IsPropagated.IsPropagated : IsPropagated + 351. unique type IsTest + 352. IsTest.IsTest : IsTest + 353. unique type Link + 354. builtin type Link.Term + 355. Link.Term : Term -> Link + 356. Link.Term.toText : Term -> Text + 357. builtin type Link.Type + 358. Link.Type : Type -> Link + 359. builtin type List + 360. List.++ : [a] -> [a] -> [a] + 361. List.+: : a -> [a] -> [a] + 362. List.:+ : [a] -> a -> [a] + 363. List.at : Nat -> [a] -> Optional a + 364. List.cons : a -> [a] -> [a] + 365. List.drop : Nat -> [a] -> [a] + 366. List.empty : [a] + 367. List.size : [a] -> Nat + 368. List.snoc : [a] -> a -> [a] + 369. List.take : Nat -> [a] -> [a] + 370. metadata.isPropagated : IsPropagated + 371. metadata.isTest : IsTest + 372. builtin type MutableArray + 373. MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a -> Nat -> Nat ->{g, Exception} () - 354. MutableArray.freeze : MutableArray g a + 374. MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 355. MutableArray.freeze! : MutableArray g a + 375. MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 356. MutableArray.read : MutableArray g a + 376. MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 357. MutableArray.size : MutableArray g a -> Nat - 358. MutableArray.write : MutableArray g a + 377. MutableArray.size : MutableArray g a -> Nat + 378. MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 359. builtin type MutableByteArray - 360. MutableByteArray.copyTo! : MutableByteArray g + 379. builtin type MutableByteArray + 380. MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 361. MutableByteArray.freeze : MutableByteArray g + 381. MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 362. MutableByteArray.freeze! : MutableByteArray g + 382. MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 363. MutableByteArray.read16be : MutableByteArray g + 383. MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 364. MutableByteArray.read24be : MutableByteArray g + 384. MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 365. MutableByteArray.read32be : MutableByteArray g + 385. MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 366. MutableByteArray.read40be : MutableByteArray g + 386. MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 367. MutableByteArray.read64be : MutableByteArray g + 387. MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 368. MutableByteArray.read8 : MutableByteArray g + 388. MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 369. MutableByteArray.size : MutableByteArray g -> Nat - 370. MutableByteArray.write16be : MutableByteArray g + 389. MutableByteArray.size : MutableByteArray g -> Nat + 390. MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 371. MutableByteArray.write32be : MutableByteArray g + 391. MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 372. MutableByteArray.write64be : MutableByteArray g + 392. MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 373. MutableByteArray.write8 : MutableByteArray g + 393. MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 374. builtin type Nat - 375. Nat.* : Nat -> Nat -> Nat - 376. Nat.+ : Nat -> Nat -> Nat - 377. Nat./ : Nat -> Nat -> Nat - 378. Nat.and : Nat -> Nat -> Nat - 379. Nat.complement : Nat -> Nat - 380. Nat.drop : Nat -> Nat -> Nat - 381. Nat.eq : Nat -> Nat -> Boolean - 382. Nat.fromText : Text -> Optional Nat - 383. Nat.gt : Nat -> Nat -> Boolean - 384. Nat.gteq : Nat -> Nat -> Boolean - 385. Nat.increment : Nat -> Nat - 386. Nat.isEven : Nat -> Boolean - 387. Nat.isOdd : Nat -> Boolean - 388. Nat.leadingZeros : Nat -> Nat - 389. Nat.lt : Nat -> Nat -> Boolean - 390. Nat.lteq : Nat -> Nat -> Boolean - 391. Nat.mod : Nat -> Nat -> Nat - 392. Nat.or : Nat -> Nat -> Nat - 393. Nat.popCount : Nat -> Nat - 394. Nat.pow : Nat -> Nat -> Nat - 395. Nat.shiftLeft : Nat -> Nat -> Nat - 396. Nat.shiftRight : Nat -> Nat -> Nat - 397. Nat.sub : Nat -> Nat -> Int - 398. Nat.toFloat : Nat -> Float - 399. Nat.toInt : Nat -> Int - 400. Nat.toText : Nat -> Text - 401. Nat.trailingZeros : Nat -> Nat - 402. Nat.xor : Nat -> Nat -> Nat - 403. structural type Optional a - 404. Optional.None : Optional a - 405. Optional.Some : a -> Optional a - 406. builtin type Pattern - 407. Pattern.capture : Pattern a -> Pattern a - 408. Pattern.isMatch : Pattern a -> a -> Boolean - 409. Pattern.join : [Pattern a] -> Pattern a - 410. Pattern.many : Pattern a -> Pattern a - 411. Pattern.or : Pattern a -> Pattern a -> Pattern a - 412. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 413. Pattern.run : Pattern a -> a -> Optional ([a], a) - 414. builtin type Ref - 415. Ref.read : Ref g a ->{g} a - 416. Ref.write : Ref g a -> a ->{g} () - 417. builtin type Request - 418. builtin type Scope - 419. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 420. Scope.arrayOf : a + 394. builtin type Nat + 395. Nat.* : Nat -> Nat -> Nat + 396. Nat.+ : Nat -> Nat -> Nat + 397. Nat./ : Nat -> Nat -> Nat + 398. Nat.and : Nat -> Nat -> Nat + 399. Nat.complement : Nat -> Nat + 400. Nat.drop : Nat -> Nat -> Nat + 401. Nat.eq : Nat -> Nat -> Boolean + 402. Nat.fromText : Text -> Optional Nat + 403. Nat.gt : Nat -> Nat -> Boolean + 404. Nat.gteq : Nat -> Nat -> Boolean + 405. Nat.increment : Nat -> Nat + 406. Nat.isEven : Nat -> Boolean + 407. Nat.isOdd : Nat -> Boolean + 408. Nat.leadingZeros : Nat -> Nat + 409. Nat.lt : Nat -> Nat -> Boolean + 410. Nat.lteq : Nat -> Nat -> Boolean + 411. Nat.mod : Nat -> Nat -> Nat + 412. Nat.or : Nat -> Nat -> Nat + 413. Nat.popCount : Nat -> Nat + 414. Nat.pow : Nat -> Nat -> Nat + 415. Nat.shiftLeft : Nat -> Nat -> Nat + 416. Nat.shiftRight : Nat -> Nat -> Nat + 417. Nat.sub : Nat -> Nat -> Int + 418. Nat.toFloat : Nat -> Float + 419. Nat.toInt : Nat -> Int + 420. Nat.toText : Nat -> Text + 421. Nat.trailingZeros : Nat -> Nat + 422. Nat.xor : Nat -> Nat -> Nat + 423. structural type Optional a + 424. Optional.None : Optional a + 425. Optional.Some : a -> Optional a + 426. builtin type Pattern + 427. Pattern.capture : Pattern a -> Pattern a + 428. Pattern.isMatch : Pattern a -> a -> Boolean + 429. Pattern.join : [Pattern a] -> Pattern a + 430. Pattern.many : Pattern a -> Pattern a + 431. Pattern.or : Pattern a -> Pattern a -> Pattern a + 432. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a + 433. Pattern.run : Pattern a -> a -> Optional ([a], a) + 434. builtin type Ref + 435. Ref.read : Ref g a ->{g} a + 436. Ref.write : Ref g a -> a ->{g} () + 437. builtin type Request + 438. builtin type Scope + 439. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a + 440. Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 421. Scope.bytearray : Nat + 441. Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 422. Scope.bytearrayOf : Nat + 442. Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 423. Scope.ref : a ->{Scope s} Ref {Scope s} a - 424. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 425. structural type SeqView a b - 426. SeqView.VElem : a -> b -> SeqView a b - 427. SeqView.VEmpty : SeqView a b - 428. Socket.toText : Socket -> Text - 429. unique type Test.Result - 430. Test.Result.Fail : Text -> Result - 431. Test.Result.Ok : Text -> Result - 432. builtin type Text - 433. Text.!= : Text -> Text -> Boolean - 434. Text.++ : Text -> Text -> Text - 435. Text.drop : Nat -> Text -> Text - 436. Text.empty : Text - 437. Text.eq : Text -> Text -> Boolean - 438. Text.fromCharList : [Char] -> Text - 439. Text.fromUtf8.impl : Bytes -> Either Failure Text - 440. Text.gt : Text -> Text -> Boolean - 441. Text.gteq : Text -> Text -> Boolean - 442. Text.lt : Text -> Text -> Boolean - 443. Text.lteq : Text -> Text -> Boolean - 444. Text.patterns.anyChar : Pattern Text - 445. Text.patterns.charIn : [Char] -> Pattern Text - 446. Text.patterns.charRange : Char -> Char -> Pattern Text - 447. Text.patterns.digit : Pattern Text - 448. Text.patterns.eof : Pattern Text - 449. Text.patterns.letter : Pattern Text - 450. Text.patterns.literal : Text -> Pattern Text - 451. Text.patterns.notCharIn : [Char] -> Pattern Text - 452. Text.patterns.notCharRange : Char -> Char -> Pattern Text - 453. Text.patterns.punctuation : Pattern Text - 454. Text.patterns.space : Pattern Text - 455. Text.repeat : Nat -> Text -> Text - 456. Text.reverse : Text -> Text - 457. Text.size : Text -> Nat - 458. Text.take : Nat -> Text -> Text - 459. Text.toCharList : Text -> [Char] - 460. Text.toLowercase : Text -> Text - 461. Text.toUppercase : Text -> Text - 462. Text.toUtf8 : Text -> Bytes - 463. Text.uncons : Text -> Optional (Char, Text) - 464. Text.unsnoc : Text -> Optional (Text, Char) - 465. ThreadId.toText : ThreadId -> Text - 466. todo : a -> b - 467. structural type Tuple a b - 468. Tuple.Cons : a -> b -> Tuple a b - 469. structural type Unit - 470. Unit.Unit : () - 471. Universal.< : a -> a -> Boolean - 472. Universal.<= : a -> a -> Boolean - 473. Universal.== : a -> a -> Boolean - 474. Universal.> : a -> a -> Boolean - 475. Universal.>= : a -> a -> Boolean - 476. Universal.compare : a -> a -> Int - 477. Universal.murmurHash : a -> Nat - 478. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 479. builtin type Value - 480. Value.dependencies : Value -> [Term] - 481. Value.deserialize : Bytes -> Either Text Value - 482. Value.load : Value ->{IO} Either [Term] a - 483. Value.serialize : Value -> Bytes - 484. Value.value : a -> Value + 443. Scope.ref : a ->{Scope s} Ref {Scope s} a + 444. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r + 445. structural type SeqView a b + 446. SeqView.VElem : a -> b -> SeqView a b + 447. SeqView.VEmpty : SeqView a b + 448. Socket.toText : Socket -> Text + 449. unique type Test.Result + 450. Test.Result.Fail : Text -> Result + 451. Test.Result.Ok : Text -> Result + 452. builtin type Text + 453. Text.!= : Text -> Text -> Boolean + 454. Text.++ : Text -> Text -> Text + 455. Text.drop : Nat -> Text -> Text + 456. Text.empty : Text + 457. Text.eq : Text -> Text -> Boolean + 458. Text.fromCharList : [Char] -> Text + 459. Text.fromUtf8.impl : Bytes -> Either Failure Text + 460. Text.gt : Text -> Text -> Boolean + 461. Text.gteq : Text -> Text -> Boolean + 462. Text.lt : Text -> Text -> Boolean + 463. Text.lteq : Text -> Text -> Boolean + 464. Text.patterns.anyChar : Pattern Text + 465. Text.patterns.char : Class -> Pattern Text + 466. Text.patterns.charIn : [Char] -> Pattern Text + 467. Text.patterns.charRange : Char -> Char -> Pattern Text + 468. Text.patterns.digit : Pattern Text + 469. Text.patterns.eof : Pattern Text + 470. Text.patterns.letter : Pattern Text + 471. Text.patterns.literal : Text -> Pattern Text + 472. Text.patterns.notCharIn : [Char] -> Pattern Text + 473. Text.patterns.notCharRange : Char -> Char -> Pattern Text + 474. Text.patterns.punctuation : Pattern Text + 475. Text.patterns.space : Pattern Text + 476. Text.repeat : Nat -> Text -> Text + 477. Text.reverse : Text -> Text + 478. Text.size : Text -> Nat + 479. Text.take : Nat -> Text -> Text + 480. Text.toCharList : Text -> [Char] + 481. Text.toLowercase : Text -> Text + 482. Text.toUppercase : Text -> Text + 483. Text.toUtf8 : Text -> Bytes + 484. Text.uncons : Text -> Optional (Char, Text) + 485. Text.unsnoc : Text -> Optional (Text, Char) + 486. ThreadId.toText : ThreadId -> Text + 487. todo : a -> b + 488. structural type Tuple a b + 489. Tuple.Cons : a -> b -> Tuple a b + 490. structural type Unit + 491. Unit.Unit : () + 492. Universal.< : a -> a -> Boolean + 493. Universal.<= : a -> a -> Boolean + 494. Universal.== : a -> a -> Boolean + 495. Universal.> : a -> a -> Boolean + 496. Universal.>= : a -> a -> Boolean + 497. Universal.compare : a -> a -> Int + 498. Universal.murmurHash : a -> Nat + 499. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b + 500. builtin type Value + 501. Value.dependencies : Value -> [Term] + 502. Value.deserialize : Bytes -> Either Text Value + 503. Value.load : Value ->{IO} Either [Term] a + 504. Value.serialize : Value -> Bytes + 505. Value.value : a -> Value .builtin> alias.many 94-104 .mylib @@ -674,17 +695,17 @@ Let's try it! Added definitions: - 1. Float.atanh : Float -> Float - 2. Float.ceiling : Float -> Int - 3. Float.cos : Float -> Float - 4. Float.cosh : Float -> Float - 5. Float.eq : Float -> Float -> Boolean - 6. Float.exp : Float -> Float - 7. Float.floor : Float -> Int - 8. Float.fromRepresentation : Nat -> Float - 9. Float.fromText : Text -> Optional Float - 10. Float.gt : Float -> Float -> Boolean - 11. Float.gteq : Float -> Float -> Boolean + 1. structural type Either a b + 2. structural ability Exception + 3. builtin type Float + 4. Either.Left : a -> Either a b + 5. Doc.Link : Link -> Doc + 6. Either.Right : b -> Either a b + 7. Doc.Signature : Term -> Doc + 8. Doc.Source : Link -> Doc + 9. Exception.raise : Failure ->{Exception} x + 10. Float.* : Float -> Float -> Float + 11. Float.+ : Float -> Float -> Float Tip: You can use `undo` or `reflog` to undo this change. @@ -744,17 +765,17 @@ I want to incorporate a few more from another namespace: .mylib> find - 1. Float.atanh : Float -> Float - 2. Float.ceiling : Float -> Int - 3. Float.cos : Float -> Float - 4. Float.cosh : Float -> Float - 5. Float.eq : Float -> Float -> Boolean - 6. Float.exp : Float -> Float - 7. Float.floor : Float -> Int - 8. Float.fromRepresentation : Nat -> Float - 9. Float.fromText : Text -> Optional Float - 10. Float.gt : Float -> Float -> Boolean - 11. Float.gteq : Float -> Float -> Boolean + 1. Doc.Link : Link -> Doc + 2. Doc.Signature : Term -> Doc + 3. Doc.Source : Link -> Doc + 4. structural type Either a b + 5. Either.Left : a -> Either a b + 6. Either.Right : b -> Either a b + 7. structural ability Exception + 8. Exception.raise : Failure ->{Exception} x + 9. builtin type Float + 10. Float.* : Float -> Float -> Float + 11. Float.+ : Float -> Float -> Float 12. List.adjacentPairs : [a] -> [(a, a)] 13. List.all : (a ->{g} Boolean) -> [a] ->{g} Boolean 14. List.any : (a ->{g} Boolean) -> [a] ->{g} Boolean diff --git a/unison-src/transcripts/builtins-merge.output.md b/unison-src/transcripts/builtins-merge.output.md index bf37fd331..bad9e8cc0 100644 --- a/unison-src/transcripts/builtins-merge.output.md +++ b/unison-src/transcripts/builtins-merge.output.md @@ -16,7 +16,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 5. Bytes (builtin type) 6. Bytes/ (33 terms) 7. Char (builtin type) - 8. Char/ (3 terms) + 8. Char/ (22 terms, 1 type) 9. Code (builtin type) 10. Code/ (8 terms) 11. Debug/ (3 terms) @@ -63,7 +63,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 52. Socket/ (1 term) 53. Test/ (2 terms, 1 type) 54. Text (builtin type) - 55. Text/ (32 terms) + 55. Text/ (33 terms) 56. ThreadId/ (1 term) 57. Tuple (type) 58. Tuple/ (1 term) diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index 7387e258a..52a58a68c 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge` .foo> ls - 1. builtin/ (420 terms, 64 types) + 1. builtin/ (440 terms, 65 types) ``` And for a limited time, you can get even more builtin goodies: @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (592 terms, 82 types) + 1. builtin/ (612 terms, 83 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/fix1063.md b/unison-src/transcripts/fix1063.md index 1806b0e30..4a876a6b1 100644 --- a/unison-src/transcripts/fix1063.md +++ b/unison-src/transcripts/fix1063.md @@ -7,6 +7,8 @@ Tests that functions named `.` are rendered correctly. ``` unison (.) f g x = f (g x) +use Boolean not + noop = not . not ``` diff --git a/unison-src/transcripts/fix1063.output.md b/unison-src/transcripts/fix1063.output.md index 38065343b..790b54a0f 100644 --- a/unison-src/transcripts/fix1063.output.md +++ b/unison-src/transcripts/fix1063.output.md @@ -3,6 +3,8 @@ Tests that functions named `.` are rendered correctly. ```unison (.) f g x = f (g x) +use Boolean not + noop = not . not ``` @@ -31,6 +33,8 @@ noop = not . not .> view noop noop : Boolean -> Boolean - noop = not . not + noop = + use Boolean not + not . not ``` diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index c727cd0ab..05f6267ff 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -113,13 +113,13 @@ it's still in the `history` of the parent namespace and can be resurrected at an Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #492bge1qkb + ⊙ 1. #pfspc3m714 - Deletes: feature1.y - ⊙ 2. #qdsgea37fc + ⊙ 2. #t9gdv3652e + Adds / updates: @@ -130,26 +130,26 @@ it's still in the `history` of the parent namespace and can be resurrected at an Original name New name(s) feature1.y master.y - ⊙ 3. #ppkkh269f7 + ⊙ 3. #fnah4umom7 + Adds / updates: feature1.y - ⊙ 4. #u8aiheqfug + ⊙ 4. #fsd9t403lp > Moves: Original name New name x master.x - ⊙ 5. #es9cmc7kok + ⊙ 5. #64tba28sdf + Adds / updates: x - □ 6. #jo7t8m4dft (start of history) + □ 6. #uql7vkh78v (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 34eda9f8b..0b5fd12c2 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -269,7 +269,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (597 terms, 83 types) + 1. root/ (617 terms, 84 types) .> history @@ -278,13 +278,13 @@ I should be able to move the root into a sub-namespace - □ 1. #bn675bbtpm (start of history) + □ 1. #g5nn5l3b03 (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (592 terms, 82 types) + 1. builtin/ (612 terms, 83 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -294,7 +294,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #vor04lbt72 + ⊙ 1. #vt3jsa8k80 - Deletes: @@ -305,7 +305,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #tk3qtdeoov + ⊙ 2. #b2h3s5rv29 + Adds / updates: @@ -317,26 +317,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #r971i7m95i + ⊙ 3. #7v6bvecsm0 + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #6qh988adub + ⊙ 4. #1uf0leagkk > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #g19mlrid0i + ⊙ 5. #a3uao3fp6q - Deletes: history.b.termInB - ⊙ 6. #n0a5seofan + ⊙ 6. #umd1mp6mku + Adds / updates: @@ -347,13 +347,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #i3nsbtl7kc + ⊙ 7. #dqfd14almm + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #a2u0kep087 + ⊙ 8. #ljk3oa07ld > Moves: @@ -363,7 +363,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #g18uf760mb + ⊙ 9. #hhun973gp5 + Adds / updates: @@ -373,7 +373,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #2edl4803r1 + ⊙ 10. #8ri4h5gjvo + Adds / updates: @@ -385,7 +385,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #qcd5obbuv8 + ⊙ 11. #ahcsbbqt21 ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index 3e0bc6d1a..f6c248b2d 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -100,334 +100,346 @@ d = c + 10 12. builtin type builtin.Bytes 13. builtin type builtin.Char 14. builtin type builtin.io2.Tls.Cipher - 15. builtin type builtin.io2.Tls.ClientConfig - 16. builtin type builtin.Code - 17. unique type builtin.Doc - 18. structural type builtin.Either a b - 19. structural ability builtin.Exception - 20. unique type builtin.io2.Failure - 21. unique type builtin.io2.FileMode - 22. builtin type builtin.Float - 23. builtin type builtin.io2.Handle - 24. builtin type builtin.crypto.HashAlgorithm - 25. builtin ability builtin.io2.IO - 26. unique type builtin.io2.IOError - 27. unique type builtin.io2.IOFailure - 28. builtin type builtin.ImmutableArray - 29. builtin type builtin.ImmutableByteArray - 30. builtin type builtin.Int - 31. unique type builtin.IsPropagated - 32. unique type builtin.IsTest - 33. unique type builtin.Link - 34. builtin type builtin.List - 35. builtin type builtin.io2.MVar - 36. unique type builtin.io2.MiscFailure - 37. builtin type builtin.MutableArray - 38. builtin type builtin.MutableByteArray - 39. builtin type builtin.Nat - 40. structural type builtin.Optional a - 41. builtin type builtin.Pattern - 42. builtin type builtin.io2.Tls.PrivateKey - 43. builtin type builtin.io2.ProcessHandle - 44. builtin type builtin.io2.Promise - 45. builtin type builtin.Ref - 46. builtin type builtin.Request - 47. unique type builtin.Test.Result - 48. unique type builtin.io2.RuntimeFailure - 49. builtin ability builtin.io2.STM - 50. unique type builtin.io2.STMFailure - 51. builtin ability builtin.Scope - 52. unique type builtin.io2.SeekMode - 53. structural type builtin.SeqView a b - 54. builtin type builtin.io2.Tls.ServerConfig - 55. builtin type builtin.io2.Tls.SignedCert - 56. builtin type builtin.io2.Socket - 57. unique type builtin.io2.StdHandle - 58. builtin type builtin.io2.TVar - 59. builtin type builtin.Link.Term - 60. builtin type builtin.Text - 61. builtin type builtin.io2.ThreadId - 62. builtin type builtin.io2.Ref.Ticket - 63. builtin type builtin.io2.Clock.internals.TimeSpec - 64. builtin type builtin.io2.Tls - 65. unique type builtin.io2.TlsFailure - 66. structural type builtin.Tuple a b - 67. builtin type builtin.Link.Type - 68. structural type builtin.Unit - 69. builtin type builtin.Value - 70. builtin type builtin.io2.Tls.Version - 71. builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 72. builtin.io2.IOError.AlreadyExists : IOError - 73. builtin.io2.FileMode.Append : FileMode - 74. builtin.Doc.Blob : Text + 15. builtin type builtin.Char.Class + 16. builtin type builtin.io2.Tls.ClientConfig + 17. builtin type builtin.Code + 18. unique type builtin.Doc + 19. structural type builtin.Either a b + 20. structural ability builtin.Exception + 21. unique type builtin.io2.Failure + 22. unique type builtin.io2.FileMode + 23. builtin type builtin.Float + 24. builtin type builtin.io2.Handle + 25. builtin type builtin.crypto.HashAlgorithm + 26. builtin ability builtin.io2.IO + 27. unique type builtin.io2.IOError + 28. unique type builtin.io2.IOFailure + 29. builtin type builtin.ImmutableArray + 30. builtin type builtin.ImmutableByteArray + 31. builtin type builtin.Int + 32. unique type builtin.IsPropagated + 33. unique type builtin.IsTest + 34. unique type builtin.Link + 35. builtin type builtin.List + 36. builtin type builtin.io2.MVar + 37. unique type builtin.io2.MiscFailure + 38. builtin type builtin.MutableArray + 39. builtin type builtin.MutableByteArray + 40. builtin type builtin.Nat + 41. structural type builtin.Optional a + 42. builtin type builtin.Pattern + 43. builtin type builtin.io2.Tls.PrivateKey + 44. builtin type builtin.io2.ProcessHandle + 45. builtin type builtin.io2.Promise + 46. builtin type builtin.Ref + 47. builtin type builtin.Request + 48. unique type builtin.Test.Result + 49. unique type builtin.io2.RuntimeFailure + 50. builtin ability builtin.io2.STM + 51. unique type builtin.io2.STMFailure + 52. builtin ability builtin.Scope + 53. unique type builtin.io2.SeekMode + 54. structural type builtin.SeqView a b + 55. builtin type builtin.io2.Tls.ServerConfig + 56. builtin type builtin.io2.Tls.SignedCert + 57. builtin type builtin.io2.Socket + 58. unique type builtin.io2.StdHandle + 59. builtin type builtin.io2.TVar + 60. builtin type builtin.Link.Term + 61. builtin type builtin.Text + 62. builtin type builtin.io2.ThreadId + 63. builtin type builtin.io2.Ref.Ticket + 64. builtin type builtin.io2.Clock.internals.TimeSpec + 65. builtin type builtin.io2.Tls + 66. unique type builtin.io2.TlsFailure + 67. structural type builtin.Tuple a b + 68. builtin type builtin.Link.Type + 69. structural type builtin.Unit + 70. builtin type builtin.Value + 71. builtin type builtin.io2.Tls.Version + 72. builtin.io2.SeekMode.AbsoluteSeek : SeekMode + 73. builtin.io2.IOError.AlreadyExists : IOError + 74. builtin.io2.FileMode.Append : FileMode + 75. builtin.Doc.Blob : Text -> Doc - 75. builtin.io2.BufferMode.BlockBuffering : BufferMode - 76. builtin.Tuple.Cons : a + 76. builtin.io2.BufferMode.BlockBuffering : BufferMode + 77. builtin.Tuple.Cons : a -> b -> Tuple a b - 77. builtin.io2.IOError.EOF : IOError - 78. builtin.Doc.Evaluate : Term + 78. builtin.io2.IOError.EOF : IOError + 79. builtin.Doc.Evaluate : Term -> Doc - 79. builtin.Test.Result.Fail : Text + 80. builtin.Test.Result.Fail : Text -> Result - 80. builtin.io2.Failure.Failure : Type + 81. builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 81. builtin.io2.IOError.IllegalOperation : IOError - 82. builtin.IsPropagated.IsPropagated : IsPropagated - 83. builtin.IsTest.IsTest : IsTest - 84. builtin.Doc.Join : [Doc] + 82. builtin.io2.IOError.IllegalOperation : IOError + 83. builtin.IsPropagated.IsPropagated : IsPropagated + 84. builtin.IsTest.IsTest : IsTest + 85. builtin.Doc.Join : [Doc] -> Doc - 85. builtin.Either.Left : a + 86. builtin.Either.Left : a -> Either a b - 86. builtin.io2.BufferMode.LineBuffering : BufferMode - 87. builtin.Doc.Link : Link + 87. builtin.io2.BufferMode.LineBuffering : BufferMode + 88. builtin.Doc.Link : Link -> Doc - 88. builtin.io2.BufferMode.NoBuffering : BufferMode - 89. builtin.io2.IOError.NoSuchThing : IOError - 90. builtin.Optional.None : Optional + 89. builtin.io2.BufferMode.NoBuffering : BufferMode + 90. builtin.io2.IOError.NoSuchThing : IOError + 91. builtin.Optional.None : Optional a - 91. builtin.Test.Result.Ok : Text + 92. builtin.Test.Result.Ok : Text -> Result - 92. builtin.io2.IOError.PermissionDenied : IOError - 93. builtin.io2.FileMode.Read : FileMode - 94. builtin.io2.FileMode.ReadWrite : FileMode - 95. builtin.io2.SeekMode.RelativeSeek : SeekMode - 96. builtin.io2.IOError.ResourceBusy : IOError - 97. builtin.io2.IOError.ResourceExhausted : IOError - 98. builtin.Either.Right : b + 93. builtin.io2.IOError.PermissionDenied : IOError + 94. builtin.io2.FileMode.Read : FileMode + 95. builtin.io2.FileMode.ReadWrite : FileMode + 96. builtin.io2.SeekMode.RelativeSeek : SeekMode + 97. builtin.io2.IOError.ResourceBusy : IOError + 98. builtin.io2.IOError.ResourceExhausted : IOError + 99. builtin.Either.Right : b -> Either a b - 99. builtin.io2.SeekMode.SeekFromEnd : SeekMode - 100. builtin.Doc.Signature : Term + 100. builtin.io2.SeekMode.SeekFromEnd : SeekMode + 101. builtin.Doc.Signature : Term -> Doc - 101. builtin.io2.BufferMode.SizedBlockBuffering : Nat + 102. builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 102. builtin.Optional.Some : a + 103. builtin.Optional.Some : a -> Optional a - 103. builtin.Doc.Source : Link + 104. builtin.Doc.Source : Link -> Doc - 104. builtin.io2.StdHandle.StdErr : StdHandle - 105. builtin.io2.StdHandle.StdIn : StdHandle - 106. builtin.io2.StdHandle.StdOut : StdHandle - 107. builtin.Link.Term : Term + 105. builtin.io2.StdHandle.StdErr : StdHandle + 106. builtin.io2.StdHandle.StdIn : StdHandle + 107. builtin.io2.StdHandle.StdOut : StdHandle + 108. builtin.Link.Term : Term -> Link - 108. builtin.Link.Type : Type + 109. builtin.Link.Type : Type -> Link - 109. builtin.Unit.Unit : () - 110. builtin.io2.IOError.UserError : IOError - 111. builtin.SeqView.VElem : a + 110. builtin.Unit.Unit : () + 111. builtin.io2.IOError.UserError : IOError + 112. builtin.SeqView.VElem : a -> b -> SeqView a b - 112. builtin.SeqView.VEmpty : SeqView + 113. builtin.SeqView.VEmpty : SeqView a b - 113. builtin.io2.FileMode.Write : FileMode - 114. builtin.Exception.raise : Failure + 114. builtin.io2.FileMode.Write : FileMode + 115. builtin.Exception.raise : Failure ->{Exception} x - 115. builtin.Text.!= : Text + 116. builtin.Text.!= : Text -> Text -> Boolean - 116. builtin.Float.* : Float + 117. builtin.Float.* : Float -> Float -> Float - 117. builtin.Int.* : Int + 118. builtin.Int.* : Int -> Int -> Int - 118. builtin.Nat.* : Nat + 119. builtin.Nat.* : Nat -> Nat -> Nat - 119. builtin.Float.+ : Float + 120. builtin.Float.+ : Float -> Float -> Float - 120. builtin.Int.+ : Int + 121. builtin.Int.+ : Int -> Int -> Int - 121. builtin.Nat.+ : Nat + 122. builtin.Nat.+ : Nat -> Nat -> Nat - 122. builtin.Bytes.++ : Bytes + 123. builtin.Bytes.++ : Bytes -> Bytes -> Bytes - 123. builtin.List.++ : [a] + 124. builtin.List.++ : [a] -> [a] -> [a] - 124. builtin.Text.++ : Text + 125. builtin.Text.++ : Text -> Text -> Text - 125. ┌ builtin.List.+: : a + 126. ┌ builtin.List.+: : a -> [a] -> [a] - 126. └ builtin.List.cons : a + 127. └ builtin.List.cons : a -> [a] -> [a] - 127. builtin.Float.- : Float + 128. builtin.Float.- : Float -> Float -> Float - 128. builtin.Int.- : Int + 129. builtin.Int.- : Int -> Int -> Int - 129. builtin.Float./ : Float + 130. builtin.Float./ : Float -> Float -> Float - 130. builtin.Int./ : Int + 131. builtin.Int./ : Int -> Int -> Int - 131. builtin.Nat./ : Nat + 132. builtin.Nat./ : Nat -> Nat -> Nat - 132. ┌ builtin.List.:+ : [a] + 133. ┌ builtin.List.:+ : [a] -> a -> [a] - 133. └ builtin.List.snoc : [a] + 134. └ builtin.List.snoc : [a] -> a -> [a] - 134. builtin.Universal.< : a + 135. builtin.Universal.< : a -> a -> Boolean - 135. builtin.Universal.<= : a + 136. builtin.Universal.<= : a -> a -> Boolean - 136. builtin.Universal.== : a + 137. builtin.Universal.== : a -> a -> Boolean - 137. builtin.Universal.> : a + 138. builtin.Universal.> : a -> a -> Boolean - 138. builtin.Universal.>= : a + 139. builtin.Universal.>= : a -> a -> Boolean - 139. builtin.Any.Any : a + 140. builtin.Any.Any : a -> Any - 140. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm - 141. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm - 142. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 143. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm - 144. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 145. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 146. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 147. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 148. builtin.Float.abs : Float + 141. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm + 142. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm + 143. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm + 144. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm + 145. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + 146. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + 147. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + 148. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + 149. builtin.Float.abs : Float -> Float - 149. builtin.Float.acos : Float + 150. builtin.Float.acos : Float -> Float - 150. builtin.Float.acosh : Float + 151. builtin.Float.acosh : Float -> Float - 151. builtin.Int.and : Int + 152. builtin.Char.Class.alphanumeric : Class + 153. builtin.Char.Class.and : Class + -> Class + -> Class + 154. builtin.Int.and : Int -> Int -> Int - 152. builtin.Nat.and : Nat + 155. builtin.Nat.and : Nat -> Nat -> Nat - 153. builtin.Text.patterns.anyChar : Pattern + 156. builtin.Char.Class.any : Class + 157. builtin.Text.patterns.anyChar : Pattern Text - 154. builtin.io2.IO.array : Nat + 158. builtin.Char.Class.anyOf : [Char] + -> Class + 159. builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 155. builtin.Scope.array : Nat + 160. builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 156. builtin.io2.IO.arrayOf : a + 161. builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 157. builtin.Scope.arrayOf : a + 162. builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 158. builtin.Float.asin : Float + 163. builtin.Float.asin : Float -> Float - 159. builtin.Float.asinh : Float + 164. builtin.Float.asinh : Float -> Float - 160. builtin.Bytes.at : Nat + 165. builtin.Bytes.at : Nat -> Bytes -> Optional Nat - 161. builtin.List.at : Nat + 166. builtin.List.at : Nat -> [a] -> Optional a - 162. builtin.Float.atan : Float + 167. builtin.Float.atan : Float -> Float - 163. builtin.Float.atan2 : Float + 168. builtin.Float.atan2 : Float -> Float -> Float - 164. builtin.Float.atanh : Float + 169. builtin.Float.atanh : Float -> Float - 165. builtin.io2.STM.atomically : '{STM} a + 170. builtin.io2.STM.atomically : '{STM} a ->{IO} a - 166. builtin.bug : a -> b - 167. builtin.io2.IO.bytearray : Nat + 171. builtin.bug : a -> b + 172. builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 168. builtin.Scope.bytearray : Nat + 173. builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 169. builtin.io2.IO.bytearrayOf : Nat + 174. builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 170. builtin.Scope.bytearrayOf : Nat + 175. builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 171. ┌ c#gjmq673r1v : Nat - 172. └ long.name.but.shortest.suffixification : Nat - 173. builtin.Code.cache_ : [( Term, + 176. ┌ c#gjmq673r1v : Nat + 177. └ long.name.but.shortest.suffixification : Nat + 178. builtin.Code.cache_ : [( Term, Code)] ->{IO} [Term] - 174. builtin.io2.IO.process.call : Text + 179. builtin.io2.IO.process.call : Text -> [Text] ->{IO} Nat - 175. builtin.Pattern.capture : Pattern + 180. builtin.Pattern.capture : Pattern a -> Pattern a - 176. builtin.io2.Ref.cas : Ref + 181. builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 177. builtin.Float.ceiling : Float + 182. builtin.Float.ceiling : Float -> Int - 178. builtin.Text.patterns.charIn : [Char] + 183. builtin.Text.patterns.char : Class -> Pattern Text - 179. builtin.Text.patterns.charRange : Char + 184. builtin.Text.patterns.charIn : [Char] + -> Pattern + Text + 185. builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 180. builtin.unsafe.coerceAbilities : (a + 186. builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 181. builtin.Universal.compare : a + 187. builtin.Universal.compare : a -> a -> Int - 182. builtin.Int.complement : Int + 188. builtin.Int.complement : Int -> Int - 183. builtin.Nat.complement : Nat + 189. builtin.Nat.complement : Nat -> Nat - 184. builtin.Bytes.gzip.compress : Bytes + 190. builtin.Bytes.gzip.compress : Bytes -> Bytes - 185. builtin.Bytes.zlib.compress : Bytes + 191. builtin.Bytes.zlib.compress : Bytes -> Bytes - 186. builtin.ImmutableArray.copyTo! : MutableArray + 192. builtin.Char.Class.control : Class + 193. builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray @@ -436,7 +448,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 187. builtin.ImmutableByteArray.copyTo! : MutableByteArray + 194. builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -444,7 +456,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 188. builtin.MutableArray.copyTo! : MutableArray + 195. builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray @@ -453,7 +465,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 189. builtin.MutableByteArray.copyTo! : MutableByteArray + 196. builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray @@ -462,958 +474,979 @@ d = c + 10 -> Nat ->{g, Exception} () - 190. builtin.Float.cos : Float + 197. builtin.Float.cos : Float -> Float - 191. builtin.Float.cosh : Float + 198. builtin.Float.cosh : Float -> Float - 192. builtin.Bytes.decodeNat16be : Bytes + 199. builtin.Bytes.decodeNat16be : Bytes -> Optional ( Nat, Bytes) - 193. builtin.Bytes.decodeNat16le : Bytes + 200. builtin.Bytes.decodeNat16le : Bytes -> Optional ( Nat, Bytes) - 194. builtin.Bytes.decodeNat32be : Bytes + 201. builtin.Bytes.decodeNat32be : Bytes -> Optional ( Nat, Bytes) - 195. builtin.Bytes.decodeNat32le : Bytes + 202. builtin.Bytes.decodeNat32le : Bytes -> Optional ( Nat, Bytes) - 196. builtin.Bytes.decodeNat64be : Bytes + 203. builtin.Bytes.decodeNat64be : Bytes -> Optional ( Nat, Bytes) - 197. builtin.Bytes.decodeNat64le : Bytes + 204. builtin.Bytes.decodeNat64le : Bytes -> Optional ( Nat, Bytes) - 198. builtin.io2.Tls.decodePrivateKey : Bytes + 205. builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 199. builtin.Bytes.gzip.decompress : Bytes + 206. builtin.Bytes.gzip.decompress : Bytes -> Either Text Bytes - 200. builtin.Bytes.zlib.decompress : Bytes + 207. builtin.Bytes.zlib.decompress : Bytes -> Either Text Bytes - 201. builtin.io2.Tls.ClientConfig.default : Text + 208. builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 202. builtin.io2.Tls.ServerConfig.default : [SignedCert] + 209. builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 203. builtin.Code.dependencies : Code + 210. builtin.Code.dependencies : Code -> [Term] - 204. builtin.Value.dependencies : Value + 211. builtin.Value.dependencies : Value -> [Term] - 205. builtin.Code.deserialize : Bytes + 212. builtin.Code.deserialize : Bytes -> Either Text Code - 206. builtin.Value.deserialize : Bytes + 213. builtin.Value.deserialize : Bytes -> Either Text Value - 207. builtin.Text.patterns.digit : Pattern + 214. builtin.Text.patterns.digit : Pattern Text - 208. builtin.Code.display : Text + 215. builtin.Code.display : Text -> Code -> Text - 209. builtin.Bytes.drop : Nat + 216. builtin.Bytes.drop : Nat -> Bytes -> Bytes - 210. builtin.List.drop : Nat + 217. builtin.List.drop : Nat -> [a] -> [a] - 211. builtin.Nat.drop : Nat + 218. builtin.Nat.drop : Nat -> Nat -> Nat - 212. builtin.Text.drop : Nat + 219. builtin.Text.drop : Nat -> Text -> Text - 213. builtin.Bytes.empty : Bytes - 214. builtin.List.empty : [a] - 215. builtin.Text.empty : Text - 216. builtin.io2.Tls.encodeCert : SignedCert + 220. builtin.Bytes.empty : Bytes + 221. builtin.List.empty : [a] + 222. builtin.Text.empty : Text + 223. builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 217. builtin.Bytes.encodeNat16be : Nat + 224. builtin.Bytes.encodeNat16be : Nat -> Bytes - 218. builtin.Bytes.encodeNat16le : Nat + 225. builtin.Bytes.encodeNat16le : Nat -> Bytes - 219. builtin.Bytes.encodeNat32be : Nat + 226. builtin.Bytes.encodeNat32be : Nat -> Bytes - 220. builtin.Bytes.encodeNat32le : Nat + 227. builtin.Bytes.encodeNat32le : Nat -> Bytes - 221. builtin.Bytes.encodeNat64be : Nat + 228. builtin.Bytes.encodeNat64be : Nat -> Bytes - 222. builtin.Bytes.encodeNat64le : Nat + 229. builtin.Bytes.encodeNat64le : Nat -> Bytes - 223. builtin.io2.Tls.encodePrivateKey : PrivateKey + 230. builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 224. builtin.Text.patterns.eof : Pattern + 231. builtin.Text.patterns.eof : Pattern Text - 225. builtin.Float.eq : Float + 232. builtin.Float.eq : Float -> Float -> Boolean - 226. builtin.Int.eq : Int + 233. builtin.Int.eq : Int -> Int -> Boolean - 227. builtin.Nat.eq : Nat + 234. builtin.Nat.eq : Nat -> Nat -> Boolean - 228. builtin.Text.eq : Text + 235. builtin.Text.eq : Text -> Text -> Boolean - 229. builtin.io2.IO.process.exitCode : ProcessHandle + 236. builtin.io2.IO.process.exitCode : ProcessHandle ->{IO} Optional Nat - 230. builtin.Float.exp : Float + 237. builtin.Float.exp : Float -> Float - 231. builtin.Bytes.flatten : Bytes + 238. builtin.Bytes.flatten : Bytes -> Bytes - 232. builtin.Float.floor : Float + 239. builtin.Float.floor : Float -> Int - 233. builtin.io2.IO.forkComp : '{IO} a + 240. builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 234. builtin.MutableArray.freeze : MutableArray + 241. builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 235. builtin.MutableByteArray.freeze : MutableByteArray + 242. builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 236. builtin.MutableArray.freeze! : MutableArray + 243. builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 237. builtin.MutableByteArray.freeze! : MutableByteArray + 244. builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 238. builtin.Bytes.fromBase16 : Bytes + 245. builtin.Bytes.fromBase16 : Bytes -> Either Text Bytes - 239. builtin.Bytes.fromBase32 : Bytes + 246. builtin.Bytes.fromBase32 : Bytes -> Either Text Bytes - 240. builtin.Bytes.fromBase64 : Bytes + 247. builtin.Bytes.fromBase64 : Bytes -> Either Text Bytes - 241. builtin.Bytes.fromBase64UrlUnpadded : Bytes + 248. builtin.Bytes.fromBase64UrlUnpadded : Bytes -> Either Text Bytes - 242. builtin.Text.fromCharList : [Char] + 249. builtin.Text.fromCharList : [Char] -> Text - 243. builtin.Bytes.fromList : [Nat] + 250. builtin.Bytes.fromList : [Nat] -> Bytes - 244. builtin.Char.fromNat : Nat + 251. builtin.Char.fromNat : Nat -> Char - 245. builtin.Float.fromRepresentation : Nat + 252. builtin.Float.fromRepresentation : Nat -> Float - 246. builtin.Int.fromRepresentation : Nat + 253. builtin.Int.fromRepresentation : Nat -> Int - 247. builtin.Float.fromText : Text + 254. builtin.Float.fromText : Text -> Optional Float - 248. builtin.Int.fromText : Text + 255. builtin.Int.fromText : Text -> Optional Int - 249. builtin.Nat.fromText : Text + 256. builtin.Nat.fromText : Text -> Optional Nat - 250. builtin.Float.gt : Float + 257. builtin.Float.gt : Float -> Float -> Boolean - 251. builtin.Int.gt : Int + 258. builtin.Int.gt : Int -> Int -> Boolean - 252. builtin.Nat.gt : Nat + 259. builtin.Nat.gt : Nat -> Nat -> Boolean - 253. builtin.Text.gt : Text + 260. builtin.Text.gt : Text -> Text -> Boolean - 254. builtin.Float.gteq : Float + 261. builtin.Float.gteq : Float -> Float -> Boolean - 255. builtin.Int.gteq : Int + 262. builtin.Int.gteq : Int -> Int -> Boolean - 256. builtin.Nat.gteq : Nat + 263. builtin.Nat.gteq : Nat -> Nat -> Boolean - 257. builtin.Text.gteq : Text + 264. builtin.Text.gteq : Text -> Text -> Boolean - 258. builtin.crypto.hash : HashAlgorithm + 265. builtin.crypto.hash : HashAlgorithm -> a -> Bytes - 259. builtin.crypto.hashBytes : HashAlgorithm + 266. builtin.crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 260. builtin.crypto.hmac : HashAlgorithm + 267. builtin.crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 261. builtin.crypto.hmacBytes : HashAlgorithm + 268. builtin.crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 262. builtin.io2.IO.clientSocket.impl : Text + 269. builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 263. builtin.io2.IO.closeFile.impl : Handle + 270. builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 264. builtin.io2.IO.closeSocket.impl : Socket + 271. builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 265. builtin.io2.IO.createDirectory.impl : Text + 272. builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 266. builtin.io2.IO.createTempDirectory.impl : Text + 273. builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 267. builtin.io2.Tls.decodeCert.impl : Bytes + 274. builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 268. builtin.io2.IO.delay.impl : Nat + 275. builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 269. builtin.io2.IO.directoryContents.impl : Text + 276. builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 270. builtin.io2.IO.fileExists.impl : Text + 277. builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 271. builtin.Text.fromUtf8.impl : Bytes + 278. builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 272. builtin.io2.IO.getArgs.impl : '{IO} Either + 279. builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 273. builtin.io2.IO.getBuffering.impl : Handle + 280. builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 274. builtin.io2.IO.getBytes.impl : Handle + 281. builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 275. builtin.io2.IO.getChar.impl : Handle + 282. builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 276. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either + 283. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 277. builtin.io2.IO.getEcho.impl : Handle + 284. builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 278. builtin.io2.IO.getEnv.impl : Text + 285. builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 279. builtin.io2.IO.getFileSize.impl : Text + 286. builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 280. builtin.io2.IO.getFileTimestamp.impl : Text + 287. builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 281. builtin.io2.IO.getLine.impl : Handle + 288. builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 282. builtin.io2.IO.getSomeBytes.impl : Handle + 289. builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 283. builtin.io2.IO.getTempDirectory.impl : '{IO} Either + 290. builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 284. builtin.io2.IO.handlePosition.impl : Handle + 291. builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 285. builtin.io2.Tls.handshake.impl : Tls + 292. builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 286. builtin.io2.IO.isDirectory.impl : Text + 293. builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 287. builtin.io2.IO.isFileEOF.impl : Handle + 294. builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 288. builtin.io2.IO.isFileOpen.impl : Handle + 295. builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 289. builtin.io2.IO.isSeekable.impl : Handle + 296. builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 290. builtin.io2.IO.kill.impl : ThreadId + 297. builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 291. builtin.io2.IO.listen.impl : Socket + 298. builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 292. builtin.io2.Tls.newClient.impl : ClientConfig + 299. builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 293. builtin.io2.Tls.newServer.impl : ServerConfig + 300. builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 294. builtin.io2.IO.openFile.impl : Text + 301. builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 295. builtin.io2.MVar.put.impl : MVar a + 302. builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 296. builtin.io2.IO.putBytes.impl : Handle + 303. builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 297. builtin.io2.MVar.read.impl : MVar a + 304. builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 298. builtin.io2.IO.ready.impl : Handle + 305. builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 299. builtin.io2.Tls.receive.impl : Tls + 306. builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 300. builtin.io2.IO.removeDirectory.impl : Text + 307. builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 301. builtin.io2.IO.removeFile.impl : Text + 308. builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 302. builtin.io2.IO.renameDirectory.impl : Text + 309. builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 303. builtin.io2.IO.renameFile.impl : Text + 310. builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 304. builtin.io2.IO.seekHandle.impl : Handle + 311. builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 305. builtin.io2.Tls.send.impl : Tls + 312. builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 306. builtin.io2.IO.serverSocket.impl : Optional + 313. builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 307. builtin.io2.IO.setBuffering.impl : Handle + 314. builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 308. builtin.io2.IO.setCurrentDirectory.impl : Text + 315. builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 309. builtin.io2.IO.setEcho.impl : Handle + 316. builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 310. builtin.io2.IO.socketAccept.impl : Socket + 317. builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 311. builtin.io2.IO.socketPort.impl : Socket + 318. builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 312. builtin.io2.IO.socketReceive.impl : Socket + 319. builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 313. builtin.io2.IO.socketSend.impl : Socket + 320. builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 314. builtin.io2.MVar.swap.impl : MVar a + 321. builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 315. builtin.io2.IO.systemTime.impl : '{IO} Either + 322. builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 316. builtin.io2.MVar.take.impl : MVar a + 323. builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 317. builtin.io2.Tls.terminate.impl : Tls + 324. builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 318. builtin.io2.MVar.tryPut.impl : MVar a + 325. builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 319. builtin.io2.MVar.tryRead.impl : MVar a + 326. builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 320. builtin.Int.increment : Int + 327. builtin.Int.increment : Int -> Int - 321. builtin.Nat.increment : Nat + 328. builtin.Nat.increment : Nat -> Nat - 322. builtin.io2.MVar.isEmpty : MVar a + 329. builtin.Char.Class.is : Class + -> Char + -> Boolean + 330. builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 323. builtin.Int.isEven : Int + 331. builtin.Int.isEven : Int -> Boolean - 324. builtin.Nat.isEven : Nat + 332. builtin.Nat.isEven : Nat -> Boolean - 325. builtin.Pattern.isMatch : Pattern + 333. builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 326. builtin.Code.isMissing : Term + 334. builtin.Code.isMissing : Term ->{IO} Boolean - 327. builtin.Int.isOdd : Int + 335. builtin.Int.isOdd : Int -> Boolean - 328. builtin.Nat.isOdd : Nat + 336. builtin.Nat.isOdd : Nat -> Boolean - 329. builtin.metadata.isPropagated : IsPropagated - 330. builtin.metadata.isTest : IsTest - 331. builtin.Pattern.join : [Pattern + 337. builtin.metadata.isPropagated : IsPropagated + 338. builtin.metadata.isTest : IsTest + 339. builtin.Pattern.join : [Pattern a] -> Pattern a - 332. builtin.io2.IO.process.kill : ProcessHandle + 340. builtin.io2.IO.process.kill : ProcessHandle ->{IO} () - 333. builtin.Int.leadingZeros : Int + 341. builtin.Int.leadingZeros : Int -> Nat - 334. builtin.Nat.leadingZeros : Nat + 342. builtin.Nat.leadingZeros : Nat -> Nat - 335. builtin.Text.patterns.letter : Pattern + 343. builtin.Char.Class.letter : Class + 344. builtin.Text.patterns.letter : Pattern Text - 336. builtin.Text.patterns.literal : Text + 345. builtin.Text.patterns.literal : Text -> Pattern Text - 337. builtin.Value.load : Value + 346. builtin.Value.load : Value ->{IO} Either [Term] a - 338. builtin.Float.log : Float + 347. builtin.Float.log : Float -> Float - 339. builtin.Float.logBase : Float + 348. builtin.Float.logBase : Float -> Float -> Float - 340. builtin.Code.lookup : Term + 349. builtin.Code.lookup : Term ->{IO} Optional Code - 341. builtin.Float.lt : Float + 350. builtin.Char.Class.lower : Class + 351. builtin.Float.lt : Float -> Float -> Boolean - 342. builtin.Int.lt : Int + 352. builtin.Int.lt : Int -> Int -> Boolean - 343. builtin.Nat.lt : Nat + 353. builtin.Nat.lt : Nat -> Nat -> Boolean - 344. builtin.Text.lt : Text + 354. builtin.Text.lt : Text -> Text -> Boolean - 345. builtin.Float.lteq : Float + 355. builtin.Float.lteq : Float -> Float -> Boolean - 346. builtin.Int.lteq : Int + 356. builtin.Int.lteq : Int -> Int -> Boolean - 347. builtin.Nat.lteq : Nat + 357. builtin.Nat.lteq : Nat -> Nat -> Boolean - 348. builtin.Text.lteq : Text + 358. builtin.Text.lteq : Text -> Text -> Boolean - 349. builtin.Pattern.many : Pattern + 359. builtin.Pattern.many : Pattern a -> Pattern a - 350. builtin.Float.max : Float + 360. builtin.Char.Class.mark : Class + 361. builtin.Float.max : Float -> Float -> Float - 351. builtin.Float.min : Float + 362. builtin.Float.min : Float -> Float -> Float - 352. builtin.Int.mod : Int + 363. builtin.Int.mod : Int -> Int -> Int - 353. builtin.Nat.mod : Nat + 364. builtin.Nat.mod : Nat -> Nat -> Nat - 354. builtin.io2.Clock.internals.monotonic : '{IO} Either + 365. builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 355. builtin.Universal.murmurHash : a + 366. builtin.Universal.murmurHash : a -> Nat - 356. builtin.Int.negate : Int + 367. builtin.Int.negate : Int -> Int - 357. builtin.io2.MVar.new : a + 368. builtin.io2.MVar.new : a ->{IO} MVar a - 358. builtin.io2.Promise.new : '{IO} Promise + 369. builtin.io2.Promise.new : '{IO} Promise a - 359. builtin.io2.TVar.new : a + 370. builtin.io2.TVar.new : a ->{STM} TVar a - 360. builtin.io2.MVar.newEmpty : '{IO} MVar + 371. builtin.io2.MVar.newEmpty : '{IO} MVar a - 361. builtin.io2.TVar.newIO : a + 372. builtin.io2.TVar.newIO : a ->{IO} TVar a - 362. builtin.Boolean.not : Boolean + 373. builtin.Boolean.not : Boolean -> Boolean - 363. builtin.Text.patterns.notCharIn : [Char] + 374. builtin.Char.Class.not : Class + -> Class + 375. builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 364. builtin.Text.patterns.notCharRange : Char + 376. builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 365. builtin.io2.Clock.internals.nsec : TimeSpec + 377. builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 366. builtin.Int.or : Int + 378. builtin.Char.Class.number : Class + 379. builtin.Char.Class.or : Class + -> Class + -> Class + 380. builtin.Int.or : Int -> Int -> Int - 367. builtin.Nat.or : Nat + 381. builtin.Nat.or : Nat -> Nat -> Nat - 368. builtin.Pattern.or : Pattern + 382. builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 369. builtin.Int.popCount : Int + 383. builtin.Int.popCount : Int -> Nat - 370. builtin.Nat.popCount : Nat + 384. builtin.Nat.popCount : Nat -> Nat - 371. builtin.Float.pow : Float + 385. builtin.Float.pow : Float -> Float -> Float - 372. builtin.Int.pow : Int + 386. builtin.Int.pow : Int -> Nat -> Int - 373. builtin.Nat.pow : Nat + 387. builtin.Nat.pow : Nat -> Nat -> Nat - 374. builtin.io2.Clock.internals.processCPUTime : '{IO} Either + 388. builtin.Char.Class.printable : Class + 389. builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 375. builtin.Text.patterns.punctuation : Pattern + 390. builtin.Char.Class.punctuation : Class + 391. builtin.Text.patterns.punctuation : Pattern Text - 376. builtin.ImmutableArray.read : ImmutableArray + 392. builtin.Char.Class.range : Char + -> Char + -> Class + 393. builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 377. builtin.MutableArray.read : MutableArray + 394. builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 378. builtin.io2.Promise.read : Promise + 395. builtin.io2.Promise.read : Promise a ->{IO} a - 379. builtin.Ref.read : Ref g a + 396. builtin.Ref.read : Ref g a ->{g} a - 380. builtin.io2.TVar.read : TVar a + 397. builtin.io2.TVar.read : TVar a ->{STM} a - 381. builtin.io2.Ref.Ticket.read : Ticket + 398. builtin.io2.Ref.Ticket.read : Ticket a -> a - 382. builtin.ImmutableByteArray.read16be : ImmutableByteArray + 399. builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 383. builtin.MutableByteArray.read16be : MutableByteArray + 400. builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 384. builtin.ImmutableByteArray.read24be : ImmutableByteArray + 401. builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 385. builtin.MutableByteArray.read24be : MutableByteArray + 402. builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 386. builtin.ImmutableByteArray.read32be : ImmutableByteArray + 403. builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 387. builtin.MutableByteArray.read32be : MutableByteArray + 404. builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 388. builtin.ImmutableByteArray.read40be : ImmutableByteArray + 405. builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 389. builtin.MutableByteArray.read40be : MutableByteArray + 406. builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 390. builtin.ImmutableByteArray.read64be : ImmutableByteArray + 407. builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 391. builtin.MutableByteArray.read64be : MutableByteArray + 408. builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 392. builtin.ImmutableByteArray.read8 : ImmutableByteArray + 409. builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 393. builtin.MutableByteArray.read8 : MutableByteArray + 410. builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 394. builtin.io2.Ref.readForCas : Ref + 411. builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 395. builtin.io2.TVar.readIO : TVar a + 412. builtin.io2.TVar.readIO : TVar a ->{IO} a - 396. builtin.io2.Clock.internals.realtime : '{IO} Either + 413. builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 397. builtin.io2.IO.ref : a + 414. builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 398. builtin.Scope.ref : a + 415. builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 399. builtin.Text.repeat : Nat + 416. builtin.Text.repeat : Nat -> Text -> Text - 400. builtin.Pattern.replicate : Nat + 417. builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 401. builtin.io2.STM.retry : '{STM} a - 402. builtin.Text.reverse : Text + 418. builtin.io2.STM.retry : '{STM} a + 419. builtin.Text.reverse : Text -> Text - 403. builtin.Float.round : Float + 420. builtin.Float.round : Float -> Int - 404. builtin.Pattern.run : Pattern + 421. builtin.Pattern.run : Pattern a -> a -> Optional ( [a], a) - 405. builtin.Scope.run : (∀ s. + 422. builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 406. builtin.io2.Clock.internals.sec : TimeSpec + 423. builtin.io2.Clock.internals.sec : TimeSpec -> Int - 407. builtin.Code.serialize : Code + 424. builtin.Char.Class.separator : Class + 425. builtin.Code.serialize : Code -> Bytes - 408. builtin.Value.serialize : Value + 426. builtin.Value.serialize : Value -> Bytes - 409. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + 427. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 410. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + 428. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 411. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + 429. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 412. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + 430. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 413. builtin.io2.Tls.ClientConfig.versions.set : [Version] + 431. builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 414. builtin.io2.Tls.ServerConfig.versions.set : [Version] + 432. builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 415. builtin.Int.shiftLeft : Int + 433. builtin.Int.shiftLeft : Int -> Nat -> Int - 416. builtin.Nat.shiftLeft : Nat + 434. builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 417. builtin.Int.shiftRight : Int + 435. builtin.Int.shiftRight : Int -> Nat -> Int - 418. builtin.Nat.shiftRight : Nat + 436. builtin.Nat.shiftRight : Nat -> Nat -> Nat - 419. builtin.Int.signum : Int + 437. builtin.Int.signum : Int -> Int - 420. builtin.Float.sin : Float + 438. builtin.Float.sin : Float -> Float - 421. builtin.Float.sinh : Float + 439. builtin.Float.sinh : Float -> Float - 422. builtin.Bytes.size : Bytes + 440. builtin.Bytes.size : Bytes -> Nat - 423. builtin.ImmutableArray.size : ImmutableArray + 441. builtin.ImmutableArray.size : ImmutableArray a -> Nat - 424. builtin.ImmutableByteArray.size : ImmutableByteArray + 442. builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 425. builtin.List.size : [a] + 443. builtin.List.size : [a] -> Nat - 426. builtin.MutableArray.size : MutableArray + 444. builtin.MutableArray.size : MutableArray g a -> Nat - 427. builtin.MutableByteArray.size : MutableByteArray + 445. builtin.MutableByteArray.size : MutableByteArray g -> Nat - 428. builtin.Text.size : Text + 446. builtin.Text.size : Text -> Nat - 429. builtin.Text.patterns.space : Pattern + 447. builtin.Text.patterns.space : Pattern Text - 430. builtin.Float.sqrt : Float + 448. builtin.Float.sqrt : Float -> Float - 431. builtin.io2.IO.process.start : Text + 449. builtin.io2.IO.process.start : Text -> [Text] ->{IO} ( Handle, Handle, Handle, ProcessHandle) - 432. builtin.io2.IO.stdHandle : StdHandle + 450. builtin.io2.IO.stdHandle : StdHandle -> Handle - 433. builtin.Nat.sub : Nat + 451. builtin.Nat.sub : Nat -> Nat -> Int - 434. builtin.io2.TVar.swap : TVar a + 452. builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 435. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 436. builtin.Bytes.take : Nat + 453. builtin.Char.Class.symbol : Class + 454. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + 455. builtin.Bytes.take : Nat -> Bytes -> Bytes - 437. builtin.List.take : Nat + 456. builtin.List.take : Nat -> [a] -> [a] - 438. builtin.Text.take : Nat + 457. builtin.Text.take : Nat -> Text -> Text - 439. builtin.Float.tan : Float + 458. builtin.Float.tan : Float -> Float - 440. builtin.Float.tanh : Float + 459. builtin.Float.tanh : Float -> Float - 441. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + 460. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 442. builtin.Bytes.toBase16 : Bytes + 461. builtin.Bytes.toBase16 : Bytes -> Bytes - 443. builtin.Bytes.toBase32 : Bytes + 462. builtin.Bytes.toBase32 : Bytes -> Bytes - 444. builtin.Bytes.toBase64 : Bytes + 463. builtin.Bytes.toBase64 : Bytes -> Bytes - 445. builtin.Bytes.toBase64UrlUnpadded : Bytes + 464. builtin.Bytes.toBase64UrlUnpadded : Bytes -> Bytes - 446. builtin.Text.toCharList : Text + 465. builtin.Text.toCharList : Text -> [Char] - 447. builtin.Int.toFloat : Int + 466. builtin.Int.toFloat : Int -> Float - 448. builtin.Nat.toFloat : Nat + 467. builtin.Nat.toFloat : Nat -> Float - 449. builtin.Nat.toInt : Nat + 468. builtin.Nat.toInt : Nat -> Int - 450. builtin.Bytes.toList : Bytes + 469. builtin.Bytes.toList : Bytes -> [Nat] - 451. builtin.Text.toLowercase : Text + 470. builtin.Text.toLowercase : Text -> Text - 452. builtin.Char.toNat : Char + 471. builtin.Char.toNat : Char -> Nat - 453. builtin.Float.toRepresentation : Float + 472. builtin.Float.toRepresentation : Float -> Nat - 454. builtin.Int.toRepresentation : Int + 473. builtin.Int.toRepresentation : Int -> Nat - 455. builtin.Char.toText : Char + 474. builtin.Char.toText : Char -> Text - 456. builtin.Debug.toText : a + 475. builtin.Debug.toText : a -> Optional (Either Text Text) - 457. builtin.Float.toText : Float + 476. builtin.Float.toText : Float -> Text - 458. builtin.Handle.toText : Handle + 477. builtin.Handle.toText : Handle -> Text - 459. builtin.Int.toText : Int + 478. builtin.Int.toText : Int -> Text - 460. builtin.Nat.toText : Nat + 479. builtin.Nat.toText : Nat -> Text - 461. builtin.Socket.toText : Socket + 480. builtin.Socket.toText : Socket -> Text - 462. builtin.Link.Term.toText : Term + 481. builtin.Link.Term.toText : Term -> Text - 463. builtin.ThreadId.toText : ThreadId + 482. builtin.ThreadId.toText : ThreadId -> Text - 464. builtin.Text.toUppercase : Text + 483. builtin.Text.toUppercase : Text -> Text - 465. builtin.Text.toUtf8 : Text + 484. builtin.Text.toUtf8 : Text -> Bytes - 466. builtin.todo : a -> b - 467. builtin.Debug.trace : Text + 485. builtin.todo : a -> b + 486. builtin.Debug.trace : Text -> a -> () - 468. builtin.Int.trailingZeros : Int + 487. builtin.Int.trailingZeros : Int -> Nat - 469. builtin.Nat.trailingZeros : Nat + 488. builtin.Nat.trailingZeros : Nat -> Nat - 470. builtin.Float.truncate : Float + 489. builtin.Float.truncate : Float -> Int - 471. builtin.Int.truncate0 : Int + 490. builtin.Int.truncate0 : Int -> Nat - 472. builtin.io2.IO.tryEval : '{IO} a + 491. builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 473. builtin.io2.Promise.tryRead : Promise + 492. builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 474. builtin.io2.MVar.tryTake : MVar a + 493. builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 475. builtin.Text.uncons : Text + 494. builtin.Text.uncons : Text -> Optional ( Char, Text) - 476. builtin.Any.unsafeExtract : Any + 495. builtin.Any.unsafeExtract : Any -> a - 477. builtin.Text.unsnoc : Text + 496. builtin.Text.unsnoc : Text -> Optional ( Text, Char) - 478. builtin.Code.validate : [( Term, + 497. builtin.Char.Class.upper : Class + 498. builtin.Code.validate : [( Term, Code)] ->{IO} Optional Failure - 479. builtin.io2.validateSandboxed : [Term] + 499. builtin.io2.validateSandboxed : [Term] -> a -> Boolean - 480. builtin.Value.value : a + 500. builtin.Value.value : a -> Value - 481. builtin.io2.IO.process.wait : ProcessHandle + 501. builtin.io2.IO.process.wait : ProcessHandle ->{IO} Nat - 482. builtin.Debug.watch : Text + 502. builtin.Debug.watch : Text -> a -> a - 483. builtin.MutableArray.write : MutableArray + 503. builtin.Char.Class.whitespace : Class + 504. builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 484. builtin.io2.Promise.write : Promise + 505. builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 485. builtin.Ref.write : Ref g a + 506. builtin.Ref.write : Ref g a -> a ->{g} () - 486. builtin.io2.TVar.write : TVar a + 507. builtin.io2.TVar.write : TVar a -> a ->{STM} () - 487. builtin.MutableByteArray.write16be : MutableByteArray + 508. builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 488. builtin.MutableByteArray.write32be : MutableByteArray + 509. builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 489. builtin.MutableByteArray.write64be : MutableByteArray + 510. builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 490. builtin.MutableByteArray.write8 : MutableByteArray + 511. builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 491. builtin.Int.xor : Int + 512. builtin.Int.xor : Int -> Int -> Int - 492. builtin.Nat.xor : Nat + 513. builtin.Nat.xor : Nat -> Nat -> Nat diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index 3239afa06..b672651fc 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #2b8npf0tu2 .old` to make an old namespace + `fork #s4kjl4lbf3 .old` to make an old namespace accessible again, - `reset-root #2b8npf0tu2` to reset the root namespace and + `reset-root #s4kjl4lbf3` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #j967usn5hk add - 2. now #2b8npf0tu2 add - 3. now #lv9og66mct builtins.merge + 1. now #hr821c0ji5 add + 2. now #s4kjl4lbf3 add + 3. now #92606li9fc builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index b6d2a1b5b..9f4e85dd0 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #a2uij441jg (start of history) + □ 1. #3jjj6quqhh (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #2orc0vqqcv + ⊙ 1. #6qm36657l4 > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #fk0nmiqqgk + ⊙ 2. #72ip8q9i3l > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #a2uij441jg (start of history) + □ 3. #3jjj6quqhh (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #2orc0vqqcv + ⊙ 1. #6qm36657l4 > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #fk0nmiqqgk + ⊙ 2. #72ip8q9i3l > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #a2uij441jg (start of history) + □ 3. #3jjj6quqhh (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #a2uij441jg (start of history) + □ 1. #3jjj6quqhh (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #9ijnd9ip7o + ⊙ 1. #p9ur8e0jlu - Deletes: Nat.* Nat.+ - □ 2. #a2uij441jg (start of history) + □ 2. #3jjj6quqhh (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From c910649ae5e3d7b66d398cd4a89d6695322a71a0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 11 Feb 2023 07:51:51 +0000 Subject: [PATCH 296/467] Add binding for Promise (blocked on upstream changes) Just like CAS, the Unison code used by native compilation needs to keep track of type info for builtins out of band if they return unboxed values --- scheme-libs/common/unison/primops.ss | 11 ++++++++++- scheme-libs/racket/unison/concurrent.ss | 8 ++++---- unison-src/builtin-tests/concurrency-tests.u | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 641152786..b85125051 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -65,6 +65,11 @@ unison-FOp-Ref.Ticket.read unison-FOp-Ref.cas + unison-FOp-Promise.new + unison-FOp-Promise.read + unison-FOp-Promise.tryRead + unison-FOp-Promise.write + unison-POp-ADDN unison-POp-ANDN unison-POp-BLDS @@ -314,5 +319,9 @@ (define (unison-FOp-Ref.write ref a) (ref-write ref a)) (define (unison-FOp-Ref.readForCas ref) (ref-read ref)) (define (unison-FOp-Ref.Ticket.read ticket) ticket) - (define (unison-FOp-Ref.cas ref ticket value) (ref-cas ref ticket value))) + (define (unison-FOp-Ref.cas ref ticket value) (ref-cas ref ticket value)) + (define (unison-FOp-Promise.new) (promise-new)) + (define (unison-FOp-Promise.read promise) (promise-read promise)) + (define (unison-FOp-Promise.tryRead promise) (promise-try-read promise)) + (define (unison-FOp-Promise.write promise a) (promise-write promise a))) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 598b8bceb..32875018a 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -57,7 +57,7 @@ (define (promise-read promise) (let loop () - (let* ([value (promise-value promise)]) + (let ([value (promise-value promise)]) (cond [(some? value) (option-get value)] [else (sync/enable-break (promise-event promise)) (loop)])))) @@ -68,10 +68,10 @@ [cas! (lambda () (unsafe-struct*-cas! promise 2 value (some new-value)))] [awake-readers (lambda () (semaphore-post (promise-semaphore promise)))]) (cond - [(some? value) #f] + [(some? value) false] [else - (let ([ok (parameterize-break #f (if (cas!) (awake-readers) #f))]) - (if ok #t (loop)))])))) + (let ([ok (parameterize-break #f (if (cas!) (awake-readers) false))]) + (if ok true (loop)))])))) (define (ref-cas ref ticket value) (if (box-cas! ref ticket value) true false)) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index ad4d8c26a..90310d213 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -57,6 +57,7 @@ threadTest = do r = while (Optional.isNone) do Ref.read ref checkEqual "Thread has been interrupted" r (Some "interrupted") +-- TODO exercise Promise.tryRead promiseSequentialTest = do use Nat eq From 5e9eee997f474f1fcd65d73d727b17f35ae284fd Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 11 Feb 2023 08:01:26 +0000 Subject: [PATCH 297/467] Test both paths of catchAll in threadTest --- unison-src/builtin-tests/concurrency-tests.u | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 90310d213..f34e4500c 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -3,7 +3,7 @@ concurrency.tests = Tests.main do !simpleRefTestScope !ticketTest !casTest - -- !threadTest + !threadTest -- !promiseSequentialTest -- !promiseConcurrentTest -- !fullTest @@ -45,17 +45,23 @@ casTest = do -- TODO test both Left and Right on the catchAll -- and try access the failure as well threadTest = do - ref = IO.ref None millis = 1000 - thread = do - match catchAll do sleep (500 * millis) with + thread ref = + match catchAll do sleep (300 * millis) with Left _ -> Ref.write ref (Some "interrupted") Right _ -> Ref.write ref (Some "completed") - t = fork thread + ref1 = IO.ref None + ref2 = IO.ref None + t1 = fork do thread ref1 + t2 = fork do thread ref2 sleep (200 * millis) - kill t - r = while (Optional.isNone) do Ref.read ref - checkEqual "Thread has been interrupted" r (Some "interrupted") + kill t1 + sleep (200 * millis) + kill t2 + r1 = while (Optional.isNone) do Ref.read ref1 + checkEqual "Thread has been interrupted" r1 (Some "interrupted") + r2 = while (Optional.isNone) do Ref.read ref2 + checkEqual "Thread has completed" r2 (Some "completed") -- TODO exercise Promise.tryRead From 24e84404755e00df4daaa9bfa826fca24afebc29 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sat, 11 Feb 2023 08:05:37 +0000 Subject: [PATCH 298/467] Update comment --- unison-src/builtin-tests/concurrency-tests.u | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index f34e4500c..8f14e92b0 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -42,8 +42,7 @@ casTest = do v2 = Ref.cas ref ticket 15 check "CAS fails when there was an intervening write" '(not v2) --- TODO test both Left and Right on the catchAll --- and try access the failure as well +-- TODO try to access the failure details threadTest = do millis = 1000 thread ref = From da7e0d63fccf4dc22a87018357d8309e1475c5e0 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 01:33:34 +0000 Subject: [PATCH 299/467] Point ucm at my fork of unison internal compiler library --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 37b526000..674cd5d38 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2657,9 +2657,9 @@ doFetchCompiler = ns = ReadShareRemoteNamespace { server = RemoteRepo.DefaultCodeserver, - repo = ShareUserHandle "dolio", + repo = ShareUserHandle "systemfw", path = - Path.fromList $ NameSegment <$> ["public", "internal", "trunk"] + Path.fromList $ NameSegment <$> ["public", "internal", "prs", "builtins"] } repo = Just $ ReadRemoteNamespaceShare ns From 18d3c0aa30b3e868499567c35058784f82d8c0bf Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 01:34:42 +0000 Subject: [PATCH 300/467] Simple promise tests pass after upstream fix --- unison-src/builtin-tests/concurrency-tests.u | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 8f14e92b0..678cb40c2 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -3,8 +3,8 @@ concurrency.tests = Tests.main do !simpleRefTestScope !ticketTest !casTest - !threadTest - -- !promiseSequentialTest + -- !threadTest + !promiseSequentialTest -- !promiseConcurrentTest -- !fullTest From f8cf62f201b66a3cfef907f38f418e71f936db26 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 02:01:41 +0000 Subject: [PATCH 301/467] wip: test tryRead, bug in the Option wrapping on success --- unison-src/builtin-tests/concurrency-tests.u | 33 ++++++++++++++------ unison-src/builtin-tests/jit-tests.output.md | 2 ++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 678cb40c2..9332c18d1 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,12 +1,21 @@ concurrency.tests = Tests.main do - !simpleRefTest - !simpleRefTestScope - !ticketTest - !casTest - -- !threadTest - !promiseSequentialTest - -- !promiseConcurrentTest - -- !fullTest + !minimal + -- !simpleRefTest + -- !simpleRefTestScope + -- !ticketTest + -- !casTest + -- -- !threadTest + -- !promiseSequentialTest + -- -- !promiseConcurrentTest + -- -- !fullTest + +minimal = do + p = !Promise.new + v = Promise.tryRead p + checkEqual "mmm" v None + Promise.write_ p 42 + v1 = Promise.tryRead p + checkEqual "mmm" v1 (Some 42) simpleRefTest = do r = IO.ref 0 @@ -62,19 +71,25 @@ threadTest = do r2 = while (Optional.isNone) do Ref.read ref2 checkEqual "Thread has completed" r2 (Some "completed") --- TODO exercise Promise.tryRead +-- TODO use write_ promiseSequentialTest = do use Nat eq use Promise read write p = !Promise.new + v0 = Promise.tryRead p + checkEqual "Promise should be empty when created" v0 (Some 0) ignore (write p 0) v1 = read p checkEqual "Promise should read a value that's been written" v1 0 ignore(write p 1) v2 = read p checkEqual "Promise can only be written to once" v2 0 + v3 = Promise.tryRead p + checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some 4) + +-- TODO add a sleep to the write here promiseConcurrentTest = do use Nat eq use concurrent fork diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 19ddeec19..b40715c5c 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -12,4 +12,6 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native concurrency.tests + Scheme evaluation failed. + ``` From 25d910ef10f8374550ea43fba59ee2cd00a9ec0a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 02:16:51 +0000 Subject: [PATCH 302/467] Reinstate existing tests, tryRead still broken (perhaps macro error?) --- unison-src/builtin-tests/concurrency-tests.u | 36 +++++++------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 9332c18d1..56c1ded60 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,21 +1,12 @@ concurrency.tests = Tests.main do - !minimal - -- !simpleRefTest - -- !simpleRefTestScope - -- !ticketTest - -- !casTest - -- -- !threadTest - -- !promiseSequentialTest - -- -- !promiseConcurrentTest - -- -- !fullTest - -minimal = do - p = !Promise.new - v = Promise.tryRead p - checkEqual "mmm" v None - Promise.write_ p 42 - v1 = Promise.tryRead p - checkEqual "mmm" v1 (Some 42) + !simpleRefTest + !simpleRefTestScope + !ticketTest + !casTest + -- !threadTest + !promiseSequentialTest + -- !promiseConcurrentTest + -- !fullTest simpleRefTest = do r = IO.ref 0 @@ -71,22 +62,21 @@ threadTest = do r2 = while (Optional.isNone) do Ref.read ref2 checkEqual "Thread has completed" r2 (Some "completed") --- TODO use write_ promiseSequentialTest = do use Nat eq use Promise read write p = !Promise.new v0 = Promise.tryRead p - checkEqual "Promise should be empty when created" v0 (Some 0) - ignore (write p 0) + checkEqual "Promise should be empty when created" v0 None + Promise.write_ p 0 v1 = read p checkEqual "Promise should read a value that's been written" v1 0 - ignore(write p 1) + Promise.write_ p 1 v2 = read p - checkEqual "Promise can only be written to once" v2 0 + checkEqual "Promise can only be written to once" v2 v1 v3 = Promise.tryRead p - checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some 4) + checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) -- TODO add a sleep to the write here From e0bc2e311a363e97c112605f31cdbeebd988bf69 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 16:44:21 +0000 Subject: [PATCH 303/467] Disable buggy try-read for now --- unison-src/builtin-tests/concurrency-tests.u | 5 +++-- unison-src/builtin-tests/jit-tests.output.md | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 56c1ded60..07a8bbd28 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -75,8 +75,9 @@ promiseSequentialTest = do Promise.write_ p 1 v2 = read p checkEqual "Promise can only be written to once" v2 v1 - v3 = Promise.tryRead p - checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) + -- TODO fix bug in boot.ss here + -- v3 = Promise.tryRead p + -- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) -- TODO add a sleep to the write here diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index b40715c5c..19ddeec19 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -12,6 +12,4 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native concurrency.tests - Scheme evaluation failed. - ``` From 07db871e1befc5f5862fb09fed875798a233723c Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 17:48:09 +0000 Subject: [PATCH 304/467] Add binding for fork --- scheme-libs/common/unison/primops.ss | 3 ++- unison-src/builtin-tests/concurrency-tests.u | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index b85125051..edc436792 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -87,6 +87,7 @@ unison-POp-EQLU unison-POp-EROR unison-POp-FTOT + unison-POp-FORK unison-POp-IDXB unison-POp-IDXS unison-POp-IORN @@ -313,6 +314,7 @@ (define (unison-FOp-Scope.bytearray n) (make-bytevector n)) (define (unison-FOp-Scope.array n) (make-vector n)) + (define (unison-POp-FORK thunk) (fork thunk)) (define (unison-FOp-Scope.ref a) (ref-new a)) (define (unison-FOp-IO.ref a) (ref-new a)) (define (unison-FOp-Ref.read ref) (ref-read ref)) @@ -324,4 +326,3 @@ (define (unison-FOp-Promise.read promise) (promise-read promise)) (define (unison-FOp-Promise.tryRead promise) (promise-try-read promise)) (define (unison-FOp-Promise.write promise a) (promise-write promise a))) - diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 07a8bbd28..328133e1c 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -5,7 +5,7 @@ concurrency.tests = Tests.main do !casTest -- !threadTest !promiseSequentialTest - -- !promiseConcurrentTest + !promiseConcurrentTest -- !fullTest simpleRefTest = do From a01ab41c90b209f26e197c3db801109c88395829 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 17:49:13 +0000 Subject: [PATCH 305/467] Complex concurrent test works --- unison-src/builtin-tests/concurrency-tests.u | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 328133e1c..095daf24a 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -6,7 +6,7 @@ concurrency.tests = Tests.main do -- !threadTest !promiseSequentialTest !promiseConcurrentTest - -- !fullTest + !fullTest simpleRefTest = do r = IO.ref 0 From a88a8850566a2e44ffd564bb0340531412f11dcd Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 17:56:54 +0000 Subject: [PATCH 306/467] Add bindings for sleep --- scheme-libs/common/unison/primops.ss | 5 ++++- scheme-libs/racket/unison/concurrent.ss | 4 +++- unison-src/builtin-tests/concurrency-tests.u | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index edc436792..3943bb8dc 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -70,6 +70,9 @@ unison-FOp-Promise.tryRead unison-FOp-Promise.write + unison-FOp-IO.delay.impl.v3 + unison-POp-FORK + unison-POp-ADDN unison-POp-ANDN unison-POp-BLDS @@ -87,7 +90,6 @@ unison-POp-EQLU unison-POp-EROR unison-POp-FTOT - unison-POp-FORK unison-POp-IDXB unison-POp-IDXS unison-POp-IORN @@ -315,6 +317,7 @@ (define (unison-FOp-Scope.array n) (make-vector n)) (define (unison-POp-FORK thunk) (fork thunk)) + (define (unison-FOp-IO.delay.impl.v3 micros) (sleep micros)) (define (unison-FOp-Scope.ref a) (ref-new a)) (define (unison-FOp-IO.ref a) (ref-new a)) (define (unison-FOp-Ref.read ref) (ref-read ref)) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 32875018a..498a2e19b 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -76,4 +76,6 @@ (define (ref-cas ref ticket value) (if (box-cas! ref ticket value) true false)) - (define (sleep n) (sleep-secs (/ n 1000000)))) + (define (sleep n) + (sleep-secs (/ n 1000000)) + (right unit))) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 095daf24a..85c2fd016 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -79,13 +79,14 @@ promiseSequentialTest = do -- v3 = Promise.tryRead p -- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) - --- TODO add a sleep to the write here promiseConcurrentTest = do use Nat eq use concurrent fork + millis = 1000 p = !Promise.new - _ = fork '(Promise.write p 5) + _ = fork do + unsafeRun! do sleep (200 * millis) + Promise.write p 5 v = Promise.read p checkEqual "Reads awaits for completion of the Promise" v 5 From c51908ede025ce2bbd39ee192ad456a3650c5201 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 19:23:25 +0000 Subject: [PATCH 307/467] Rearrange tests for forking and killing threads --- unison-src/builtin-tests/concurrency-tests.u | 64 +++++++++++--------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 85c2fd016..656660c58 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -3,9 +3,10 @@ concurrency.tests = Tests.main do !simpleRefTestScope !ticketTest !casTest - -- !threadTest !promiseSequentialTest !promiseConcurrentTest + -- !forkKillTest + -- !tryEvalForkTest !fullTest simpleRefTest = do @@ -42,8 +43,36 @@ casTest = do v2 = Ref.cas ref ticket 15 check "CAS fails when there was an intervening write" '(not v2) --- TODO try to access the failure details -threadTest = do +promiseSequentialTest = do + use Nat eq + use Promise read write + p = !Promise.new + v0 = Promise.tryRead p + checkEqual "Promise should be empty when created" v0 None + Promise.write_ p 0 + v1 = read p + checkEqual "Promise should read a value that's been written" v1 0 + Promise.write_ p 1 + v2 = read p + checkEqual "Promise can only be written to once" v2 v1 + -- TODO fix bug in boot.ss here + -- v3 = Promise.tryRead p + -- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) + +millis = 1000 +sleep_ n = unsafeRun! do sleep n + +promiseConcurrentTest = do + use Nat eq + use concurrent fork + p = !Promise.new + _ = fork do + sleep_ (200 * millis) + Promise.write p 5 + v = Promise.read p + checkEqual "Reads awaits for completion of the Promise" v 5 + +forkKillTest = do millis = 1000 thread ref = match catchAll do sleep (300 * millis) with @@ -62,33 +91,8 @@ threadTest = do r2 = while (Optional.isNone) do Ref.read ref2 checkEqual "Thread has completed" r2 (Some "completed") - -promiseSequentialTest = do - use Nat eq - use Promise read write - p = !Promise.new - v0 = Promise.tryRead p - checkEqual "Promise should be empty when created" v0 None - Promise.write_ p 0 - v1 = read p - checkEqual "Promise should read a value that's been written" v1 0 - Promise.write_ p 1 - v2 = read p - checkEqual "Promise can only be written to once" v2 v1 - -- TODO fix bug in boot.ss here - -- v3 = Promise.tryRead p - -- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) - -promiseConcurrentTest = do - use Nat eq - use concurrent fork - millis = 1000 - p = !Promise.new - _ = fork do - unsafeRun! do sleep (200 * millis) - Promise.write p 5 - v = Promise.read p - checkEqual "Reads awaits for completion of the Promise" v 5 +-- TODO +tryEvalForkTest = bug "TODO" atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () atomicUpdate ref f = From fc3561929d0e1001fb382e89d1f6d40bd006d344 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 20:10:37 +0000 Subject: [PATCH 308/467] Add binding for thread kill, currently broken on arity mismatch --- scheme-libs/common/unison/primops.ss | 3 ++ scheme-libs/racket/unison/concurrent.ss | 9 ++-- unison-src/builtin-tests/concurrency-tests.u | 48 ++++++++++++-------- unison-src/builtin-tests/jit-tests.output.md | 2 + 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 3943bb8dc..8d895e5a1 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -72,6 +72,7 @@ unison-FOp-IO.delay.impl.v3 unison-POp-FORK + unison-FOp-IO.kill.impl.v3 unison-POp-ADDN unison-POp-ANDN @@ -318,6 +319,7 @@ (define (unison-POp-FORK thunk) (fork thunk)) (define (unison-FOp-IO.delay.impl.v3 micros) (sleep micros)) + (define (unison-FOp-IO.kill.impl.v3 threadId) (kill threadId)) (define (unison-FOp-Scope.ref a) (ref-new a)) (define (unison-FOp-IO.ref a) (ref-new a)) (define (unison-FOp-Ref.read ref) (ref-read ref)) @@ -329,3 +331,4 @@ (define (unison-FOp-Promise.read promise) (promise-read promise)) (define (unison-FOp-Promise.tryRead promise) (promise-try-read promise)) (define (unison-FOp-Promise.write promise a) (promise-write promise a))) + diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 498a2e19b..3a5f7d4cd 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -1,9 +1,5 @@ #!r6rs -;; TODO some ops return Either Failure (fork, kill, sleep) -;; ^ separate point, they shouldn't -;; TODO some others are in the exception ability (tryEval) -;; I'm not handling the mapping right now (library (unison concurrent) (export ref-new @@ -39,7 +35,6 @@ (box ref-new) (unbox ref-read) (set-box! ref-write) - (break-thread kill) ; TODO need to see whether the compiler wraps the exception for me (thread fork) (sleep sleep-secs)) (only (racket unsafe ops) unsafe-struct*-cas!) @@ -78,4 +73,8 @@ (define (sleep n) (sleep-secs (/ n 1000000)) + (right unit)) + + (define (kill threadId) + (break-thread threadId) (right unit))) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 656660c58..de0617773 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -5,7 +5,7 @@ concurrency.tests = Tests.main do !casTest !promiseSequentialTest !promiseConcurrentTest - -- !forkKillTest + !forkKillTest -- !tryEvalForkTest !fullTest @@ -72,24 +72,36 @@ promiseConcurrentTest = do v = Promise.read p checkEqual "Reads awaits for completion of the Promise" v 5 +kill_ t = unsafeRun! do concurrent.kill t + forkKillTest = do - millis = 1000 - thread ref = - match catchAll do sleep (300 * millis) with - Left _ -> Ref.write ref (Some "interrupted") - Right _ -> Ref.write ref (Some "completed") - ref1 = IO.ref None - ref2 = IO.ref None - t1 = fork do thread ref1 - t2 = fork do thread ref2 - sleep (200 * millis) - kill t1 - sleep (200 * millis) - kill t2 - r1 = while (Optional.isNone) do Ref.read ref1 - checkEqual "Thread has been interrupted" r1 (Some "interrupted") - r2 = while (Optional.isNone) do Ref.read ref2 - checkEqual "Thread has completed" r2 (Some "completed") + ref = IO.ref "initial" + thread = fork do + sleep_ (400 * millis) + Ref.write ref "done" + sleep_ (200 * millis) + kill_ thread + sleep_ (300 * millis) + v = Ref.read ref + checkEqual "Thread was killed" v "done" + + -- millis = 1000 + -- thread ref = + -- match catchAll do sleep (300 * millis) with + -- Left _ -> Ref.write ref (Some "interrupted") + -- Right _ -> Ref.write ref (Some "completed") + -- ref1 = IO.ref None + -- ref2 = IO.ref None + -- t1 = fork do thread ref1 + -- t2 = fork do thread ref2 + -- sleep (200 * millis) + -- kill t1 + -- sleep (200 * millis) + -- kill t2 + -- r1 = while (Optional.isNone) do Ref.read ref1 + -- checkEqual "Thread has been interrupted" r1 (Some "interrupted") + -- r2 = while (Optional.isNone) do Ref.read ref2 + -- checkEqual "Thread has completed" r2 (Some "completed") -- TODO tryEvalForkTest = bug "TODO" diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 19ddeec19..b40715c5c 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -12,4 +12,6 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native concurrency.tests + Scheme evaluation failed. + ``` From b7d8eb08025eeda9921988546da1fede652d3837 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Sun, 12 Feb 2023 20:34:15 +0000 Subject: [PATCH 309/467] Disable failing tests --- unison-src/builtin-tests/concurrency-tests.u | 27 +++----------------- unison-src/builtin-tests/jit-tests.output.md | 2 -- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index de0617773..4d2190a4f 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -5,8 +5,8 @@ concurrency.tests = Tests.main do !casTest !promiseSequentialTest !promiseConcurrentTest - !forkKillTest - -- !tryEvalForkTest + -- !forkKillTest + -- !tryEvalForkTest !fullTest simpleRefTest = do @@ -80,31 +80,12 @@ forkKillTest = do sleep_ (400 * millis) Ref.write ref "done" sleep_ (200 * millis) - kill_ thread + kill_ thread -- TODO fix bug in boot.hs here sleep_ (300 * millis) v = Ref.read ref checkEqual "Thread was killed" v "done" - -- millis = 1000 - -- thread ref = - -- match catchAll do sleep (300 * millis) with - -- Left _ -> Ref.write ref (Some "interrupted") - -- Right _ -> Ref.write ref (Some "completed") - -- ref1 = IO.ref None - -- ref2 = IO.ref None - -- t1 = fork do thread ref1 - -- t2 = fork do thread ref2 - -- sleep (200 * millis) - -- kill t1 - -- sleep (200 * millis) - -- kill t2 - -- r1 = while (Optional.isNone) do Ref.read ref1 - -- checkEqual "Thread has been interrupted" r1 (Some "interrupted") - -- r2 = while (Optional.isNone) do Ref.read ref2 - -- checkEqual "Thread has completed" r2 (Some "completed") - --- TODO -tryEvalForkTest = bug "TODO" +tryEvalForkTest = bug "Depends on the Exception ability being implemented" atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () atomicUpdate ref f = diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index b40715c5c..19ddeec19 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -12,6 +12,4 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native concurrency.tests - Scheme evaluation failed. - ``` From 774addbab58b14461d0702dd0739d47f3ae232c3 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 13 Feb 2023 14:08:39 +0000 Subject: [PATCH 310/467] Fix representation of Option --- scheme-libs/common/unison/data.ss | 6 +++--- unison-src/builtin-tests/concurrency-tests.u | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index 76f1a1c3d..9a52c6b4f 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -21,10 +21,10 @@ (import (rnrs)) ; Option a - (define none (cons 0 ())) + (define none `(0)) ; a -> Option a - (define (some a) (cons 1 a)) + (define (some a) `(1 ,a)) ; Option a -> Bool (define (some? option) (eq? 1 (car option))) @@ -36,7 +36,7 @@ (define (option-get option) (if (some? option) - (cdr option) + (car (cdr option)) (raise "Cannot get the value of an empty option "))) ; TODO this might be reduntant, # works diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 4d2190a4f..3c0efbea9 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -5,8 +5,8 @@ concurrency.tests = Tests.main do !casTest !promiseSequentialTest !promiseConcurrentTest - -- !forkKillTest - -- !tryEvalForkTest + -- !forkKillTest + -- !tryEvalForkTest !fullTest simpleRefTest = do @@ -55,9 +55,8 @@ promiseSequentialTest = do Promise.write_ p 1 v2 = read p checkEqual "Promise can only be written to once" v2 v1 - -- TODO fix bug in boot.ss here - -- v3 = Promise.tryRead p - -- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) + v3 = Promise.tryRead p + checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) millis = 1000 sleep_ n = unsafeRun! do sleep n From cbee37d3a881b8525a6c6a03684847a8187b8937 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 13 Feb 2023 14:26:46 +0000 Subject: [PATCH 311/467] Make representation of Either consistent with Option --- scheme-libs/common/unison/data.ss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index 9a52c6b4f..d4848c111 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -39,19 +39,19 @@ (car (cdr option)) (raise "Cannot get the value of an empty option "))) - ; TODO this might be reduntant, # works + ; # works as well ; Unit - (define unit (cons 0 ())) + (define unit `(0)) ; Booleans are represented as numbers (define false 0) (define true 1) ; a -> Either b a - (define (right a)(cons 1 a)) + (define (right a) `(1 ,a)) ; b -> Either b a - (define (left b) (cons 0 b)) + (define (left b) `(0 ,b)) ; Either a b -> Boolean (define (right? either) (eq? 1 (car either))) @@ -60,4 +60,4 @@ (define (left? either) (eq? 0 (car either))) ; Either a b -> a | b - (define (either-get either) (cdr either))) + (define (either-get either) (car (cdr either)))) From 9308c8cd63c11f18ea94c4b222b78142a0f09737 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 13 Feb 2023 16:29:19 +0000 Subject: [PATCH 312/467] Fix calling convention wrapper for killThread --- parser-typechecker/src/Unison/Runtime/Builtin.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index a38725729..52bd3cf70 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2307,7 +2307,7 @@ declareForeigns = do $ \(hs, n) -> maybe mempty Bytes.fromArray <$> SYS.recv hs n - declareForeign Tracked "IO.kill.impl.v3" boxTo0 $ mkForeignIOF killThread + declareForeign Tracked "IO.kill.impl.v3" boxToEF0 $ mkForeignIOF killThread declareForeign Tracked "IO.delay.impl.v3" natToEFUnit $ mkForeignIOF threadDelay From 390e4ed7e5d1aafdd8dd6d633e7660de677cafdd Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 13 Feb 2023 16:48:19 +0000 Subject: [PATCH 313/467] Point UCM back at internal.trunk compiler lib --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 674cd5d38..37b526000 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2657,9 +2657,9 @@ doFetchCompiler = ns = ReadShareRemoteNamespace { server = RemoteRepo.DefaultCodeserver, - repo = ShareUserHandle "systemfw", + repo = ShareUserHandle "dolio", path = - Path.fromList $ NameSegment <$> ["public", "internal", "prs", "builtins"] + Path.fromList $ NameSegment <$> ["public", "internal", "trunk"] } repo = Just $ ReadRemoteNamespaceShare ns From a3249914a070d22af42beb402c016b0d5b72c341 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 13 Feb 2023 16:52:57 +0000 Subject: [PATCH 314/467] Thread kill test is fixed, but Racket logs thread kills --- unison-src/builtin-tests/concurrency-tests.u | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 3c0efbea9..b18ffb765 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -5,7 +5,7 @@ concurrency.tests = Tests.main do !casTest !promiseSequentialTest !promiseConcurrentTest - -- !forkKillTest + !forkKillTest -- !tryEvalForkTest !fullTest @@ -79,10 +79,10 @@ forkKillTest = do sleep_ (400 * millis) Ref.write ref "done" sleep_ (200 * millis) - kill_ thread -- TODO fix bug in boot.hs here + kill_ thread sleep_ (300 * millis) v = Ref.read ref - checkEqual "Thread was killed" v "done" + checkEqual "Thread was killed" v "initial" tryEvalForkTest = bug "Depends on the Exception ability being implemented" From 44eb68a2cfc6e46345ed63babb3ae6363fe1482a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 13 Feb 2023 17:32:10 +0000 Subject: [PATCH 315/467] Point UCM at new location of internal compiler lib --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 37b526000..b06e167fa 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2657,7 +2657,7 @@ doFetchCompiler = ns = ReadShareRemoteNamespace { server = RemoteRepo.DefaultCodeserver, - repo = ShareUserHandle "dolio", + repo = ShareUserHandle "unison", path = Path.fromList $ NameSegment <$> ["public", "internal", "trunk"] } From 32451ecb0aeb0e9bbeab233eec7a85cae342be0b Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Mon, 13 Feb 2023 17:41:49 +0000 Subject: [PATCH 316/467] Don't log uncaught thread kills, like in Haskell --- scheme-libs/racket/unison/concurrent.ss | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 3a5f7d4cd..3c79ae533 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -31,11 +31,12 @@ break-thread parameterize-break sleep - printf) + printf + exn:break? + with-handlers) (box ref-new) (unbox ref-read) (set-box! ref-write) - (thread fork) (sleep sleep-secs)) (only (racket unsafe ops) unsafe-struct*-cas!) (unison data)) @@ -75,6 +76,14 @@ (sleep-secs (/ n 1000000)) (right unit)) + ;; Swallows uncaught breaks/thread kills rather than logging them to + ;; match the behaviour of the Haskell runtime + (define (fork thunk) + (thread + (lambda () + (with-handlers ([exn:break? (lambda (x) ())]) + (thunk))))) + (define (kill threadId) (break-thread threadId) (right unit))) From 76c0f0b23bda0ecb0e37219c1e9d6dfb6ca731e3 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Mon, 13 Feb 2023 12:34:55 -0600 Subject: [PATCH 317/467] Fail a PR if not ormolu formatted --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f3887bc7c..bf11ccdc0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,6 +37,7 @@ jobs: - uses: actions/checkout@v2 with: path: unison + - uses: mrkkrp/ormolu-action@v10 # The number towards the beginning of the cache keys allow you to manually avoid using a previous cache. # GitHub will automatically delete caches that haven't been accessed in 7 days, but there is no way to From 88ef0a8d378ee60eaae2acfb0dcd9556dea97461 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Mon, 13 Feb 2023 13:03:08 -0600 Subject: [PATCH 318/467] Ormolu-ify the codebase and update development.markdown docs --- .../src/U/Codebase/Sqlite/V2/HashHandle.hs | 2 +- .../src/Unison/Hashing/V2/Convert2.hs | 6 +- .../U/Codebase/Sqlite/LocalizeObject.hs | 4 +- .../U/Codebase/Sqlite/NamedRef.hs | 6 +- .../U/Codebase/Sqlite/Operations.hs | 17 +- .../U/Codebase/Sqlite/Patch/Format.hs | 2 +- .../U/Codebase/Sqlite/Queries.hs | 6 +- .../U/Codebase/Sqlite/Reference.hs | 4 +- .../U/Codebase/Sqlite/Serialization.hs | 192 ++++----- .../U/Codebase/Sqlite/Sync22.hs | 3 +- codebase2/codebase/U/Codebase/Branch/Type.hs | 11 +- codebase2/codebase/U/Codebase/Causal.hs | 2 +- codebase2/codebase/U/Codebase/Type.hs | 6 +- codebase2/core/U/Core/ABT.hs | 18 +- codebase2/core/U/Core/ABT/Var.hs | 2 +- codebase2/core/Unison/Util/Alphabetical.hs | 8 +- .../U/Util/Serialization.hs | 58 +-- codebase2/util-term/U/Util/Term.hs | 4 +- codebase2/util-term/U/Util/Type.hs | 12 +- development.markdown | 25 ++ lib/unison-prelude/src/U/Util/Text.hs | 3 +- lib/unison-prelude/src/Unison/Debug.hs | 4 +- lib/unison-prelude/src/Unison/Prelude.hs | 24 +- .../src/Unison/Util/Alternative.hs | 6 +- lib/unison-prelude/src/Unison/Util/Map.hs | 10 +- lib/unison-prelude/src/Unison/Util/Monoid.hs | 4 +- lib/unison-prelude/src/Unison/Util/Set.hs | 8 +- lib/unison-prelude/src/Unison/Util/Timing.hs | 4 +- .../src/Unison/Util/AnnotatedText.hs | 8 +- .../src/Unison/Util/Pretty.hs | 58 +-- .../tests/Unison/Test/ColorText.hs | 2 +- .../src/Unison/Sqlite/Connection.hs | 22 +- .../src/Unison/Sqlite/Exception.hs | 4 +- .../src/Unison/Sqlite/JournalMode.hs | 4 +- .../src/Unison/Sqlite/Transaction.hs | 22 +- lib/unison-sqlite/src/Unison/Sqlite/Values.hs | 4 +- .../src/Unison/Util/Bytes.hs | 8 +- lib/unison-util-bytes/test/Main.hs | 6 +- .../src/Unison/Util/Cache.hs | 27 +- .../src/Unison/Util/Relation.hs | 26 +- .../src/Unison/Util/Relation3.hs | 10 +- .../src/Unison/Util/Relation4.hs | 12 +- lib/unison-util-rope/src/Unison/Util/Rope.hs | 24 +- .../src/U/Codebase/Branch/Diff.hs | 4 +- parser-typechecker/src/Unison/Builtin.hs | 67 ++- .../src/Unison/Builtin/Decls.hs | 14 +- .../src/Unison/Builtin/Terms.hs | 2 +- parser-typechecker/src/Unison/Codebase.hs | 42 +- .../src/Unison/Codebase/Branch.hs | 50 +-- .../src/Unison/Codebase/Branch/BranchDiff.hs | 2 +- .../src/Unison/Codebase/Branch/Merge.hs | 4 +- .../src/Unison/Codebase/Branch/Names.hs | 6 +- .../src/Unison/Codebase/BranchDiff.hs | 22 +- .../src/Unison/Codebase/BranchUtil.hs | 4 +- .../src/Unison/Codebase/Causal.hs | 16 +- .../src/Unison/Codebase/Causal/Type.hs | 18 +- .../src/Unison/Codebase/CodeLookup.hs | 4 +- .../src/Unison/Codebase/Editor/Git.hs | 26 +- .../src/Unison/Codebase/FileCodebase.hs | 2 +- .../src/Unison/Codebase/Init.hs | 12 +- .../src/Unison/Codebase/IntegrityCheck.hs | 2 +- .../src/Unison/Codebase/MainTerm.hs | 10 +- .../src/Unison/Codebase/Metadata.hs | 8 +- .../src/Unison/Codebase/Path.hs | 2 +- .../src/Unison/Codebase/RootBranchCache.hs | 6 +- .../src/Unison/Codebase/Runtime.hs | 2 +- .../src/Unison/Codebase/Serialization.hs | 10 +- .../src/Unison/Codebase/ShortCausalHash.hs | 4 +- .../src/Unison/Codebase/SqliteCodebase.hs | 24 +- .../Codebase/SqliteCodebase/Branch/Cache.hs | 2 +- .../SqliteCodebase/Branch/Dependencies.hs | 6 +- .../Codebase/SqliteCodebase/Conversions.hs | 22 +- .../Codebase/SqliteCodebase/Migrations.hs | 2 +- .../Migrations/MigrateSchema1To2.hs | 9 +- .../Migrations/MigrateSchema3To4.hs | 13 +- .../Codebase/SqliteCodebase/Operations.hs | 8 +- .../src/Unison/Codebase/TermEdit/Typing.hs | 2 +- .../src/Unison/Codebase/Watch.hs | 9 +- parser-typechecker/src/Unison/CodebasePath.hs | 2 +- parser-typechecker/src/Unison/FileParsers.hs | 6 +- .../src/Unison/Hashing/V2/Convert.hs | 34 +- parser-typechecker/src/Unison/Parsers.hs | 12 +- .../src/Unison/PrettyPrintEnv/MonadPretty.hs | 22 +- .../src/Unison/PrettyPrintEnv/Names.hs | 2 +- parser-typechecker/src/Unison/PrintError.hs | 77 ++-- parser-typechecker/src/Unison/Result.hs | 18 +- parser-typechecker/src/Unison/Runtime/ANF.hs | 340 ++++++++------- .../src/Unison/Runtime/ANF/Serialize.hs | 118 +++--- .../src/Unison/Runtime/Array.hs | 64 +-- .../src/Unison/Runtime/Builtin.hs | 299 +++++++------- .../src/Unison/Runtime/Debug.hs | 4 +- .../src/Unison/Runtime/Decompile.hs | 14 +- .../src/Unison/Runtime/Exception.hs | 8 +- .../src/Unison/Runtime/Foreign.hs | 8 +- .../src/Unison/Runtime/Foreign/Function.hs | 27 +- .../src/Unison/Runtime/IOSource.hs | 2 +- .../src/Unison/Runtime/Interface.hs | 32 +- .../src/Unison/Runtime/MCode.hs | 85 ++-- .../src/Unison/Runtime/MCode/Serialize.hs | 48 +-- .../src/Unison/Runtime/Machine.hs | 27 +- .../src/Unison/Runtime/Pattern.hs | 54 +-- .../src/Unison/Runtime/Serialize.hs | 87 ++-- .../src/Unison/Runtime/Stack.hs | 16 +- .../src/Unison/Runtime/Vector.hs | 2 +- .../src/Unison/Syntax/DeclPrinter.hs | 20 +- .../src/Unison/Syntax/FileParser.hs | 29 +- .../src/Unison/Syntax/NamePrinter.hs | 10 +- .../src/Unison/Syntax/TermParser.hs | 139 ++++--- .../src/Unison/Syntax/TermPrinter.hs | 101 ++--- .../src/Unison/Syntax/TypeParser.hs | 30 +- .../src/Unison/Syntax/TypePrinter.hs | 24 +- parser-typechecker/src/Unison/Typechecker.hs | 12 +- .../src/Unison/Typechecker/Components.hs | 7 +- .../src/Unison/Typechecker/Context.hs | 231 +++++------ .../src/Unison/Typechecker/Extractor.hs | 6 +- .../src/Unison/Typechecker/TypeError.hs | 4 +- .../src/Unison/Typechecker/TypeVar.hs | 18 +- parser-typechecker/src/Unison/UnisonFile.hs | 14 +- .../src/Unison/UnisonFile/Names.hs | 10 +- .../src/Unison/UnisonFile/Type.hs | 2 +- .../src/Unison/Util/CyclicEq.hs | 6 +- .../src/Unison/Util/CyclicOrd.hs | 6 +- .../src/Unison/Util/EnumContainers.hs | 48 +-- .../src/Unison/Util/Exception.hs | 2 +- .../src/Unison/Util/PinBoard.hs | 6 +- .../src/Unison/Util/Pretty/MegaParsec.hs | 5 +- .../src/Unison/Util/RefPromise.hs | 16 +- parser-typechecker/src/Unison/Util/Star3.hs | 2 +- parser-typechecker/src/Unison/Util/TQueue.hs | 4 +- .../src/Unison/Util/TransitiveClosure.hs | 4 +- parser-typechecker/tests/Unison/Test/ANF.hs | 12 +- .../tests/Unison/Test/Codebase/Causal.hs | 9 +- .../tests/Unison/Test/Codebase/Path.hs | 3 +- .../tests/Unison/Test/Common.hs | 2 +- .../tests/Unison/Test/Syntax/FileParser.hs | 12 +- parser-typechecker/tests/Unison/Test/Type.hs | 2 +- .../tests/Unison/Test/UnisonSources.hs | 2 +- .../tests/Unison/Test/Util/Text.hs | 6 +- unison-cli/src/Compat.hs | 7 +- unison-cli/src/Unison/Auth/CredentialFile.hs | 4 +- .../src/Unison/Auth/CredentialManager.hs | 8 +- unison-cli/src/Unison/Auth/Discovery.hs | 2 +- unison-cli/src/Unison/Auth/HTTPClient.hs | 2 +- unison-cli/src/Unison/Auth/Tokens.hs | 4 +- unison-cli/src/Unison/Cli/Monad.hs | 2 +- unison-cli/src/Unison/Cli/MonadUtils.hs | 14 +- unison-cli/src/Unison/Cli/NamesUtils.hs | 2 +- unison-cli/src/Unison/Cli/TypeCheck.hs | 2 +- .../src/Unison/Codebase/Editor/AuthorInfo.hs | 2 +- .../src/Unison/Codebase/Editor/HandleInput.hs | 42 +- .../Codebase/Editor/HandleInput/AuthLogin.hs | 4 +- .../Editor/HandleInput/MetadataUtils.hs | 2 +- .../Codebase/Editor/HandleInput/Update.hs | 11 +- .../Codebase/Editor/Output/BranchDiff.hs | 41 +- .../src/Unison/Codebase/Editor/Propagate.hs | 8 +- .../src/Unison/Codebase/Editor/Slurp.hs | 20 +- .../Unison/Codebase/Editor/SlurpComponent.hs | 2 +- .../src/Unison/Codebase/Editor/SlurpResult.hs | 6 +- .../src/Unison/Codebase/Editor/TodoOutput.hs | 2 +- .../src/Unison/Codebase/Editor/UriParser.hs | 6 +- .../src/Unison/Codebase/TranscriptParser.hs | 6 +- unison-cli/src/Unison/CommandLine.hs | 6 +- .../src/Unison/CommandLine/Completion.hs | 12 +- .../src/Unison/CommandLine/DisplayValues.hs | 26 +- unison-cli/src/Unison/CommandLine/Globbing.hs | 3 +- .../src/Unison/CommandLine/InputPattern.hs | 5 +- .../src/Unison/CommandLine/InputPatterns.hs | 28 +- unison-cli/src/Unison/CommandLine/Main.hs | 2 +- .../src/Unison/CommandLine/OutputMessages.hs | 287 ++++++++----- unison-cli/src/Unison/LSP/Diagnostics.hs | 2 +- unison-cli/src/Unison/LSP/FileAnalysis.hs | 12 +- .../src/Unison/LSP/NotificationHandlers.hs | 2 +- unison-cli/src/Unison/LSP/Queries.hs | 2 +- unison-cli/src/Unison/Share/Sync.hs | 2 +- unison-cli/tests/Unison/Test/GitSync.hs | 388 +++++++++--------- unison-cli/unison/ArgParse.hs | 35 +- unison-cli/unison/System/Path.hs | 2 +- unison-core/src/Unison/ABT.hs | 47 +-- unison-core/src/Unison/ABT/Normalized.hs | 23 +- unison-core/src/Unison/DataDeclaration.hs | 24 +- .../src/Unison/DataDeclaration/Names.hs | 12 +- unison-core/src/Unison/HashQualified'.hs | 8 +- unison-core/src/Unison/HashQualified.hs | 4 +- unison-core/src/Unison/Hashable.hs | 6 +- unison-core/src/Unison/LabeledDependency.hs | 4 +- unison-core/src/Unison/Name.hs | 12 +- unison-core/src/Unison/Names.hs | 2 +- unison-core/src/Unison/NamesWithHistory.hs | 2 +- unison-core/src/Unison/Pattern.hs | 4 +- unison-core/src/Unison/Term.hs | 131 +++--- unison-core/src/Unison/Type.hs | 171 ++++---- unison-core/src/Unison/Type/Names.hs | 2 +- unison-core/src/Unison/Util/Components.hs | 2 +- unison-core/src/Unison/Util/List.hs | 6 +- unison-core/src/Unison/Var.hs | 36 +- .../src/Unison/Hashing/V2/ABT.hs | 3 +- .../src/Unison/Hashing/V2/DataDeclaration.hs | 4 +- .../src/Unison/Hashing/V2/Term.hs | 116 +++--- .../src/Unison/Hashing/V2/Tokenizable.hs | 8 +- .../src/Unison/Hashing/V2/Type.hs | 10 +- unison-share-api/src/Unison/Server/Backend.hs | 46 +-- .../src/Unison/Server/CodebaseServer.hs | 2 +- unison-share-api/src/Unison/Server/Doc.hs | 15 +- .../Server/Endpoints/DefinitionSummary.hs | 12 +- .../src/Unison/Server/Endpoints/FuzzyFind.hs | 5 +- .../Unison/Server/Endpoints/GetDefinitions.hs | 3 +- .../Server/Endpoints/NamespaceDetails.hs | 5 +- .../Server/Endpoints/NamespaceListing.hs | 5 +- .../src/Unison/Server/Endpoints/Projects.hs | 5 +- unison-share-api/src/Unison/Server/Orphans.hs | 4 +- .../src/Unison/Server/SearchResult'.hs | 24 +- unison-share-api/src/Unison/Server/Syntax.hs | 8 +- unison-share-api/src/Unison/Server/Types.hs | 4 +- unison-share-api/src/Unison/Sync/Types.hs | 18 +- unison-share-api/src/Unison/Util/Find.hs | 2 +- unison-src/parser-tests/GenerateErrors.hs | 4 +- .../src/Unison/Syntax/HashQualified'.hs | 2 +- .../src/Unison/Syntax/HashQualified.hs | 4 +- unison-syntax/src/Unison/Syntax/Lexer.hs | 63 ++- unison-syntax/src/Unison/Syntax/Name.hs | 6 +- unison-syntax/src/Unison/Syntax/Parser.hs | 98 ++--- yaks/easytest/src/EasyTest.hs | 26 +- 222 files changed, 2862 insertions(+), 2485 deletions(-) diff --git a/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs b/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs index ebce136d7..efb8eb2e2 100644 --- a/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs +++ b/codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Sqlite/V2/HashHandle.hs @@ -6,8 +6,8 @@ where import qualified Data.Set as Set import U.Codebase.Sqlite.HashHandle import U.Util.Type (removeAllEffectVars) -import Unison.Hashing.V2.Convert2 (h2ToV2Reference, v2ToH2Type, v2ToH2TypeD) import qualified Unison.Hashing.V2 as H2 +import Unison.Hashing.V2.Convert2 (h2ToV2Reference, v2ToH2Type, v2ToH2TypeD) v2HashHandle :: HashHandle v2HashHandle = diff --git a/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs b/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs index 3e091d376..a5c193e62 100644 --- a/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs +++ b/codebase2/codebase-sqlite-hashing-v2/src/Unison/Hashing/V2/Convert2.hs @@ -27,13 +27,13 @@ convertReference' idConv = \case V2.ReferenceBuiltin x -> H2.ReferenceBuiltin x V2.ReferenceDerived x -> H2.ReferenceDerivedId (idConv x) -v2ToH2Type :: forall v. Ord v => V2.Type.TypeR V2.TypeRef v -> H2.Type v () +v2ToH2Type :: forall v. (Ord v) => V2.Type.TypeR V2.TypeRef v -> H2.Type v () v2ToH2Type = v2ToH2Type' convertReference -v2ToH2TypeD :: forall v. Ord v => Hash -> V2.Type.TypeD v -> H2.Type v () +v2ToH2TypeD :: forall v. (Ord v) => Hash -> V2.Type.TypeD v -> H2.Type v () v2ToH2TypeD defaultHash = v2ToH2Type' (convertReference' (convertId defaultHash)) -v2ToH2Type' :: forall r v. Ord v => (r -> H2.Reference) -> V2.Type.TypeR r v -> H2.Type v () +v2ToH2Type' :: forall r v. (Ord v) => (r -> H2.Reference) -> V2.Type.TypeR r v -> H2.Type v () v2ToH2Type' mkReference = ABT.transform convertF where convertF :: forall a. V2.Type.F' r a -> H2.TypeF a diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/LocalizeObject.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/LocalizeObject.hs index 186195134..0f857ef7a 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/LocalizeObject.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/LocalizeObject.hs @@ -122,7 +122,7 @@ type LocalizeBranchState = ) -- Run a computation that localizes a branch object, returning the local ids recorded within. -runLocalizeBranch :: Monad m => StateT LocalizeBranchState m a -> m (BranchLocalIds, a) +runLocalizeBranch :: (Monad m) => StateT LocalizeBranchState m a -> m (BranchLocalIds, a) runLocalizeBranch action = do (result, (localTexts, localDefns, localPatches, localChildren)) <- State.runStateT action (mempty @LocalizeBranchState) let branchLocalIds :: BranchLocalIds @@ -143,7 +143,7 @@ type LocalizePatchState = ) -- Run a computation that localizes a patch object, returning the local ids recorded within. -runLocalizePatch :: Monad m => StateT LocalizePatchState m a -> m (PatchLocalIds, a) +runLocalizePatch :: (Monad m) => StateT LocalizePatchState m a -> m (PatchLocalIds, a) runLocalizePatch action = do (result, (localTexts, localHashes, localDefns)) <- State.runStateT action (mempty @LocalizePatchState) let patchLocalIds :: PatchLocalIds diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs index ea69c9c64..88a028f08 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs @@ -28,19 +28,19 @@ instance FromField (ConstructorType) where data NamedRef ref = NamedRef {reversedSegments :: ReversedSegments, ref :: ref} deriving stock (Show, Functor, Foldable, Traversable) -instance ToRow ref => ToRow (NamedRef ref) where +instance (ToRow ref) => ToRow (NamedRef ref) where toRow (NamedRef {reversedSegments = segments, ref}) = [toField reversedName] <> toRow ref where reversedName = Text.intercalate "." . toList $ segments -instance FromRow ref => FromRow (NamedRef ref) where +instance (FromRow ref) => FromRow (NamedRef ref) where fromRow = do reversedSegments <- NonEmpty.fromList . Text.splitOn "." <$> field ref <- fromRow pure (NamedRef {reversedSegments, ref}) -toRowWithNamespace :: ToRow ref => NamedRef ref -> [SQLData] +toRowWithNamespace :: (ToRow ref) => NamedRef ref -> [SQLData] toRowWithNamespace nr = toRow nr <> [SQLText namespace] where namespace = Text.intercalate "." . reverse . NEL.tail . reversedSegments $ nr diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs index 59d1a0ad1..646268d1a 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Operations.hs @@ -544,7 +544,8 @@ s2cBranch (S.Branch.Full.Branch tms tps patches children) = Map Db.TextId (Db.BranchObjectId, Db.CausalHashId) -> Transaction (Map NameSegment (C.Causal Transaction CausalHash BranchHash (C.Branch.Branch Transaction))) doChildren = Map.bitraverse (fmap NameSegment . Q.expectText) \(boId, chId) -> - C.Causal <$> Q.expectCausalHash chId + C.Causal + <$> Q.expectCausalHash chId <*> expectValueHashByCausalHashId chId <*> headParents chId <*> pure (expectBranch boId) @@ -572,7 +573,8 @@ s2cBranch (S.Branch.Full.Branch tms tps patches children) = Db.CausalHashId -> Transaction (C.Causal Transaction CausalHash BranchHash (C.Branch.Branch Transaction)) loadCausal chId = do - C.Causal <$> Q.expectCausalHash chId + C.Causal + <$> Q.expectCausalHash chId <*> expectValueHashByCausalHashId chId <*> headParents chId <*> pure (loadValue chId) @@ -771,7 +773,7 @@ expectDbBranch id = (mergePatches patches patches') (mergeChildren children children') mergeChildren :: - Ord ns => + (Ord ns) => Map ns (Db.BranchObjectId, Db.CausalHashId) -> Map ns S.BranchDiff.ChildOp -> Map ns (Db.BranchObjectId, Db.CausalHashId) @@ -794,7 +796,7 @@ expectDbBranch id = S.BranchDiff.ChildAddReplace id -> id S.BranchDiff.ChildRemove -> error "diff tries to remove a nonexistent child" mergePatches :: - Ord ns => + (Ord ns) => Map ns Db.PatchObjectId -> Map ns S.BranchDiff.PatchOp -> Map ns Db.PatchObjectId @@ -826,7 +828,7 @@ expectDbBranch id = S.Branch.Diff.RemoveDef -> error "diff tries to remove a nonexistent definition" S.Branch.Diff.AlterDefMetadata _md -> error "diff tries to change metadata for a nonexistent definition" mergeDefnOp :: - Ord r => + (Ord r) => Map r S.MetadataSet.DbMetadataSet -> Map r S.BranchDiff.DefinitionOp -> Map r S.MetadataSet.DbMetadataSet @@ -872,7 +874,10 @@ saveDbBranchUnderHashId hh bhId@(Db.unBranchHashId -> hashId) stats branch = do let (localBranchIds, localBranch) = LocalizeObject.localizeBranch branch when debug $ traceM $ - "saveBranchObject\n\tid = " ++ show bhId ++ "\n\tli = " ++ show localBranchIds + "saveBranchObject\n\tid = " + ++ show bhId + ++ "\n\tli = " + ++ show localBranchIds ++ "\n\tlBranch = " ++ show localBranch let bytes = S.putBytes S.putBranchFormat $ S.BranchFormat.Full localBranchIds localBranch diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Patch/Format.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Patch/Format.hs index c792d00de..d46d9a3e9 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Patch/Format.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Patch/Format.hs @@ -59,7 +59,7 @@ applyPatchDiffs = addRemove add del src = Map.unionWith (<>) add (Map.differenceWith remove src del) - remove :: Ord b => Set b -> Set b -> Maybe (Set b) + remove :: (Ord b) => Set b -> Set b -> Maybe (Set b) remove src del = let diff = Set.difference src del in if Set.null diff then Nothing else Just diff diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 1703f2b18..e3a39118a 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -2130,7 +2130,7 @@ saveDeclComponent hh@HashHandle {toReferenceDecl, toReferenceDeclMentions} maybe pure oId -- | implementation detail of {s,w}2c*Term* & s2cDecl -localIdsToLookups :: Monad m => (t -> m Text) -> (d -> m Hash) -> LocalIds' t d -> m (LocalTextId -> Text, LocalDefnId -> Hash) +localIdsToLookups :: (Monad m) => (t -> m Text) -> (d -> m Hash) -> LocalIds' t d -> m (LocalTextId -> Text, LocalDefnId -> Hash) localIdsToLookups loadText loadHash localIds = do texts <- traverse loadText $ LocalIds.textLookup localIds hashes <- traverse loadHash $ LocalIds.defnLookup localIds @@ -2174,7 +2174,7 @@ localIdsToTypeRefLookup localIds = do c2sDecl :: forall m t d. - Monad m => + (Monad m) => (Text -> m t) -> (Hash -> m d) -> C.Decl Symbol -> @@ -2210,7 +2210,7 @@ c2sDecl saveText saveDefn (C.Decl.DataDeclaration dt m b cts) = do -- | implementation detail of c2{s,w}Term -- The Type is optional, because we don't store them for watch expression results. -c2xTerm :: forall m t d. Monad m => (Text -> m t) -> (Hash -> m d) -> C.Term Symbol -> Maybe (C.Term.Type Symbol) -> m (LocalIds' t d, S.Term.Term, Maybe (S.Term.Type)) +c2xTerm :: forall m t d. (Monad m) => (Text -> m t) -> (Hash -> m d) -> C.Term Symbol -> Maybe (C.Term.Type Symbol) -> m (LocalIds' t d, S.Term.Term, Maybe (S.Term.Type)) c2xTerm saveText saveDefn tm tp = done =<< (runWriterT . flip evalStateT mempty) do sterm <- ABT.transformM go tm diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Reference.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Reference.hs index 7f68e9bed..ca228f83d 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Reference.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Reference.hs @@ -65,9 +65,9 @@ referenceFromRow' = liftA3 mkRef field field field where str = "(" ++ show t ++ ", " ++ show h ++ ", " ++ show i ++ ")" -instance ToField h => ToRow (Id' h) where +instance (ToField h) => ToRow (Id' h) where toRow = \case Id h i -> toRow (Only h) ++ toRow (Only i) -instance FromField h => FromRow (Id' h) where +instance (FromField h) => FromRow (Id' h) where fromRow = Id <$> field <*> field diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs index e87b08331..146af9fc0 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs @@ -115,47 +115,47 @@ putLocalIdsWith putText putDefn LocalIds {textLookup, defnLookup} = do putFoldable putText textLookup putFoldable putDefn defnLookup -getLocalIds :: MonadGet m => m LocalIds +getLocalIds :: (MonadGet m) => m LocalIds getLocalIds = getLocalIdsWith getVarInt getVarInt -getWatchLocalIds :: MonadGet m => m WatchLocalIds +getWatchLocalIds :: (MonadGet m) => m WatchLocalIds getWatchLocalIds = getLocalIdsWith getVarInt getVarInt -getLocalIdsWith :: MonadGet m => m t -> m d -> m (LocalIds' t d) +getLocalIdsWith :: (MonadGet m) => m t -> m d -> m (LocalIds' t d) getLocalIdsWith getText getDefn = LocalIds <$> getVector getText <*> getVector getDefn -putUnit :: Applicative m => () -> m () +putUnit :: (Applicative m) => () -> m () putUnit _ = pure () -getUnit :: Applicative m => m () +getUnit :: (Applicative m) => m () getUnit = pure () -putWatchResultFormat :: MonadPut m => TermFormat.WatchResultFormat -> m () +putWatchResultFormat :: (MonadPut m) => TermFormat.WatchResultFormat -> m () putWatchResultFormat = \case TermFormat.WatchResult ids t -> do putWord8 0 putLocalIds ids putTerm t -getWatchResultFormat :: MonadGet m => m TermFormat.WatchResultFormat +getWatchResultFormat :: (MonadGet m) => m TermFormat.WatchResultFormat getWatchResultFormat = getWord8 >>= \case 0 -> TermFormat.WatchResult <$> getWatchLocalIds <*> getTerm other -> unknownTag "getWatchResultFormat" other -putTermFormat :: MonadPut m => TermFormat.TermFormat -> m () +putTermFormat :: (MonadPut m) => TermFormat.TermFormat -> m () putTermFormat = \case TermFormat.Term c -> putWord8 0 *> putTermComponent c -getTermFormat :: MonadGet m => m TermFormat.TermFormat +getTermFormat :: (MonadGet m) => m TermFormat.TermFormat getTermFormat = getWord8 >>= \case 0 -> TermFormat.Term <$> getTermComponent other -> unknownTag "getTermFormat" other putTermComponent :: - MonadPut m => + (MonadPut m) => TermFormat.LocallyIndexedComponent -> m () putTermComponent t | debug && trace ("putTermComponent " ++ show t) False = undefined @@ -166,11 +166,11 @@ putTermComponent (TermFormat.LocallyIndexedComponent v) = ) v -putTerm :: MonadPut m => TermFormat.Term -> m () +putTerm :: (MonadPut m) => TermFormat.Term -> m () putTerm _t | debug && trace "putTerm" False = undefined putTerm t = putABT putSymbol putUnit putF t where - putF :: MonadPut m => (a -> m ()) -> TermFormat.F a -> m () + putF :: (MonadPut m) => (a -> m ()) -> TermFormat.F a -> m () putF putChild = \case Term.Int n -> putWord8 0 *> putInt n @@ -216,10 +216,10 @@ putTerm t = putABT putSymbol putUnit putF t putWord8 20 *> putReferent' putRecursiveReference putReference r Term.TypeLink r -> putWord8 21 *> putReference r - putMatchCase :: MonadPut m => (a -> m ()) -> Term.MatchCase LocalTextId TermFormat.TypeRef a -> m () + putMatchCase :: (MonadPut m) => (a -> m ()) -> Term.MatchCase LocalTextId TermFormat.TypeRef a -> m () putMatchCase putChild (Term.MatchCase pat guard body) = putPattern pat *> putMaybe putChild guard *> putChild body - putPattern :: MonadPut m => Term.Pattern LocalTextId TermFormat.TypeRef -> m () + putPattern :: (MonadPut m) => Term.Pattern LocalTextId TermFormat.TypeRef -> m () putPattern p = case p of Term.PUnbound -> putWord8 0 Term.PVar -> putWord8 1 @@ -249,23 +249,23 @@ putTerm t = putABT putSymbol putUnit putF t *> putPattern r Term.PText t -> putWord8 12 *> putVarInt t Term.PChar c -> putWord8 13 *> putChar c - putSeqOp :: MonadPut m => Term.SeqOp -> m () + putSeqOp :: (MonadPut m) => Term.SeqOp -> m () putSeqOp Term.PCons = putWord8 0 putSeqOp Term.PSnoc = putWord8 1 putSeqOp Term.PConcat = putWord8 2 -getTermComponent :: MonadGet m => m TermFormat.LocallyIndexedComponent +getTermComponent :: (MonadGet m) => m TermFormat.LocallyIndexedComponent getTermComponent = TermFormat.LocallyIndexedComponent <$> getFramedArray (getTuple3 getLocalIds (getFramed getTerm) getTType) -getTermAndType :: MonadGet m => m (TermFormat.Term, TermFormat.Type) +getTermAndType :: (MonadGet m) => m (TermFormat.Term, TermFormat.Type) getTermAndType = (,) <$> getFramed getTerm <*> getTType -getTerm :: MonadGet m => m TermFormat.Term +getTerm :: (MonadGet m) => m TermFormat.Term getTerm = getABT getSymbol getUnit getF where - getF :: MonadGet m => m a -> m (TermFormat.F a) + getF :: (MonadGet m) => m a -> m (TermFormat.F a) getF getChild = getWord8 >>= \case 0 -> Term.Int <$> getInt @@ -296,13 +296,13 @@ getTerm = getABT getSymbol getUnit getF 21 -> Term.TypeLink <$> getReference tag -> unknownTag "getTerm" tag where - getReferent :: MonadGet m => m (Referent' TermFormat.TermRef TermFormat.TypeRef) + getReferent :: (MonadGet m) => m (Referent' TermFormat.TermRef TermFormat.TypeRef) getReferent = getWord8 >>= \case 0 -> Referent.Ref <$> getRecursiveReference 1 -> Referent.Con <$> getReference <*> getVarInt x -> unknownTag "getTermComponent" x - getPattern :: MonadGet m => m (Term.Pattern LocalTextId TermFormat.TypeRef) + getPattern :: (MonadGet m) => m (Term.Pattern LocalTextId TermFormat.TypeRef) getPattern = getWord8 >>= \case 0 -> pure Term.PUnbound @@ -330,7 +330,7 @@ getTerm = getABT getSymbol getUnit getF 13 -> Term.PChar <$> getChar x -> unknownTag "Pattern" x where - getSeqOp :: MonadGet m => m Term.SeqOp + getSeqOp :: (MonadGet m) => m Term.SeqOp getSeqOp = getWord8 >>= \case 0 -> pure Term.PCons @@ -338,28 +338,28 @@ getTerm = getABT getSymbol getUnit getF 2 -> pure Term.PConcat tag -> unknownTag "SeqOp" tag -lookupTermElement :: MonadGet m => Reference.Pos -> m (LocalIds, TermFormat.Term, TermFormat.Type) +lookupTermElement :: (MonadGet m) => Reference.Pos -> m (LocalIds, TermFormat.Term, TermFormat.Type) lookupTermElement i = getWord8 >>= \case 0 -> unsafeFramedArrayLookup (getTuple3 getLocalIds (getFramed getTerm) getTType) $ fromIntegral i tag -> unknownTag "lookupTermElement" tag -lookupTermElementDiscardingType :: MonadGet m => Reference.Pos -> m (LocalIds, TermFormat.Term) +lookupTermElementDiscardingType :: (MonadGet m) => Reference.Pos -> m (LocalIds, TermFormat.Term) lookupTermElementDiscardingType i = getWord8 >>= \case 0 -> unsafeFramedArrayLookup ((,) <$> getLocalIds <*> getFramed getTerm) $ fromIntegral i tag -> unknownTag "lookupTermElementDiscardingType" tag -lookupTermElementDiscardingTerm :: MonadGet m => Reference.Pos -> m (LocalIds, TermFormat.Type) +lookupTermElementDiscardingTerm :: (MonadGet m) => Reference.Pos -> m (LocalIds, TermFormat.Type) lookupTermElementDiscardingTerm i = getWord8 >>= \case 0 -> unsafeFramedArrayLookup ((,) <$> getLocalIds <* skipFramed <*> getTType) $ fromIntegral i tag -> unknownTag "lookupTermElementDiscardingTerm" tag -getTType :: MonadGet m => m TermFormat.Type +getTType :: (MonadGet m) => m TermFormat.Type getTType = getType getReference -getType :: forall m r. MonadGet m => m r -> m (Type.TypeR r Symbol) +getType :: forall m r. (MonadGet m) => m r -> m (Type.TypeR r Symbol) getType getReference = getABT getSymbol getUnit go where go :: m x -> m (Type.F' r x) @@ -374,19 +374,19 @@ getType getReference = getABT getSymbol getUnit go 6 -> Type.Forall <$> getChild 7 -> Type.IntroOuter <$> getChild tag -> unknownTag "getType" tag - getKind :: MonadGet m => m Kind + getKind :: (MonadGet m) => m Kind getKind = getWord8 >>= \case 0 -> pure Kind.Star 1 -> Kind.Arrow <$> getKind <*> getKind tag -> unknownTag "getKind" tag -putDeclFormat :: MonadPut m => DeclFormat.DeclFormat -> m () +putDeclFormat :: (MonadPut m) => DeclFormat.DeclFormat -> m () putDeclFormat = \case DeclFormat.Decl c -> putWord8 0 *> putDeclComponent c where -- These use a framed array for randomer access - putDeclComponent :: MonadPut m => DeclFormat.LocallyIndexedComponent -> m () + putDeclComponent :: (MonadPut m) => DeclFormat.LocallyIndexedComponent -> m () putDeclComponent t | debug && trace ("putDeclComponent " ++ show t) False = undefined putDeclComponent (DeclFormat.LocallyIndexedComponent v) = putFramedArray (putPair putLocalIds putDeclElement) v @@ -401,18 +401,18 @@ putDeclFormat = \case putModifier Decl.Structural = putWord8 0 putModifier (Decl.Unique t) = putWord8 1 *> putText t -getDeclFormat :: MonadGet m => m DeclFormat.DeclFormat +getDeclFormat :: (MonadGet m) => m DeclFormat.DeclFormat getDeclFormat = getWord8 >>= \case 0 -> DeclFormat.Decl <$> getDeclComponent other -> unknownTag "DeclFormat" other where - getDeclComponent :: MonadGet m => m DeclFormat.LocallyIndexedComponent + getDeclComponent :: (MonadGet m) => m DeclFormat.LocallyIndexedComponent getDeclComponent = DeclFormat.LocallyIndexedComponent <$> getFramedArray (getPair getLocalIds getDeclElement) -getDeclElement :: MonadGet m => m (DeclFormat.Decl Symbol) +getDeclElement :: (MonadGet m) => m (DeclFormat.Decl Symbol) getDeclElement = Decl.DataDeclaration <$> getDeclType @@ -432,13 +432,13 @@ getDeclElement = other -> unknownTag "DeclModifier" other lookupDeclElement :: - MonadGet m => Reference.Pos -> m (LocalIds, DeclFormat.Decl Symbol) + (MonadGet m) => Reference.Pos -> m (LocalIds, DeclFormat.Decl Symbol) lookupDeclElement i = getWord8 >>= \case 0 -> unsafeFramedArrayLookup (getPair getLocalIds getDeclElement) $ fromIntegral i other -> unknownTag "lookupDeclElement" other -putBranchFormat :: MonadPut m => BranchFormat.BranchFormat -> m () +putBranchFormat :: (MonadPut m) => BranchFormat.BranchFormat -> m () putBranchFormat b | debug && trace ("putBranchFormat " ++ show b) False = undefined putBranchFormat b = case b of BranchFormat.Full li b -> do @@ -480,14 +480,14 @@ putBranchFormat b = case b of BranchDiff.ChildRemove -> putWord8 0 BranchDiff.ChildAddReplace b -> putWord8 1 *> putVarInt b -putBranchLocalIds :: MonadPut m => BranchFormat.BranchLocalIds -> m () +putBranchLocalIds :: (MonadPut m) => BranchFormat.BranchLocalIds -> m () putBranchLocalIds (BranchFormat.LocalIds ts os ps cs) = do putFoldable putVarInt ts putFoldable putVarInt os putFoldable putVarInt ps putFoldable (putPair putVarInt putVarInt) cs -putPatchFormat :: MonadPut m => PatchFormat.PatchFormat -> m () +putPatchFormat :: (MonadPut m) => PatchFormat.PatchFormat -> m () putPatchFormat = \case PatchFormat.Full ids p -> do putWord8 0 @@ -499,71 +499,71 @@ putPatchFormat = \case putPatchLocalIds ids putPatchDiff p -getPatchFormat :: MonadGet m => m PatchFormat.PatchFormat +getPatchFormat :: (MonadGet m) => m PatchFormat.PatchFormat getPatchFormat = getWord8 >>= \case 0 -> PatchFormat.Full <$> getPatchLocalIds <*> getPatchFull 1 -> PatchFormat.Diff <$> getVarInt <*> getPatchLocalIds <*> getPatchDiff x -> unknownTag "getPatchFormat" x where - getPatchFull :: MonadGet m => m PatchFull.LocalPatch + getPatchFull :: (MonadGet m) => m PatchFull.LocalPatch getPatchFull = PatchFull.Patch <$> getMap getReferent (getSet getTermEdit) <*> getMap getReference (getSet getTypeEdit) - getPatchDiff :: MonadGet m => m PatchDiff.LocalPatchDiff + getPatchDiff :: (MonadGet m) => m PatchDiff.LocalPatchDiff getPatchDiff = PatchDiff.PatchDiff <$> getMap getReferent (getSet getTermEdit) <*> getMap getReference (getSet getTypeEdit) <*> getMap getReferent (getSet getTermEdit) <*> getMap getReference (getSet getTypeEdit) - getTermEdit :: MonadGet m => m TermEdit.LocalTermEdit + getTermEdit :: (MonadGet m) => m TermEdit.LocalTermEdit getTermEdit = getWord8 >>= \case 0 -> pure TermEdit.Deprecate 1 -> TermEdit.Replace <$> getReferent <*> getTyping x -> unknownTag "getTermEdit" x - getTyping :: MonadGet m => m TermEdit.Typing + getTyping :: (MonadGet m) => m TermEdit.Typing getTyping = getWord8 >>= \case 0 -> pure TermEdit.Same 1 -> pure TermEdit.Subtype 2 -> pure TermEdit.Different x -> unknownTag "getTyping" x - getTypeEdit :: MonadGet m => m TypeEdit.LocalTypeEdit + getTypeEdit :: (MonadGet m) => m TypeEdit.LocalTypeEdit getTypeEdit = getWord8 >>= \case 0 -> pure TypeEdit.Deprecate 1 -> TypeEdit.Replace <$> getReference x -> unknownTag "getTypeEdit" x -getPatchLocalIds :: MonadGet m => m PatchFormat.PatchLocalIds +getPatchLocalIds :: (MonadGet m) => m PatchFormat.PatchLocalIds getPatchLocalIds = PatchFormat.LocalIds <$> getVector getVarInt <*> getVector getVarInt <*> getVector getVarInt -putPatchFull :: MonadPut m => PatchFull.LocalPatch -> m () +putPatchFull :: (MonadPut m) => PatchFull.LocalPatch -> m () putPatchFull (PatchFull.Patch termEdits typeEdits) = do putMap putReferent (putFoldable putTermEdit) termEdits putMap putReference (putFoldable putTypeEdit) typeEdits -putPatchDiff :: MonadPut m => PatchDiff.LocalPatchDiff -> m () +putPatchDiff :: (MonadPut m) => PatchDiff.LocalPatchDiff -> m () putPatchDiff (PatchDiff.PatchDiff atm atp rtm rtp) = do putMap putReferent (putFoldable putTermEdit) atm putMap putReference (putFoldable putTypeEdit) atp putMap putReferent (putFoldable putTermEdit) rtm putMap putReference (putFoldable putTypeEdit) rtp -putPatchLocalIds :: MonadPut m => PatchFormat.PatchLocalIds -> m () +putPatchLocalIds :: (MonadPut m) => PatchFormat.PatchLocalIds -> m () putPatchLocalIds (PatchFormat.LocalIds ts hs os) = do putFoldable putVarInt ts putFoldable putVarInt hs putFoldable putVarInt os -putTermEdit :: MonadPut m => TermEdit.LocalTermEdit -> m () +putTermEdit :: (MonadPut m) => TermEdit.LocalTermEdit -> m () putTermEdit TermEdit.Deprecate = putWord8 0 putTermEdit (TermEdit.Replace r t) = putWord8 1 *> putReferent r *> putTyping t where @@ -571,29 +571,29 @@ putTermEdit (TermEdit.Replace r t) = putWord8 1 *> putReferent r *> putTyping t putTyping TermEdit.Subtype = putWord8 1 putTyping TermEdit.Different = putWord8 2 -putTypeEdit :: MonadPut m => TypeEdit.LocalTypeEdit -> m () +putTypeEdit :: (MonadPut m) => TypeEdit.LocalTypeEdit -> m () putTypeEdit TypeEdit.Deprecate = putWord8 0 putTypeEdit (TypeEdit.Replace r) = putWord8 1 *> putReference r -getBranchFormat :: MonadGet m => m BranchFormat.BranchFormat +getBranchFormat :: (MonadGet m) => m BranchFormat.BranchFormat getBranchFormat = getWord8 >>= \case 0 -> getBranchFull 1 -> getBranchDiff x -> unknownTag "getBranchFormat" x where - getBranchFull :: MonadGet m => m BranchFormat.BranchFormat + getBranchFull :: (MonadGet m) => m BranchFormat.BranchFormat getBranchFull = BranchFormat.Full <$> getBranchLocalIds <*> getLocalBranch where - getLocalBranch :: MonadGet m => m BranchFull.LocalBranch + getLocalBranch :: (MonadGet m) => m BranchFull.LocalBranch getLocalBranch = BranchFull.Branch <$> getMap getVarInt (getMap getReferent getMetadataSetFormat) <*> getMap getVarInt (getMap getReference getMetadataSetFormat) <*> getMap getVarInt getVarInt <*> getMap getVarInt getVarInt - getMetadataSetFormat :: MonadGet m => m BranchFull.LocalMetadataSet + getMetadataSetFormat :: (MonadGet m) => m BranchFull.LocalMetadataSet getMetadataSetFormat = getWord8 >>= \case 0 -> BranchFull.Inline <$> getSet getReference @@ -604,14 +604,14 @@ getBranchFormat = <*> getBranchLocalIds <*> getLocalBranchDiff where - getLocalBranchDiff :: MonadGet m => m BranchDiff.LocalDiff + getLocalBranchDiff :: (MonadGet m) => m BranchDiff.LocalDiff getLocalBranchDiff = BranchDiff.Diff <$> getMap getVarInt (getMap getReferent getDiffOp) <*> getMap getVarInt (getMap getReference getDiffOp) <*> getMap getVarInt getPatchOp <*> getMap getVarInt getChildOp - getDiffOp :: MonadGet m => m BranchDiff.LocalDefinitionOp + getDiffOp :: (MonadGet m) => m BranchDiff.LocalDefinitionOp getDiffOp = getWord8 >>= \case 0 -> pure BranchDiff.RemoveDef @@ -622,20 +622,20 @@ getBranchFormat = adds <- getMap get (pure True) -- and removes: addToExistingMap get (pure False) adds - getPatchOp :: MonadGet m => m BranchDiff.LocalPatchOp + getPatchOp :: (MonadGet m) => m BranchDiff.LocalPatchOp getPatchOp = getWord8 >>= \case 0 -> pure BranchDiff.PatchRemove 1 -> BranchDiff.PatchAddReplace <$> getVarInt x -> unknownTag "getPatchOp" x - getChildOp :: MonadGet m => m BranchDiff.LocalChildOp + getChildOp :: (MonadGet m) => m BranchDiff.LocalChildOp getChildOp = getWord8 >>= \case 0 -> pure BranchDiff.ChildRemove 1 -> BranchDiff.ChildAddReplace <$> getVarInt x -> unknownTag "getChildOp" x -getBranchLocalIds :: MonadGet m => m BranchFormat.BranchLocalIds +getBranchLocalIds :: (MonadGet m) => m BranchFormat.BranchLocalIds getBranchLocalIds = BranchFormat.LocalIds <$> getVector getVarInt @@ -643,7 +643,7 @@ getBranchLocalIds = <*> getVector getVarInt <*> getVector (getPair getVarInt getVarInt) -decomposeTermFormat :: MonadGet m => m TermFormat.SyncTermFormat +decomposeTermFormat :: (MonadGet m) => m TermFormat.SyncTermFormat decomposeTermFormat = getWord8 >>= \case 0 -> @@ -652,7 +652,7 @@ decomposeTermFormat = <$> decomposeComponent tag -> error $ "todo: unknown term format tag " ++ show tag -decomposeDeclFormat :: MonadGet m => m DeclFormat.SyncDeclFormat +decomposeDeclFormat :: (MonadGet m) => m DeclFormat.SyncDeclFormat decomposeDeclFormat = getWord8 >>= \case 0 -> @@ -661,7 +661,7 @@ decomposeDeclFormat = <$> decomposeComponent tag -> error $ "todo: unknown term format tag " ++ show tag -decomposeComponent :: MonadGet m => m (Vector (LocalIds, BS.ByteString)) +decomposeComponent :: (MonadGet m) => m (Vector (LocalIds, BS.ByteString)) decomposeComponent = do offsets <- getList (getVarInt @_ @Int) componentBytes <- getByteString (last offsets) @@ -671,60 +671,60 @@ decomposeComponent = do split = (,) <$> getLocalIds <*> getRemainingByteString Monoid.foldMapM get1 (zip offsets (tail offsets)) -recomposeTermFormat :: MonadPut m => TermFormat.SyncTermFormat -> m () +recomposeTermFormat :: (MonadPut m) => TermFormat.SyncTermFormat -> m () recomposeTermFormat = \case TermFormat.SyncTerm (TermFormat.SyncLocallyIndexedComponent x) -> putWord8 0 >> recomposeComponent x -recomposeDeclFormat :: MonadPut m => DeclFormat.SyncDeclFormat -> m () +recomposeDeclFormat :: (MonadPut m) => DeclFormat.SyncDeclFormat -> m () recomposeDeclFormat = \case DeclFormat.SyncDecl (DeclFormat.SyncLocallyIndexedComponent x) -> putWord8 0 >> recomposeComponent x -recomposeComponent :: MonadPut m => Vector (LocalIds, BS.ByteString) -> m () +recomposeComponent :: (MonadPut m) => Vector (LocalIds, BS.ByteString) -> m () recomposeComponent = putFramedArray \(localIds, bytes) -> do putLocalIds localIds putByteString bytes -decomposeWatchFormat :: MonadGet m => m TermFormat.SyncWatchResultFormat +decomposeWatchFormat :: (MonadGet m) => m TermFormat.SyncWatchResultFormat decomposeWatchFormat = getWord8 >>= \case 0 -> TermFormat.SyncWatchResult <$> getWatchLocalIds <*> getRemainingByteString x -> unknownTag "decomposeWatchFormat" x -recomposeWatchFormat :: MonadPut m => TermFormat.SyncWatchResultFormat -> m () +recomposeWatchFormat :: (MonadPut m) => TermFormat.SyncWatchResultFormat -> m () recomposeWatchFormat (TermFormat.SyncWatchResult wli bs) = putWord8 0 *> putLocalIds wli *> putByteString bs -decomposePatchFormat :: MonadGet m => m PatchFormat.SyncPatchFormat +decomposePatchFormat :: (MonadGet m) => m PatchFormat.SyncPatchFormat decomposePatchFormat = getWord8 >>= \case 0 -> PatchFormat.SyncFull <$> getPatchLocalIds <*> getRemainingByteString 1 -> PatchFormat.SyncDiff <$> getVarInt <*> getPatchLocalIds <*> getRemainingByteString x -> unknownTag "decomposePatchFormat" x -recomposePatchFormat :: MonadPut m => PatchFormat.SyncPatchFormat -> m () +recomposePatchFormat :: (MonadPut m) => PatchFormat.SyncPatchFormat -> m () recomposePatchFormat = \case PatchFormat.SyncFull li bs -> putWord8 0 *> putPatchLocalIds li *> putByteString bs PatchFormat.SyncDiff id li bs -> putWord8 1 *> putVarInt id *> putPatchLocalIds li *> putByteString bs -decomposeBranchFormat :: MonadGet m => m BranchFormat.SyncBranchFormat +decomposeBranchFormat :: (MonadGet m) => m BranchFormat.SyncBranchFormat decomposeBranchFormat = getWord8 >>= \case 0 -> BranchFormat.SyncFull <$> getBranchLocalIds <*> getRemainingByteString 1 -> BranchFormat.SyncDiff <$> getVarInt <*> getBranchLocalIds <*> getRemainingByteString x -> unknownTag "decomposeBranchFormat" x -recomposeBranchFormat :: MonadPut m => BranchFormat.SyncBranchFormat -> m () +recomposeBranchFormat :: (MonadPut m) => BranchFormat.SyncBranchFormat -> m () recomposeBranchFormat = \case BranchFormat.SyncFull li bs -> putWord8 0 *> putBranchLocalIds li *> putByteString bs BranchFormat.SyncDiff id li bs -> putWord8 1 *> putVarInt id *> putBranchLocalIds li *> putByteString bs -putTempEntity :: MonadPut m => TempEntity -> m () +putTempEntity :: (MonadPut m) => TempEntity -> m () putTempEntity = \case Entity.TC tc -> case tc of TermFormat.SyncTerm term -> @@ -784,10 +784,10 @@ putTempEntity = \case putLocalIdsWith putText putHash32 localIds putFramedByteString bytes -getHash32 :: MonadGet m => m Hash32 +getHash32 :: (MonadGet m) => m Hash32 getHash32 = Hash32.UnsafeFromBase32Hex . Base32Hex.UnsafeFromText <$> getText -getTempTermFormat :: MonadGet m => m TempEntity.TempTermFormat +getTempTermFormat :: (MonadGet m) => m TempEntity.TempTermFormat getTempTermFormat = getWord8 >>= \case 0 -> @@ -799,7 +799,7 @@ getTempTermFormat = ) tag -> unknownTag "getTempTermFormat" tag -getTempDeclFormat :: MonadGet m => m TempEntity.TempDeclFormat +getTempDeclFormat :: (MonadGet m) => m TempEntity.TempDeclFormat getTempDeclFormat = getWord8 >>= \case 0 -> @@ -811,7 +811,7 @@ getTempDeclFormat = ) tag -> unknownTag "getTempDeclFormat" tag -getTempPatchFormat :: MonadGet m => m TempEntity.TempPatchFormat +getTempPatchFormat :: (MonadGet m) => m TempEntity.TempPatchFormat getTempPatchFormat = getWord8 >>= \case 0 -> PatchFormat.SyncFull <$> getPatchLocalIds <*> getFramedByteString @@ -824,7 +824,7 @@ getTempPatchFormat = <*> getVector getHash32 <*> getVector getHash32 -getTempNamespaceFormat :: MonadGet m => m TempEntity.TempNamespaceFormat +getTempNamespaceFormat :: (MonadGet m) => m TempEntity.TempNamespaceFormat getTempNamespaceFormat = getWord8 >>= \case 0 -> BranchFormat.SyncFull <$> getBranchLocalIds <*> getFramedByteString @@ -838,16 +838,16 @@ getTempNamespaceFormat = <*> getVector getHash32 <*> getVector (getPair getHash32 getHash32) -getTempCausalFormat :: MonadGet m => m TempEntity.TempCausalFormat +getTempCausalFormat :: (MonadGet m) => m TempEntity.TempCausalFormat getTempCausalFormat = Causal.SyncCausalFormat <$> getHash32 <*> getVector getHash32 -getSymbol :: MonadGet m => m Symbol +getSymbol :: (MonadGet m) => m Symbol getSymbol = Symbol <$> getVarInt <*> getText -putSymbol :: MonadPut m => Symbol -> m () +putSymbol :: (MonadPut m) => Symbol -> m () putSymbol (Symbol n t) = putVarInt n >> putText t putReferent :: @@ -865,7 +865,7 @@ putReferent :: m () putReferent = putReferent' putReference putReference -putReferent' :: MonadPut m => (r1 -> m ()) -> (r2 -> m ()) -> Referent' r1 r2 -> m () +putReferent' :: (MonadPut m) => (r1 -> m ()) -> (r2 -> m ()) -> Referent' r1 r2 -> m () putReferent' putRefRef putConRef = \case Referent.Ref r -> do putWord8 0 @@ -885,7 +885,7 @@ putReference = \case ReferenceDerived (Reference.Id r index) -> putWord8 1 *> putVarInt r *> putVarInt index -getReferent' :: MonadGet m => m r1 -> m r2 -> m (Referent' r1 r2) +getReferent' :: (MonadGet m) => m r1 -> m r2 -> m (Referent' r1 r2) getReferent' getRefRef getConRef = getWord8 >>= \case 0 -> Referent.Ref <$> getRefRef @@ -934,39 +934,39 @@ getRecursiveReference = 1 -> ReferenceDerived <$> (Reference.Id <$> getMaybe getVarInt <*> getVarInt) x -> unknownTag "getRecursiveReference" x -putInt :: MonadPut m => Int64 -> m () +putInt :: (MonadPut m) => Int64 -> m () putInt = serializeBE -getInt :: MonadGet m => m Int64 +getInt :: (MonadGet m) => m Int64 getInt = deserializeBE -putNat :: MonadPut m => Word64 -> m () +putNat :: (MonadPut m) => Word64 -> m () putNat = serializeBE -getNat :: MonadGet m => m Word64 +getNat :: (MonadGet m) => m Word64 getNat = deserializeBE -putFloat :: MonadPut m => Double -> m () +putFloat :: (MonadPut m) => Double -> m () putFloat = serializeBE -getFloat :: MonadGet m => m Double +getFloat :: (MonadGet m) => m Double getFloat = deserializeBE -putBoolean :: MonadPut m => Bool -> m () +putBoolean :: (MonadPut m) => Bool -> m () putBoolean False = putWord8 0 putBoolean True = putWord8 1 -getBoolean :: MonadGet m => m Bool +getBoolean :: (MonadGet m) => m Bool getBoolean = getWord8 >>= \case 0 -> pure False 1 -> pure True x -> unknownTag "Boolean" x -putTType :: MonadPut m => TermFormat.Type -> m () +putTType :: (MonadPut m) => TermFormat.Type -> m () putTType = putType putReference putSymbol -putDType :: MonadPut m => DeclFormat.Type Symbol -> m () +putDType :: (MonadPut m) => DeclFormat.Type Symbol -> m () putDType = putType putRecursiveReference putSymbol putType :: @@ -988,23 +988,23 @@ putType putReference putVar = putABT putVar putUnit go Type.Effects es -> putWord8 5 *> putFoldable putChild es Type.Forall body -> putWord8 6 *> putChild body Type.IntroOuter body -> putWord8 7 *> putChild body - putKind :: MonadPut m => Kind -> m () + putKind :: (MonadPut m) => Kind -> m () putKind k = case k of Kind.Star -> putWord8 0 Kind.Arrow i o -> putWord8 1 *> putKind i *> putKind o -putChar :: MonadPut m => Char -> m () +putChar :: (MonadPut m) => Char -> m () putChar = serialize . VarInt . fromEnum -getChar :: MonadGet m => m Char +getChar :: (MonadGet m) => m Char getChar = toEnum . unVarInt <$> deserialize -putMaybe :: MonadPut m => (a -> m ()) -> Maybe a -> m () +putMaybe :: (MonadPut m) => (a -> m ()) -> Maybe a -> m () putMaybe putA = \case Nothing -> putWord8 0 Just a -> putWord8 1 *> putA a -getMaybe :: MonadGet m => m a -> m (Maybe a) +getMaybe :: (MonadGet m) => m a -> m (Maybe a) getMaybe getA = getWord8 >>= \tag -> case tag of 0 -> pure Nothing diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Sync22.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Sync22.hs index 2b0ab3031..717827acf 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Sync22.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Sync22.hs @@ -195,7 +195,8 @@ trySync hh runSrc runDest tCache hCache oCache cCache = \case localIds' <- traverse syncLocalIds localIds -- reassemble and save the reindexed term let bytes' = - runPutS . S.recomposeDeclFormat + runPutS + . S.recomposeDeclFormat . DeclFormat.SyncDecl . DeclFormat.SyncLocallyIndexedComponent $ Vector.zip localIds' declBytes diff --git a/codebase2/codebase/U/Codebase/Branch/Type.hs b/codebase2/codebase/U/Codebase/Branch/Type.hs index 1a98245c7..0f3fd246c 100644 --- a/codebase2/codebase/U/Codebase/Branch/Type.hs +++ b/codebase2/codebase/U/Codebase/Branch/Type.hs @@ -57,7 +57,8 @@ data Patch = Patch instance Show (Branch m) where show b = - "Branch { terms = " ++ show (fmap Map.keys (terms b)) + "Branch { terms = " + ++ show (fmap Map.keys (terms b)) ++ ", types = " ++ show (fmap Map.keys (types b)) ++ ", patches = " @@ -90,7 +91,7 @@ hasDefinitions (NamespaceStats numTerms numTypes _numPatches) = childAt :: NameSegment -> Branch m -> Maybe (CausalBranch m) childAt ns (Branch {children}) = Map.lookup ns children -hoist :: Functor n => (forall x. m x -> n x) -> Branch m -> Branch n +hoist :: (Functor n) => (forall x. m x -> n x) -> Branch m -> Branch n hoist f Branch {..} = Branch { terms = (fmap . fmap) f terms, @@ -100,7 +101,7 @@ hoist f Branch {..} = fmap (fmap (hoist f) . Causal.hoist f) children } -hoistCausalBranch :: Functor n => (forall x. m x -> n x) -> CausalBranch m -> CausalBranch n +hoistCausalBranch :: (Functor n) => (forall x. m x -> n x) -> CausalBranch m -> CausalBranch n hoistCausalBranch f cb = cb & Causal.hoist f @@ -110,14 +111,14 @@ hoistCausalBranch f cb = -- provided branch. -- -- If only name is specified, metadata will be returned for all terms at that name. -termMetadata :: Monad m => Branch m -> NameSegment -> Maybe Referent -> m [Map MetadataValue MetadataType] +termMetadata :: (Monad m) => Branch m -> NameSegment -> Maybe Referent -> m [Map MetadataValue MetadataType] termMetadata Branch {terms} = metadataHelper terms -- | Returns all the metadata value references that are attached to a type with the provided name in the -- provided branch. -- -- If only name is specified, metadata will be returned for all types at that name. -typeMetadata :: Monad m => Branch m -> NameSegment -> Maybe Reference -> m [Map MetadataValue MetadataType] +typeMetadata :: (Monad m) => Branch m -> NameSegment -> Maybe Reference -> m [Map MetadataValue MetadataType] typeMetadata Branch {types} = metadataHelper types metadataHelper :: (Monad m, Ord ref) => Map NameSegment (Map ref (m MdValues)) -> NameSegment -> Maybe ref -> m [Map MetadataValue MetadataType] diff --git a/codebase2/codebase/U/Codebase/Causal.hs b/codebase2/codebase/U/Codebase/Causal.hs index 26eb4c0c2..7cd6a07eb 100644 --- a/codebase2/codebase/U/Codebase/Causal.hs +++ b/codebase2/codebase/U/Codebase/Causal.hs @@ -18,7 +18,7 @@ data Causal m hc he e = Causal } deriving (Functor) -hoist :: Functor n => (forall x. m x -> n x) -> Causal m hc he e -> Causal n hc he e +hoist :: (Functor n) => (forall x. m x -> n x) -> Causal m hc he e -> Causal n hc he e hoist f (Causal {..}) = Causal { parents = parents & fmap f & (fmap . fmap) (hoist f), diff --git a/codebase2/codebase/U/Codebase/Type.hs b/codebase2/codebase/U/Codebase/Type.hs index e25958e6d..4de17ec37 100644 --- a/codebase2/codebase/U/Codebase/Type.hs +++ b/codebase2/codebase/U/Codebase/Type.hs @@ -38,17 +38,17 @@ type TypeD v = ABT.Term FD v () type TypeR r v = ABT.Term (F' r) v () -rmap :: Ord v => (r -> r') -> ABT.Term (F' r) v a -> ABT.Term (F' r') v a +rmap :: (Ord v) => (r -> r') -> ABT.Term (F' r) v a -> ABT.Term (F' r') v a rmap f = ABT.transform \case Ref r -> Ref (f r) x -> unsafeCoerce x -typeD2T :: Ord v => Hash -> TypeD v -> TypeT v +typeD2T :: (Ord v) => Hash -> TypeD v -> TypeT v typeD2T h = rmap $ bimap id $ Maybe.fromMaybe h dependencies :: (Ord v, Ord r) => ABT.Term (F' r) v a -> Set r dependencies = Writer.execWriter . ABT.visit' f where - f :: Ord r => F' r a -> Writer.Writer (Set r) (F' r a) + f :: (Ord r) => F' r a -> Writer.Writer (Set r) (F' r a) f t@(Ref r) = Writer.tell (Set.singleton r) $> t f t = pure t diff --git a/codebase2/core/U/Core/ABT.hs b/codebase2/core/U/Core/ABT.hs index 01252401a..eaf7b9cdd 100644 --- a/codebase2/core/U/Core/ABT.hs +++ b/codebase2/core/U/Core/ABT.hs @@ -26,7 +26,7 @@ data ABT f v r data Term f v a = Term {freeVars :: Set v, annotation :: a, out :: ABT f v (Term f v a)} deriving (Functor, Foldable, Generic, Traversable) -instance (Foldable f, Functor f, forall a. Eq a => Eq (f a), Var v) => Eq (Term f v a) where +instance (Foldable f, Functor f, forall a. (Eq a) => Eq (f a), Var v) => Eq (Term f v a) where -- alpha equivalence, works by renaming any aligned Abs ctors to use a common fresh variable t1 == t2 = go (out t1) (out t2) where @@ -43,10 +43,10 @@ instance (Foldable f, Functor f, forall a. Eq a => Eq (f a), Var v) => Eq (Term go _ _ = False instance - ( forall a. Eq a => Eq (f a), + ( forall a. (Eq a) => Eq (f a), Foldable f, Functor f, - forall a. Ord a => Ord (f a), + forall a. (Ord a) => Ord (f a), Var v ) => Ord (Term f v a) @@ -70,7 +70,7 @@ instance tag (Abs _ _) = 2 tag (Cycle _) = 3 -instance (forall a. Show a => Show (f a), Show v) => Show (Term f v a) where +instance (forall a. (Show a) => Show (f a), Show v) => Show (Term f v a) where showsPrec p (Term _ ann out) = case out of Var v -> showParen (p >= 9) $ \x -> showAnn ++ "Var " ++ show v ++ x Cycle body -> (\s -> showAnn ++ "Cycle " ++ s) . showsPrec p body @@ -82,7 +82,7 @@ instance (forall a. Show a => Show (f a), Show v) => Show (Term f v a) where then "(" ++ RTTI.anythingToString ann ++ ")" else "" -amap :: Functor f => (a -> a') -> Term f v a -> Term f v a' +amap :: (Functor f) => (a -> a') -> Term f v a -> Term f v a' amap = fmap vmap :: (Functor f, Foldable f, Ord v') => (v -> v') -> Term f v a -> Term f v' a @@ -93,7 +93,7 @@ vmap f (Term _ a out) = case out of Abs v body -> abs a (f v) (vmap f body) cata :: - Functor f => + (Functor f) => (a -> ABT f v x -> x) -> Term f v a -> x @@ -102,7 +102,7 @@ cata abtAlg = in go para :: - Functor f => + (Functor f) => (a -> ABT f v (Term f v a, x) -> x) -> Term f v a -> x @@ -132,7 +132,7 @@ transformM f t = case out t of Tm subterms -> tm (annotation t) <$> (traverse (transformM f) =<< f subterms) Cycle body -> cycle (annotation t) <$> (transformM f body) -abs :: Ord v => a -> v -> Term f v a -> Term f v a +abs :: (Ord v) => a -> v -> Term f v a -> Term f v a abs a v body = Term (Set.delete v (freeVars body)) a (Abs v body) var :: a -> v -> Term f v a @@ -234,7 +234,7 @@ unabs (Term _ _ (Abs hd body)) = unabs t = ([], t) -- | Produce a variable which is free in both terms -freshInBoth :: Var v => Term f v a -> Term f v a -> v -> v +freshInBoth :: (Var v) => Term f v a -> Term f v a -> v -> v freshInBoth t1 t2 = freshIn $ Set.union (freeVars t1) (freeVars t2) substsInheritAnnotation :: diff --git a/codebase2/core/U/Core/ABT/Var.hs b/codebase2/core/U/Core/ABT/Var.hs index 3a70eb736..6a2d443cd 100644 --- a/codebase2/core/U/Core/ABT/Var.hs +++ b/codebase2/core/U/Core/ABT/Var.hs @@ -6,5 +6,5 @@ import Data.Set (Set) -- -- * `Set.notMember (freshIn vs v) vs`: -- `freshIn` returns a variable not used in the `Set` -class Ord v => Var v where +class (Ord v) => Var v where freshIn :: Set v -> v -> v diff --git a/codebase2/core/Unison/Util/Alphabetical.hs b/codebase2/core/Unison/Util/Alphabetical.hs index 7bcb549db..1dc6a2515 100644 --- a/codebase2/core/Unison/Util/Alphabetical.hs +++ b/codebase2/core/Unison/Util/Alphabetical.hs @@ -14,7 +14,7 @@ import Data.Text (Text) -- This need not coincide with the `Ord` instance for a type, which -- is often an efficient yet arbitrary ordering that's used for -- stashing the values in maps and sets. -class Eq n => Alphabetical n where +class (Eq n) => Alphabetical n where compareAlphabetical :: n -> n -> Ordering instance Alphabetical Text where @@ -26,11 +26,11 @@ newtype OrderAlphabetically a = OrderAlphabetically a deriving (Functor, Travers instance (Eq a, Alphabetical a) => Ord (OrderAlphabetically a) where compare (OrderAlphabetically a) (OrderAlphabetically b) = compareAlphabetical a b -instance Alphabetical a => Alphabetical [a] where +instance (Alphabetical a) => Alphabetical [a] where compareAlphabetical a1s a2s = compare (OrderAlphabetically <$> a1s) (OrderAlphabetically <$> a2s) -instance Alphabetical a => Alphabetical (List.NonEmpty a) where +instance (Alphabetical a) => Alphabetical (List.NonEmpty a) where compareAlphabetical a1s a2s = compare (OrderAlphabetically <$> a1s) (OrderAlphabetically <$> a2s) -instance Alphabetical a => Alphabetical (Maybe a) where +instance (Alphabetical a) => Alphabetical (Maybe a) where compareAlphabetical a1s a2s = compare (OrderAlphabetically <$> a1s) (OrderAlphabetically <$> a2s) diff --git a/codebase2/util-serialization/U/Util/Serialization.hs b/codebase2/util-serialization/U/Util/Serialization.hs index 773f4886f..3e249770a 100644 --- a/codebase2/util-serialization/U/Util/Serialization.hs +++ b/codebase2/util-serialization/U/Util/Serialization.hs @@ -40,9 +40,9 @@ import UnliftIO (MonadIO, liftIO) import UnliftIO.Directory (createDirectoryIfMissing, doesFileExist) import Prelude hiding (readFile, writeFile) -type Get a = forall m. MonadGet m => m a +type Get a = forall m. (MonadGet m) => m a -type Put a = forall m. MonadPut m => a -> m () +type Put a = forall m. (MonadPut m) => a -> m () -- todo: do we use this? data Format a = Format @@ -57,12 +57,12 @@ getFromBytes :: Get a -> ByteString -> Maybe a getFromBytes getA bytes = case runGetS getA bytes of Left _ -> Nothing; Right a -> Just a -getFromFile :: MonadIO m => Get a -> FilePath -> m (Maybe a) +getFromFile :: (MonadIO m) => Get a -> FilePath -> m (Maybe a) getFromFile getA file = do b <- doesFileExist file if b then getFromBytes getA <$> liftIO (readFile file) else pure Nothing -getFromFile' :: MonadIO m => Get a -> FilePath -> m (Either String a) +getFromFile' :: (MonadIO m) => Get a -> FilePath -> m (Either String a) getFromFile' getA file = do b <- doesFileExist file if b @@ -72,7 +72,7 @@ getFromFile' getA file = do putBytes :: Put a -> a -> ByteString putBytes put a = runPutS (put a) -putWithParentDirs :: MonadIO m => Put a -> FilePath -> a -> m () +putWithParentDirs :: (MonadIO m) => Put a -> FilePath -> a -> m () putWithParentDirs putA file a = do createDirectoryIfMissing True (takeDirectory file) liftIO . writeFile file $ putBytes putA a @@ -97,28 +97,28 @@ getVarInt = getWord8 >>= getVarInt {-# INLINE getVarInt #-} {-# INLINE getVarInt #-} -putText :: MonadPut m => Text -> m () +putText :: (MonadPut m) => Text -> m () putText text = do let bs = encodeUtf8 text putVarInt $ BS.length bs putByteString bs -getText :: MonadGet m => m Text +getText :: (MonadGet m) => m Text getText = do len <- getVarInt bs <- BS.copy <$> getBytes len pure $ decodeUtf8 bs -skipText :: MonadGet m => m () +skipText :: (MonadGet m) => m () skipText = skip =<< getVarInt -putShortText :: MonadPut m => ShortText -> m () +putShortText :: (MonadPut m) => ShortText -> m () putShortText text = do let sbs = TS.toShortByteString text putVarInt $ BSS.length sbs putShortByteString sbs -getShortText :: MonadGet m => m ShortText +getShortText :: (MonadGet m) => m ShortText getShortText = do len <- getVarInt sbs <- getShortByteString len @@ -126,12 +126,12 @@ getShortText = do -- | the `binary` package has a native version of this, -- which may be more efficient by a constant factor -putShortByteString :: MonadPut m => ShortByteString -> m () +putShortByteString :: (MonadPut m) => ShortByteString -> m () putShortByteString = putByteString . BSS.fromShort -- | the `binary` package has a native version of this, -- which may be more efficient by a constant factor -getShortByteString :: MonadGet m => Int -> m ShortByteString +getShortByteString :: (MonadGet m) => Int -> m ShortByteString getShortByteString len = BSS.toShort <$> getByteString len putFoldable :: @@ -140,17 +140,17 @@ putFoldable putA as = do putVarInt (length as) traverse_ putA as -getList :: MonadGet m => m a -> m [a] +getList :: (MonadGet m) => m a -> m [a] getList getA = do length <- getVarInt replicateM length getA -getVector :: MonadGet m => m a -> m (Vector a) +getVector :: (MonadGet m) => m a -> m (Vector a) getVector getA = do length <- getVarInt Vector.replicateM length getA -getSequence :: MonadGet m => m a -> m (Seq a) +getSequence :: (MonadGet m) => m a -> m (Seq a) getSequence getA = do length <- getVarInt Seq.replicateM length getA @@ -161,7 +161,7 @@ getSet getA = do -- avoid materializing intermediate list foldM (\s ma -> Set.insert <$> ma <*> pure s) mempty (replicate length getA) -putMap :: MonadPut m => (a -> m ()) -> (b -> m ()) -> Map a b -> m () +putMap :: (MonadPut m) => (a -> m ()) -> (b -> m ()) -> Map a b -> m () putMap putA putB m = putFoldable (putPair putA putB) (Map.toList m) addToExistingMap :: (MonadGet m, Ord a) => m a -> m b -> Map a b -> m (Map a b) @@ -176,22 +176,22 @@ addToExistingMap getA getB map = do getMap :: (MonadGet m, Ord a) => m a -> m b -> m (Map a b) getMap getA getB = addToExistingMap getA getB mempty -getFramedByteString :: MonadGet m => m ByteString +getFramedByteString :: (MonadGet m) => m ByteString getFramedByteString = getVarInt >>= getByteString -getRemainingByteString :: MonadGet m => m ByteString +getRemainingByteString :: (MonadGet m) => m ByteString getRemainingByteString = fromIntegral <$> remaining >>= getByteString -getFramed :: MonadGet m => Get a -> m a +getFramed :: (MonadGet m) => Get a -> m a getFramed get = getFramedByteString >>= either fail pure . runGetS get -putFramedByteString :: MonadPut m => ByteString -> m () +putFramedByteString :: (MonadPut m) => ByteString -> m () putFramedByteString bs = do putVarInt (BS.length bs) putByteString bs -putFramed :: MonadPut m => Put a -> a -> m () +putFramed :: (MonadPut m) => Put a -> a -> m () putFramed put a = do -- 1. figure out the length `len` of serialized `a` -- 2. Put the length `len` @@ -201,7 +201,7 @@ putFramed put a = do putVarInt (BS.length bs) putByteString bs -skipFramed :: MonadGet m => m () +skipFramed :: (MonadGet m) => m () skipFramed = do len <- getVarInt skip len @@ -214,7 +214,7 @@ putFramedArray put (toList -> as) = do putFoldable putVarInt offsets traverse_ putByteString bss -getFramedArray :: MonadGet m => m a -> m (Vector a) +getFramedArray :: (MonadGet m) => m a -> m (Vector a) getFramedArray getA = do offsets :: [Int] <- getList getVarInt let count = length offsets - 1 @@ -223,7 +223,7 @@ getFramedArray getA = do -- | Look up a 0-based index in a framed array, O(num array elements), -- because it reads the start indices for all elements first. -- This could be skipped if the indices had a fixed size instead of varint -lookupFramedArray :: MonadGet m => m a -> Int -> m (Maybe a) +lookupFramedArray :: (MonadGet m) => m a -> Int -> m (Maybe a) lookupFramedArray getA index = do offsets <- getVector getVarInt if index > Vector.length offsets - 1 @@ -232,20 +232,20 @@ lookupFramedArray getA index = do skip (Vector.unsafeIndex offsets index) Just <$> getA -lengthFramedArray :: MonadGet m => m Word64 +lengthFramedArray :: (MonadGet m) => m Word64 lengthFramedArray = (\offsetsLen -> offsetsLen - 1) <$> getVarInt -unsafeFramedArrayLookup :: MonadGet m => m a -> Int -> m a +unsafeFramedArrayLookup :: (MonadGet m) => m a -> Int -> m a unsafeFramedArrayLookup getA index = do offsets <- getVector getVarInt skip (Vector.unsafeIndex offsets index) getA -putPair :: MonadPut m => (a -> m ()) -> (b -> m ()) -> (a, b) -> m () +putPair :: (MonadPut m) => (a -> m ()) -> (b -> m ()) -> (a, b) -> m () putPair putA putB (a, b) = putA a *> putB b -getPair :: MonadGet m => m a -> m b -> m (a, b) +getPair :: (MonadGet m) => m a -> m b -> m (a, b) getPair = liftA2 (,) -getTuple3 :: MonadGet m => m a -> m b -> m c -> m (a, b, c) +getTuple3 :: (MonadGet m) => m a -> m b -> m c -> m (a, b, c) getTuple3 = liftA3 (,,) diff --git a/codebase2/util-term/U/Util/Term.hs b/codebase2/util-term/U/Util/Term.hs index d012ffd6c..f86f598e8 100644 --- a/codebase2/util-term/U/Util/Term.hs +++ b/codebase2/util-term/U/Util/Term.hs @@ -11,14 +11,14 @@ import U.Codebase.Term (F' (..), MatchCase (..), Pattern (..)) import qualified U.Codebase.Term as Term import qualified U.Core.ABT as ABT -text :: Ord v => ABT.Term (Term.F' text termRef typeRef termLink typeLink vt) v a -> [text] +text :: (Ord v) => ABT.Term (Term.F' text termRef typeRef termLink typeLink vt) v a -> [text] text = execWriter . ABT.visit_ \case Text t -> tell [t] _ -> pure () dependencies :: - Ord v => + (Ord v) => ABT.Term (Term.F' text termRef typeRef termLink typeLink vt) v a -> ([termRef], [typeRef], [termLink], [typeLink]) dependencies = diff --git a/codebase2/util-term/U/Util/Type.hs b/codebase2/util-term/U/Util/Type.hs index d6e52d0e0..7acf6a4c1 100644 --- a/codebase2/util-term/U/Util/Type.hs +++ b/codebase2/util-term/U/Util/Type.hs @@ -13,13 +13,13 @@ import qualified U.Core.ABT.Var as ABT -- * Constructors -effect :: Ord v => [TypeR r v] -> TypeR r v -> TypeR r v +effect :: (Ord v) => [TypeR r v] -> TypeR r v -> TypeR r v effect es (Effect1' fs t) = let es' = (es >>= flattenEffects) ++ flattenEffects fs in ABT.tm () (Effect (ABT.tm () (Effects es')) t) effect es t = ABT.tm () (Effect (ABT.tm () (Effects es)) t) -effects :: Ord v => [TypeR r v] -> TypeR r v +effects :: (Ord v) => [TypeR r v] -> TypeR r v effects es = ABT.tm () (Effects $ es >>= flattenEffects) -- * Modification @@ -28,7 +28,7 @@ effects es = ABT.tm () (Effects $ es >>= flattenEffects) -- Used for type-based search, we apply this transformation to both the -- indexed type and the query type, so the user can supply `a -> b` that will -- match `a ->{e} b` (but not `a ->{IO} b`). -removeAllEffectVars :: ABT.Var v => TypeR r v -> TypeR r v +removeAllEffectVars :: (ABT.Var v) => TypeR r v -> TypeR r v removeAllEffectVars t = let allEffectVars = foldMap go (ABT.subterms t) go (Effects' vs) = Set.fromList [v | Var' v <- vs] @@ -38,7 +38,7 @@ removeAllEffectVars t = in generalize vs (removeEffectVars allEffectVars tu) -- Remove free effect variables from the type that are in the set -removeEffectVars :: ABT.Var v => Set v -> TypeR r v -> TypeR r v +removeEffectVars :: (ABT.Var v) => Set v -> TypeR r v -> TypeR r v removeEffectVars removals t = let z = effects [] t' = ABT.substsInheritAnnotation ((,z) <$> Set.toList removals) t @@ -58,7 +58,7 @@ flattenEffects (Effects' es) = es >>= flattenEffects flattenEffects es = [es] -- | Bind the given variables with an outer `forall`, if they are used in `t`. -generalize :: Ord v => [v] -> TypeR r v -> TypeR r v +generalize :: (Ord v) => [v] -> TypeR r v -> TypeR r v generalize vs t = foldr f t vs where f v t = if Set.member v (ABT.freeVars t) then forall v t else t @@ -80,7 +80,7 @@ pattern Effect1' e t <- ABT.Tm' (Effect e t) pattern Ref' :: r -> TypeR r v pattern Ref' r <- ABT.Tm' (Ref r) -forall :: Ord v => v -> TypeR r v -> TypeR r v +forall :: (Ord v) => v -> TypeR r v -> TypeR r v forall v body = ABT.tm () (Forall (ABT.abs () v body)) unforall' :: TypeR r v -> ([v], TypeR r v) diff --git a/development.markdown b/development.markdown index f54066a3a..64dc24c32 100644 --- a/development.markdown +++ b/development.markdown @@ -16,6 +16,31 @@ To get cracking with Unison: On startup, Unison prints a url for the codebase UI. If you did step 3 above, then visiting that URL in a browser will give you a nice interface to your codebase. +## Add a pre-commit hook for autoformatting with Ormolu + +We use 0.5.3.0 of Ormolu and CI will fail if your code isn't properly formatted. You can add the following to `.git/hooks/pre-commit` to make sure all your commits get formatted (this assumes you've got [`rg`](https://github.com/BurntSushi/ripgrep) installed and on your path): + +``` +#!/bin/bash + +set -e + +if [[ -z "${SKIP_FORMATTING}" ]]; then + git diff --cached --name-only | rg '.hs$' | xargs -n1 ormolu --ghc-opt '-XBangPatterns' --ghc-opt '-XCPP' --ghc-opt '-XPatternSynonyms' -i + git add $(git diff --cached --name-only) +fi +``` + +Note that you can always wrap a comment around some code you don't want Ormolu to touch, using: + +``` +{- ORMOLU_DISABLE -} +dontFormatMe = do blah + blah + blah +{- ORMOLU_ENABLE -} +``` + ## Running Tests * `stack test --fast` builds and runs most test suites, see below for exceptions to this (e.g. transcript tests). diff --git a/lib/unison-prelude/src/U/Util/Text.hs b/lib/unison-prelude/src/U/Util/Text.hs index 69664c836..c16e33b72 100644 --- a/lib/unison-prelude/src/U/Util/Text.hs +++ b/lib/unison-prelude/src/U/Util/Text.hs @@ -21,7 +21,8 @@ import Safe.Foldable (minimumMay) stripMargin :: Text -> Text stripMargin str = let stripLen = - Data.Maybe.fromMaybe 0 . minimumMay + Data.Maybe.fromMaybe 0 + . minimumMay . map (Text.length . fst . Text.span (== ' ')) . filter (not . Text.all (Char.isSpace)) $ Text.lines str diff --git a/lib/unison-prelude/src/Unison/Debug.hs b/lib/unison-prelude/src/Unison/Debug.hs index 94efac5bd..defaff3b0 100644 --- a/lib/unison-prelude/src/Unison/Debug.hs +++ b/lib/unison-prelude/src/Unison/Debug.hs @@ -114,7 +114,7 @@ debugAnnotations = Annotations `Set.member` debugFlags -- Or, use in pattern matching to view arguments. -- E.g. -- myFunc (debug Git "argA" -> argA) = ... -debug :: Show a => DebugFlag -> String -> a -> a +debug :: (Show a) => DebugFlag -> String -> a -> a debug flag msg a = if shouldDebug flag then pTraceShowId (pTrace (msg <> ":\n") a) @@ -142,7 +142,7 @@ debugLogM flag msg = whenDebug flag $ pTraceM msg -- | A 'when' block which is triggered if the given flag is being debugged. -whenDebug :: Monad m => DebugFlag -> m () -> m () +whenDebug :: (Monad m) => DebugFlag -> m () -> m () whenDebug flag action = do when (shouldDebug flag) action diff --git a/lib/unison-prelude/src/Unison/Prelude.hs b/lib/unison-prelude/src/Unison/Prelude.hs index 6ed914f63..b7f3bb779 100644 --- a/lib/unison-prelude/src/Unison/Prelude.hs +++ b/lib/unison-prelude/src/Unison/Prelude.hs @@ -89,43 +89,43 @@ altMap f = altSum . fmap f . toList -- @@ -- onNothing (throwIO MissingPerson) $ mayThing -- @@ -onNothing :: Applicative m => m a -> Maybe a -> m a +onNothing :: (Applicative m) => m a -> Maybe a -> m a onNothing m may = maybe m pure may -onNothingM :: Monad m => m a -> m (Maybe a) -> m a +onNothingM :: (Monad m) => m a -> m (Maybe a) -> m a onNothingM = flip whenNothingM -- | E.g. @maybePerson `whenNothing` throwIO MissingPerson@ -whenNothing :: Applicative m => Maybe a -> m a -> m a +whenNothing :: (Applicative m) => Maybe a -> m a -> m a whenNothing may m = maybe m pure may -whenNothingM :: Monad m => m (Maybe a) -> m a -> m a +whenNothingM :: (Monad m) => m (Maybe a) -> m a -> m a whenNothingM mx my = mx >>= maybe my pure -whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m () +whenJust :: (Applicative m) => Maybe a -> (a -> m ()) -> m () whenJust mx f = maybe (pure ()) f mx -whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () +whenJustM :: (Monad m) => m (Maybe a) -> (a -> m ()) -> m () whenJustM mx f = do mx >>= maybe (pure ()) f -onLeft :: Applicative m => (a -> m b) -> Either a b -> m b +onLeft :: (Applicative m) => (a -> m b) -> Either a b -> m b onLeft = flip whenLeft -onLeftM :: Monad m => (a -> m b) -> m (Either a b) -> m b +onLeftM :: (Monad m) => (a -> m b) -> m (Either a b) -> m b onLeftM = flip whenLeftM -whenLeft :: Applicative m => Either a b -> (a -> m b) -> m b +whenLeft :: (Applicative m) => Either a b -> (a -> m b) -> m b whenLeft = \case Left a -> \f -> f a Right b -> \_ -> pure b -whenLeftM :: Monad m => m (Either a b) -> (a -> m b) -> m b +whenLeftM :: (Monad m) => m (Either a b) -> (a -> m b) -> m b whenLeftM m f = m >>= \case Left x -> f x @@ -146,7 +146,7 @@ throwEitherM = throwEitherMWith id throwEitherMWith :: forall e e' m a. (MonadIO m, Exception e') => (e -> e') -> m (Either e a) -> m a throwEitherMWith f action = throwExceptT . withExceptT f $ (ExceptT action) -tShow :: Show a => a -> Text +tShow :: (Show a) => a -> Text tShow = Text.pack . show -- | Strictly read an entire file decoding UTF8. @@ -206,5 +206,5 @@ reportBug bugId msg = ] {-# WARNING wundefined "You left this wundefined." #-} -wundefined :: HasCallStack => a +wundefined :: (HasCallStack) => a wundefined = undefined diff --git a/lib/unison-prelude/src/Unison/Util/Alternative.hs b/lib/unison-prelude/src/Unison/Util/Alternative.hs index b97f3df9a..785ffb497 100644 --- a/lib/unison-prelude/src/Unison/Util/Alternative.hs +++ b/lib/unison-prelude/src/Unison/Util/Alternative.hs @@ -1,6 +1,7 @@ module Unison.Util.Alternative - ( whenM - ) where + ( whenM, + ) +where import Control.Applicative (Alternative (empty)) @@ -8,4 +9,3 @@ whenM :: (Monad m, Alternative m) => m Bool -> a -> m a whenM m a = do b <- m if b then pure a else empty - diff --git a/lib/unison-prelude/src/Unison/Util/Map.hs b/lib/unison-prelude/src/Unison/Util/Map.hs index be3af46cb..d682a3fe1 100644 --- a/lib/unison-prelude/src/Unison/Util/Map.hs +++ b/lib/unison-prelude/src/Unison/Util/Map.hs @@ -25,7 +25,7 @@ import Data.Vector (Vector) import qualified Data.Vector as Vector import Unison.Prelude -bimap :: Ord a' => (a -> a') -> (b -> b') -> Map a b -> Map a' b' +bimap :: (Ord a') => (a -> a') -> (b -> b') -> Map a b -> Map a' b' bimap fa fb = Map.fromList . map (B.bimap fa fb) . Map.toList bitraverse :: (Applicative f, Ord a') => (a -> f a') -> (b -> f b') -> Map a b -> f (Map a' b') @@ -36,12 +36,12 @@ bitraversed keyT valT f m = bitraverse (keyT f) (valT f) m -- | 'swap' throws away data if the input contains duplicate values -swap :: Ord b => Map a b -> Map b a +swap :: (Ord b) => Map a b -> Map b a swap = Map.foldlWithKey' (\z a b -> Map.insert b a z) mempty -- | Upsert an element into a map. -upsert :: Ord k => (Maybe v -> v) -> k -> Map k v -> Map k v +upsert :: (Ord k) => (Maybe v -> v) -> k -> Map k v -> Map k v upsert f = Map.alter (Just . f) @@ -50,7 +50,7 @@ valuesVector = Vector.fromList . Map.elems -- | Like 'Map.delete', but returns the value as well. -deleteLookup :: Ord k => k -> Map k v -> (Maybe v, Map k v) +deleteLookup :: (Ord k) => k -> Map k v -> (Maybe v, Map k v) deleteLookup = Map.alterF (,Nothing) @@ -85,7 +85,7 @@ unionWithM f m1 m2 = -- @ -- remap f = Map.fromList . map f . Map.toList -- @ -remap :: Ord k1 => ((k0, v0) -> (k1, v1)) -> Map k0 v0 -> Map k1 v1 +remap :: (Ord k1) => ((k0, v0) -> (k1, v1)) -> Map k0 v0 -> Map k1 v1 remap f = Map.fromList . map f . Map.toList diff --git a/lib/unison-prelude/src/Unison/Util/Monoid.hs b/lib/unison-prelude/src/Unison/Util/Monoid.hs index 82cf96264..239d91159 100644 --- a/lib/unison-prelude/src/Unison/Util/Monoid.hs +++ b/lib/unison-prelude/src/Unison/Util/Monoid.hs @@ -22,11 +22,11 @@ intercalateMap separator renderer elements = intercalateMapM :: (Traversable t, Monad m, Monoid a) => a -> (b -> m a) -> t b -> m a intercalateMapM separator renderer = traverse renderer >=> return . intercalateMap separator id -fromMaybe :: Monoid a => Maybe a -> a +fromMaybe :: (Monoid a) => Maybe a -> a fromMaybe Nothing = mempty fromMaybe (Just a) = a -whenM, unlessM :: Monoid a => Bool -> a -> a +whenM, unlessM :: (Monoid a) => Bool -> a -> a whenM True a = a whenM False _ = mempty unlessM = whenM . not diff --git a/lib/unison-prelude/src/Unison/Util/Set.hs b/lib/unison-prelude/src/Unison/Util/Set.hs index fe7392f0e..9d18673a8 100644 --- a/lib/unison-prelude/src/Unison/Util/Set.hs +++ b/lib/unison-prelude/src/Unison/Util/Set.hs @@ -21,22 +21,22 @@ asSingleton xs = if Set.size xs == 1 then Just (Set.findMin xs) else Nothing -- | Set difference, but return @Nothing@ if the difference is empty. -difference1 :: Ord a => Set a -> Set a -> Maybe (Set a) +difference1 :: (Ord a) => Set a -> Set a -> Maybe (Set a) difference1 xs ys = if null zs then Nothing else Just zs where zs = Set.difference xs ys -symmetricDifference :: Ord a => Set a -> Set a -> Set a +symmetricDifference :: (Ord a) => Set a -> Set a -> Set a symmetricDifference a b = (a `Set.difference` b) `Set.union` (b `Set.difference` a) -mapMaybe :: Ord b => (a -> Maybe b) -> Set a -> Set b +mapMaybe :: (Ord b) => (a -> Maybe b) -> Set a -> Set b mapMaybe f = Set.fromList . Maybe.mapMaybe f . Set.toList traverse :: (Applicative f, Ord b) => (a -> f b) -> Set a -> f (Set b) traverse f = fmap Set.fromList . Prelude.traverse f . Set.toList -flatMap :: Ord b => (a -> Set b) -> Set a -> Set b +flatMap :: (Ord b) => (a -> Set b) -> Set a -> Set b flatMap f = Set.unions . fmap f . Set.toList filterM :: (Ord a, Monad m) => (a -> m Bool) -> Set a -> m (Set a) diff --git a/lib/unison-prelude/src/Unison/Util/Timing.hs b/lib/unison-prelude/src/Unison/Util/Timing.hs index a3702ee67..16ffed52c 100644 --- a/lib/unison-prelude/src/Unison/Util/Timing.hs +++ b/lib/unison-prelude/src/Unison/Util/Timing.hs @@ -12,7 +12,7 @@ import System.IO.Unsafe (unsafePerformIO) import qualified Unison.Debug as Debug import UnliftIO (MonadIO, liftIO) -time :: MonadIO m => String -> m a -> m a +time :: (MonadIO m) => String -> m a -> m a time label ma = if Debug.shouldDebug Debug.Timing then do @@ -29,7 +29,7 @@ time label ma = else ma -- Mitchell says: this function doesn't look like it would work at all; let's just delete it -unsafeTime :: Monad m => String -> m a -> m a +unsafeTime :: (Monad m) => String -> m a -> m a unsafeTime label ma = if Debug.shouldDebug Debug.Timing then do diff --git a/lib/unison-pretty-printer/src/Unison/Util/AnnotatedText.hs b/lib/unison-pretty-printer/src/Unison/Util/AnnotatedText.hs index 49bcb16cb..cfd343b5b 100644 --- a/lib/unison-pretty-printer/src/Unison/Util/AnnotatedText.hs +++ b/lib/unison-pretty-printer/src/Unison/Util/AnnotatedText.hs @@ -182,10 +182,10 @@ snipWithContext margin source = text', text2' :: [String] (text', text2') = splitAt takeLineCount (drop dropLineCount (lines (text source))) - in AnnotatedExcerpt startLine' (unlines text') group' : - snipWithContext - margin - (AnnotatedExcerpt (endLine' + 1) (unlines text2') rest') + in AnnotatedExcerpt startLine' (unlines text') group' + : snipWithContext + margin + (AnnotatedExcerpt (endLine' + 1) (unlines text2') rest') where withinMargin :: Range -> Range -> Bool withinMargin (Range _start1 (Pos end1 _)) (Range (Pos start2 _) _end2) = diff --git a/lib/unison-pretty-printer/src/Unison/Util/Pretty.hs b/lib/unison-pretty-printer/src/Unison/Util/Pretty.hs index b7dde7ad4..ac252c7e3 100644 --- a/lib/unison-pretty-printer/src/Unison/Util/Pretty.hs +++ b/lib/unison-pretty-printer/src/Unison/Util/Pretty.hs @@ -187,7 +187,7 @@ data F s r | Append (Seq r) deriving (Eq, Show, Foldable, Traversable, Functor) -isEmpty :: Eq s => IsString s => Pretty s -> Bool +isEmpty :: (Eq s) => (IsString s) => Pretty s -> Bool isEmpty s = out s == Empty || out s == Lit "" mapLit :: (s -> t) -> F s r -> F t r @@ -211,7 +211,7 @@ orElses :: [Pretty s] -> Pretty s orElses [] = mempty orElses ps = foldr1 orElse ps -wrapImpl :: IsString s => [Pretty s] -> Pretty s +wrapImpl :: (IsString s) => [Pretty s] -> Pretty s wrapImpl [] = mempty wrapImpl (p : ps) = wrap_ . Seq.fromList $ @@ -241,7 +241,7 @@ wrapString s = wrap (lit $ fromString s) paragraphyText :: (LL.ListLike s Char, IsString s) => Text -> Pretty s paragraphyText = sep "\n" . fmap (wrapPreserveSpaces . text) . Text.splitOn "\n" -wrap' :: IsString s => (s -> [Pretty s]) -> Pretty s -> Pretty s +wrap' :: (IsString s) => (s -> [Pretty s]) -> Pretty s -> Pretty s wrap' wordify p = wrapImpl (toLeaves [p]) where toLeaves [] = [] @@ -383,22 +383,22 @@ render availableWidth p = go mempty [Right p] SingleLine c -> SingleLine (min c (availableWidth - 1)) MultiLine fc lc mc -> MultiLine fc lc (min mc (availableWidth - 1)) -newline :: IsString s => Pretty s +newline :: (IsString s) => Pretty s newline = "\n" -lineSkip :: IsString s => Pretty s +lineSkip :: (IsString s) => Pretty s lineSkip = newline <> newline -spaceIfNeeded :: Eq s => IsString s => Pretty s -> Pretty s -> Pretty s +spaceIfNeeded :: (Eq s) => (IsString s) => Pretty s -> Pretty s -> Pretty s spaceIfNeeded a b = if isEmpty a then b else a <> " " <> b -spaceIfBreak :: IsString s => Pretty s +spaceIfBreak :: (IsString s) => Pretty s spaceIfBreak = "" `orElse` " " -spacesIfBreak :: IsString s => Int -> Pretty s +spacesIfBreak :: (IsString s) => Int -> Pretty s spacesIfBreak n = "" `orElse` fromString (replicate n ' ') -softbreak :: IsString s => Pretty s +softbreak :: (IsString s) => Pretty s softbreak = " " `orElse` newline spaced :: (Foldable f, IsString s) => f (Pretty s) -> Pretty s @@ -460,12 +460,12 @@ sepNonEmpty :: (Foldable f, IsString s) => Pretty s -> f (Pretty s) -> Pretty s sepNonEmpty between ps = sep between (nonEmpty ps) -- if list is too long, adds `... 22 more` to the end -excerptSep :: IsString s => Maybe Int -> Pretty s -> [Pretty s] -> Pretty s +excerptSep :: (IsString s) => Maybe Int -> Pretty s -> [Pretty s] -> Pretty s excerptSep maxCount = excerptSep' maxCount (\i -> group ("... " <> shown i <> " more")) excerptSep' :: - IsString s => + (IsString s) => Maybe Int -> (Int -> Pretty s) -> Pretty s -> @@ -474,7 +474,7 @@ excerptSep' :: excerptSep' maxCount summarize s ps = case maxCount of Just max | length ps > max -> - sep s (take max ps) <> summarize (length ps - max) + sep s (take max ps) <> summarize (length ps - max) _ -> sep s ps nonEmpty :: (Foldable f, IsString s) => f (Pretty s) -> [Pretty s] @@ -483,10 +483,10 @@ nonEmpty (toList -> l) = case l of h : t -> h : nonEmpty t [] -> [] -parenthesize :: IsString s => Pretty s -> Pretty s +parenthesize :: (IsString s) => Pretty s -> Pretty s parenthesize p = group $ "(" <> p <> ")" -parenthesizeIf :: IsString s => Bool -> Pretty s -> Pretty s +parenthesizeIf :: (IsString s) => Bool -> Pretty s -> Pretty s parenthesizeIf False s = s parenthesizeIf True s = parenthesize s @@ -564,10 +564,10 @@ numberedColumnNHeader headers rows = in columnNHeader ("" : headers) (zipWith (:) numbers rows) -- Opinionated `numbered` that uses bold numbers in front -numberedList :: Foldable f => f (Pretty ColorText) -> Pretty ColorText +numberedList :: (Foldable f) => f (Pretty ColorText) -> Pretty ColorText numberedList = numbered (\i -> hiBlack . fromString $ show i <> ".") -leftPad, rightPad :: IsString s => Width -> Pretty s -> Pretty s +leftPad, rightPad :: (IsString s) => Width -> Pretty s -> Pretty s leftPad n p = let rem = n - preferredWidth p in if rem > 0 then fromString (replicate (widthToInt rem) ' ') <> p else p @@ -584,7 +584,7 @@ excerptColumn2Headed :: excerptColumn2Headed max hd cols = case max of Just max | len > max -> - lines [column2 (hd : take max cols), "... " <> shown (len - max) <> " more"] + lines [column2 (hd : take max cols), "... " <> shown (len - max) <> " more"] _ -> column2 (hd : cols) where len = length cols @@ -771,13 +771,13 @@ align' rows = alignedRows | (col0, col1) <- rows ] -text :: IsString s => Text -> Pretty s +text :: (IsString s) => Text -> Pretty s text t = fromString (Text.unpack t) num :: (Show n, Num n, IsString s) => n -> Pretty s num n = fromString (show n) -string :: IsString s => String -> Pretty s +string :: (IsString s) => String -> Pretty s string = fromString shown :: (Show a, IsString s) => a -> Pretty s @@ -912,7 +912,7 @@ indentAfterNewline by = flatMap f -- or other extra info attached to the original `s` lit (LL.take (LL.length hd) s0) <> "\n" <> by <> f (LL.drop 1 s) -instance IsString s => IsString (Pretty s) where +instance (IsString s) => IsString (Pretty s) where fromString s = lit' (foldMap chDelta s) (fromString s) instance Semigroup (Pretty s) where @@ -1022,7 +1022,7 @@ background f p = _ -> p plural :: - Foldable f => + (Foldable f) => f a -> Pretty ColorText -> Pretty ColorText @@ -1068,7 +1068,7 @@ type BoxStyle s = (Pretty s, Pretty s) -- singleton ) -lBoxStyle1, lBoxStyle2, rBoxStyle2 :: IsString s => BoxStyle s +lBoxStyle1, lBoxStyle2, rBoxStyle2 :: (IsString s) => BoxStyle s lBoxStyle1 = ( ("┌ ", "│ "), -- first ("├ ", "│ "), -- middle @@ -1143,23 +1143,23 @@ fatalCallout = callout "❗️" okCallout = callout "✅" blockedCallout = callout "🚫" -backticked :: IsString s => Pretty s -> Pretty s +backticked :: (IsString s) => Pretty s -> Pretty s backticked p = group ("`" <> p <> "`") -- | Attach some punctuation after the closing backtick. -backticked' :: IsString s => Pretty s -> Pretty s -> Pretty s +backticked' :: (IsString s) => Pretty s -> Pretty s -> Pretty s backticked' p end = group ("`" <> p <> "`" <> end) -singleQuoted :: IsString s => Pretty s -> Pretty s +singleQuoted :: (IsString s) => Pretty s -> Pretty s singleQuoted p = "'" <> p <> "'" -singleQuoted' :: IsString s => Pretty s -> Pretty s -> Pretty s +singleQuoted' :: (IsString s) => Pretty s -> Pretty s -> Pretty s singleQuoted' p end = "'" <> p <> "'" <> end -instance Show s => Show (Pretty s) where +instance (Show s) => Show (Pretty s) where show p = render 80 (metaPretty p) -metaPretty :: Show s => Pretty s -> Pretty String +metaPretty :: (Show s) => Pretty s -> Pretty String metaPretty = go (0 :: Int) where go prec p = case out p of @@ -1175,7 +1175,7 @@ metaPretty = go (0 :: Int) "OrElse" `hang` spaced [go 1 a, go 1 b] Append s -> surroundCommas "[" "]" (go 1 <$> s) -map :: LL.ListLike s2 Char => (s -> s2) -> Pretty s -> Pretty s2 +map :: (LL.ListLike s2 Char) => (s -> s2) -> Pretty s -> Pretty s2 map f p = case out p of Append ps -> foldMap (map f) ps Empty -> mempty diff --git a/lib/unison-pretty-printer/tests/Unison/Test/ColorText.hs b/lib/unison-pretty-printer/tests/Unison/Test/ColorText.hs index f34dd762c..42a213d86 100644 --- a/lib/unison-pretty-printer/tests/Unison/Test/ColorText.hs +++ b/lib/unison-pretty-printer/tests/Unison/Test/ColorText.hs @@ -65,7 +65,7 @@ ex4 = (Range (Pos 1 1) (Pos 1 5), Green) ] -ex :: Ord a => AnnotatedExcerpt a +ex :: (Ord a) => AnnotatedExcerpt a ex = [r|The Tempest | Act 1, Scene 1 diff --git a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs index 48712ce2b..20274da98 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs @@ -101,7 +101,7 @@ import UnliftIO.Exception -- does not automatically enforce foreign key integrity, because it elected to maintain backwards compatibility with -- code that was written before the foreign key integrity feature was implemented. withConnection :: - MonadUnliftIO m => + (MonadUnliftIO m) => -- | Connection name, for debugging. String -> -- | Path to SQLite database file. @@ -168,7 +168,7 @@ logQuery sql params result = -- Without results, with parameters -execute :: Sqlite.ToRow a => Connection -> Sql -> a -> IO () +execute :: (Sqlite.ToRow a) => Connection -> Sql -> a -> IO () execute conn@(Connection _ _ conn0) s params = do logQuery s (Just params) Nothing Sqlite.execute conn0 (coerce s) params `catch` \(exception :: Sqlite.SQLError) -> @@ -180,7 +180,7 @@ execute conn@(Connection _ _ conn0) s params = do sql = s } -executeMany :: Sqlite.ToRow a => Connection -> Sql -> [a] -> IO () +executeMany :: (Sqlite.ToRow a) => Connection -> Sql -> [a] -> IO () executeMany conn@(Connection _ _ conn0) s = \case [] -> pure () params -> do @@ -397,7 +397,7 @@ queryOneColCheck conn s params check = -- With results, without parameters, without checks -queryListRow_ :: Sqlite.FromRow a => Connection -> Sql -> IO [a] +queryListRow_ :: (Sqlite.FromRow a) => Connection -> Sql -> IO [a] queryListRow_ conn@(Connection _ _ conn0) s = do result <- Sqlite.query_ conn0 (coerce s) @@ -412,28 +412,28 @@ queryListRow_ conn@(Connection _ _ conn0) s = do logQuery s Nothing (Just result) pure result -queryListCol_ :: forall a. Sqlite.FromField a => Connection -> Sql -> IO [a] +queryListCol_ :: forall a. (Sqlite.FromField a) => Connection -> Sql -> IO [a] queryListCol_ conn s = coerce @(IO [Sqlite.Only a]) @(IO [a]) (queryListRow_ conn s) -queryMaybeRow_ :: Sqlite.FromRow a => Connection -> Sql -> IO (Maybe a) +queryMaybeRow_ :: (Sqlite.FromRow a) => Connection -> Sql -> IO (Maybe a) queryMaybeRow_ conn s = queryListRowCheck_ conn s \case [] -> Right Nothing [x] -> Right (Just x) xs -> Left (SomeSqliteExceptionReason (ExpectedAtMostOneRowException (anythingToString xs))) -queryMaybeCol_ :: forall a. Sqlite.FromField a => Connection -> Sql -> IO (Maybe a) +queryMaybeCol_ :: forall a. (Sqlite.FromField a) => Connection -> Sql -> IO (Maybe a) queryMaybeCol_ conn s = coerce @(IO (Maybe (Sqlite.Only a))) @(IO (Maybe a)) (queryMaybeRow_ conn s) -queryOneRow_ :: Sqlite.FromRow a => Connection -> Sql -> IO a +queryOneRow_ :: (Sqlite.FromRow a) => Connection -> Sql -> IO a queryOneRow_ conn s = queryListRowCheck_ conn s \case [x] -> Right x xs -> Left (SomeSqliteExceptionReason (ExpectedExactlyOneRowException (anythingToString xs))) -queryOneCol_ :: forall a. Sqlite.FromField a => Connection -> Sql -> IO a +queryOneCol_ :: forall a. (Sqlite.FromField a) => Connection -> Sql -> IO a queryOneCol_ conn s = coerce @(IO (Sqlite.Only a)) @(IO a) (queryOneRow_ conn s) @@ -443,7 +443,7 @@ queryListRowCheck_ :: (Sqlite.FromRow a, SqliteExceptionReason e) => Connection queryListRowCheck_ conn s check = gqueryListCheck_ conn s (mapLeft SomeSqliteExceptionReason . check) -gqueryListCheck_ :: Sqlite.FromRow a => Connection -> Sql -> ([a] -> Either SomeSqliteExceptionReason r) -> IO r +gqueryListCheck_ :: (Sqlite.FromRow a) => Connection -> Sql -> ([a] -> Either SomeSqliteExceptionReason r) -> IO r gqueryListCheck_ conn s check = do xs <- queryListRow_ conn s case check xs of @@ -550,7 +550,7 @@ rollback conn = execute_ conn "ROLLBACK" -- | Perform an action within a named savepoint. The action is provided a rollback action. -withSavepoint :: MonadUnliftIO m => Connection -> Text -> (m () -> m a) -> m a +withSavepoint :: (MonadUnliftIO m) => Connection -> Text -> (m () -> m a) -> m a withSavepoint conn name action = withRunInIO \runInIO -> withSavepointIO conn name \rollback -> diff --git a/lib/unison-sqlite/src/Unison/Sqlite/Exception.hs b/lib/unison-sqlite/src/Unison/Sqlite/Exception.hs index 931cb24f5..7d8a56522 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/Exception.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/Exception.hs @@ -52,7 +52,7 @@ import UnliftIO.Exception -- When actions are run on an untrusted codebase, e.g. one downloaded from a remote server, it is sufficient to catch -- just one exception type, @SomeSqliteException@. data SomeSqliteException - = forall e. Exception e => SomeSqliteException e + = forall e. (Exception e) => SomeSqliteException e deriving anyclass (Exception) instance Show SomeSqliteException where @@ -155,7 +155,7 @@ throwSqliteQueryException SqliteQueryExceptionInfo {connection, exception, param } data SomeSqliteExceptionReason - = forall e. SqliteExceptionReason e => SomeSqliteExceptionReason e + = forall e. (SqliteExceptionReason e) => SomeSqliteExceptionReason e deriving anyclass (SqliteExceptionReason) instance Show SomeSqliteExceptionReason where diff --git a/lib/unison-sqlite/src/Unison/Sqlite/JournalMode.hs b/lib/unison-sqlite/src/Unison/Sqlite/JournalMode.hs index 67537eff6..8ac4d80df 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/JournalMode.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/JournalMode.hs @@ -32,7 +32,7 @@ journalModeFromText = \case "off" -> Just JournalMode'OFF _ -> Nothing -unsafeJournalModeFromText :: HasCallStack => Text -> JournalMode +unsafeJournalModeFromText :: (HasCallStack) => Text -> JournalMode unsafeJournalModeFromText s = fromMaybe (error ("Unknown journal mode: " ++ Text.unpack s)) (journalModeFromText s) @@ -45,7 +45,7 @@ journalModeToText = \case JournalMode'WAL -> "wal" JournalMode'OFF -> "off" -trySetJournalMode :: MonadIO m => Connection -> JournalMode -> m () +trySetJournalMode :: (MonadIO m) => Connection -> JournalMode -> m () trySetJournalMode conn mode0 = liftIO do queryOneRowCheck_ conn diff --git a/lib/unison-sqlite/src/Unison/Sqlite/Transaction.hs b/lib/unison-sqlite/src/Unison/Sqlite/Transaction.hs index 0977625b3..9f4c0d20f 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/Transaction.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/Transaction.hs @@ -86,7 +86,7 @@ unsafeGetConnection :: Transaction Connection unsafeGetConnection = Transaction pure -- | Run a transaction on the given connection. -runTransaction :: MonadIO m => Connection -> Transaction a -> m a +runTransaction :: (MonadIO m) => Connection -> Transaction a -> m a runTransaction conn (Transaction f) = liftIO do uninterruptibleMask \restore -> do Connection.begin conn @@ -111,7 +111,7 @@ runTransaction conn (Transaction f) = liftIO do -- -- The transaction is never retried, so it is (more) safe to interleave arbitrary IO actions. If the transaction does -- attempt a write and gets SQLITE_BUSY, it's your fault! -runReadOnlyTransaction :: MonadUnliftIO m => Connection -> ((forall x. Transaction x -> m x) -> m a) -> m a +runReadOnlyTransaction :: (MonadUnliftIO m) => Connection -> ((forall x. Transaction x -> m x) -> m a) -> m a runReadOnlyTransaction conn f = withRunInIO \runInIO -> runReadOnlyTransaction_ conn (runInIO (f (\transaction -> liftIO (unsafeUnTransaction transaction conn)))) @@ -134,7 +134,7 @@ runReadOnlyTransaction_ conn action = do -- BEGIN/COMMIT statements. -- -- The transaction is never retried, so it is (more) safe to interleave arbitrary IO actions. -runWriteTransaction :: MonadUnliftIO m => Connection -> ((forall x. Transaction x -> m x) -> m a) -> m a +runWriteTransaction :: (MonadUnliftIO m) => Connection -> ((forall x. Transaction x -> m x) -> m a) -> m a runWriteTransaction conn f = withRunInIO \runInIO -> uninterruptibleMask \restore -> @@ -197,11 +197,11 @@ unsafeIO action = -- Without results, with parameters -execute :: Sqlite.ToRow a => Sql -> a -> Transaction () +execute :: (Sqlite.ToRow a) => Sql -> a -> Transaction () execute s params = do Transaction \conn -> Connection.execute conn s params -executeMany :: Sqlite.ToRow a => Sql -> [a] -> Transaction () +executeMany :: (Sqlite.ToRow a) => Sql -> [a] -> Transaction () executeMany s params = Transaction \conn -> Connection.executeMany conn s params @@ -324,27 +324,27 @@ queryOneColCheck s params check = -- With results, without parameters, without checks -queryListRow_ :: Sqlite.FromRow a => Sql -> Transaction [a] +queryListRow_ :: (Sqlite.FromRow a) => Sql -> Transaction [a] queryListRow_ s = Transaction \conn -> Connection.queryListRow_ conn s -queryListCol_ :: Sqlite.FromField a => Sql -> Transaction [a] +queryListCol_ :: (Sqlite.FromField a) => Sql -> Transaction [a] queryListCol_ s = Transaction \conn -> Connection.queryListCol_ conn s -queryMaybeRow_ :: Sqlite.FromRow a => Sql -> Transaction (Maybe a) +queryMaybeRow_ :: (Sqlite.FromRow a) => Sql -> Transaction (Maybe a) queryMaybeRow_ s = Transaction \conn -> Connection.queryMaybeRow_ conn s -queryMaybeCol_ :: Sqlite.FromField a => Sql -> Transaction (Maybe a) +queryMaybeCol_ :: (Sqlite.FromField a) => Sql -> Transaction (Maybe a) queryMaybeCol_ s = Transaction \conn -> Connection.queryMaybeCol_ conn s -queryOneRow_ :: Sqlite.FromRow a => Sql -> Transaction a +queryOneRow_ :: (Sqlite.FromRow a) => Sql -> Transaction a queryOneRow_ s = Transaction \conn -> Connection.queryOneRow_ conn s -queryOneCol_ :: Sqlite.FromField a => Sql -> Transaction a +queryOneCol_ :: (Sqlite.FromField a) => Sql -> Transaction a queryOneCol_ s = Transaction \conn -> Connection.queryOneCol_ conn s diff --git a/lib/unison-sqlite/src/Unison/Sqlite/Values.hs b/lib/unison-sqlite/src/Unison/Sqlite/Values.hs index e38c4df05..8b3730730 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/Values.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/Values.hs @@ -16,7 +16,7 @@ newtype Values a = Values (List.NonEmpty a) deriving stock (Show) -instance Sqlite.Simple.ToRow a => Sqlite.Simple.ToRow (Values a) where +instance (Sqlite.Simple.ToRow a) => Sqlite.Simple.ToRow (Values a) where toRow (Values values) = foldMap Sqlite.Simple.toRow values @@ -26,7 +26,7 @@ instance Sqlite.Simple.ToRow a => Sqlite.Simple.ToRow (Values a) where -- @ -- VALUES (?, ?), (?, ?), (?, ?) -- @ -valuesSql :: Sqlite.Simple.ToRow a => Values a -> Sql +valuesSql :: (Sqlite.Simple.ToRow a) => Values a -> Sql valuesSql (Values values) = Sql ("VALUES " <> Text.intercalate "," (replicate (length values) (valueSql columns))) where diff --git a/lib/unison-util-bytes/src/Unison/Util/Bytes.hs b/lib/unison-util-bytes/src/Unison/Util/Bytes.hs index a8e2d5b9a..29bdd7a00 100644 --- a/lib/unison-util-bytes/src/Unison/Util/Bytes.hs +++ b/lib/unison-util-bytes/src/Unison/Util/Bytes.hs @@ -115,10 +115,10 @@ fromByteString b = snoc empty (byteStringToChunk b) toByteString :: Bytes -> B.ByteString toByteString b = B.concat (map chunkToByteString (chunks b)) -toArray :: BA.ByteArray b => Bytes -> b +toArray :: (BA.ByteArray b) => Bytes -> b toArray b = chunkToArray $ V.concat (chunks b) -fromArray :: BA.ByteArrayAccess b => b -> Bytes +fromArray :: (BA.ByteArrayAccess b) => b -> Bytes fromArray b = snoc empty (arrayToChunk b) byteStringToChunk, chunkFromByteString :: B.ByteString -> Chunk @@ -341,7 +341,7 @@ toBase16 bs = foldl' step empty (chunks bs) BE.convertToBase BE.Base16 (chunkToArray @BA.Bytes b) ) -chunkToArray, arrayFromChunk :: BA.ByteArray b => Chunk -> b +chunkToArray, arrayFromChunk :: (BA.ByteArray b) => Chunk -> b chunkToArray bs = BA.allocAndFreeze (V.length bs) $ \ptr -> let go !ind = if ind < V.length bs @@ -350,7 +350,7 @@ chunkToArray bs = BA.allocAndFreeze (V.length bs) $ \ptr -> in go 0 arrayFromChunk = chunkToArray -arrayToChunk, chunkFromArray :: BA.ByteArrayAccess b => b -> Chunk +arrayToChunk, chunkFromArray :: (BA.ByteArrayAccess b) => b -> Chunk arrayToChunk bs = case BA.convert bs :: Block Word8 of Block bs -> V.Vector 0 n (ByteArray bs) where diff --git a/lib/unison-util-bytes/test/Main.hs b/lib/unison-util-bytes/test/Main.hs index a97686bf1..cc56c309a 100644 --- a/lib/unison-util-bytes/test/Main.hs +++ b/lib/unison-util-bytes/test/Main.hs @@ -42,8 +42,10 @@ test = scope "<>" . expect' $ Bytes.toArray (b1s <> b2s <> b3s) == b1 <> b2 <> b3 scope "Ord" . expect' $ - (b1 <> b2 <> b3) `compare` b3 - == (b1s <> b2s <> b3s) `compare` b3s + (b1 <> b2 <> b3) + `compare` b3 + == (b1s <> b2s <> b3s) + `compare` b3s scope "take" . expect' $ Bytes.toArray (Bytes.take k (b1s <> b2s)) == BS.take k (b1 <> b2) scope "drop" . expect' $ diff --git a/lib/unison-util-cache/src/Unison/Util/Cache.hs b/lib/unison-util-cache/src/Unison/Util/Cache.hs index 84f824955..9dcfd7448 100644 --- a/lib/unison-util-cache/src/Unison/Util/Cache.hs +++ b/lib/unison-util-cache/src/Unison/Util/Cache.hs @@ -1,13 +1,14 @@ -module Unison.Util.Cache - ( Cache - , cache - , nullCache - , semispaceCache - , lookup - , insert - , apply - , applyDefined - ) where +module Unison.Util.Cache + ( Cache, + cache, + nullCache, + semispaceCache, + lookup, + insert, + apply, + applyDefined, + ) +where import Control.Monad (when) import Control.Monad.IO.Class (liftIO) @@ -22,10 +23,10 @@ data Cache k v = Cache insert_ :: k -> v -> IO () } -lookup :: MonadIO m => Cache k v -> k -> m (Maybe v) +lookup :: (MonadIO m) => Cache k v -> k -> m (Maybe v) lookup c k = liftIO (lookup_ c k) -insert :: MonadIO m => Cache k v -> k -> v -> m () +insert :: (MonadIO m) => Cache k v -> k -> v -> m () insert c k v = liftIO (insert_ c k v) -- Create a cache of unbounded size. @@ -80,7 +81,7 @@ semispaceCache maxSize = do -- Cached function application: if a key `k` is not in the cache, -- calls `f` and inserts `f k` results in the cache. -apply :: MonadIO m => Cache k v -> (k -> m v) -> k -> m v +apply :: (MonadIO m) => Cache k v -> (k -> m v) -> k -> m v apply c f k = lookup c k >>= \case Just v -> pure v diff --git a/lib/unison-util-relation/src/Unison/Util/Relation.hs b/lib/unison-util-relation/src/Unison/Util/Relation.hs index dae52b0bc..f5fa40bdd 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation.hs @@ -360,19 +360,19 @@ delete x y r = r {domain = domain', range = range'} erase e s = if S.singleton e == s then Nothing else Just $ S.delete e s -- | The Set of values associated with a value in the domain. -lookupDom' :: Ord a => a -> Relation a b -> Maybe (Set b) +lookupDom' :: (Ord a) => a -> Relation a b -> Maybe (Set b) lookupDom' x r = M.lookup x (domain r) -- | The Set of values associated with a value in the range. -lookupRan' :: Ord b => b -> Relation a b -> Maybe (Set a) +lookupRan' :: (Ord b) => b -> Relation a b -> Maybe (Set a) lookupRan' y r = M.lookup y (range r) -- | True if the element @ x @ exists in the domain of @ r @. -memberDom :: Ord a => a -> Relation a b -> Bool +memberDom :: (Ord a) => a -> Relation a b -> Bool memberDom x r = isJust $ lookupDom' x r -- | True if the element exists in the range. -memberRan :: Ord b => b -> Relation a b -> Bool +memberRan :: (Ord b) => b -> Relation a b -> Bool memberRan y r = isJust $ lookupRan' y r filterDom :: (Ord a, Ord b) => (a -> Bool) -> Relation a b -> Relation a b @@ -417,10 +417,10 @@ notMember :: (Ord a, Ord b) => a -> b -> Relation a b -> Bool notMember x y r = not $ member x y r -- | True if a value appears more than one time in the relation. -manyDom :: Ord a => a -> Relation a b -> Bool +manyDom :: (Ord a) => a -> Relation a b -> Bool manyDom a = (> 1) . S.size . lookupDom a -manyRan :: Ord b => b -> Relation a b -> Bool +manyRan :: (Ord b) => b -> Relation a b -> Bool manyRan b = (> 1) . S.size . lookupRan b -- | Returns the domain in the relation, as a Set, in its entirety. @@ -441,7 +441,7 @@ ran r = M.keysSet (range r) -- The cases of 'Nothing' are purged. -- -- It is similar to 'concat'. -compactSet :: Ord a => Set (Maybe (Set a)) -> Set a +compactSet :: (Ord a) => Set (Maybe (Set a)) -> Set a compactSet = S.fold (S.union . fromMaybe S.empty) S.empty -- $selectops @@ -566,10 +566,10 @@ insertManyDom :: (Foldable f, Ord a, Ord b) => f a -> b -> Relation a b -> Relation a b insertManyDom as b r = foldl' (flip $ flip insert b) r as -lookupRan :: Ord b => b -> Relation a b -> Set a +lookupRan :: (Ord b) => b -> Relation a b -> Set a lookupRan b r = fromMaybe S.empty $ lookupRan' b r -lookupDom :: Ord a => a -> Relation a b -> Set b +lookupDom :: (Ord a) => a -> Relation a b -> Set b lookupDom a r = fromMaybe S.empty $ lookupDom' a r -- Efficiently locate the `Set b` for which the corresponding `a` tests @@ -708,7 +708,7 @@ toMultimap :: Relation a b -> Map a (Set b) toMultimap = domain -- Returns Nothing if Relation isn't one-to-one. -toMap :: Ord a => Relation a b -> Maybe (Map a b) +toMap :: (Ord a) => Relation a b -> Maybe (Map a b) toMap r = let mm = toMultimap r in if all (\s -> S.size s == 1) mm @@ -752,12 +752,12 @@ instance (Ord a, Ord b) => Semigroup (Relation a b) where (<>) = union toUnzippedMultimap :: - Ord a => Ord b => Ord c => Relation a (b, c) -> Map a (Set b, Set c) + (Ord a) => (Ord b) => (Ord c) => Relation a (b, c) -> Map a (Set b, Set c) toUnzippedMultimap r = (\s -> (S.map fst s, S.map snd s)) <$> toMultimap r collectRan :: - Ord a => - Ord c => + (Ord a) => + (Ord c) => (b -> Maybe c) -> Relation a b -> Relation a c diff --git a/lib/unison-util-relation/src/Unison/Util/Relation3.hs b/lib/unison-util-relation/src/Unison/Util/Relation3.hs index 0e598ec03..358bbdc02 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation3.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation3.hs @@ -94,7 +94,7 @@ mapD2Monotonic f Relation3 {d1, d2, d3} = member :: (Ord a, Ord b, Ord c) => a -> b -> c -> Relation3 a b c -> Bool member a b c = R.member b c . lookupD1 a -memberD2 :: Ord b => b -> Relation3 a b c -> Bool +memberD2 :: (Ord b) => b -> Relation3 a b c -> Bool memberD2 b = Map.member b . d2 @@ -154,10 +154,10 @@ insert a b c Relation3 {..} = insertAll, deleteAll :: - Foldable f => - Ord a => - Ord b => - Ord c => + (Foldable f) => + (Ord a) => + (Ord b) => + (Ord c) => f (a, b, c) -> Relation3 a b c -> Relation3 a b c diff --git a/lib/unison-util-relation/src/Unison/Util/Relation4.hs b/lib/unison-util-relation/src/Unison/Util/Relation4.hs index 3ea236280..10eebf81e 100644 --- a/lib/unison-util-relation/src/Unison/Util/Relation4.hs +++ b/lib/unison-util-relation/src/Unison/Util/Relation4.hs @@ -105,7 +105,7 @@ lookupD1 a = fromMaybe mempty . Map.lookup a . d1 lookupD2 :: (Ord a, Ord b, Ord c, Ord d) => b -> Relation4 a b c d -> Relation3 a c d lookupD2 b = fromMaybe mempty . Map.lookup b . d2 -d1set :: Ord a => Relation4 a b c d -> Set a +d1set :: (Ord a) => Relation4 a b c d -> Set a d1set = Map.keysSet . d1 d12 :: (Ord a, Ord b) => Relation4 a b c d -> Relation a b @@ -196,11 +196,11 @@ mapD2Monotonic f Relation4 {d1, d2, d3, d4} = } insertAll :: - Foldable f => - Ord a => - Ord b => - Ord c => - Ord d => + (Foldable f) => + (Ord a) => + (Ord b) => + (Ord c) => + (Ord d) => f (a, b, c, d) -> Relation4 a b c d -> Relation4 a b c d diff --git a/lib/unison-util-rope/src/Unison/Util/Rope.hs b/lib/unison-util-rope/src/Unison/Util/Rope.hs index b635b36b6..e0d2c6475 100644 --- a/lib/unison-util-rope/src/Unison/Util/Rope.hs +++ b/lib/unison-util-rope/src/Unison/Util/Rope.hs @@ -40,7 +40,7 @@ data Rope a chunks :: Rope a -> [a] chunks = toList -singleton, one :: Sized a => a -> Rope a +singleton, one :: (Sized a) => a -> Rope a one a | size a == 0 = Empty one a = One a singleton = one @@ -49,7 +49,7 @@ singleton = one -- be used unless the function is "roughly" size-preserving. -- So converting from text to utf-8 encoded text chunks is okay, -- wherease filtering out 95% of the chunks will lead to a size-unbalanced tree -map :: Sized b => (a -> b) -> Rope a -> Rope b +map :: (Sized b) => (a -> b) -> Rope a -> Rope b map f = \case Empty -> Empty One a -> one (f a) @@ -73,16 +73,16 @@ class Index a elem where unsafeIndex :: Int -> a -> elem class Reverse a where reverse :: a -> a -instance Sized a => Sized (Rope a) where +instance (Sized a) => Sized (Rope a) where size = \case Empty -> 0 One a -> size a Two n _ _ -> n -null :: Sized a => Rope a -> Bool +null :: (Sized a) => Rope a -> Bool null r = size r == 0 -flatten :: Monoid a => Rope a -> a +flatten :: (Monoid a) => Rope a -> a flatten = mconcat . toList instance (Sized a, Semigroup a) => Semigroup (Rope a) where @@ -100,7 +100,7 @@ instance (Sized a, Semigroup a) => Monoid (Rope a) where mempty = Empty -- size-balanced append, leaving the left tree as is -appendL :: Sized a => Int -> Rope a -> Rope a -> Rope a +appendL :: (Sized a) => Int -> Rope a -> Rope a -> Rope a appendL 0 _ a = a appendL _ l Empty = l appendL szl l r@(One a) = Two (szl + size a) l r @@ -109,7 +109,7 @@ appendL szl l r@(Two szr r1 r2) | otherwise = Two (szl + szr) (appendL szl l r1) r2 -- size-balanced append, leaving the right tree as is -appendR :: Sized a => Rope a -> Int -> Rope a -> Rope a +appendR :: (Sized a) => Rope a -> Int -> Rope a -> Rope a appendR a 0 _ = a appendR Empty _ r = r appendR l@(One a) szr r = Two (size a + szr) l r @@ -151,13 +151,13 @@ snoc' as szN aN = go as | szN >= sz -> Two (sz + szN) as (One aN) | otherwise -> appendL (size l) l (go r) -instance Reverse a => Reverse (Rope a) where +instance (Reverse a) => Reverse (Rope a) where reverse = \case One a -> One (reverse a) Two sz l r -> Two sz (reverse r) (reverse l) Empty -> Empty -two :: Sized a => Rope a -> Rope a -> Rope a +two :: (Sized a) => Rope a -> Rope a -> Rope a two r1 r2 = Two (size r1 + size r2) r1 r2 -- Cutoff for when `snoc` or `cons` will create a new subtree @@ -204,7 +204,7 @@ instance (Sized a, Semigroup a, Drop a) => Drop (Rope a) where | otherwise -> two (drop n l) r -- don't rebalance Empty -> Empty -uncons :: Sized a => Rope a -> Maybe (a, Rope a) +uncons :: (Sized a) => Rope a -> Maybe (a, Rope a) uncons = \case Empty -> Nothing One a -> Just (a, Empty) @@ -212,7 +212,7 @@ uncons = \case Nothing -> uncons r Just (hd, tl) -> Just (hd, two tl r) -unsnoc :: Sized a => Rope a -> Maybe (Rope a, a) +unsnoc :: (Sized a) => Rope a -> Maybe (Rope a, a) unsnoc = \case Empty -> Nothing One a -> Just (Empty, a) @@ -249,7 +249,7 @@ instance (Sized a, Take a, Drop a, Eq a) => Eq (Rope a) where instance (Sized a, Take a, Drop a, Ord a) => Ord (Rope a) where b1 `compare` b2 = uncurry compare (alignChunks (chunks b1) (chunks b2)) -instance NFData a => NFData (Rope a) where +instance (NFData a) => NFData (Rope a) where rnf Empty = () rnf (One a) = rnf a rnf (Two _ l r) = rnf l `seq` rnf r diff --git a/parser-typechecker/src/U/Codebase/Branch/Diff.hs b/parser-typechecker/src/U/Codebase/Branch/Diff.hs index 614942e08..ad8e17496 100644 --- a/parser-typechecker/src/U/Codebase/Branch/Diff.hs +++ b/parser-typechecker/src/U/Codebase/Branch/Diff.hs @@ -113,7 +113,7 @@ instance Semigroup NameBasedDiff where NameBasedDiff (terms0 <> terms1) (types0 <> types1) -- | Diff two Branches, returning a tree containing all of the changes -diffBranches :: forall m. Monad m => Branch m -> Branch m -> m TreeDiff +diffBranches :: forall m. (Monad m) => Branch m -> Branch m -> m TreeDiff diffBranches from to = do let termDiffs = diffMap (Branch.terms from) (Branch.terms to) let typeDiffs = diffMap (Branch.types from) (Branch.types to) @@ -142,7 +142,7 @@ diffBranches from to = do TreeDiff cfr -> pure . Just $ cfr pure $ TreeDiff (defDiff :< childDiff) where - diffMap :: forall ref. Ord ref => Map NameSegment (Map ref (m MdValues)) -> Map NameSegment (Map ref (m MdValues)) -> Map NameSegment (Diff ref) + diffMap :: forall ref. (Ord ref) => Map NameSegment (Map ref (m MdValues)) -> Map NameSegment (Map ref (m MdValues)) -> Map NameSegment (Diff ref) diffMap l r = Align.align l r & fmap \case diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index f261fe79e..a1b930716 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -110,7 +110,7 @@ builtinDataDecls = builtinEffectDecls :: [(Symbol, (R.Id, EffectDeclaration))] builtinEffectDecls = [(v, (r, Intrinsic <$ d)) | (v, r, d) <- DD.builtinEffectDecls] -codeLookup :: Applicative m => CodeLookup Symbol m Ann +codeLookup :: (Applicative m) => CodeLookup Symbol m Ann codeLookup = CodeLookup (const $ pure Nothing) $ \r -> pure $ lookup r [(r, Right x) | (r, x) <- snd <$> builtinDataDecls] @@ -165,7 +165,11 @@ builtinTypes = Rename' r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to rename `" <> r <> "` to `" <> name <> "`, " + "tried to rename `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -175,7 +179,11 @@ builtinTypes = Alias' r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to alias `" <> r <> "` to `" <> name <> "`, " + "tried to alias `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -294,7 +302,11 @@ termNameRefs = Map.mapKeys Name.unsafeFromText $ foldl' go mempty (stripVersion Rename r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to rename `" <> r <> "` to `" <> name <> "`, " + "tried to rename `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -304,7 +316,11 @@ termNameRefs = Map.mapKeys Name.unsafeFromText $ foldl' go mempty (stripVersion Alias r name -> case Map.lookup name m of Just _ -> error . Text.unpack $ - "tried to alias `" <> r <> "` to `" <> name <> "`, " + "tried to alias `" + <> r + <> "` to `" + <> name + <> "`, " <> "which already exists." Nothing -> case Map.lookup r m of Nothing -> @@ -569,10 +585,18 @@ builtinsSrc = B "ImmutableArray.size" . forall1 "a" $ \a -> iarrayt a --> nat, B "ImmutableByteArray.size" $ ibytearrayt --> nat, B "MutableArray.copyTo!" . forall2 "g" "a" $ \g a -> - marrayt g a --> nat --> marrayt g a --> nat --> nat + marrayt g a + --> nat + --> marrayt g a + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "MutableByteArray.copyTo!" . forall1 "g" $ \g -> - mbytearrayt g --> nat --> mbytearrayt g --> nat --> nat + mbytearrayt g + --> nat + --> mbytearrayt g + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "MutableArray.read" . forall2 "g" "a" $ \g a -> marrayt g a --> nat --> Type.effect () [g, DD.exceptionType ()] a, @@ -599,10 +623,18 @@ builtinsSrc = B "MutableByteArray.write64be" . forall1 "g" $ \g -> mbytearrayt g --> nat --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "ImmutableArray.copyTo!" . forall2 "g" "a" $ \g a -> - marrayt g a --> nat --> iarrayt a --> nat --> nat + marrayt g a + --> nat + --> iarrayt a + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "ImmutableByteArray.copyTo!" . forall1 "g" $ \g -> - mbytearrayt g --> nat --> ibytearrayt --> nat --> nat + mbytearrayt g + --> nat + --> ibytearrayt + --> nat + --> nat --> Type.effect () [g, DD.exceptionType ()] unit, B "ImmutableArray.read" . forall1 "a" $ \a -> iarrayt a --> nat --> Type.effect1 () (DD.exceptionType ()) a, @@ -762,13 +794,15 @@ ioBuiltins = forall1 "a" $ \a -> a --> io (reft iot a) ), - ( "IO.process.call", text --> list text --> io nat), + ("IO.process.call", text --> list text --> io nat), ( "IO.process.start", - text --> list text --> - io (tuple [handle, handle, handle, phandle])), - ( "IO.process.kill", phandle --> io unit), - ( "IO.process.wait", phandle --> io nat), - ( "IO.process.exitCode", phandle --> io (optionalt nat)), + text + --> list text + --> io (tuple [handle, handle, handle, phandle]) + ), + ("IO.process.kill", phandle --> io unit), + ("IO.process.wait", phandle --> io nat), + ("IO.process.exitCode", phandle --> io (optionalt nat)), ( "validateSandboxed", forall1 "a" $ \a -> list termLink --> a --> boolean ), @@ -868,7 +902,7 @@ stmBuiltins = refPromiseBuiltins :: [(Text, Type)] refPromiseBuiltins = [ ("Ref.Ticket.read", forall1 "a" $ \a -> ticket a --> a), - ("Ref.readForCas", forall1 "a" $ \a -> reft iot a --> io (ticket a)), + ("Ref.readForCas", forall1 "a" $ \a -> reft iot a --> io (ticket a)), ("Ref.cas", forall1 "a" $ \a -> reft iot a --> ticket a --> a --> io boolean), ("Promise.new", forall1 "a" $ \a -> unit --> io (promise a)), ("Promise.read", forall1 "a" $ \a -> promise a --> io a), @@ -937,6 +971,7 @@ infixr 9 --> io, iof :: Type -> Type io = Type.effect1 () (Type.builtinIO ()) iof = io . eithert failure + iot :: Type iot = (Type.effects () [Type.builtinIO ()]) diff --git a/parser-typechecker/src/Unison/Builtin/Decls.hs b/parser-typechecker/src/Unison/Builtin/Decls.hs index 59191c429..607ad7632 100644 --- a/parser-typechecker/src/Unison/Builtin/Decls.hs +++ b/parser-typechecker/src/Unison/Builtin/Decls.hs @@ -460,7 +460,7 @@ pattern OptionalSome' :: ABT.Term (Term.F typeVar typeAnn patternAnn) v a pattern OptionalSome' d <- Term.App' (Term.Constructor' (ConstructorReference OptionalRef ((==) someId -> True))) d -pattern TupleType' :: Var v => [Type v a] -> Type v a +pattern TupleType' :: (Var v) => [Type v a] -> Type v a pattern TupleType' ts <- (unTupleType -> Just ts) pattern TupleTerm' :: [Term2 vt at ap v a] -> Term2 vt at ap v a @@ -577,7 +577,7 @@ unitType, stdHandleType, failureType, exceptionType :: - Ord v => a -> Type v a + (Ord v) => a -> Type v a unitType a = Type.ref a unitRef pairType a = Type.ref a pairRef testResultType a = Type.app a (Type.list a) (Type.ref a testResultRef) @@ -592,10 +592,10 @@ stdHandleType a = Type.ref a stdHandleRef failureType a = Type.ref a failureRef exceptionType a = Type.ref a exceptionRef -tlsSignedCertType :: Var v => a -> Type v a +tlsSignedCertType :: (Var v) => a -> Type v a tlsSignedCertType a = Type.ref a tlsSignedCertRef -unitTerm :: Var v => a -> Term v a +unitTerm :: (Var v) => a -> Term v a unitTerm ann = Term.constructor ann (ConstructorReference unitRef 0) tupleConsTerm :: @@ -611,10 +611,10 @@ tupleTerm = foldr tupleConsTerm (unitTerm mempty) -- delayed terms are just lambdas that take a single `()` arg -- `force` calls the function -forceTerm :: Var v => a -> a -> Term v a -> Term v a +forceTerm :: (Var v) => a -> a -> Term v a -> Term v a forceTerm a au e = Term.app a e (unitTerm au) -delayTerm :: Var v => a -> Term v a -> Term v a +delayTerm :: (Var v) => a -> Term v a -> Term v a delayTerm a = Term.lam a $ Var.named "()" unTupleTerm :: @@ -626,7 +626,7 @@ unTupleTerm t = case t of Term.Constructor' (ConstructorReference UnitRef 0) -> Just [] _ -> Nothing -unTupleType :: Var v => Type v a -> Maybe [Type v a] +unTupleType :: (Var v) => Type v a -> Maybe [Type v a] unTupleType t = case t of Type.Apps' (Type.Ref' PairRef) [fst, snd] -> (fst :) <$> unTupleType snd Type.Ref' UnitRef -> Just [] diff --git a/parser-typechecker/src/Unison/Builtin/Terms.hs b/parser-typechecker/src/Unison/Builtin/Terms.hs index c4b2056bc..52595b56f 100644 --- a/parser-typechecker/src/Unison/Builtin/Terms.hs +++ b/parser-typechecker/src/Unison/Builtin/Terms.hs @@ -34,7 +34,7 @@ builtinTermsSrc ann = ) ] -v :: Var v => Text -> v +v :: (Var v) => Text -> v v = Var.named builtinTermsRef :: Map Symbol Reference.Id diff --git a/parser-typechecker/src/Unison/Codebase.hs b/parser-typechecker/src/Unison/Codebase.hs index 6347a9c38..b38a404c6 100644 --- a/parser-typechecker/src/Unison/Codebase.hs +++ b/parser-typechecker/src/Unison/Codebase.hs @@ -170,7 +170,7 @@ import Unison.Var (Var) import qualified Unison.WatchKind as WK -- | Run a transaction on a codebase. -runTransaction :: MonadIO m => Codebase m v a -> Sqlite.Transaction b -> m b +runTransaction :: (MonadIO m) => Codebase m v a -> Sqlite.Transaction b -> m b runTransaction Codebase {withConnection} action = withConnection \conn -> Sqlite.runTransaction conn action @@ -232,7 +232,7 @@ getShallowBranchAtPath path mayBranch = do getShallowBranchAtPath p (Just childBranch) -- | Get a branch from the codebase. -getBranchForHash :: Monad m => Codebase m v a -> CausalHash -> m (Maybe (Branch m)) +getBranchForHash :: (Monad m) => Codebase m v a -> CausalHash -> m (Maybe (Branch m)) getBranchForHash codebase h = -- Attempt to find the Branch in the current codebase cache and root up to 3 levels deep -- If not found, attempt to find it in the Codebase (sqlite) @@ -263,7 +263,7 @@ termMetadata mayBranch (path, nameSeg) ref = do V2Branch.termMetadata b (coerce @NameSegment.NameSegment nameSeg) ref -- | Get the lowest common ancestor of two branches, i.e. the most recent branch that is an ancestor of both branches. -lca :: MonadIO m => Codebase m v a -> Branch m -> Branch m -> m (Maybe (Branch m)) +lca :: (MonadIO m) => Codebase m v a -> Branch m -> Branch m -> m (Maybe (Branch m)) lca code b1@(Branch.headHash -> h1) b2@(Branch.headHash -> h2) = do action <- runTransaction code do @@ -310,11 +310,11 @@ addDefsToCodebase c uf = do goTerm (r, Nothing, tm, tp) = putTerm c r tm tp goTerm (r, Just WK.TestWatch, tm, tp) = putTerm c r tm tp goTerm _ = pure () - goType :: Show t => (t -> Decl v a) -> (Reference.Id, t) -> Sqlite.Transaction () + goType :: (Show t) => (t -> Decl v a) -> (Reference.Id, t) -> Sqlite.Transaction () goType _f pair | debug && trace ("Codebase.addDefsToCodebase.goType " ++ show pair) False = undefined goType f (ref, decl) = putTypeDeclaration c ref (f decl) -getTypeOfConstructor :: Ord v => Codebase m v a -> ConstructorReference -> Sqlite.Transaction (Maybe (Type v a)) +getTypeOfConstructor :: (Ord v) => Codebase m v a -> ConstructorReference -> Sqlite.Transaction (Maybe (Type v a)) getTypeOfConstructor codebase (ConstructorReference r0 cid) = case r0 of Reference.DerivedId r -> do @@ -338,7 +338,7 @@ lookupWatchCache codebase h = do maybe (getWatch codebase WK.TestWatch h) (pure . Just) m1 typeLookupForDependencies :: - BuiltinAnnotation a => + (BuiltinAnnotation a) => Codebase m Symbol a -> Set Reference -> Sqlite.Transaction (TL.TypeLookup Symbol a) @@ -359,7 +359,7 @@ typeLookupForDependencies codebase s = do Nothing -> pure mempty go tl Reference.Builtin {} = pure tl -- codebase isn't consulted for builtins -toCodeLookup :: MonadIO m => Codebase m Symbol Parser.Ann -> CL.CodeLookup Symbol m Parser.Ann +toCodeLookup :: (MonadIO m) => Codebase m Symbol Parser.Ann -> CL.CodeLookup Symbol m Parser.Ann toCodeLookup c = CL.CodeLookup (runTransaction c . getTerm c) (runTransaction c . getTypeDeclaration c) <> Builtin.codeLookup @@ -370,7 +370,7 @@ toCodeLookup c = -- Note that it is possible to call 'putTerm', then 'getTypeOfTerm', and receive @Nothing@, per the semantics of -- 'putTerm'. getTypeOfTerm :: - BuiltinAnnotation a => + (BuiltinAnnotation a) => Codebase m Symbol a -> Reference -> Sqlite.Transaction (Maybe (Type Symbol a)) @@ -384,7 +384,7 @@ getTypeOfTerm c r = case r of -- | Get the type of a referent. getTypeOfReferent :: - BuiltinAnnotation a => + (BuiltinAnnotation a) => Codebase m Symbol a -> Referent.Referent -> Sqlite.Transaction (Maybe (Type Symbol a)) @@ -413,18 +413,18 @@ dependentsOfComponent h = <$> SqliteCodebase.Operations.dependentsOfComponentImpl h -- | Get the set of terms-or-constructors that have the given type. -termsOfType :: Var v => Codebase m v a -> Type v a -> Sqlite.Transaction (Set Referent.Referent) +termsOfType :: (Var v) => Codebase m v a -> Type v a -> Sqlite.Transaction (Set Referent.Referent) termsOfType c ty = termsOfTypeByReference c $ Hashing.typeToReference ty -- | Get all terms which match the exact type the provided reference points to. -termsOfTypeByReference :: Var v => Codebase m v a -> Reference -> Sqlite.Transaction (Set Referent.Referent) +termsOfTypeByReference :: (Var v) => Codebase m v a -> Reference -> Sqlite.Transaction (Set Referent.Referent) termsOfTypeByReference c r = Set.union (Rel.lookupDom r Builtin.builtinTermsByType) . Set.map (fmap Reference.DerivedId) <$> termsOfTypeImpl c r -- | Get the set of terms-or-constructors mention the given type anywhere in their signature. -termsMentioningType :: Var v => Codebase m v a -> Type v a -> Sqlite.Transaction (Set Referent.Referent) +termsMentioningType :: (Var v) => Codebase m v a -> Type v a -> Sqlite.Transaction (Set Referent.Referent) termsMentioningType c ty = Set.union (Rel.lookupDom r Builtin.builtinTermsByTypeMention) . Set.map (fmap Reference.DerivedId) @@ -434,7 +434,7 @@ termsMentioningType c ty = -- | Check whether a reference is a term. isTerm :: - BuiltinAnnotation a => + (BuiltinAnnotation a) => Codebase m Symbol a -> Reference -> Sqlite.Transaction Bool @@ -458,7 +458,7 @@ data Preprocessing m -- otherwise we try to load the root branch. importRemoteBranch :: forall m v a. - MonadUnliftIO m => + (MonadUnliftIO m) => Codebase m v a -> ReadGitRemoteNamespace -> SyncMode -> @@ -484,7 +484,7 @@ importRemoteBranch codebase ns mode preprocess = runExceptT $ do -- | Pull a git branch and view it from the cache, without syncing into the -- local codebase. viewRemoteBranch :: - MonadIO m => + (MonadIO m) => Codebase m v a -> ReadGitRemoteNamespace -> Git.GitBranchBehavior -> @@ -493,35 +493,35 @@ viewRemoteBranch :: viewRemoteBranch codebase ns gitBranchBehavior action = viewRemoteBranch' codebase ns gitBranchBehavior (\(b, _dir) -> action b) -unsafeGetComponentLength :: HasCallStack => Hash -> Sqlite.Transaction Reference.CycleSize +unsafeGetComponentLength :: (HasCallStack) => Hash -> Sqlite.Transaction Reference.CycleSize unsafeGetComponentLength h = Operations.getCycleLen h >>= \case Nothing -> error (reportBug "E713350" ("component with hash " ++ show h ++ " not found")) Just size -> pure size -- | Like 'getTerm', for when the term is known to exist in the codebase. -unsafeGetTerm :: HasCallStack => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Term v a) +unsafeGetTerm :: (HasCallStack) => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Term v a) unsafeGetTerm codebase rid = getTerm codebase rid >>= \case Nothing -> error (reportBug "E520818" ("term " ++ show rid ++ " not found")) Just term -> pure term -- | Like 'getTypeDeclaration', for when the type declaration is known to exist in the codebase. -unsafeGetTypeDeclaration :: HasCallStack => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Decl v a) +unsafeGetTypeDeclaration :: (HasCallStack) => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Decl v a) unsafeGetTypeDeclaration codebase rid = getTypeDeclaration codebase rid >>= \case Nothing -> error (reportBug "E129043" ("type decl " ++ show rid ++ " not found")) Just decl -> pure decl -- | Like 'getTypeOfTerm', but for when the term is known to exist in the codebase. -unsafeGetTypeOfTermById :: HasCallStack => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Type v a) +unsafeGetTypeOfTermById :: (HasCallStack) => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Type v a) unsafeGetTypeOfTermById codebase rid = getTypeOfTermImpl codebase rid >>= \case Nothing -> error (reportBug "E377910" ("type of term " ++ show rid ++ " not found")) Just ty -> pure ty -- | Like 'unsafeGetTerm', but returns the type of the term, too. -unsafeGetTermWithType :: HasCallStack => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Term v a, Type v a) +unsafeGetTermWithType :: (HasCallStack) => Codebase m v a -> Reference.Id -> Sqlite.Transaction (Term v a, Type v a) unsafeGetTermWithType codebase rid = do term <- unsafeGetTerm codebase rid ty <- @@ -534,7 +534,7 @@ unsafeGetTermWithType codebase rid = do -- | Like 'getTermComponentWithTypes', for when the term component is known to exist in the codebase. unsafeGetTermComponent :: - HasCallStack => + (HasCallStack) => Codebase m v a -> Hash -> Sqlite.Transaction [(Term v a, Type v a)] diff --git a/parser-typechecker/src/Unison/Codebase/Branch.hs b/parser-typechecker/src/Unison/Codebase/Branch.hs index e81376a34..375698e48 100644 --- a/parser-typechecker/src/Unison/Codebase/Branch.hs +++ b/parser-typechecker/src/Unison/Codebase/Branch.hs @@ -388,18 +388,18 @@ deepEdits' = go id f (c, b) = go (addPrefix . Name.cons c) (head b) -- | Discards the history of a Branch0's children, recursively -discardHistory0 :: Applicative m => Branch0 m -> Branch0 m +discardHistory0 :: (Applicative m) => Branch0 m -> Branch0 m discardHistory0 = over children (fmap tweak) where tweak b = one (discardHistory0 (head b)) -- | Discards the history of a Branch and its children, recursively -discardHistory :: Applicative m => Branch m -> Branch m +discardHistory :: (Applicative m) => Branch m -> Branch m discardHistory b = one (discardHistory0 (head b)) -- `before b1 b2` is true if `b2` incorporates all of `b1` -before :: Monad m => Branch m -> Branch m -> m Bool +before :: (Monad m) => Branch m -> Branch m -> m Bool before (Branch b1) (Branch b2) = Causal.before b1 b2 -- | what does this do? —AI @@ -407,12 +407,12 @@ toList0 :: Branch0 m -> [(Path, Branch0 m)] toList0 = go Path.empty where go p b = - (p, b) : - ( Map.toList (_children b) - >>= ( \(seg, cb) -> - go (Path.snoc p seg) (head cb) - ) - ) + (p, b) + : ( Map.toList (_children b) + >>= ( \(seg, cb) -> + go (Path.snoc p seg) (head cb) + ) + ) -- returns `Nothing` if no Branch at `path` or if Branch is empty at `path` getAt :: @@ -450,7 +450,7 @@ isEmpty :: Branch m -> Bool isEmpty = (== empty) -- | Perform an update over the current branch and create a new causal step. -step :: Applicative m => (Branch0 m -> Branch0 m) -> Branch m -> Branch m +step :: (Applicative m) => (Branch0 m -> Branch0 m) -> Branch m -> Branch m step f = runIdentity . stepM (Identity . f) -- | Perform an update over the current branch and create a new causal step. @@ -459,14 +459,14 @@ stepM f = \case Branch (Causal.One _h _eh e) | e == empty0 -> Branch . Causal.one <$> f empty0 b -> mapMOf history (Causal.stepDistinctM f) b -cons :: Applicative m => Branch0 m -> Branch m -> Branch m +cons :: (Applicative m) => Branch0 m -> Branch m -> Branch m cons = step . const isOne :: Branch m -> Bool isOne (Branch Causal.One {}) = True isOne _ = False -uncons :: Applicative m => Branch m -> m (Maybe (Branch0 m, Branch m)) +uncons :: (Applicative m) => Branch m -> m (Maybe (Branch0 m, Branch m)) uncons (Branch b) = go <$> Causal.uncons b where go = over (_Just . _2) Branch @@ -518,7 +518,7 @@ stepManyAtM actions startBranch = do -- starting at the leaves, apply `f` to every level of the branch. stepEverywhere :: - Applicative m => (Branch0 m -> Branch0 m) -> (Branch0 m -> Branch0 m) + (Applicative m) => (Branch0 m -> Branch0 m) -> (Branch0 m -> Branch0 m) stepEverywhere f Branch0 {..} = f (branch0 _terms _types children _edits) where children = fmap (step $ stepEverywhere f) _children @@ -533,18 +533,18 @@ getChildBranch seg b = fromMaybe empty $ Map.lookup seg (_children b) setChildBranch :: NameSegment -> Branch m -> Branch0 m -> Branch0 m setChildBranch seg b = over children (updateChildren seg b) -getPatch :: Applicative m => NameSegment -> Branch0 m -> m Patch +getPatch :: (Applicative m) => NameSegment -> Branch0 m -> m Patch getPatch seg b = case Map.lookup seg (_edits b) of Nothing -> pure Patch.empty Just (_, p) -> p -getMaybePatch :: Applicative m => NameSegment -> Branch0 m -> m (Maybe Patch) +getMaybePatch :: (Applicative m) => NameSegment -> Branch0 m -> m (Maybe Patch) getMaybePatch seg b = case Map.lookup seg (_edits b) of Nothing -> pure Nothing Just (_, p) -> Just <$> p modifyPatches :: - Monad m => NameSegment -> (Patch -> Patch) -> Branch0 m -> m (Branch0 m) + (Monad m) => NameSegment -> (Patch -> Patch) -> Branch0 m -> m (Branch0 m) modifyPatches seg f = mapMOf edits update where update m = do @@ -554,7 +554,7 @@ modifyPatches seg f = mapMOf edits update let h = H.hashPatch p' pure $ Map.insert seg (PatchHash h, pure p') m -replacePatch :: Applicative m => NameSegment -> Patch -> Branch0 m -> Branch0 m +replacePatch :: (Applicative m) => NameSegment -> Patch -> Branch0 m -> Branch0 m replacePatch n p = over edits (Map.insert n (PatchHash (H.hashPatch p), pure p)) deletePatch :: NameSegment -> Branch0 m -> Branch0 m @@ -573,7 +573,7 @@ updateChildren seg updatedChild = -- Modify the Branch at `path` with `f`, after creating it if necessary. -- Because it's a `Branch`, it overwrites the history at `path`. modifyAt :: - Applicative m => + (Applicative m) => Path -> (Branch m -> Branch m) -> Branch m -> @@ -584,8 +584,8 @@ modifyAt path f = runIdentity . modifyAtM path (pure . f) -- Because it's a `Branch`, it overwrites the history at `path`. modifyAtM :: forall n m. - Functor n => - Applicative m => -- because `Causal.cons` uses `pure` + (Functor n) => + (Applicative m) => -- because `Causal.cons` uses `pure` Path -> (Branch m -> n (Branch m)) -> Branch m -> @@ -700,14 +700,14 @@ deleteTypeName r n b over types (Star3.deletePrimaryD1 (r, n)) b deleteTypeName _ _ b = b -lca :: Monad m => Branch m -> Branch m -> m (Maybe (Branch m)) +lca :: (Monad m) => Branch m -> Branch m -> m (Maybe (Branch m)) lca (Branch a) (Branch b) = fmap Branch <$> Causal.lca a b -transform :: Functor m => (forall a. m a -> n a) -> Branch m -> Branch n +transform :: (Functor m) => (forall a. m a -> n a) -> Branch m -> Branch n transform f b = case _history b of causal -> Branch . Causal.transform f $ transformB0s f causal where - transformB0 :: Functor m => (forall a. m a -> n a) -> Branch0 m -> Branch0 n + transformB0 :: (Functor m) => (forall a. m a -> n a) -> Branch0 m -> Branch0 n transformB0 f b = b { _children = transform f <$> _children b, @@ -715,7 +715,7 @@ transform f b = case _history b of } transformB0s :: - Functor m => + (Functor m) => (forall a. m a -> n a) -> Causal m (Branch0 m) -> Causal m (Branch0 n) @@ -733,7 +733,7 @@ children0 = children .> itraversed <. (history . Causal.head_) -- the existing base if there are no) consBranchSnapshot :: forall m. - Monad m => + (Monad m) => Branch m -> Branch m -> Branch m diff --git a/parser-typechecker/src/Unison/Codebase/Branch/BranchDiff.hs b/parser-typechecker/src/Unison/Codebase/Branch/BranchDiff.hs index a7e2e81f9..b53128cde 100644 --- a/parser-typechecker/src/Unison/Codebase/Branch/BranchDiff.hs +++ b/parser-typechecker/src/Unison/Codebase/Branch/BranchDiff.hs @@ -25,7 +25,7 @@ data BranchDiff = BranchDiff } deriving (Eq, Ord, Show) -diff0 :: Monad m => Branch0 m -> Branch0 m -> m BranchDiff +diff0 :: (Monad m) => Branch0 m -> Branch0 m -> m BranchDiff diff0 old new = do newEdits <- sequenceA $ snd <$> _edits new oldEdits <- sequenceA $ snd <$> _edits old diff --git a/parser-typechecker/src/Unison/Codebase/Branch/Merge.hs b/parser-typechecker/src/Unison/Codebase/Branch/Merge.hs index a6a4c73da..096601a8b 100644 --- a/parser-typechecker/src/Unison/Codebase/Branch/Merge.hs +++ b/parser-typechecker/src/Unison/Codebase/Branch/Merge.hs @@ -40,7 +40,7 @@ data MergeMode = RegularMerge | SquashMerge deriving (Eq, Ord, Show) merge'' :: forall m. - Monad m => + (Monad m) => (Branch m -> Branch m -> m (Maybe (Branch m))) -> -- lca calculator MergeMode -> Branch m -> @@ -111,7 +111,7 @@ merge'' lca mode (Branch x) (Branch y) = merge0 :: forall m. - Monad m => + (Monad m) => (Branch m -> Branch m -> m (Maybe (Branch m))) -> MergeMode -> Branch0 m -> diff --git a/parser-typechecker/src/Unison/Codebase/Branch/Names.hs b/parser-typechecker/src/Unison/Codebase/Branch/Names.hs index 2b15f3147..7bd594693 100644 --- a/parser-typechecker/src/Unison/Codebase/Branch/Names.hs +++ b/parser-typechecker/src/Unison/Codebase/Branch/Names.hs @@ -40,7 +40,7 @@ toNames b = -- This stops searching for a given HashQualified once it encounters -- any term or type in any Branch0 that satisfies that HashQualified. findHistoricalHQs :: - Monad m => + (Monad m) => Set (HashQualified Name) -> Branch m -> m (Set (HashQualified Name), Names) @@ -50,7 +50,7 @@ findHistoricalHQs = (\hq r n -> HQ.matchesNamedReference n r hq) findHistoricalRefs :: - Monad m => + (Monad m) => Set LabeledDependency -> Branch m -> m (Set LabeledDependency, Names) @@ -60,7 +60,7 @@ findHistoricalRefs = (\query r _n -> LD.fold (== r) (const False) query) findHistoricalRefs' :: - Monad m => + (Monad m) => Set Reference -> Branch m -> m (Set Reference, Names) diff --git a/parser-typechecker/src/Unison/Codebase/BranchDiff.hs b/parser-typechecker/src/Unison/Codebase/BranchDiff.hs index 4cf9f5616..2812b2455 100644 --- a/parser-typechecker/src/Unison/Codebase/BranchDiff.hs +++ b/parser-typechecker/src/Unison/Codebase/BranchDiff.hs @@ -46,7 +46,7 @@ data BranchDiff = BranchDiff } deriving stock (Generic, Show) -diff0 :: forall m. Monad m => Branch0 m -> Branch0 m -> m BranchDiff +diff0 :: forall m. (Monad m) => Branch0 m -> Branch0 m -> m BranchDiff diff0 old new = BranchDiff terms types <$> patchDiff old new where (terms, types) = @@ -56,7 +56,7 @@ diff0 old new = BranchDiff terms types <$> patchDiff old new (deepr4ToSlice (Branch.deepTypes old) (Branch.deepTypeMetadata old)) (deepr4ToSlice (Branch.deepTypes new) (Branch.deepTypeMetadata new)) -patchDiff :: forall m. Monad m => Branch0 m -> Branch0 m -> m (Map Name (DiffType PatchDiff)) +patchDiff :: forall m. (Monad m) => Branch0 m -> Branch0 m -> m (Map Name (DiffType PatchDiff)) patchDiff old new = do let oldDeepEdits, newDeepEdits :: Map Name (PatchHash, m Patch) oldDeepEdits = Branch.deepEdits' old @@ -80,7 +80,7 @@ patchDiff old new = do pure $ added <> removed <> modified deepr4ToSlice :: - Ord r => + (Ord r) => R.Relation r Name -> Metadata.R4 r Name -> NamespaceSlice r @@ -118,13 +118,13 @@ computeSlices oldTerms newTerms oldTypes newTypes = (termsOut, typesOut) tremovedMetadata = removedMetadata oldTypes newTypes } - allNames :: Ord r => NamespaceSlice r -> NamespaceSlice r -> Map r (Set Name, Set Name) + allNames :: (Ord r) => NamespaceSlice r -> NamespaceSlice r -> Map r (Set Name, Set Name) allNames old new = R.outerJoinDomMultimaps (names old) (names new) allAdds, allRemoves :: forall r. - Ord r => + (Ord r) => Map r (Set Name, Set Name) -> Map Name (Set r, Set r) -> Relation r Name @@ -147,26 +147,26 @@ computeSlices oldTerms newTerms oldTypes newTypes = (termsOut, typesOut) -- renames and stuff, name changes without a reference change remainingNameChanges :: forall r. - Ord r => + (Ord r) => Map r (Set Name, Set Name) -> Map r (Set Name, Set Name) remainingNameChanges = Map.filter (\(old, new) -> not (null old) && not (null new) && old /= new) - allNamespaceUpdates :: Ord r => NamespaceSlice r -> NamespaceSlice r -> Map Name (Set r, Set r) + allNamespaceUpdates :: (Ord r) => NamespaceSlice r -> NamespaceSlice r -> Map Name (Set r, Set r) allNamespaceUpdates old new = Map.filter f $ R.innerJoinRanMultimaps (names old) (names new) where f (old, new) = old /= new - addedMetadata :: Ord r => NamespaceSlice r -> NamespaceSlice r -> Relation3 r Name Metadata.Value + addedMetadata :: (Ord r) => NamespaceSlice r -> NamespaceSlice r -> Relation3 r Name Metadata.Value addedMetadata old new = metadata new `R3.difference` metadata old - removedMetadata :: Ord r => NamespaceSlice r -> NamespaceSlice r -> Relation3 r Name Metadata.Value + removedMetadata :: (Ord r) => NamespaceSlice r -> NamespaceSlice r -> Relation3 r Name Metadata.Value removedMetadata old new = metadata old `R3.difference` metadata new -- the namespace updates that aren't propagated -namespaceUpdates :: Ord r => DiffSlice r -> Map Name (Set r, Set r) +namespaceUpdates :: (Ord r) => DiffSlice r -> Map Name (Set r, Set r) namespaceUpdates s = Map.mapMaybeWithKey f (tallnamespaceUpdates s) where f name (olds, news) = @@ -174,7 +174,7 @@ namespaceUpdates s = Map.mapMaybeWithKey f (tallnamespaceUpdates s) in if null news' then Nothing else Just (olds, news') propagated = propagatedUpdates s -propagatedUpdates :: Ord r => DiffSlice r -> Map Name (Set r) +propagatedUpdates :: (Ord r) => DiffSlice r -> Map Name (Set r) propagatedUpdates s = Map.fromList [ (name, news) diff --git a/parser-typechecker/src/Unison/Codebase/BranchUtil.hs b/parser-typechecker/src/Unison/Codebase/BranchUtil.hs index a921c2d81..ded59dc2a 100644 --- a/parser-typechecker/src/Unison/Codebase/BranchUtil.hs +++ b/parser-typechecker/src/Unison/Codebase/BranchUtil.hs @@ -48,7 +48,7 @@ import qualified Unison.Util.Relation4 as R4 import qualified Unison.Util.Star3 as Star3 -- | Creates a branch containing all of the given names, with a single history node. -fromNames :: Monad m => Names -> Branch m +fromNames :: (Monad m) => Names -> Branch m fromNames names0 = Branch.stepManyAt (typeActions <> termActions) Branch.empty where typeActions = map doType . R.toList $ Names.types names0 @@ -119,7 +119,7 @@ makeAddTermName (p, name) r md = (p, Branch.addTermName r name md) makeDeleteTermName :: Path.Split -> Referent -> (Path, Branch0 m -> Branch0 m) makeDeleteTermName (p, name) r = (p, Branch.deleteTermName r name) -makeReplacePatch :: Applicative m => Path.Split -> Patch -> (Path, Branch0 m -> Branch0 m) +makeReplacePatch :: (Applicative m) => Path.Split -> Patch -> (Path, Branch0 m -> Branch0 m) makeReplacePatch (p, name) patch = (p, Branch.replacePatch name patch) makeDeletePatch :: Path.Split -> (Path, Branch0 m -> Branch0 m) diff --git a/parser-typechecker/src/Unison/Codebase/Causal.hs b/parser-typechecker/src/Unison/Codebase/Causal.hs index 3d57dbfdc..ae2764038 100644 --- a/parser-typechecker/src/Unison/Codebase/Causal.hs +++ b/parser-typechecker/src/Unison/Codebase/Causal.hs @@ -58,7 +58,7 @@ import Unison.Prelude import Prelude hiding (head, read, tail) -- | Focus the current head, keeping the hash up to date. -head_ :: Hashing.ContentAddressable e => Lens.Lens' (Causal m e) e +head_ :: (Hashing.ContentAddressable e) => Lens.Lens' (Causal m e) e head_ = Lens.lens getter setter where getter = head @@ -122,7 +122,7 @@ threeWayMerge' lca combine c1 c2 = do -- `True` if `h` is found in the history of `c` within `maxDepth` path length -- from the tip of `c` -beforeHash :: forall m e. Monad m => Word -> CausalHash -> Causal m e -> m Bool +beforeHash :: forall m e. (Monad m) => Word -> CausalHash -> Causal m e -> m Bool beforeHash maxDepth h c = Reader.runReaderT (State.evalStateT (go c) Set.empty) (0 :: Word) where @@ -155,7 +155,7 @@ fromList e cs = fromListM e (map (\c -> (currentHash c, pure c)) cs) -- | Construct a causal from a list of predecessors. The predecessors may be given in any order. -fromListM :: Hashing.ContentAddressable e => e -> [(CausalHash, m (Causal m e))] -> Causal m e +fromListM :: (Hashing.ContentAddressable e) => e -> [(CausalHash, m (Causal m e))] -> Causal m e fromListM e ts = case ts of [] -> UnsafeOne ch eh e @@ -165,13 +165,13 @@ fromListM e ts = (ch, eh) = (Hashing.hashCausal e (Set.fromList (map fst ts))) -- | An optimized variant of 'fromListM' for when it is known we have 2+ predecessors (merge node). -mergeNode :: Hashing.ContentAddressable e => e -> Map (CausalHash) (m (Causal m e)) -> Causal m e +mergeNode :: (Hashing.ContentAddressable e) => e -> Map (CausalHash) (m (Causal m e)) -> Causal m e mergeNode newHead predecessors = let (ch, eh) = Hashing.hashCausal newHead (Map.keysSet predecessors) in UnsafeMerge ch eh newHead predecessors -- duplicated logic here instead of delegating to `fromList` to avoid `Applicative m` constraint. -one :: Hashing.ContentAddressable e => e -> Causal m e +one :: (Hashing.ContentAddressable e) => e -> Causal m e one e = UnsafeOne ch eh e where (ch, eh) = Hashing.hashCausal e mempty @@ -185,21 +185,21 @@ consDistinct e tl = then tl else cons e tl -uncons :: Applicative m => Causal m e -> m (Maybe (e, Causal m e)) +uncons :: (Applicative m) => Causal m e -> m (Maybe (e, Causal m e)) uncons c = case c of Cons _ _ e (_, tl) -> fmap (e,) . Just <$> tl _ -> pure Nothing -- it's okay to call "Unsafe"* here with the existing hashes because `nt` can't -- affect `e`. -transform :: Functor m => (forall a. m a -> n a) -> Causal m e -> Causal n e +transform :: (Functor m) => (forall a. m a -> n a) -> Causal m e -> Causal n e transform nt c = case c of One h eh e -> UnsafeOne h eh e Cons h eh e (ht, tl) -> UnsafeCons h eh e (ht, nt (transform nt <$> tl)) Merge h eh e tls -> UnsafeMerge h eh e $ Map.map (\mc -> nt (transform nt <$> mc)) tls -- "unsafe" because the hashes will be wrong if `f` affects aspects of `e` that impact hashing -unsafeMapHashPreserving :: forall m e e2. Functor m => (e -> e2) -> Causal m e -> Causal m e2 +unsafeMapHashPreserving :: forall m e e2. (Functor m) => (e -> e2) -> Causal m e -> Causal m e2 unsafeMapHashPreserving f c = case c of One h eh e -> UnsafeOne h (retagValueHash eh) (f e) Cons h eh e (ht, tl) -> UnsafeCons h (retagValueHash eh) (f e) (ht, unsafeMapHashPreserving f <$> tl) diff --git a/parser-typechecker/src/Unison/Codebase/Causal/Type.hs b/parser-typechecker/src/Unison/Codebase/Causal/Type.hs index d3ba902e8..d3f0aebc5 100644 --- a/parser-typechecker/src/Unison/Codebase/Causal/Type.hs +++ b/parser-typechecker/src/Unison/Codebase/Causal/Type.hs @@ -24,18 +24,18 @@ import Prelude hiding (head, read, tail) {- `Causal a` has 5 operations, specified algebraically here: -* `before : Causal m a -> Causal m a -> m Bool` defines a partial order on +\* `before : Causal m a -> Causal m a -> m Bool` defines a partial order on `Causal`. -* `head : Causal m a -> a`, which represents the "latest" `a` value in a causal +\* `head : Causal m a -> a`, which represents the "latest" `a` value in a causal chain. -* `one : a -> Causal m a`, satisfying `head (one hd) == hd` -* `cons : a -> Causal a -> Causal a`, satisfying `head (cons hd tl) == hd` and +\* `one : a -> Causal m a`, satisfying `head (one hd) == hd` +\* `cons : a -> Causal a -> Causal a`, satisfying `head (cons hd tl) == hd` and also `before tl (cons hd tl)`. -* `merge : CommutativeSemigroup a => Causal a -> Causal a -> Causal a`, which is +\* `merge : CommutativeSemigroup a => Causal a -> Causal a -> Causal a`, which is commutative (but not associative) and satisfies: * `before c1 (merge c1 c2)` * `before c2 (merge c1 c2)` -* `sequence : Causal a -> Causal a -> Causal a`, which is defined as +\* `sequence : Causal a -> Causal a -> Causal a`, which is defined as `sequence c1 c2 = cons (head c2) (merge c1 c2)`. * `before c1 (sequence c1 c2)` * `head (sequence c1 c2) == head c2` @@ -85,11 +85,11 @@ predecessors (UnsafeOne _ _ _) = Seq.empty predecessors (UnsafeCons _ _ _ (_, t)) = Seq.singleton t predecessors (UnsafeMerge _ _ _ ts) = Seq.fromList $ Map.elems ts -before :: Monad m => Causal m e -> Causal m e -> m Bool +before :: (Monad m) => Causal m e -> Causal m e -> m Bool before a b = (== Just a) <$> lca a b -- Find the lowest common ancestor of two causals. -lca :: Monad m => Causal m e -> Causal m e -> m (Maybe (Causal m e)) +lca :: (Monad m) => Causal m e -> Causal m e -> m (Maybe (Causal m e)) lca a b = lca' (Seq.singleton $ pure a) (Seq.singleton $ pure b) @@ -97,7 +97,7 @@ lca a b = -- element of `ys`. -- This is a breadth-first search used in the implementation of `lca a b`. lca' :: - Monad m => + (Monad m) => Seq (m (Causal m e)) -> Seq (m (Causal m e)) -> m (Maybe (Causal m e)) diff --git a/parser-typechecker/src/Unison/Codebase/CodeLookup.hs b/parser-typechecker/src/Unison/Codebase/CodeLookup.hs index 8c33ee1d5..a4f500a35 100644 --- a/parser-typechecker/src/Unison/Codebase/CodeLookup.hs +++ b/parser-typechecker/src/Unison/Codebase/CodeLookup.hs @@ -27,7 +27,7 @@ instance (Ord v, Functor m) => Functor (CodeLookup v m) where md (Left e) = Left (f <$> e) md (Right d) = Right (f <$> d) -instance Monad m => Semigroup (CodeLookup v m a) where +instance (Monad m) => Semigroup (CodeLookup v m a) where c1 <> c2 = CodeLookup tm ty where tm id = do @@ -37,7 +37,7 @@ instance Monad m => Semigroup (CodeLookup v m a) where o <- getTypeDeclaration c1 id case o of Nothing -> getTypeDeclaration c2 id; Just _ -> pure o -instance Monad m => Monoid (CodeLookup v m a) where +instance (Monad m) => Monoid (CodeLookup v m a) where mempty = CodeLookup (const $ pure Nothing) (const $ pure Nothing) -- todo: can this be implemented in terms of TransitiveClosure.transitiveClosure? diff --git a/parser-typechecker/src/Unison/Codebase/Editor/Git.hs b/parser-typechecker/src/Unison/Codebase/Editor/Git.hs index da6089a46..9df7d7fea 100644 --- a/parser-typechecker/src/Unison/Codebase/Editor/Git.hs +++ b/parser-typechecker/src/Unison/Codebase/Editor/Git.hs @@ -54,26 +54,28 @@ encodeFileName s = go ('$' : rem) = "$$" <> go rem go (c : rem) | elem @[] c "/\\:*?\"<>|" || not (Char.isPrint c && Char.isAscii c) = - "$x" <> encodeHex [c] <> "$" <> go rem + "$x" <> encodeHex [c] <> "$" <> go rem | otherwise = c : go rem go [] = [] encodeHex :: String -> String encodeHex = - Text.unpack . Text.toUpper . ByteString.encodeBase16 + Text.unpack + . Text.toUpper + . ByteString.encodeBase16 . encodeUtf8 . Text.pack in -- 'bare' suffix is to avoid clashes with non-bare repos initialized by earlier versions -- of ucm. go s <> "-bare" -gitCacheDir :: MonadIO m => Text -> m FilePath +gitCacheDir :: (MonadIO m) => Text -> m FilePath gitCacheDir url = getXdgDirectory XdgCache $ "unisonlanguage" "gitfiles" encodeFileName (Text.unpack url) -withStatus :: MonadIO m => String -> m a -> m a +withStatus :: (MonadIO m) => String -> m a -> m a withStatus str ma = do flushStr str a <- ma @@ -233,19 +235,19 @@ cloneIfMissing repo@(ReadGitRepo {url = uri}) localPath = do unless isGitDir . throwError $ GitError.UnrecognizableCheckoutDir repo localPath -- | See if `git` is on the system path. -checkForGit :: MonadIO m => MonadError GitProtocolError m => m () +checkForGit :: (MonadIO m) => (MonadError GitProtocolError m) => m () checkForGit = do gitPath <- liftIO $ findExecutable "git" when (isNothing gitPath) $ throwError GitError.NoGit -- | Returns the name of the default branch of a repository, if one exists. -getDefaultBranch :: MonadIO m => GitRepo -> m (Maybe Text) +getDefaultBranch :: (MonadIO m) => GitRepo -> m (Maybe Text) getDefaultBranch dir = liftIO $ do (Text.stripPrefix "refs/heads/" <$> gitTextIn dir ["symbolic-ref", "HEAD"]) $? pure Nothing -- | Does `git` recognize this directory as being managed by git? -isGitRepo :: MonadIO m => GitRepo -> m Bool +isGitRepo :: (MonadIO m) => GitRepo -> m Bool isGitRepo dir = liftIO $ (True <$ gitIn dir (["rev-parse"] ++ gitVerbosity)) $? pure False @@ -257,7 +259,7 @@ isEmptyGitRepo dir = liftIO do (gitTextIn dir (["rev-parse", "HEAD"] ++ gitVerbosity) $> False) $? pure True -- | Perform an IO action, passing any IO exception to `handler` -withIOError :: MonadIO m => IO a -> (IOException -> m a) -> m a +withIOError :: (MonadIO m) => IO a -> (IOException -> m a) -> m a withIOError action handler = liftIO (fmap Right action `Control.Exception.catch` (pure . Left)) >>= either handler pure @@ -289,27 +291,27 @@ setupGitDir dir = -- | Run a git command in the current work directory. -- Note: this should only be used for commands like 'clone' which don't interact with an -- existing repository. -gitGlobal :: MonadIO m => [Text] -> m () +gitGlobal :: (MonadIO m) => [Text] -> m () gitGlobal args = do when debugGit $ traceM (Text.unpack . Text.unwords $ ["$ git"] <> args) liftIO $ "git" $^ (args ++ gitVerbosity) -- | Run a git command in the repository at localPath -gitIn :: MonadIO m => GitRepo -> [Text] -> m () +gitIn :: (MonadIO m) => GitRepo -> [Text] -> m () gitIn localPath args = do when debugGit $ traceM (Text.unpack . Text.unwords $ ["$ git"] <> setupGitDir localPath <> args) liftIO $ "git" $^ (setupGitDir localPath <> args) -- | like 'gitIn', but silences all output from the command and returns whether the command -- succeeded. -gitInCaptured :: MonadIO m => GitRepo -> [Text] -> m (Bool, Text, Text) +gitInCaptured :: (MonadIO m) => GitRepo -> [Text] -> m (Bool, Text, Text) gitInCaptured localPath args = do when debugGit $ traceM (Text.unpack . Text.unwords $ ["$ git"] <> setupGitDir localPath <> args) (exitCode, stdout, stderr) <- UnliftIO.readProcessWithExitCode "git" (Text.unpack <$> setupGitDir localPath <> args) "" pure (exitCode == ExitSuccess, Text.pack stdout, Text.pack stderr) -- | Run a git command in the repository at localPath and capture stdout -gitTextIn :: MonadIO m => GitRepo -> [Text] -> m Text +gitTextIn :: (MonadIO m) => GitRepo -> [Text] -> m Text gitTextIn localPath args = do when debugGit $ traceM (Text.unpack . Text.unwords $ ["$ git"] <> setupGitDir localPath <> args) liftIO $ "git" $| setupGitDir localPath <> args diff --git a/parser-typechecker/src/Unison/Codebase/FileCodebase.hs b/parser-typechecker/src/Unison/Codebase/FileCodebase.hs index 03a5346ae..b5efd4e48 100644 --- a/parser-typechecker/src/Unison/Codebase/FileCodebase.hs +++ b/parser-typechecker/src/Unison/Codebase/FileCodebase.hs @@ -6,7 +6,7 @@ import Unison.Prelude (MonadIO) import UnliftIO.Directory (doesDirectoryExist) -- checks if a minimal codebase structure exists at `path` -codebaseExists :: MonadIO m => CodebasePath -> m Bool +codebaseExists :: (MonadIO m) => CodebasePath -> m Bool codebaseExists root = and <$> traverse doesDirectoryExist (minimalCodebaseStructure root) where diff --git a/parser-typechecker/src/Unison/Codebase/Init.hs b/parser-typechecker/src/Unison/Codebase/Init.hs index f2de5de2a..69a614586 100644 --- a/parser-typechecker/src/Unison/Codebase/Init.hs +++ b/parser-typechecker/src/Unison/Codebase/Init.hs @@ -86,7 +86,7 @@ data InitResult deriving (Show, Eq) createCodebaseWithResult :: - MonadIO m => + (MonadIO m) => Init m v a -> DebugName -> CodebasePath -> @@ -98,7 +98,7 @@ createCodebaseWithResult cbInit debugName dir lockOption action = errorMessage -> (dir, (CouldntCreateCodebase errorMessage)) withOpenOrCreateCodebase :: - MonadIO m => + (MonadIO m) => Init m v a -> DebugName -> CodebaseInitOptions -> @@ -136,7 +136,7 @@ withOpenOrCreateCodebase cbInit debugName initOptions lockOption migrationStrate OpenCodebaseRequiresMigration {} -> pure (Left (resolvedPath, InitErrorOpen err)) OpenCodebaseFileLockFailed {} -> pure (Left (resolvedPath, InitErrorOpen err)) -createCodebase :: MonadIO m => Init m v a -> DebugName -> CodebasePath -> CodebaseLockOption -> (Codebase m v a -> m r) -> m (Either Pretty r) +createCodebase :: (MonadIO m) => Init m v a -> DebugName -> CodebasePath -> CodebaseLockOption -> (Codebase m v a -> m r) -> m (Either Pretty r) createCodebase cbInit debugName path lockOption action = do prettyDir <- P.string <$> canonicalizePath path withCreatedCodebase cbInit debugName path lockOption action <&> mapLeft \case @@ -149,7 +149,7 @@ createCodebase cbInit debugName path lockOption action = do -- previously: initCodebaseOrExit :: CodebasePath -> m (m (), Codebase m v a) -- previously: FileCodebase.initCodebase :: CodebasePath -> m (m (), Codebase m v a) -withNewUcmCodebaseOrExit :: MonadIO m => Init m Symbol Ann -> DebugName -> CodebasePath -> CodebaseLockOption -> (Codebase m Symbol Ann -> m r) -> m r +withNewUcmCodebaseOrExit :: (MonadIO m) => Init m Symbol Ann -> DebugName -> CodebasePath -> CodebaseLockOption -> (Codebase m Symbol Ann -> m r) -> m r withNewUcmCodebaseOrExit cbInit debugName path lockOption action = do prettyDir <- P.string <$> canonicalizePath path let codebaseSetup codebase = do @@ -161,13 +161,13 @@ withNewUcmCodebaseOrExit cbInit debugName path lockOption action = do Right result -> pure result -- | try to init a codebase where none exists and then exit regardless (i.e. `ucm --codebase dir init`) -initCodebaseAndExit :: MonadIO m => Init m Symbol Ann -> DebugName -> Maybe CodebasePath -> CodebaseLockOption -> m () +initCodebaseAndExit :: (MonadIO m) => Init m Symbol Ann -> DebugName -> Maybe CodebasePath -> CodebaseLockOption -> m () initCodebaseAndExit i debugName mdir lockOption = do codebaseDir <- Codebase.getCodebaseDir mdir withNewUcmCodebaseOrExit i debugName codebaseDir lockOption (const $ pure ()) withTemporaryUcmCodebase :: - MonadUnliftIO m => + (MonadUnliftIO m) => Init m Symbol Ann -> DebugName -> CodebaseLockOption -> diff --git a/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs b/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs index 0d9b1eb97..008fb344b 100644 --- a/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs +++ b/parser-typechecker/src/Unison/Codebase/IntegrityCheck.hs @@ -203,7 +203,7 @@ integrityCheckAllBranches = do pure (Set.singleton $ MismatchedObjectForChild ch branchObjId foundBranchId) | otherwise -> pure mempty -prettyPrintIntegrityErrors :: Foldable f => f IntegrityError -> P.Pretty P.ColorText +prettyPrintIntegrityErrors :: (Foldable f) => f IntegrityError -> P.Pretty P.ColorText prettyPrintIntegrityErrors xs | null xs = mempty | otherwise = diff --git a/parser-typechecker/src/Unison/Codebase/MainTerm.hs b/parser-typechecker/src/Unison/Codebase/MainTerm.hs index 1564b8020..d62df18b3 100644 --- a/parser-typechecker/src/Unison/Codebase/MainTerm.hs +++ b/parser-typechecker/src/Unison/Codebase/MainTerm.hs @@ -56,25 +56,25 @@ getMainTerm loadTypeOfTerm parseNames mainName mainType = _ -> pure (error "multiple matching refs") -- TODO: make a real exception -- forall x. '{ io2.IO, Exception } x -builtinMain :: Var v => a -> Type.Type v a +builtinMain :: (Var v) => a -> Type.Type v a builtinMain a = let result = Var.named "result" in Type.forall a result (builtinMainWithResultType a (Type.var a result)) -- '{io2.IO, Exception} res -builtinMainWithResultType :: Var v => a -> Type.Type v a -> Type.Type v a +builtinMainWithResultType :: (Var v) => a -> Type.Type v a -> Type.Type v a builtinMainWithResultType a res = Type.arrow a (Type.ref a DD.unitRef) io where io = Type.effect a [Type.builtinIO a, DD.exceptionType a] res -- [Result] -resultArr :: Ord v => a -> Type.Type v a +resultArr :: (Ord v) => a -> Type.Type v a resultArr a = Type.app a (Type.ref a Type.listRef) (Type.ref a DD.testResultRef) -builtinResultArr :: Ord v => a -> Type.Type v a +builtinResultArr :: (Ord v) => a -> Type.Type v a builtinResultArr a = Type.effect a [Type.builtinIO a, DD.exceptionType a] (resultArr a) -- '{io2.IO} [Result] -builtinTest :: Ord v => a -> Type.Type v a +builtinTest :: (Ord v) => a -> Type.Type v a builtinTest a = Type.arrow a (Type.ref a DD.unitRef) (builtinResultArr a) diff --git a/parser-typechecker/src/Unison/Codebase/Metadata.hs b/parser-typechecker/src/Unison/Codebase/Metadata.hs index 8f66e70db..4ca5c0bf6 100644 --- a/parser-typechecker/src/Unison/Codebase/Metadata.hs +++ b/parser-typechecker/src/Unison/Codebase/Metadata.hs @@ -31,7 +31,7 @@ starToR4 :: (Ord r, Ord n) => Star r n -> Relation4 r n Type Value starToR4 = R4.fromList . starToR4List -- | Flattens a Metadata.Star into a 4-tuple. -starToR4List :: Ord r => Star r n -> [(r, n, Type, Value)] +starToR4List :: (Ord r) => Star r n -> [(r, n, Type, Value)] starToR4List s = [ (f, x, y, z) | f <- Set.toList (Star3.fact s), @@ -39,14 +39,14 @@ starToR4List s = (y, z) <- Set.toList (R.lookupDom f (Star3.d3 s)) ] -hasMetadata :: Ord a => a -> Type -> Value -> Star a n -> Bool +hasMetadata :: (Ord a) => a -> Type -> Value -> Star a n -> Bool hasMetadata a t v = Set.member (t, v) . R.lookupDom a . Star3.d3 -hasMetadataWithType' :: Ord a => a -> Type -> R4 a n -> Bool +hasMetadataWithType' :: (Ord a) => a -> Type -> R4 a n -> Bool hasMetadataWithType' = R4.memberD13 -hasMetadataWithType :: Ord a => a -> Type -> Star a n -> Bool +hasMetadataWithType :: (Ord a) => a -> Type -> Star a n -> Bool hasMetadataWithType a t = Set.member t . R.lookupDom a . Star3.d2 inserts :: (Ord a, Ord n) => [(a, Type, Value)] -> Star a n -> Star a n diff --git a/parser-typechecker/src/Unison/Codebase/Path.hs b/parser-typechecker/src/Unison/Codebase/Path.hs index 49484c0d9..18f75f64f 100644 --- a/parser-typechecker/src/Unison/Codebase/Path.hs +++ b/parser-typechecker/src/Unison/Codebase/Path.hs @@ -527,7 +527,7 @@ instance Convert (path, NameSegment) (path, HQ'.HQSegment) where convert (path, name) = (path, HQ'.fromName name) -instance Convert path0 path1 => Convert (path0, name) (path1, name) where +instance (Convert path0 path1) => Convert (path0, name) (path1, name) where convert = over _1 convert diff --git a/parser-typechecker/src/Unison/Codebase/RootBranchCache.hs b/parser-typechecker/src/Unison/Codebase/RootBranchCache.hs index 6fed979dc..1c7bd0eab 100644 --- a/parser-typechecker/src/Unison/Codebase/RootBranchCache.hs +++ b/parser-typechecker/src/Unison/Codebase/RootBranchCache.hs @@ -36,7 +36,7 @@ data RootBranchCacheVal -- This is isomorphic to @TMVar (Maybe (Branch Sqlite.Transaction))@ newtype RootBranchCache = RootBranchCache (TVar RootBranchCacheVal) -newEmptyRootBranchCacheIO :: MonadIO m => m RootBranchCache +newEmptyRootBranchCacheIO :: (MonadIO m) => m RootBranchCache newEmptyRootBranchCacheIO = liftIO (coerce $ newTVarIO Empty) newEmptyRootBranchCache :: STM RootBranchCache @@ -57,7 +57,7 @@ readRootBranchCache v = ConcurrentModification -> retrySTM Full x -> pure (Just x) -fetchRootBranch :: forall m. MonadUnliftIO m => RootBranchCache -> m (Branch Sqlite.Transaction) -> m (Branch Sqlite.Transaction) +fetchRootBranch :: forall m. (MonadUnliftIO m) => RootBranchCache -> m (Branch Sqlite.Transaction) -> m (Branch Sqlite.Transaction) fetchRootBranch rbc getFromDb = mask \restore -> do join (atomically (fetch restore)) where @@ -78,7 +78,7 @@ fetchRootBranch rbc getFromDb = mask \restore -> do -- the cache to Empty or Full withLock :: forall m r. - MonadUnliftIO m => + (MonadUnliftIO m) => RootBranchCache -> -- | Perform an action with the cached value ( -- restore masking state diff --git a/parser-typechecker/src/Unison/Codebase/Runtime.hs b/parser-typechecker/src/Unison/Codebase/Runtime.hs index 2b79285b6..03e4c21fb 100644 --- a/parser-typechecker/src/Unison/Codebase/Runtime.hs +++ b/parser-typechecker/src/Unison/Codebase/Runtime.hs @@ -70,7 +70,7 @@ type WatchResults v a = -- can be skipped. evaluateWatches :: forall v a. - Var v => + (Var v) => CL.CodeLookup v IO a -> PPE.PrettyPrintEnv -> (Reference.Id -> IO (Maybe (Term v))) -> diff --git a/parser-typechecker/src/Unison/Codebase/Serialization.hs b/parser-typechecker/src/Unison/Codebase/Serialization.hs index 85deaf6c4..565f0d7f4 100644 --- a/parser-typechecker/src/Unison/Codebase/Serialization.hs +++ b/parser-typechecker/src/Unison/Codebase/Serialization.hs @@ -10,9 +10,9 @@ import UnliftIO (MonadIO, liftIO) import UnliftIO.Directory (createDirectoryIfMissing, doesFileExist) import Prelude hiding (readFile, writeFile) -type Get a = forall m. MonadGet m => m a +type Get a = forall m. (MonadGet m) => m a -type Put a = forall m. MonadPut m => a -> m () +type Put a = forall m. (MonadPut m) => a -> m () -- todo: do we use this? data Format a = Format @@ -24,12 +24,12 @@ getFromBytes :: Get a -> ByteString -> Maybe a getFromBytes getA bytes = case runGetS getA bytes of Left _ -> Nothing; Right a -> Just a -getFromFile :: MonadIO m => Get a -> FilePath -> m (Maybe a) +getFromFile :: (MonadIO m) => Get a -> FilePath -> m (Maybe a) getFromFile getA file = do b <- doesFileExist file if b then getFromBytes getA <$> liftIO (readFile file) else pure Nothing -getFromFile' :: MonadIO m => Get a -> FilePath -> m (Either String a) +getFromFile' :: (MonadIO m) => Get a -> FilePath -> m (Either String a) getFromFile' getA file = do b <- doesFileExist file if b @@ -39,7 +39,7 @@ getFromFile' getA file = do putBytes :: Put a -> a -> ByteString putBytes put a = runPutS (put a) -putWithParentDirs :: MonadIO m => Put a -> FilePath -> a -> m () +putWithParentDirs :: (MonadIO m) => Put a -> FilePath -> a -> m () putWithParentDirs putA file a = do createDirectoryIfMissing True (takeDirectory file) liftIO . writeFile file $ putBytes putA a diff --git a/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs b/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs index 7156962f9..75f8095d8 100644 --- a/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs +++ b/parser-typechecker/src/Unison/Codebase/ShortCausalHash.hs @@ -20,10 +20,10 @@ newtype ShortCausalHash = ShortCausalHash {toText :: Text} -- base32hex characte toString :: ShortCausalHash -> String toString = Text.unpack . toText -toHash :: Coercible Hash.Hash h => ShortCausalHash -> Maybe h +toHash :: (Coercible Hash.Hash h) => ShortCausalHash -> Maybe h toHash = fmap coerce . Hash.fromBase32HexText . toText -fromHash :: Coercible h Hash.Hash => Int -> h -> ShortCausalHash +fromHash :: (Coercible h Hash.Hash) => Int -> h -> ShortCausalHash fromHash len = ShortCausalHash . Text.take len . Hash.toBase32HexText . coerce diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs index 1e9ca9dcd..4848b4964 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs @@ -88,7 +88,7 @@ debug, debugProcessBranches :: Bool debug = False debugProcessBranches = False -init :: HasCallStack => (MonadUnliftIO m) => Codebase.Init m Symbol Ann +init :: (HasCallStack) => (MonadUnliftIO m) => Codebase.Init m Symbol Ann init = Codebase.Init { withOpenCodebase = withCodebaseOrError, @@ -103,7 +103,7 @@ data CodebaseStatus -- | Open the codebase at the given location, or create it if one doesn't already exist. withOpenOrCreateCodebase :: - MonadUnliftIO m => + (MonadUnliftIO m) => Codebase.DebugName -> CodebasePath -> LocalOrRemote -> @@ -159,7 +159,7 @@ withCodebaseOrError debugName dir lockOption migrationStrategy action = do False -> pure (Left Codebase1.OpenCodebaseDoesntExist) True -> sqliteCodebase debugName dir Local lockOption migrationStrategy action -initSchemaIfNotExist :: MonadIO m => FilePath -> m () +initSchemaIfNotExist :: (MonadIO m) => FilePath -> m () initSchemaIfNotExist path = liftIO do unlessM (doesDirectoryExist $ makeCodebaseDirPath path) $ createDirectoryIfMissing True (makeCodebaseDirPath path) @@ -176,7 +176,7 @@ initSchemaIfNotExist path = liftIO do -- | Run an action with a connection to the codebase, closing the connection on completion or -- failure. withConnection :: - MonadUnliftIO m => + (MonadUnliftIO m) => Codebase.DebugName -> CodebasePath -> (Sqlite.Connection -> m a) -> @@ -186,7 +186,7 @@ withConnection name root action = sqliteCodebase :: forall m r. - MonadUnliftIO m => + (MonadUnliftIO m) => Codebase.DebugName -> CodebasePath -> -- | When local, back up the existing codebase before migrating, in case there's a catastrophic bug in the migration. @@ -222,7 +222,7 @@ sqliteCodebase debugName root localOrRemote lockOption migrationStrategy action case result of Left err -> pure $ Left err Right () -> do - let finalizer :: MonadIO m => m () + let finalizer :: (MonadIO m) => m () finalizer = do decls <- readTVarIO declBuffer terms <- readTVarIO termBuffer @@ -397,7 +397,7 @@ sqliteCodebase debugName root localOrRemote lockOption migrationStrategy action syncInternal :: forall m. - MonadUnliftIO m => + (MonadUnliftIO m) => Sync.Progress m Sync22.Entity -> (forall a. Sqlite.Transaction a -> m a) -> (forall a. Sqlite.Transaction a -> m a) -> @@ -485,7 +485,7 @@ data SyncProgressState = SyncProgressState emptySyncProgressState :: SyncProgressState emptySyncProgressState = SyncProgressState (Just mempty) (Right mempty) (Right mempty) -syncProgress :: forall m. MonadIO m => IORef SyncProgressState -> Sync.Progress m Sync22.Entity +syncProgress :: forall m. (MonadIO m) => IORef SyncProgressState -> Sync.Progress m Sync22.Entity syncProgress progressStateRef = Sync.Progress (liftIO . need) (liftIO . done) (liftIO . warn) (liftIO allDone) where quiet = False @@ -546,7 +546,9 @@ syncProgress progressStateRef = Sync.Progress (liftIO . need) (liftIO . done) (l SyncProgressState Nothing (Left done) (Left warn) -> "\r" ++ prefix ++ show done ++ " entities" ++ if warn > 0 then " with " ++ show warn ++ " warnings." else "." SyncProgressState (Just _need) (Right done) (Right warn) -> - "\r" ++ prefix ++ show (Set.size done + Set.size warn) + "\r" + ++ prefix + ++ show (Set.size done + Set.size warn) ++ " entities" ++ if Set.size warn > 0 then " with " ++ show (Set.size warn) ++ " warnings." @@ -612,7 +614,7 @@ viewRemoteBranch' ReadGitRemoteNamespace {repo, sch, path} gitBranchBehavior act -- the existing root. pushGitBranch :: forall m e. - MonadUnliftIO m => + (MonadUnliftIO m) => Sqlite.Connection -> WriteGitRepo -> PushGitBranchOpts -> @@ -728,7 +730,7 @@ pushGitBranch srcConn repo (PushGitBranchOpts behavior _syncMode) action = Unlif hasDeleteShm = any isShmDelete statusLines -- Commit our changes - push :: forall n. MonadIO n => Git.GitRepo -> WriteGitRepo -> Branch m -> n Bool -- withIOError needs IO + push :: forall n. (MonadIO n) => Git.GitRepo -> WriteGitRepo -> Branch m -> n Bool -- withIOError needs IO push remotePath repo@(WriteGitRepo {url, branch = mayGitBranch}) newRootBranch = time "SqliteCodebase.pushGitRootBranch.push" $ do -- has anything changed? -- note: -uall recursively shows status for all files in untracked directories diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Cache.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Cache.hs index 43ef4701b..b5f792ef9 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Cache.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Cache.hs @@ -18,7 +18,7 @@ data BranchCache m = BranchCache -- as long as they're reachable by something else in the app. -- -- This means you don't need to worry about a Branch not being GC'd because it's in the cache. -newBranchCache :: forall m. MonadIO m => m (BranchCache Sqlite.Transaction) +newBranchCache :: forall m. (MonadIO m) => m (BranchCache Sqlite.Transaction) newBranchCache = do var <- newTVarIO mempty pure $ diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Dependencies.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Dependencies.hs index 323738fb4..3dc0941fd 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Dependencies.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Branch/Dependencies.hs @@ -50,7 +50,7 @@ data Dependencies' = Dependencies' to' :: Dependencies -> Dependencies' to' Dependencies {..} = Dependencies' (toList patches) (toList terms) (toList decls) -fromBranch :: Applicative m => Branch m -> (Branches m, Dependencies) +fromBranch :: (Applicative m) => Branch m -> (Branches m, Dependencies) fromBranch (Branch c) = case c of Causal.One _hh _eh e -> fromBranch0 e Causal.Cons _hh _eh e (h, m) -> fromBranch0 e <> fromTails (Map.singleton h m) @@ -58,7 +58,7 @@ fromBranch (Branch c) = case c of where fromTails m = ([(h, Branch <$> mc) | (h, mc) <- Map.toList m], mempty) -fromBranch0 :: Applicative m => Branch0 m -> (Branches m, Dependencies) +fromBranch0 :: (Applicative m) => Branch0 m -> (Branches m, Dependencies) fromBranch0 b = ( fromChildren (Branch._children b), fromTermsStar (Branch._terms b) @@ -66,7 +66,7 @@ fromBranch0 b = <> fromEdits (Branch._edits b) ) where - fromChildren :: Applicative m => Map NameSegment (Branch m) -> Branches m + fromChildren :: (Applicative m) => Map NameSegment (Branch m) -> Branches m fromChildren m = [(Branch.headHash b, pure b) | b <- toList m] references :: Branch.Star r NameSegment -> [r] references = toList . R.dom . Star3.d1 diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs index 4bb81f59d..7de8e842f 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Conversions.hs @@ -142,13 +142,13 @@ term1to2 h = V1.Pattern.Snoc -> V2.Term.PSnoc V1.Pattern.Concat -> V2.Term.PConcat -term2to1 :: forall m. Monad m => Hash -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.Term V2.Symbol -> m (V1.Term.Term V1.Symbol Ann) +term2to1 :: forall m. (Monad m) => Hash -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.Term V2.Symbol -> m (V1.Term.Term V1.Symbol Ann) term2to1 h lookupCT = ABT.transformM (termF2to1 h lookupCT) . ABT.vmap symbol2to1 . ABT.amap (const Ann.External) where - termF2to1 :: forall m a. Monad m => Hash -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a) + termF2to1 :: forall m a. (Monad m) => Hash -> (V2.Reference -> m CT.ConstructorType) -> V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a) termF2to1 h lookupCT = go where go :: V2.Term.F V2.Symbol a -> m (V1.Term.F V1.Symbol Ann Ann a) @@ -294,7 +294,7 @@ referenceid1to2 (V1.Reference.Id h i) = V2.Reference.Id h i referenceid2to1 :: V2.Reference.Id -> V1.Reference.Id referenceid2to1 (V2.Reference.Id h i) = V1.Reference.Id h i -rreferent2to1 :: Applicative m => Hash -> (V2.Reference -> m CT.ConstructorType) -> V2.ReferentH -> m V1.Referent +rreferent2to1 :: (Applicative m) => Hash -> (V2.Reference -> m CT.ConstructorType) -> V2.ReferentH -> m V1.Referent rreferent2to1 h lookupCT = \case V2.Ref r -> pure . V1.Ref $ rreference2to1 h r V2.Con r i -> V1.Con (V1.ConstructorReference (reference2to1 r) (fromIntegral i)) <$> lookupCT r @@ -304,7 +304,7 @@ rreferent1to2 h = \case V1.Ref r -> V2.Ref (rreference1to2 h r) V1.Con (V1.ConstructorReference r i) _ct -> V2.Con (reference1to2 r) (fromIntegral i) -referent2to1 :: Applicative m => (V2.Reference -> m CT.ConstructorType) -> V2.Referent -> m V1.Referent +referent2to1 :: (Applicative m) => (V2.Reference -> m CT.ConstructorType) -> V2.Referent -> m V1.Referent referent2to1 lookupCT = \case V2.Ref r -> pure $ V1.Ref (reference2to1 r) V2.Con r i -> V1.Con (V1.ConstructorReference (reference2to1 r) (fromIntegral i)) <$> lookupCT r @@ -314,7 +314,7 @@ referent1to2 = \case V1.Ref r -> V2.Ref $ reference1to2 r V1.Con (V1.ConstructorReference r i) _ct -> V2.Con (reference1to2 r) (fromIntegral i) -referentid2to1 :: Applicative m => (V2.Reference -> m CT.ConstructorType) -> V2.Referent.Id -> m V1.Referent.Id +referentid2to1 :: (Applicative m) => (V2.Reference -> m CT.ConstructorType) -> V2.Referent.Id -> m V1.Referent.Id referentid2to1 lookupCT = \case V2.RefId r -> pure $ V1.RefId (referenceid2to1 r) V2.ConId r i -> @@ -385,7 +385,7 @@ type1to2' convertRef = V1.Kind.Arrow i o -> V2.Kind.Arrow (convertKind i) (convertKind o) -- | forces loading v1 branches even if they may not exist -causalbranch2to1 :: Monad m => BranchCache m -> (V2.Reference -> m CT.ConstructorType) -> V2.Branch.CausalBranch m -> m (V1.Branch.Branch m) +causalbranch2to1 :: (Monad m) => BranchCache m -> (V2.Reference -> m CT.ConstructorType) -> V2.Branch.CausalBranch m -> m (V1.Branch.Branch m) causalbranch2to1 branchCache lookupCT cb = do let ch = V2.causalHash cb lookupCachedBranch branchCache ch >>= \case @@ -395,7 +395,7 @@ causalbranch2to1 branchCache lookupCT cb = do insertCachedBranch branchCache ch b pure b -causalbranch2to1' :: Monad m => BranchCache m -> (V2.Reference -> m CT.ConstructorType) -> V2.Branch.CausalBranch m -> m (V1.Branch.UnwrappedBranch m) +causalbranch2to1' :: (Monad m) => BranchCache m -> (V2.Reference -> m CT.ConstructorType) -> V2.Branch.CausalBranch m -> m (V1.Branch.UnwrappedBranch m) causalbranch2to1' branchCache lookupCT (V2.Causal currentHash eh (Map.toList -> parents) me) = do let branchHash = branchHash2to1 eh case parents of @@ -409,18 +409,18 @@ causalbranch2to1' branchCache lookupCT (V2.Causal currentHash eh (Map.toList -> e <- me V1.Causal.UnsafeMerge currentHash branchHash <$> branch2to1 branchCache lookupCT e <*> pure (Map.fromList tailsList) -causalbranch1to2 :: forall m. Monad m => V1.Branch.Branch m -> V2.Branch.CausalBranch m +causalbranch1to2 :: forall m. (Monad m) => V1.Branch.Branch m -> V2.Branch.CausalBranch m causalbranch1to2 (V1.Branch.Branch c) = causal1to2 branchHash1to2 branch1to2 c where - causal1to2 :: forall m h2e e e2. Monad m => (V1.HashFor e -> h2e) -> (e -> m e2) -> V1.Causal.Causal m e -> V2.Causal m CausalHash h2e e2 + causal1to2 :: forall m h2e e e2. (Monad m) => (V1.HashFor e -> h2e) -> (e -> m e2) -> V1.Causal.Causal m e -> V2.Causal m CausalHash h2e e2 causal1to2 eh1to2 e1to2 = \case V1.Causal.One hc eh e -> V2.Causal hc (eh1to2 eh) Map.empty (e1to2 e) V1.Causal.Cons hc eh e (ht, mt) -> V2.Causal hc (eh1to2 eh) (Map.singleton ht (causal1to2 eh1to2 e1to2 <$> mt)) (e1to2 e) V1.Causal.Merge hc eh e parents -> V2.Causal hc (eh1to2 eh) (Map.map (causal1to2 eh1to2 e1to2 <$>) parents) (e1to2 e) -- todo: this could be a pure function - branch1to2 :: forall m. Monad m => V1.Branch.Branch0 m -> m (V2.Branch.Branch m) + branch1to2 :: forall m. (Monad m) => V1.Branch.Branch0 m -> m (V2.Branch.Branch m) branch1to2 b = pure $ V2.Branch.Branch @@ -508,7 +508,7 @@ patch1to2 (V1.Patch v1termedits v1typeedits) = V2.Branch.Patch v2termedits v2typ V1.TermEdit.Different -> V2.TermEdit.Different branch2to1 :: - Monad m => + (Monad m) => BranchCache m -> (V2.Reference -> m CT.ConstructorType) -> V2.Branch.Branch m -> diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs index 368fd415d..f9563f992 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs @@ -82,7 +82,7 @@ checkCodebaseIsUpToDate = do -- This is a No-op if it's up to date -- Returns an error if the schema version is newer than this ucm knows about. ensureCodebaseIsUpToDate :: - MonadIO m => + (MonadIO m) => LocalOrRemote -> CodebasePath -> -- | A 'getDeclType'-like lookup, possibly backed by a cache. diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs index af8726074..b9543851e 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema1To2.hs @@ -312,7 +312,8 @@ migrateBranch oldObjectId = fmap (either id id) . runExceptT $ do ++ allMissingChildCausals when (not . null $ allMissingReferences) $ - throwE $ Sync.Missing allMissingReferences + throwE $ + Sync.Missing allMissingReferences let remapPatchObjectId patchObjId = case Map.lookup (unPatchObjectId patchObjId) migratedObjects of Nothing -> error $ "Expected patch: " <> show patchObjId <> " to be migrated" @@ -554,7 +555,9 @@ migrateTermComponent getDeclType termBuffer declBuffer oldHash = fmap (either id in filter (`Map.notMember` referencesMap) (missingTermRefs <> missingTypeRefs) when (not . null $ allMissingReferences) $ - throwE $ Sync.Missing . nubOrd $ (someReferenceIdToEntity <$> allMissingReferences) + throwE $ + Sync.Missing . nubOrd $ + (someReferenceIdToEntity <$> allMissingReferences) let getMigratedReference :: Old SomeReferenceId -> New SomeReferenceId getMigratedReference ref = @@ -648,7 +651,7 @@ migrateDeclComponent termBuffer declBuffer oldHash = fmap (either id id) . runEx . DD.constructors_ -- Get the data constructors . traversed -- traverse the list of them . _3 -- Select the Type term. - %~ remapTerm + %~ remapTerm let declNameToOldReference :: Map (DeclName v) (Old Reference.Id) declNameToOldReference = Map.fromList . fmap swap . Map.toList . fmap fst $ remappedReferences diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema3To4.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema3To4.hs index b83aa8af0..6bfe6a6f1 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema3To4.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema3To4.hs @@ -218,12 +218,13 @@ rehashAndCanonicalizeNamespace causalHashId possiblyIncorrectNamespaceHashId obj -- get a list of any unmigrated children, and also track whether any re-mappings actually -- occurred, so we don't do extra work when nothing changed. let ((unmigratedChildren, Any changes), remappedBranch) = - dbBranch & DBBranch.childrenHashes_ %%~ \(ids@(childBranchObjId, childCausalHashId)) -> do - case Map.lookup childCausalHashId canonicalBranchForCausalMap of - Nothing -> (([childCausalHashId], Any False), ids) - Just (_, canonicalObjId) -> - let changed = canonicalObjId /= childBranchObjId - in (([], Any changed), (canonicalObjId, childCausalHashId)) + dbBranch + & DBBranch.childrenHashes_ %%~ \(ids@(childBranchObjId, childCausalHashId)) -> do + case Map.lookup childCausalHashId canonicalBranchForCausalMap of + Nothing -> (([childCausalHashId], Any False), ids) + Just (_, canonicalObjId) -> + let changed = canonicalObjId /= childBranchObjId + in (([], Any changed), (canonicalObjId, childCausalHashId)) when (not . null $ unmigratedChildren) $ throwError (Sync.Missing unmigratedChildren) when changes $ do liftT $ replaceBranch objId remappedBranch diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs index edef2cba8..b4677640d 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs @@ -96,9 +96,11 @@ data BufferEntry a = BufferEntry } deriving (Eq, Show) -prettyBufferEntry :: Show a => Hash -> BufferEntry a -> String +prettyBufferEntry :: (Show a) => Hash -> BufferEntry a -> String prettyBufferEntry (h :: Hash) BufferEntry {..} = - "BufferEntry " ++ show h ++ "\n" + "BufferEntry " + ++ show h + ++ "\n" ++ " { beComponentTargetSize = " ++ show beComponentTargetSize ++ "\n" @@ -721,7 +723,7 @@ initializeNameLookupIndexFromV2Root getDeclType = do -- Collects two maps, one with all term names and one with all type names. -- Note that unlike the `Name` type in `unison-core1`, this list of name segments is -- in reverse order, e.g. `["map", "List", "base"]` - nameMapsFromV2Branch :: Monad m => [NameSegment] -> V2Branch.CausalBranch m -> m (Map (NonEmpty NameSegment) (Set C.Referent.Referent), Map (NonEmpty NameSegment) (Set C.Reference.Reference)) + nameMapsFromV2Branch :: (Monad m) => [NameSegment] -> V2Branch.CausalBranch m -> m (Map (NonEmpty NameSegment) (Set C.Referent.Referent), Map (NonEmpty NameSegment) (Set C.Reference.Reference)) nameMapsFromV2Branch reversedNamePrefix cb = do b <- V2Causal.value cb let (shallowTermNames, shallowTypeNames) = (Map.keysSet <$> V2Branch.terms b, Map.keysSet <$> V2Branch.types b) diff --git a/parser-typechecker/src/Unison/Codebase/TermEdit/Typing.hs b/parser-typechecker/src/Unison/Codebase/TermEdit/Typing.hs index 1d9db07a0..c2ca1d4ef 100644 --- a/parser-typechecker/src/Unison/Codebase/TermEdit/Typing.hs +++ b/parser-typechecker/src/Unison/Codebase/TermEdit/Typing.hs @@ -5,7 +5,7 @@ import Unison.Type (Type) import qualified Unison.Typechecker as Typechecker import Unison.Var (Var) -typing :: Var v => Type v loc -> Type v loc -> Typing +typing :: (Var v) => Type v loc -> Type v loc -> Typing typing newType oldType | Typechecker.isEqual newType oldType = Same | Typechecker.isSubtype newType oldType = Subtype diff --git a/parser-typechecker/src/Unison/Codebase/Watch.hs b/parser-typechecker/src/Unison/Codebase/Watch.hs index 063f55549..609de3b8b 100644 --- a/parser-typechecker/src/Unison/Codebase/Watch.hs +++ b/parser-typechecker/src/Unison/Codebase/Watch.hs @@ -35,11 +35,11 @@ import UnliftIO.MVar ) import UnliftIO.STM (atomically) -untilJust :: Monad m => m (Maybe a) -> m a +untilJust :: (Monad m) => m (Maybe a) -> m a untilJust act = act >>= maybe (untilJust act) return watchDirectory' :: - forall m. MonadIO m => FilePath -> m (IO (), IO (FilePath, UTCTime)) + forall m. (MonadIO m) => FilePath -> m (IO (), IO (FilePath, UTCTime)) watchDirectory' d = do mvar <- newEmptyMVar let handler :: Event -> IO () @@ -85,7 +85,7 @@ collectUntilPause queue minPauseµsec = do watchDirectory :: forall m. - MonadIO m => + (MonadIO m) => FilePath -> (FilePath -> Bool) -> m (IO (), IO (FilePath, Text)) @@ -126,7 +126,8 @@ watchDirectory dir allow = do forever $ do event@(file, _) <- watcher when (allow file) $ - STM.atomically $ TQueue.enqueue queue event + STM.atomically $ + TQueue.enqueue queue event pending <- newIORef [] let await :: IO (FilePath, Text) await = diff --git a/parser-typechecker/src/Unison/CodebasePath.hs b/parser-typechecker/src/Unison/CodebasePath.hs index 49554b478..2a1d9ecaf 100644 --- a/parser-typechecker/src/Unison/CodebasePath.hs +++ b/parser-typechecker/src/Unison/CodebasePath.hs @@ -10,5 +10,5 @@ import UnliftIO.Directory (getHomeDirectory) -- | A directory that contains a codebase. type CodebasePath = FilePath -getCodebaseDir :: MonadIO m => Maybe CodebasePath -> m CodebasePath +getCodebaseDir :: (MonadIO m) => Maybe CodebasePath -> m CodebasePath getCodebaseDir = maybe getHomeDirectory pure diff --git a/parser-typechecker/src/Unison/FileParsers.hs b/parser-typechecker/src/Unison/FileParsers.hs index 9a9934182..678141e27 100644 --- a/parser-typechecker/src/Unison/FileParsers.hs +++ b/parser-typechecker/src/Unison/FileParsers.hs @@ -52,7 +52,7 @@ type Result' v = Result (Seq (Note v Ann)) debug :: Bool debug = False -convertNotes :: Ord v => Typechecker.Notes v ann -> Seq (Note v ann) +convertNotes :: (Ord v) => Typechecker.Notes v ann -> Seq (Note v ann) convertNotes (Typechecker.Notes bugs es is) = (CompilerBug . TypecheckerBug <$> bugs) <> (TypeError <$> es) <> (TypeInfo <$> Seq.fromList is') where @@ -137,7 +137,7 @@ resolveNames typeLookupf preexistingNames uf = do synthesizeFile' :: forall v. - Var v => + (Var v) => [Type v] -> TL.TypeLookup v Ann -> UnisonFile v -> @@ -147,7 +147,7 @@ synthesizeFile' ambient tl uf = synthesizeFile :: forall v. - Var v => + (Var v) => [Type v] -> TL.TypeLookup v Ann -> TDNRMap v -> diff --git a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs index c05cfee9a..22ce23ded 100644 --- a/parser-typechecker/src/Unison/Hashing/V2/Convert.hs +++ b/parser-typechecker/src/Unison/Hashing/V2/Convert.hs @@ -54,10 +54,10 @@ import qualified Unison.Util.Relation as Relation import qualified Unison.Util.Star3 as Memory.Star3 import Unison.Var (Var) -typeToReference :: Var v => Memory.Type.Type v a -> Memory.Reference.Reference +typeToReference :: (Var v) => Memory.Type.Type v a -> Memory.Reference.Reference typeToReference = h2mReference . Hashing.typeToReference . m2hType . Memory.Type.removeAllEffectVars -typeToReferenceMentions :: Var v => Memory.Type.Type v a -> Set Memory.Reference.Reference +typeToReferenceMentions :: (Var v) => Memory.Type.Type v a -> Set Memory.Reference.Reference typeToReferenceMentions = Set.map h2mReference . Hashing.typeToReferenceMentions . m2hType . Memory.Type.removeAllEffectVars @@ -65,7 +65,7 @@ typeToReferenceMentions = -- include type in hash hashTermComponents :: forall v a. - Var v => + (Var v) => Map v (Memory.Term.Term v a, Memory.Type.Type v a) -> Map v (Memory.Reference.Id, Memory.Term.Term v a, Memory.Type.Type v a) hashTermComponents mTerms = @@ -73,7 +73,7 @@ hashTermComponents mTerms = (hTerms, constructorTypes) -> h2mTermResult (constructorTypes Map.!) <$> Hashing.hashTermComponents hTerms where h2mTermResult :: - Ord v => + (Ord v) => ( Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType ) -> @@ -86,20 +86,20 @@ hashTermComponents mTerms = -- saving them. hashTermComponentsWithoutTypes :: forall v a. - Var v => + (Var v) => Map v (Memory.Term.Term v a) -> Map v (Memory.Reference.Id, Memory.Term.Term v a) hashTermComponentsWithoutTypes mTerms = case Writer.runWriter (traverse m2hTerm mTerms) of (hTerms, constructorTypes) -> h2mTermResult (constructorTypes Map.!) <$> Hashing.hashTermComponentsWithoutTypes hTerms where - h2mTermResult :: Ord v => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> (Hashing.ReferenceId, Hashing.Term v a) -> (Memory.Reference.Id, Memory.Term.Term v a) + h2mTermResult :: (Ord v) => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> (Hashing.ReferenceId, Hashing.Term v a) -> (Memory.Reference.Id, Memory.Term.Term v a) h2mTermResult getCtorType (id, tm) = (h2mReferenceId id, h2mTerm getCtorType tm) -hashClosedTerm :: Var v => Memory.Term.Term v a -> Memory.Reference.Id +hashClosedTerm :: (Var v) => Memory.Term.Term v a -> Memory.Reference.Id hashClosedTerm = h2mReferenceId . Hashing.hashClosedTerm . fst . Writer.runWriter . m2hTerm -m2hTerm :: Ord v => Memory.Term.Term v a -> Writer (Map Memory.Reference.Reference Memory.ConstructorType.ConstructorType) (Hashing.Term v a) +m2hTerm :: (Ord v) => Memory.Term.Term v a -> Writer (Map Memory.Reference.Reference Memory.ConstructorType.ConstructorType) (Hashing.Term v a) m2hTerm = ABT.transformM \case Memory.Term.Int i -> pure (Hashing.TermInt i) Memory.Term.Nat n -> pure (Hashing.TermNat n) @@ -160,7 +160,7 @@ m2hReferent = \case Writer.tell (Map.singleton ref ct) pure (Hashing.ReferentCon (m2hReference ref) n) -h2mTerm :: Ord v => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> Hashing.Term v a -> Memory.Term.Term v a +h2mTerm :: (Ord v) => (Memory.Reference.Reference -> Memory.ConstructorType.ConstructorType) -> Hashing.Term v a -> Memory.Term.Term v a h2mTerm getCT = ABT.transform \case Hashing.TermInt i -> Memory.Term.Int i Hashing.TermNat n -> Memory.Term.Nat n @@ -222,7 +222,7 @@ h2mReferent getCT = \case in Memory.Referent.Con (Memory.ConstructorReference.ConstructorReference mRef n) (getCT mRef) hashDataDecls :: - Var v => + (Var v) => Map v (Memory.DD.DataDeclaration v a) -> ResolutionResult v a [(v, Memory.Reference.Id, Memory.DD.DataDeclaration v a)] hashDataDecls memDecls = do @@ -230,11 +230,11 @@ hashDataDecls memDecls = do hashingResult <- Hashing.hashDecls Name.unsafeFromVar hashingDecls pure $ map h2mDeclResult hashingResult where - h2mDeclResult :: Ord v => (v, Hashing.ReferenceId, Hashing.DataDeclaration v a) -> (v, Memory.Reference.Id, Memory.DD.DataDeclaration v a) + h2mDeclResult :: (Ord v) => (v, Hashing.ReferenceId, Hashing.DataDeclaration v a) -> (v, Memory.Reference.Id, Memory.DD.DataDeclaration v a) h2mDeclResult (v, id, dd) = (v, h2mReferenceId id, h2mDecl dd) hashDecls :: - Var v => + (Var v) => Map v (Memory.DD.Decl v a) -> ResolutionResult v a [(v, Memory.Reference.Id, Memory.DD.Decl v a)] hashDecls memDecls = do @@ -255,11 +255,11 @@ hashDecls memDecls = do retag CT.Effect = Left . Memory.DD.EffectDeclaration retag CT.Data = Right -m2hDecl :: Ord v => Memory.DD.DataDeclaration v a -> Hashing.DataDeclaration v a +m2hDecl :: (Ord v) => Memory.DD.DataDeclaration v a -> Hashing.DataDeclaration v a m2hDecl (Memory.DD.DataDeclaration mod ann bound ctors) = Hashing.DataDeclaration (m2hModifier mod) ann bound $ fmap (Lens.over _3 m2hType) ctors -m2hType :: Ord v => Memory.Type.Type v a -> Hashing.Type v a +m2hType :: (Ord v) => Memory.Type.Type v a -> Hashing.Type v a m2hType = ABT.transform \case Memory.Type.Ref ref -> Hashing.TypeRef (m2hReference ref) Memory.Type.Arrow a1 a1' -> Hashing.TypeArrow a1 a1' @@ -293,11 +293,11 @@ m2hModifier = \case Memory.DD.Structural -> Hashing.Structural Memory.DD.Unique text -> Hashing.Unique text -h2mDecl :: Ord v => Hashing.DataDeclaration v a -> Memory.DD.DataDeclaration v a +h2mDecl :: (Ord v) => Hashing.DataDeclaration v a -> Memory.DD.DataDeclaration v a h2mDecl (Hashing.DataDeclaration mod ann bound ctors) = Memory.DD.DataDeclaration (h2mModifier mod) ann bound (over _3 h2mType <$> ctors) -h2mType :: Ord v => Hashing.Type v a -> Memory.Type.Type v a +h2mType :: (Ord v) => Hashing.Type v a -> Memory.Type.Type v a h2mType = ABT.transform \case Hashing.TypeRef ref -> Memory.Type.Ref (h2mReference ref) Hashing.TypeArrow a1 a1' -> Memory.Type.Arrow a1 a1' @@ -348,7 +348,7 @@ hashPatch = Hashing.contentHash . m2hPatch hashBranch0 :: Memory.Branch.Branch0 m -> Hash hashBranch0 = Hashing.contentHash . m2hBranch0 -hashCausal :: Hashing.ContentAddressable e => e -> Set CausalHash -> (CausalHash, HashFor e) +hashCausal :: (Hashing.ContentAddressable e) => e -> Set CausalHash -> (CausalHash, HashFor e) hashCausal e tails = let valueHash = Hashing.contentHash e causalHash = diff --git a/parser-typechecker/src/Unison/Parsers.hs b/parser-typechecker/src/Unison/Parsers.hs index 7ccb530db..3a21170c7 100644 --- a/parser-typechecker/src/Unison/Parsers.hs +++ b/parser-typechecker/src/Unison/Parsers.hs @@ -25,7 +25,7 @@ unsafeGetRightFrom src = either (error . Pr.toANSI defaultWidth . prettyParseError src) id parse :: - Var v => + (Var v) => Parser.P v a -> String -> Parser.ParsingEnv -> @@ -33,21 +33,21 @@ parse :: parse p = Parser.run (Parser.root p) parseTerm :: - Var v => + (Var v) => String -> Parser.ParsingEnv -> Either (Parser.Err v) (Term v Ann) parseTerm = parse TermParser.term parseType :: - Var v => + (Var v) => String -> Parser.ParsingEnv -> Either (Parser.Err v) (Type v Ann) parseType = Parser.run (Parser.root TypeParser.valueType) parseFile :: - Var v => + (Var v) => FilePath -> String -> Parser.ParsingEnv -> @@ -55,7 +55,7 @@ parseFile :: parseFile filename s = Parser.run' (Parser.rootFile FileParser.file) s filename readAndParseFile :: - Var v => + (Var v) => Parser.ParsingEnv -> FilePath -> IO (Either (Parser.Err v) (UnisonFile v Ann)) @@ -64,7 +64,7 @@ readAndParseFile penv fileName = do let src = Text.unpack txt pure $ parseFile fileName src penv -unsafeParseTerm :: Var v => String -> Parser.ParsingEnv -> Term v Ann +unsafeParseTerm :: (Var v) => String -> Parser.ParsingEnv -> Term v Ann unsafeParseTerm s = fmap (unsafeGetRightFrom s) . parseTerm $ s unsafeReadAndParseFile :: diff --git a/parser-typechecker/src/Unison/PrettyPrintEnv/MonadPretty.hs b/parser-typechecker/src/Unison/PrettyPrintEnv/MonadPretty.hs index f6660a123..33e07d668 100644 --- a/parser-typechecker/src/Unison/PrettyPrintEnv/MonadPretty.hs +++ b/parser-typechecker/src/Unison/PrettyPrintEnv/MonadPretty.hs @@ -11,37 +11,37 @@ import Unison.Var (Var) type MonadPretty v m = (Var v, MonadReader (PrettyPrintEnv, Set v) m) -getPPE :: MonadPretty v m => m PrettyPrintEnv +getPPE :: (MonadPretty v m) => m PrettyPrintEnv getPPE = view _1 -- | Run a computation with a modified PrettyPrintEnv, restoring the original -withPPE :: MonadPretty v m => PrettyPrintEnv -> m a -> m a +withPPE :: (MonadPretty v m) => PrettyPrintEnv -> m a -> m a withPPE p = local (set _1 p) -applyPPE :: MonadPretty v m => (PrettyPrintEnv -> a) -> m a +applyPPE :: (MonadPretty v m) => (PrettyPrintEnv -> a) -> m a applyPPE = views _1 -applyPPE2 :: MonadPretty v m => (PrettyPrintEnv -> a -> b) -> a -> m b +applyPPE2 :: (MonadPretty v m) => (PrettyPrintEnv -> a -> b) -> a -> m b applyPPE2 f a = views _1 (`f` a) -applyPPE3 :: MonadPretty v m => (PrettyPrintEnv -> a -> b -> c) -> a -> b -> m c +applyPPE3 :: (MonadPretty v m) => (PrettyPrintEnv -> a -> b -> c) -> a -> b -> m c applyPPE3 f a b = views _1 (\ppe -> f ppe a b) -- | Run a computation with a modified PrettyPrintEnv, restoring the original -modifyPPE :: MonadPretty v m => (PrettyPrintEnv -> PrettyPrintEnv) -> m a -> m a +modifyPPE :: (MonadPretty v m) => (PrettyPrintEnv -> PrettyPrintEnv) -> m a -> m a modifyPPE = local . over _1 -modifyTypeVars :: MonadPretty v m => (Set v -> Set v) -> m a -> m a +modifyTypeVars :: (MonadPretty v m) => (Set v -> Set v) -> m a -> m a modifyTypeVars = local . over _2 -- | Add type variables to the set of variables that need to be avoided -addTypeVars :: MonadPretty v m => [v] -> m a -> m a +addTypeVars :: (MonadPretty v m) => [v] -> m a -> m a addTypeVars = modifyTypeVars . Set.union . Set.fromList -- | Check if a list of type variables contains any variables that need to be -- avoided -willCapture :: MonadPretty v m => [v] -> m Bool +willCapture :: (MonadPretty v m) => [v] -> m Bool willCapture vs = views _2 (not . Set.null . Set.intersection (Set.fromList vs)) -runPretty :: Var v => PrettyPrintEnv -> Reader (PrettyPrintEnv, Set v) a -> a -runPretty ppe m = runReader m (ppe, mempty) \ No newline at end of file +runPretty :: (Var v) => PrettyPrintEnv -> Reader (PrettyPrintEnv, Set v) a -> a +runPretty ppe m = runReader m (ppe, mempty) diff --git a/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs b/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs index e213ecfad..732cbbb13 100644 --- a/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs +++ b/parser-typechecker/src/Unison/PrettyPrintEnv/Names.hs @@ -58,5 +58,5 @@ fromSuffixNames len names = PrettyPrintEnv terms' types' -- | Reduce the provided names to their minimal unique suffix within the scope of the given -- relation. -shortestUniqueSuffixes :: Ord ref => ref -> Rel.Relation Name ref -> [(a, HQ'.HashQualified Name)] -> [(a, HQ'.HashQualified Name)] +shortestUniqueSuffixes :: (Ord ref) => ref -> Rel.Relation Name ref -> [(a, HQ'.HashQualified Name)] -> [(a, HQ'.HashQualified Name)] shortestUniqueSuffixes ref rel names = names <&> second (fmap (\name -> Name.shortestUniqueSuffix name ref rel)) diff --git a/parser-typechecker/src/Unison/PrintError.hs b/parser-typechecker/src/Unison/PrintError.hs index ce2c1d175..d785307b2 100644 --- a/parser-typechecker/src/Unison/PrintError.hs +++ b/parser-typechecker/src/Unison/PrintError.hs @@ -89,11 +89,11 @@ defaultWidth :: Pr.Width defaultWidth = 60 -- Various links used in error messages, collected here for a quick overview -structuralVsUniqueDocsLink :: IsString a => Pretty a +structuralVsUniqueDocsLink :: (IsString a) => Pretty a structuralVsUniqueDocsLink = "https://www.unison-lang.org/learn/language-reference/unique-types/" fromOverHere' :: - Ord a => + (Ord a) => String -> [Maybe (Range, a)] -> [Maybe (Range, a)] -> @@ -102,7 +102,7 @@ fromOverHere' s spots0 removing = fromOverHere s (catMaybes spots0) (catMaybes removing) fromOverHere :: - Ord a => String -> [(Range, a)] -> [(Range, a)] -> Pretty (AnnotatedText a) + (Ord a) => String -> [(Range, a)] -> [(Range, a)] -> Pretty (AnnotatedText a) fromOverHere src spots0 removing = let spots = toList $ Set.fromList spots0 Set.\\ Set.fromList removing in case length spots of @@ -122,7 +122,7 @@ showTypeWithProvenance env src color typ = <> ".\n" <> fromOverHere' src [styleAnnotated color typ] [] -styleAnnotated :: Annotated a => sty -> a -> Maybe (Range, sty) +styleAnnotated :: (Annotated a) => sty -> a -> Maybe (Range, sty) styleAnnotated sty a = (,sty) <$> rangeForAnnotated a style :: s -> String -> Pretty (AnnotatedText s) @@ -147,7 +147,8 @@ renderTypeInfo :: renderTypeInfo i env = case i of TopLevelComponent {..} -> case definitions of [def] -> - Pr.wrap "🌟 I found and typechecked a definition:" <> Pr.newline + Pr.wrap "🌟 I found and typechecked a definition:" + <> Pr.newline <> mconcat (renderOne def) [] -> mempty @@ -156,7 +157,7 @@ renderTypeInfo i env = case i of <> Pr.newline <> intercalateMap Pr.newline (foldMap ("\t" <>) . renderOne) definitions where - renderOne :: IsString s => (v, Type v loc, RedundantTypeAnnotation) -> [s] + renderOne :: (IsString s) => (v, Type v loc, RedundantTypeAnnotation) -> [s] renderOne (v, typ, _) = [fromString . Text.unpack $ Var.name v, " : ", renderType' env typ] @@ -286,7 +287,9 @@ renderTypeError e env src curPath = case e of in mconcat [ Pr.lines [ Pr.wrap $ - "The " <> ordinal argNum <> " argument to " + "The " + <> ordinal argNum + <> " argument to " <> Pr.backticked (style ErrorSite (renderTerm env f)), "", " has type: " <> style Type2 (renderType' env foundType), @@ -583,7 +586,9 @@ renderTypeError e env src curPath = case e of if ann typeSite == External then "I don't know about the type " <> style ErrorSite (renderVar unknownTypeV) <> ". " else - "I don't know about the type " <> style ErrorSite (renderVar unknownTypeV) <> ":\n" + "I don't know about the type " + <> style ErrorSite (renderVar unknownTypeV) + <> ":\n" <> annotatedAsErrorSite src typeSite, "Make sure it's imported and spelled correctly." ] @@ -660,7 +665,8 @@ renderTypeError e env src curPath = case e of "", annotatedAsErrorSite src loc, Pr.wrap $ - "has type " <> stylePretty ErrorSite (Pr.group (renderType' env typ)) + "has type " + <> stylePretty ErrorSite (Pr.group (renderType' env typ)) <> "but I'm expecting a function of the form" <> Pr.group (Pr.blue (renderType' env exHandler) <> ".") ] @@ -1029,7 +1035,7 @@ renderType' env typ = -- | `f` may do some styling based on `loc`. -- | You can pass `(const id)` if no styling is needed, or call `renderType'`. renderType :: - Var v => + (Var v) => Env -> (loc -> Pretty (AnnotatedText a) -> Pretty (AnnotatedText a)) -> Type v loc -> @@ -1068,7 +1074,8 @@ renderType env f t = renderType0 env f (0 :: Int) (Type.removePureEffects t) renderSuggestion :: (IsString s, Semigroup s, Var v) => Env -> C.Suggestion v loc -> s renderSuggestion env sug = - fromString (Text.unpack $ C.suggestionName sug) <> " : " + fromString (Text.unpack $ C.suggestionName sug) + <> " : " <> renderType' env (C.suggestionType sug) @@ -1090,21 +1097,21 @@ renderVar' env ctx v = case C.lookupSolved ctx v of Nothing -> "unsolved" Just t -> renderType' env $ Type.getPolytype t -prettyVar :: Var v => v -> Pretty ColorText +prettyVar :: (Var v) => v -> Pretty ColorText prettyVar = Pr.text . Var.name renderKind :: Kind -> Pretty (AnnotatedText a) renderKind Kind.Star = "*" renderKind (Kind.Arrow k1 k2) = renderKind k1 <> " -> " <> renderKind k2 -showTermRef :: IsString s => Env -> Referent -> s +showTermRef :: (IsString s) => Env -> Referent -> s showTermRef env r = fromString . HQ.toString $ PPE.termName env r -showTypeRef :: IsString s => Env -> R.Reference -> s +showTypeRef :: (IsString s) => Env -> R.Reference -> s showTypeRef env r = fromString . HQ.toString $ PPE.typeName env r -- todo: do something different/better if cid not found -showConstructor :: IsString s => Env -> ConstructorReference -> s +showConstructor :: (IsString s) => Env -> ConstructorReference -> s showConstructor env r = fromString . HQ.toString $ PPE.patternName env r @@ -1120,14 +1127,14 @@ styleInOverallType e overallType leafType c = renderType e f overallType where f loc s = if loc == ABT.annotation leafType then Color.style c <$> s else s -_posToEnglish :: IsString s => L.Pos -> s +_posToEnglish :: (IsString s) => L.Pos -> s _posToEnglish (L.Pos l c) = fromString $ "Line " ++ show l ++ ", Column " ++ show c rangeForToken :: L.Token a -> Range rangeForToken t = Range (L.start t) (L.end t) -rangeToEnglish :: IsString s => Range -> s +rangeToEnglish :: (IsString s) => Range -> s rangeToEnglish (Range (L.Pos l c) (L.Pos l' c')) = fromString $ let showColumn = True @@ -1159,7 +1166,7 @@ annotatedToEnglish a = case ann a of External -> "an external" Ann start end -> rangeToEnglish $ Range start end -rangeForAnnotated :: Annotated a => a -> Maybe Range +rangeForAnnotated :: (Annotated a) => a -> Maybe Range rangeForAnnotated a = case ann a of Intrinsic -> Nothing External -> Nothing @@ -1178,7 +1185,7 @@ renderNoteAsANSI :: String renderNoteAsANSI w e s curPath n = Pr.toANSI w $ printNoteWithSource e s curPath n -renderParseErrorAsANSI :: Var v => Pr.Width -> String -> Parser.Err v -> String +renderParseErrorAsANSI :: (Var v) => Pr.Width -> String -> Parser.Err v -> String renderParseErrorAsANSI w src = Pr.toANSI w . prettyParseError src printNoteWithSource :: @@ -1217,13 +1224,13 @@ _printArrowsAtPos s line column = pattern LexerError :: [L.Token L.Lexeme] -> L.Err -> Maybe (P.ErrorItem (L.Token L.Lexeme)) pattern LexerError ts e <- Just (P.Tokens (firstLexerError -> Just (ts, e))) -firstLexerError :: Foldable t => t (L.Token L.Lexeme) -> Maybe ([L.Token L.Lexeme], L.Err) +firstLexerError :: (Foldable t) => t (L.Token L.Lexeme) -> Maybe ([L.Token L.Lexeme], L.Err) firstLexerError ts = find (const True) [(toList ts, e) | (L.payload -> L.Err e) <- toList ts] prettyParseError :: forall v. - Var v => + (Var v) => String -> Parser.Err v -> Pretty ColorText @@ -1238,7 +1245,7 @@ prettyParseError s e = renderParseErrors :: forall v. - Var v => + (Var v) => String -> Parser.Err v -> [(Pretty ColorText, [Range])] @@ -1249,11 +1256,13 @@ renderParseErrors s = \case excerpt = showSource s ((\r -> (r, ErrorSite)) <$> ranges) go = \case L.UnexpectedDelimiter s -> - "I found a " <> style ErrorSite (fromString s) + "I found a " + <> style ErrorSite (fromString s) <> " here, but I didn't see a list or tuple that it might be a separator for.\n\n" <> excerpt L.CloseWithoutMatchingOpen open close -> - "I found a closing " <> style ErrorSite (fromString close) + "I found a closing " + <> style ErrorSite (fromString close) <> " here without a matching " <> style ErrorSite (fromString open) <> ".\n\n" @@ -1479,7 +1488,9 @@ renderParseErrors s = \case "You can write" <> Pr.group ( Pr.blue $ - "use " <> Pr.text (Name.toText (Name.makeRelative parent)) <> " " + "use " + <> Pr.text (Name.toText (Name.makeRelative parent)) + <> " " <> Pr.text (Name.toText (Name.unqualified (L.payload tok))) ) <> "to introduce " @@ -1519,7 +1530,9 @@ renderParseErrors s = \case where ranges = ts >>= snd >>= toList . rangeForAnnotated showDup (v, locs) = - "I found multiple types with the name " <> errorVar v <> ":\n\n" + "I found multiple types with the name " + <> errorVar v + <> ":\n\n" <> annotatedsStartingLineAsStyle ErrorSite s locs go (Parser.DuplicateTermNames ts) = (Pr.fatalCallout $ intercalateMap "\n\n" showDup ts, ranges) @@ -1578,7 +1591,9 @@ renderParseErrors s = \case "\n - A binding, like " <> t <> style Code " = 42" <> " OR", "\n " <> t <> style Code " : Nat", "\n " <> t <> style Code " = 42", - "\n - A watch expression, like " <> style Code "> " <> t + "\n - A watch expression, like " + <> style Code "> " + <> t <> style Code " + 1", @@ -1738,7 +1753,7 @@ renderParseErrors s = \case ] annotatedAsErrorSite :: - Annotated a => String -> a -> Pretty ColorText + (Annotated a) => String -> a -> Pretty ColorText annotatedAsErrorSite = annotatedAsStyle ErrorSite annotatedAsStyle :: @@ -1772,17 +1787,17 @@ tokensAsErrorSite src ts = showSource src [(rangeForToken t, ErrorSite) | t <- ts] showSourceMaybes :: - Ord a => String -> [Maybe (Range, a)] -> Pretty (AnnotatedText a) + (Ord a) => String -> [Maybe (Range, a)] -> Pretty (AnnotatedText a) showSourceMaybes src annotations = showSource src $ catMaybes annotations -showSource :: Ord a => String -> [(Range, a)] -> Pretty (AnnotatedText a) +showSource :: (Ord a) => String -> [(Range, a)] -> Pretty (AnnotatedText a) showSource src annotations = Pr.lit . AT.condensedExcerptToText 6 $ AT.markup (fromString src) (Map.fromList annotations) -showSource1 :: Ord a => String -> (Range, a) -> Pretty (AnnotatedText a) +showSource1 :: (Ord a) => String -> (Range, a) -> Pretty (AnnotatedText a) showSource1 src annotation = showSource src [annotation] findTerm :: Seq (C.PathElement v loc) -> Maybe loc diff --git a/parser-typechecker/src/Unison/Result.hs b/parser-typechecker/src/Unison/Result.hs index 9004d42bd..11fe80dcf 100644 --- a/parser-typechecker/src/Unison/Result.hs +++ b/parser-typechecker/src/Unison/Result.hs @@ -43,41 +43,41 @@ pattern Result notes may = MaybeT (WriterT (Identity (may, notes))) {-# COMPLETE Result #-} -isSuccess :: Functor f => ResultT note f a -> f Bool +isSuccess :: (Functor f) => ResultT note f a -> f Bool isSuccess = (isJust . fst <$>) . runResultT -isFailure :: Functor f => ResultT note f a -> f Bool +isFailure :: (Functor f) => ResultT note f a -> f Bool isFailure = (isNothing . fst <$>) . runResultT -toMaybe :: Functor f => ResultT note f a -> f (Maybe a) +toMaybe :: (Functor f) => ResultT note f a -> f (Maybe a) toMaybe = (fst <$>) . runResultT runResultT :: ResultT notes f a -> f (Maybe a, notes) runResultT = runWriterT . runMaybeT -- Returns the `Result` in the `f` functor. -getResult :: Functor f => ResultT notes f a -> f (Result notes a) +getResult :: (Functor f) => ResultT notes f a -> f (Result notes a) getResult r = uncurry (flip Result) <$> runResultT r -toEither :: Functor f => ResultT notes f a -> ExceptT notes f a +toEither :: (Functor f) => ResultT notes f a -> ExceptT notes f a toEither r = ExceptT (go <$> runResultT r) where go (may, notes) = note notes may -tell1 :: Monad f => note -> ResultT (Seq note) f () +tell1 :: (Monad f) => note -> ResultT (Seq note) f () tell1 = tell . pure fromParsing :: - Monad f => Either (Parser.Err v) a -> ResultT (Seq (Note v loc)) f a + (Monad f) => Either (Parser.Err v) a -> ResultT (Seq (Note v loc)) f a fromParsing (Left e) = do tell1 $ Parsing e Fail.fail "" fromParsing (Right a) = pure a -tellAndFail :: Monad f => note -> ResultT (Seq note) f a +tellAndFail :: (Monad f) => note -> ResultT (Seq note) f a tellAndFail note = tell1 note *> Fail.fail "Elegantly and responsibly" -compilerBug :: Monad f => CompilerBug v loc -> ResultT (Seq (Note v loc)) f a +compilerBug :: (Monad f) => CompilerBug v loc -> ResultT (Seq (Note v loc)) f a compilerBug = tellAndFail . CompilerBug hoist :: diff --git a/parser-typechecker/src/Unison/Runtime/ANF.hs b/parser-typechecker/src/Unison/Runtime/ANF.hs index a7b8c1be5..6545463e4 100644 --- a/parser-typechecker/src/Unison/Runtime/ANF.hs +++ b/parser-typechecker/src/Unison/Runtime/ANF.hs @@ -58,7 +58,7 @@ module Unison.Runtime.ANF ANFM, Branched (.., MatchDataCover), Func (..), - SGEqv(..), + SGEqv (..), equivocate, superNormalize, anfTerm, @@ -117,10 +117,10 @@ data CompileExn = CE CallStack (Pretty.Pretty Pretty.ColorText) instance Exception CompileExn -internalBug :: HasCallStack => String -> a +internalBug :: (HasCallStack) => String -> a internalBug = throw . CE callStack . Pretty.lit . fromString -closure :: Var v => Map v (Set v, Set v) -> Map v (Set v) +closure :: (Var v) => Map v (Set v, Set v) -> Map v (Set v) closure m0 = trace (snd <$> m0) where refs = fst <$> m0 @@ -232,11 +232,11 @@ newtype Prefix v x = Pfx (Map v [v]) deriving (Show) instance Functor (Prefix v) where fmap _ (Pfx m) = Pfx m -instance Ord v => Applicative (Prefix v) where +instance (Ord v) => Applicative (Prefix v) where pure _ = Pfx Map.empty Pfx ml <*> Pfx mr = Pfx $ Map.unionWith common ml mr -common :: Eq v => [v] -> [v] -> [v] +common :: (Eq v) => [v] -> [v] -> [v] common (u : us) (v : vs) | u == v = u : common us vs common _ _ = [] @@ -249,21 +249,21 @@ splitPfx v = first (Pfx . Map.singleton v) . split -- Finds the common variable prefixes that function variables are -- applied to, so that they can be reduced. -prefix :: Ord v => Term v a -> Prefix v (Term v a) +prefix :: (Ord v) => Term v a -> Prefix v (Term v a) prefix = ABT.visit \case Apps' (Var' u) as -> case splitPfx u as of (pf, rest) -> Just $ traverse prefix rest *> pf Var' u -> Just . Pfx $ Map.singleton u [] _ -> Nothing -appPfx :: Ord v => Prefix v a -> v -> [v] -> [v] +appPfx :: (Ord v) => Prefix v a -> v -> [v] -> [v] appPfx (Pfx m) v = maybe (const []) common $ Map.lookup v m -- Rewrites a term by dropping the first n arguments to every -- application of `v`. This just assumes such a thing makes sense, as -- in `beta`, where we've calculated how many arguments to drop by -- looking at every occurrence of `v`. -dropPrefix :: Ord v => Semigroup a => v -> Int -> Term v a -> Term v a +dropPrefix :: (Ord v) => (Semigroup a) => v -> Int -> Term v a -> Term v a dropPrefix _ 0 = id dropPrefix v n = ABT.visitPure rw where @@ -272,7 +272,7 @@ dropPrefix v n = ABT.visitPure rw rw _ = Nothing dropPrefixes :: - Ord v => Semigroup a => Map v Int -> Term v a -> Term v a + (Ord v) => (Semigroup a) => Map v Int -> Term v a -> Term v a dropPrefixes m = ABT.visitPure rw where rw (Apps' f@(Var' u) as) @@ -282,7 +282,7 @@ dropPrefixes m = ABT.visitPure rw -- Performs opposite transformations to those in enclose. Named after -- the lambda case, which is beta reduction. -beta :: Var v => Monoid a => (Term v a -> Term v a) -> Term v a -> Maybe (Term v a) +beta :: (Var v) => (Monoid a) => (Term v a -> Term v a) -> Term v a -> Maybe (Term v a) beta rec (LetRecNamedTop' top (fmap (fmap rec) -> vbs) (rec -> bd)) = Just $ letRec' top lvbs lbd where @@ -333,7 +333,7 @@ beta rec (Apps' l@(LamsNamed' vs body) as) matchVars n _ _ = n beta _ _ = Nothing -isStructured :: Var v => Term v a -> Bool +isStructured :: (Var v) => Term v a -> Bool isStructured (Var' _) = False isStructured (Lam' _) = False isStructured (Nat' _) = False @@ -358,7 +358,7 @@ open x = ABT.visitPure (beta open) x type FloatM v a r = State (Set v, [(v, Term v a)], [(v, Term v a)]) r -freshFloat :: Var v => Set v -> v -> v +freshFloat :: (Var v) => Set v -> v -> v freshFloat avoid (Var.freshIn avoid -> v0) = case Var.typeOf v0 of Var.User nm @@ -464,8 +464,8 @@ floater top rec tm@(LamsNamed' vs bd) floater _ _ _ = Nothing float :: - Var v => - Monoid a => + (Var v) => + (Monoid a) => Term v a -> (Term v a, [(Reference, Term v a)], [(Reference, Term v a)]) float tm = case runState go0 (Set.empty, [], []) of @@ -504,14 +504,14 @@ unLamsAnnot tm0 | LamsNamed' vs bd <- bd1 = (vs, bd) | otherwise = ([], bd1) -deannotate :: Var v => Term v a -> Term v a +deannotate :: (Var v) => Term v a -> Term v a deannotate = ABT.visitPure $ \case Ann' c _ -> Just $ deannotate c _ -> Nothing lamLift :: - Var v => - Monoid a => + (Var v) => + (Monoid a) => Term v a -> (Term v a, [(Reference, Term v a)], [(Reference, Term v a)]) lamLift = float . close Set.empty @@ -549,11 +549,11 @@ saturate dat = ABT.visitPure $ \case fvs = foldMap freeVars args args' = saturate dat <$> args -addDefaultCases :: Var v => Monoid a => String -> Term v a -> Term v a +addDefaultCases :: (Var v) => (Monoid a) => String -> Term v a -> Term v a addDefaultCases = ABT.visitPure . defaultCaseVisitor defaultCaseVisitor :: - Var v => Monoid a => String -> Term v a -> Maybe (Term v a) + (Var v) => (Monoid a) => String -> Term v a -> Maybe (Term v a) defaultCaseVisitor func m@(Match' scrut cases) | scrut <- addDefaultCases func scrut, cases <- fmap (addDefaultCases func) <$> cases = @@ -570,12 +570,12 @@ defaultCaseVisitor func m@(Match' scrut cases) $ apps bu [(a, Ty.tupleTerm [msg, var a v])] defaultCaseVisitor _ _ = Nothing -inlineAlias :: Var v => Monoid a => Term v a -> Term v a +inlineAlias :: (Var v) => (Monoid a) => Term v a -> Term v a inlineAlias = ABT.visitPure $ \case Let1Named' v b@(Var' _) e -> Just . inlineAlias $ ABT.subst v b e _ -> Nothing -minimizeCyclesOrCrash :: Var v => Term v a -> Term v a +minimizeCyclesOrCrash :: (Var v) => Term v a -> Term v a minimizeCyclesOrCrash t = case minimize' t of Right t -> t Left e -> @@ -606,7 +606,6 @@ data ANormalF v e | AVar v deriving (Show, Eq) - -- Types representing components that will go into the runtime tag of -- a data type value. RTags correspond to references, while CTags -- correspond to constructors. @@ -711,49 +710,57 @@ instance ABTN.Align ANormalF where align _ _ (ALit l) (ALit r) | l == r = Just $ pure (ALit l) align _ g (ALet dl ccl bl el) (ALet dr ccr br er) - | dl == dr, ccl == ccr = - Just $ ALet dl ccl <$> g bl br <*> g el er + | dl == dr, + ccl == ccr = + Just $ ALet dl ccl <$> g bl br <*> g el er align f g (AName hl asl el) (AName hr asr er) - | length asl == length asr - , Just hs <- alignEither f hl hr = - Just $ - AName <$> hs + | length asl == length asr, + Just hs <- alignEither f hl hr = + Just $ + AName + <$> hs <*> traverse (uncurry f) (zip asl asr) <*> g el er align f g (AMatch vl bsl) (AMatch vr bsr) | Just bss <- alignBranch g bsl bsr = - Just $ AMatch <$> f vl vr <*> bss + Just $ AMatch <$> f vl vr <*> bss align f g (AHnd rl hl bl) (AHnd rr hr br) | rl == rr = Just $ AHnd rl <$> f hl hr <*> g bl br align _ g (AShift rl bl) (AShift rr br) | rl == rr = Just $ AShift rl <$> g bl br align f _ (AFrc u) (AFrc v) = Just $ AFrc <$> f u v align f _ (AApp hl asl) (AApp hr asr) - | Just hs <- alignFunc f hl hr - , length asl == length asr - = Just $ AApp <$> hs <*> traverse (uncurry f) (zip asl asr) + | Just hs <- alignFunc f hl hr, + length asl == length asr = + Just $ AApp <$> hs <*> traverse (uncurry f) (zip asl asr) align _ _ _ _ = Nothing alignEither :: - Applicative f => + (Applicative f) => (l -> r -> f s) -> - Either Reference l -> Either Reference r -> Maybe (f (Either Reference s)) + Either Reference l -> + Either Reference r -> + Maybe (f (Either Reference s)) alignEither _ (Left rl) (Left rr) | rl == rr = Just . pure $ Left rl alignEither f (Right u) (Right v) = Just $ Right <$> f u v alignEither _ _ _ = Nothing alignMaybe :: - Applicative f => + (Applicative f) => (l -> r -> f s) -> - Maybe l -> Maybe r -> Maybe (f (Maybe s)) + Maybe l -> + Maybe r -> + Maybe (f (Maybe s)) alignMaybe f (Just l) (Just r) = Just $ Just <$> f l r alignMaybe _ Nothing Nothing = Just (pure Nothing) alignMaybe _ _ _ = Nothing alignFunc :: - Applicative f => + (Applicative f) => (vl -> vr -> f vs) -> - Func vl -> Func vr -> Maybe (f (Func vs)) + Func vl -> + Func vr -> + Maybe (f (Func vs)) alignFunc f (FVar u) (FVar v) = Just $ FVar <$> f u v alignFunc _ (FComb rl) (FComb rr) | rl == rr = Just . pure $ FComb rl alignFunc f (FCont u) (FCont v) = Just $ FCont <$> f u v @@ -766,28 +773,33 @@ alignFunc _ (FPrim ol) (FPrim or) alignFunc _ _ _ = Nothing alignBranch :: - Applicative f => + (Applicative f) => (el -> er -> f es) -> - Branched el -> Branched er -> Maybe (f (Branched es)) + Branched el -> + Branched er -> + Maybe (f (Branched es)) alignBranch _ MatchEmpty MatchEmpty = Just $ pure MatchEmpty alignBranch f (MatchIntegral bl dl) (MatchIntegral br dr) - | keysSet bl == keysSet br - , Just ds <- alignMaybe f dl dr - = Just $ MatchIntegral - <$> interverse f bl br - <*> ds + | keysSet bl == keysSet br, + Just ds <- alignMaybe f dl dr = + Just $ + MatchIntegral + <$> interverse f bl br + <*> ds alignBranch f (MatchText bl dl) (MatchText br dr) - | Map.keysSet bl == Map.keysSet br - , Just ds <- alignMaybe f dl dr - = Just $ MatchText - <$> traverse id (Map.intersectionWith f bl br) - <*> ds + | Map.keysSet bl == Map.keysSet br, + Just ds <- alignMaybe f dl dr = + Just $ + MatchText + <$> traverse id (Map.intersectionWith f bl br) + <*> ds alignBranch f (MatchRequest bl pl) (MatchRequest br pr) - | Map.keysSet bl == Map.keysSet br - , all p (Map.keysSet bl) - = Just $ MatchRequest - <$> traverse id (Map.intersectionWith (interverse (alignCCs f)) bl br) - <*> f pl pr + | Map.keysSet bl == Map.keysSet br, + all p (Map.keysSet bl) = + Just $ + MatchRequest + <$> traverse id (Map.intersectionWith (interverse (alignCCs f)) bl br) + <*> f pl pr where p r = keysSet hsl == keysSet hsr && all q (keys hsl) where @@ -795,18 +807,18 @@ alignBranch f (MatchRequest bl pl) (MatchRequest br pr) hsr = br Map.! r q t = fst (hsl ! t) == fst (hsr ! t) alignBranch f (MatchData rfl bl dl) (MatchData rfr br dr) - | rfl == rfr - , keysSet bl == keysSet br - , all (\t -> fst (bl ! t) == fst (br ! t)) (keys bl) - , Just ds <- alignMaybe f dl dr - = Just $ MatchData rfl <$> interverse (alignCCs f) bl br <*> ds + | rfl == rfr, + keysSet bl == keysSet br, + all (\t -> fst (bl ! t) == fst (br ! t)) (keys bl), + Just ds <- alignMaybe f dl dr = + Just $ MatchData rfl <$> interverse (alignCCs f) bl br <*> ds alignBranch f (MatchSum bl) (MatchSum br) - | keysSet bl == keysSet br - , all (\w -> fst (bl ! w) == fst (br ! w)) (keys bl) - = Just $ MatchSum <$> interverse (alignCCs f) bl br + | keysSet bl == keysSet br, + all (\w -> fst (bl ! w) == fst (br ! w)) (keys bl) = + Just $ MatchSum <$> interverse (alignCCs f) bl br alignBranch _ _ _ = Nothing -alignCCs :: Functor f => (l -> r -> f s) -> (a, l) -> (a, r) -> f (a, s) +alignCCs :: (Functor f) => (l -> r -> f s) -> (a, l) -> (a, r) -> f (a, s) alignCCs f (ccs, l) (_, r) = (,) ccs <$> f l r matchLit :: Term v a -> Maybe Lit @@ -818,7 +830,7 @@ matchLit (Char' c) = Just $ C c matchLit _ = Nothing pattern TLet :: - ABT.Var v => + (ABT.Var v) => Direction Word16 -> v -> Mem -> @@ -828,7 +840,7 @@ pattern TLet :: pattern TLet d v m bn bo = ABTN.TTm (ALet d [m] bn (ABTN.TAbs v bo)) pattern TLetD :: - ABT.Var v => + (ABT.Var v) => v -> Mem -> ABTN.Term ANormalF v -> @@ -837,7 +849,7 @@ pattern TLetD :: pattern TLetD v m bn bo = ABTN.TTm (ALet Direct [m] bn (ABTN.TAbs v bo)) pattern TLets :: - ABT.Var v => + (ABT.Var v) => Direction Word16 -> [v] -> [Mem] -> @@ -847,7 +859,7 @@ pattern TLets :: pattern TLets d vs ms bn bo = ABTN.TTm (ALet d ms bn (ABTN.TAbss vs bo)) pattern TName :: - ABT.Var v => + (ABT.Var v) => v -> Either Reference v -> [v] -> @@ -859,13 +871,13 @@ pattern Lit' :: Lit -> Term v a pattern Lit' l <- (matchLit -> Just l) pattern TLit :: - ABT.Var v => + (ABT.Var v) => Lit -> ABTN.Term ANormalF v pattern TLit l = ABTN.TTm (ALit l) pattern TApp :: - ABT.Var v => + (ABT.Var v) => Func v -> [v] -> ABTN.Term ANormalF v @@ -875,7 +887,7 @@ pattern AApv :: v -> [v] -> ANormalF v e pattern AApv v args = AApp (FVar v) args pattern TApv :: - ABT.Var v => + (ABT.Var v) => v -> [v] -> ABTN.Term ANormalF v @@ -885,7 +897,7 @@ pattern ACom :: Reference -> [v] -> ANormalF v e pattern ACom r args = AApp (FComb r) args pattern TCom :: - ABT.Var v => + (ABT.Var v) => Reference -> [v] -> ABTN.Term ANormalF v @@ -895,7 +907,7 @@ pattern ACon :: Reference -> CTag -> [v] -> ANormalF v e pattern ACon r t args = AApp (FCon r t) args pattern TCon :: - ABT.Var v => + (ABT.Var v) => Reference -> CTag -> [v] -> @@ -906,7 +918,7 @@ pattern AKon :: v -> [v] -> ANormalF v e pattern AKon v args = AApp (FCont v) args pattern TKon :: - ABT.Var v => + (ABT.Var v) => v -> [v] -> ABTN.Term ANormalF v @@ -916,7 +928,7 @@ pattern AReq :: Reference -> CTag -> [v] -> ANormalF v e pattern AReq r t args = AApp (FReq r t) args pattern TReq :: - ABT.Var v => + (ABT.Var v) => Reference -> CTag -> [v] -> @@ -927,7 +939,7 @@ pattern APrm :: POp -> [v] -> ANormalF v e pattern APrm p args = AApp (FPrim (Left p)) args pattern TPrm :: - ABT.Var v => + (ABT.Var v) => POp -> [v] -> ABTN.Term ANormalF v @@ -937,14 +949,14 @@ pattern AFOp :: FOp -> [v] -> ANormalF v e pattern AFOp p args = AApp (FPrim (Right p)) args pattern TFOp :: - ABT.Var v => + (ABT.Var v) => FOp -> [v] -> ABTN.Term ANormalF v pattern TFOp p args = TApp (FPrim (Right p)) args pattern THnd :: - ABT.Var v => + (ABT.Var v) => [Reference] -> v -> ABTN.Term ANormalF v -> @@ -952,7 +964,7 @@ pattern THnd :: pattern THnd rs h b = ABTN.TTm (AHnd rs h b) pattern TShift :: - ABT.Var v => + (ABT.Var v) => Reference -> v -> ABTN.Term ANormalF v -> @@ -960,16 +972,16 @@ pattern TShift :: pattern TShift i v e = ABTN.TTm (AShift i (ABTN.TAbs v e)) pattern TMatch :: - ABT.Var v => + (ABT.Var v) => v -> Branched (ABTN.Term ANormalF v) -> ABTN.Term ANormalF v pattern TMatch v cs = ABTN.TTm (AMatch v cs) -pattern TFrc :: ABT.Var v => v -> ABTN.Term ANormalF v +pattern TFrc :: (ABT.Var v) => v -> ABTN.Term ANormalF v pattern TFrc v = ABTN.TTm (AFrc v) -pattern TVar :: ABT.Var v => v -> ABTN.Term ANormalF v +pattern TVar :: (ABT.Var v) => v -> ABTN.Term ANormalF v pattern TVar v = ABTN.TTm (AVar v) {-# COMPLETE TLet, TName, TVar, TApp, TFrc, TLit, THnd, TShift, TMatch #-} @@ -992,23 +1004,23 @@ pattern TVar v = ABTN.TTm (AVar v) TMatch #-} -bind :: Var v => Cte v -> ANormal v -> ANormal v +bind :: (Var v) => Cte v -> ANormal v -> ANormal v bind (ST d us ms bu) = TLets d us ms bu bind (LZ u f as) = TName u f as -unbind :: Var v => ANormal v -> Maybe (Cte v, ANormal v) +unbind :: (Var v) => ANormal v -> Maybe (Cte v, ANormal v) unbind (TLets d us ms bu bd) = Just (ST d us ms bu, bd) unbind (TName u f as bd) = Just (LZ u f as, bd) unbind _ = Nothing -unbinds :: Var v => ANormal v -> ([Cte v], ANormal v) +unbinds :: (Var v) => ANormal v -> ([Cte v], ANormal v) unbinds (TLets d us ms bu (unbinds -> (ctx, bd))) = (ST d us ms bu : ctx, bd) unbinds (TName u f as (unbinds -> (ctx, bd))) = (LZ u f as : ctx, bd) unbinds tm = ([], tm) pattern TBind :: - Var v => + (Var v) => Cte v -> ANormal v -> ANormal v @@ -1017,7 +1029,7 @@ pattern TBind bn bd <- where TBind bn bd = bind bn bd -pattern TBinds :: Var v => [Cte v] -> ANormal v -> ANormal v +pattern TBinds :: (Var v) => [Cte v] -> ANormal v -> ANormal v pattern TBinds ctx bd <- (unbinds -> (ctx, bd)) where @@ -1316,18 +1328,18 @@ type Ctx v = Directed () [Cte v] data Direction a = Indirect a | Direct deriving (Eq, Ord, Show, Functor, Foldable, Traversable) -directed :: Foldable f => f (Cte v) -> Directed () (f (Cte v)) +directed :: (Foldable f) => f (Cte v) -> Directed () (f (Cte v)) directed x = (foldMap f x, x) where f (ST d _ _ _) = () <$ d f _ = Direct -instance Semigroup a => Semigroup (Direction a) where +instance (Semigroup a) => Semigroup (Direction a) where Indirect l <> Indirect r = Indirect $ l <> r Direct <> r = r l <> Direct = l -instance Semigroup a => Monoid (Direction a) where +instance (Semigroup a) => Monoid (Direction a) where mempty = Direct type Directed a = (,) (Direction a) @@ -1344,39 +1356,41 @@ data SuperGroup v = Rec } deriving (Show) -instance Var v => Eq (SuperGroup v) where +instance (Var v) => Eq (SuperGroup v) where g0 == g1 | Left _ <- equivocate g0 g1 = False | otherwise = True -- Failure modes for SuperGroup alpha equivalence test data SGEqv v - -- mismatch number of definitions in group - = NumDefns (SuperGroup v) (SuperGroup v) - -- mismatched SuperNormal calling conventions - | DefnConventions (SuperNormal v) (SuperNormal v) - -- mismatched subterms in corresponding definition - | Subterms (ANormal v) (ANormal v) + = -- mismatch number of definitions in group + NumDefns (SuperGroup v) (SuperGroup v) + | -- mismatched SuperNormal calling conventions + DefnConventions (SuperNormal v) (SuperNormal v) + | -- mismatched subterms in corresponding definition + Subterms (ANormal v) (ANormal v) -- Checks if two SuperGroups are equivalent up to renaming. The rest -- of the structure must match on the nose. If the two groups are not -- equivalent, an example of conflicting structure is returned. equivocate :: - Var v => - SuperGroup v -> SuperGroup v -> Either (SGEqv v) () + (Var v) => + SuperGroup v -> + SuperGroup v -> + Either (SGEqv v) () equivocate g0@(Rec bs0 e0) g1@(Rec bs1 e1) | length bs0 == length bs1 = - traverse_ eqvSN (zip ns0 ns1) *> eqvSN (e0, e1) + traverse_ eqvSN (zip ns0 ns1) *> eqvSN (e0, e1) | otherwise = Left $ NumDefns g0 g1 where - (vs0, ns0) = unzip bs0 - (vs1, ns1) = unzip bs1 - vm = Map.fromList (zip vs1 vs0) + (vs0, ns0) = unzip bs0 + (vs1, ns1) = unzip bs1 + vm = Map.fromList (zip vs1 vs0) - promote (Left (l, r)) = Left $ Subterms l r - promote (Right v) = Right v + promote (Left (l, r)) = Left $ Subterms l r + promote (Right v) = Right v - eqvSN (Lambda ccs0 e0, Lambda ccs1 e1) - | ccs0 == ccs1 = promote $ ABTN.alpha vm e0 e1 - eqvSN (n0, n1) = Left $ DefnConventions n0 n1 + eqvSN (Lambda ccs0 e0, Lambda ccs1 e1) + | ccs0 == ccs1 = promote $ ABTN.alpha vm e0 e1 + eqvSN (n0, n1) = Left $ DefnConventions n0 n1 type ANFM v = ReaderT @@ -1415,16 +1429,16 @@ data BLit groupVars :: ANFM v (Set v) groupVars = ask -bindLocal :: Ord v => [v] -> ANFM v r -> ANFM v r +bindLocal :: (Ord v) => [v] -> ANFM v r -> ANFM v r bindLocal vs = local (Set.\\ Set.fromList vs) -freshANF :: Var v => Word64 -> v +freshANF :: (Var v) => Word64 -> v freshANF fr = Var.freshenId fr $ typed Var.ANFBlank -fresh :: Var v => ANFM v v +fresh :: (Var v) => ANFM v v fresh = state $ \(fr, bnd, cs) -> (freshANF fr, (fr + 1, bnd, cs)) -contextualize :: Var v => DNormal v -> ANFM v (Ctx v, v) +contextualize :: (Var v) => DNormal v -> ANFM v (Ctx v, v) contextualize (_, TVar cv) = do gvs <- groupVars if cv `Set.notMember` gvs @@ -1444,10 +1458,10 @@ binder = state $ \(fr, bnd, cs) -> (bnd, (fr, bnd + 1, cs)) bindDirection :: Direction a -> ANFM v (Direction Word16) bindDirection = traverse (const binder) -record :: Var v => (v, SuperNormal v) -> ANFM v () +record :: (Var v) => (v, SuperNormal v) -> ANFM v () record p = modify $ \(fr, bnd, to) -> (fr, bnd, p : to) -superNormalize :: Var v => Term v a -> SuperGroup v +superNormalize :: (Var v) => Term v a -> SuperGroup v superNormalize tm = Rec l c where (bs, e) @@ -1458,12 +1472,12 @@ superNormalize tm = Rec l c subc = runReaderT comp grp (c, (_, _, l)) = runState subc (0, 1, []) -superBinding :: Var v => (v, Term v a) -> ANFM v () +superBinding :: (Var v) => (v, Term v a) -> ANFM v () superBinding (v, tm) = do nf <- toSuperNormal tm modify $ \(cvs, bnd, ctx) -> (cvs, bnd, (v, nf) : ctx) -toSuperNormal :: Var v => Term v a -> ANFM v (SuperNormal v) +toSuperNormal :: (Var v) => Term v a -> ANFM v (SuperNormal v) toSuperNormal tm = do grp <- groupVars if not . Set.null . (Set.\\ grp) $ freeVars tm @@ -1474,14 +1488,14 @@ toSuperNormal tm = do where (vs, body) = fromMaybe ([], tm) $ unLams' tm -anfTerm :: Var v => Term v a -> ANFM v (DNormal v) +anfTerm :: (Var v) => Term v a -> ANFM v (DNormal v) anfTerm tm = f <$> anfBlock tm where -- f = uncurry (liftA2 TBinds) f ((_, []), dtm) = dtm f ((_, cx), (_, tm)) = (Indirect (), TBinds cx tm) -floatableCtx :: Var v => Ctx v -> Bool +floatableCtx :: (Var v) => Ctx v -> Bool floatableCtx = all p . snd where p (LZ _ _ _) = True @@ -1491,7 +1505,7 @@ floatableCtx = all p . snd q (TCon _ _ _) = True q _ = False -anfHandled :: Var v => Term v a -> ANFM v (Ctx v, DNormal v) +anfHandled :: (Var v) => Term v a -> ANFM v (Ctx v, DNormal v) anfHandled body = anfBlock body >>= \case (ctx, (_, t@TCon {})) -> @@ -1504,7 +1518,7 @@ anfHandled body = cc = case l of T {} -> BX; LM {} -> BX; LY {} -> BX; _ -> UN p -> pure p -fls, tru :: Var v => ANormal v +fls, tru :: (Var v) => ANormal v fls = TCon Ty.booleanRef 0 [] tru = TCon Ty.booleanRef 1 [] @@ -1513,7 +1527,7 @@ tru = TCon Ty.booleanRef 1 [] -- binding during ANF translation. Renames a variable in a -- context, and returns an indication of whether the varible -- was shadowed by one of the context bindings. -renameCtx :: Var v => v -> v -> Ctx v -> (Ctx v, Bool) +renameCtx :: (Var v) => v -> v -> Ctx v -> (Ctx v, Bool) renameCtx v u (d, ctx) | (ctx, b) <- rn [] ctx = ((d, ctx), b) where swap w @@ -1532,7 +1546,7 @@ renameCtx v u (d, ctx) | (ctx, b) <- rn [] ctx = ((d, ctx), b) where e = LZ w (swap <$> f) (swap <$> as) -anfBlock :: Var v => Term v a -> ANFM v (Ctx v, DNormal v) +anfBlock :: (Var v) => Term v a -> ANFM v (Ctx v, DNormal v) anfBlock (Var' v) = pure (mempty, pure $ TVar v) anfBlock (If' c t f) = do (cctx, cc) <- anfBlock c @@ -1644,7 +1658,8 @@ anfBlock (Match' scrut cas) = do | otherwise = Builtin "List.viewr" b <- binder pure - ( sctx <> cx + ( sctx + <> cx <> (Indirect (), [ST1 (Indirect b) r BX (TCom op [v])]), pure . TMatch r $ MatchDataCover @@ -1747,7 +1762,7 @@ anfBlock t = internalBug $ "anf: unhandled term: " ++ show t -- with no guards, and no variables ignored. This is not checked -- completely. anfInitCase :: - Var v => + (Var v) => v -> MatchCase p (Term v a) -> ANFD v (BranchAccum v) @@ -1788,7 +1803,8 @@ anfInitCase u (MatchCase p guard (ABT.AbsN' vs bd)) (,) <$> expandBindings [q] vs <*> anfBody bd <&> \(us, bd) -> AccumPure $ ABTN.TAbss us bd | P.EffectBind _ (ConstructorReference r t) ps pk <- p = do - (,,) <$> expandBindings (snoc ps pk) vs + (,,) + <$> expandBindings (snoc ps pk) vs <*> Compose (pure <$> fresh) <*> anfBody bd <&> \(exp, kf, bd) -> @@ -1831,7 +1847,7 @@ valueTermLinks = Set.toList . valueLinks f f False r = Set.singleton r f _ _ = Set.empty -valueLinks :: Monoid a => (Bool -> Reference -> a) -> Value -> a +valueLinks :: (Monoid a) => (Bool -> Reference -> a) -> Value -> a valueLinks f (Partial (GR cr _) _ bs) = f False cr <> foldMap (valueLinks f) bs valueLinks f (Data dr _ _ bs) = @@ -1840,7 +1856,7 @@ valueLinks f (Cont _ bs k) = foldMap (valueLinks f) bs <> contLinks f k valueLinks f (BLit l) = litLinks f l -contLinks :: Monoid a => (Bool -> Reference -> a) -> Cont -> a +contLinks :: (Monoid a) => (Bool -> Reference -> a) -> Cont -> a contLinks f (Push _ _ _ _ (GR cr _) k) = f False cr <> contLinks f k contLinks f (Mark _ _ ps de k) = @@ -1849,7 +1865,7 @@ contLinks f (Mark _ _ ps de k) = <> contLinks f k contLinks _ KE = mempty -litLinks :: Monoid a => (Bool -> Reference -> a) -> BLit -> a +litLinks :: (Monoid a) => (Bool -> Reference -> a) -> BLit -> a litLinks f (List s) = foldMap (valueLinks f) s litLinks _ _ = mempty @@ -1859,20 +1875,20 @@ groupTermLinks = Set.toList . groupLinks f f False r = Set.singleton r f _ _ = Set.empty -groupLinks :: Monoid a => (Bool -> Reference -> a) -> SuperGroup v -> a +groupLinks :: (Monoid a) => (Bool -> Reference -> a) -> SuperGroup v -> a groupLinks f (Rec bs e) = foldMap (foldMap (normalLinks f)) bs <> normalLinks f e normalLinks :: - Monoid a => (Bool -> Reference -> a) -> SuperNormal v -> a + (Monoid a) => (Bool -> Reference -> a) -> SuperNormal v -> a normalLinks f (Lambda _ e) = anfLinks f e -anfLinks :: Monoid a => (Bool -> Reference -> a) -> ANormal v -> a +anfLinks :: (Monoid a) => (Bool -> Reference -> a) -> ANormal v -> a anfLinks f (ABTN.Term _ (ABTN.Abs _ e)) = anfLinks f e anfLinks f (ABTN.Term _ (ABTN.Tm e)) = anfFLinks f (anfLinks f) e anfFLinks :: - Monoid a => + (Monoid a) => (Bool -> Reference -> a) -> (e -> a) -> ANormalF v e -> @@ -1887,20 +1903,20 @@ anfFLinks f _ (AApp fu _) = funcLinks f fu anfFLinks _ _ _ = mempty branchLinks :: - Monoid a => + (Monoid a) => (Reference -> a) -> (e -> a) -> Branched e -> a branchLinks f g bs = tyRefs f bs <> foldMap g bs -tyRefs :: Monoid a => (Reference -> a) -> Branched e -> a +tyRefs :: (Monoid a) => (Reference -> a) -> Branched e -> a tyRefs f (MatchRequest m _) = foldMap f (Map.keys m) tyRefs f (MatchData r _ _) = f r tyRefs _ _ = mempty funcLinks :: - Monoid a => + (Monoid a) => (Bool -> Reference -> a) -> Func v -> a @@ -1910,7 +1926,7 @@ funcLinks f (FReq r _) = f True r funcLinks _ _ = mempty expandBindings' :: - Var v => + (Var v) => Word64 -> [P.Pattern p] -> [v] -> @@ -1929,20 +1945,20 @@ expandBindings' _ (_ : _) [] = expandBindings' _ _ _ = Left $ "expandBindings': unexpected pattern" -expandBindings :: Var v => [P.Pattern p] -> [v] -> ANFD v [v] +expandBindings :: (Var v) => [P.Pattern p] -> [v] -> ANFD v [v] expandBindings ps vs = Compose . state $ \(fr, bnd, co) -> case expandBindings' fr ps vs of Left err -> internalBug $ err ++ " " ++ show (ps, vs) Right (fr, l) -> (pure l, (fr, bnd, co)) anfCases :: - Var v => + (Var v) => v -> [MatchCase p (Term v a)] -> ANFM v (Directed () (BranchAccum v)) anfCases u = getCompose . fmap fold . traverse (anfInitCase u) -anfFunc :: Var v => Term v a -> ANFM v (Ctx v, Directed () (Func v)) +anfFunc :: (Var v) => Term v a -> ANFM v (Ctx v, Directed () (Func v)) anfFunc (Var' v) = pure (mempty, (Indirect (), FVar v)) anfFunc (Ref' r) = pure (mempty, (Indirect (), FComb r)) anfFunc (Constructor' (ConstructorReference r t)) = pure (mempty, (Direct, FCon r $ fromIntegral t)) @@ -1952,19 +1968,19 @@ anfFunc tm = do (cx, v) <- contextualize ctm pure (fctx <> cx, (Indirect (), FVar v)) -anfArg :: Var v => Term v a -> ANFM v (Ctx v, v) +anfArg :: (Var v) => Term v a -> ANFM v (Ctx v, v) anfArg tm = do (ctx, ctm) <- anfBlock tm (cx, v) <- contextualize ctm pure (ctx <> cx, v) -anfArgs :: Var v => [Term v a] -> ANFM v (Ctx v, [v]) +anfArgs :: (Var v) => [Term v a] -> ANFM v (Ctx v, [v]) anfArgs tms = first fold . unzip <$> traverse anfArg tms indent :: Int -> ShowS indent ind = showString (replicate (ind * 2) ' ') -prettyGroup :: Var v => String -> SuperGroup v -> ShowS +prettyGroup :: (Var v) => String -> SuperGroup v -> ShowS prettyGroup s (Rec grp ent) = showString ("let rec[" ++ s ++ "]\n") . foldr f id grp @@ -1972,19 +1988,20 @@ prettyGroup s (Rec grp ent) = . prettySuperNormal 1 ent where f (v, sn) r = - indent 1 . pvar v + indent 1 + . pvar v . prettySuperNormal 2 sn . showString "\n" . r -pvar :: Var v => v -> ShowS +pvar :: (Var v) => v -> ShowS pvar v = showString . Data.Text.unpack $ Var.name v -prettyVars :: Var v => [v] -> ShowS +prettyVars :: (Var v) => [v] -> ShowS prettyVars = foldr (\v r -> showString " " . pvar v . r) id -prettyLVars :: Var v => [Mem] -> [v] -> ShowS +prettyLVars :: (Var v) => [Mem] -> [v] -> ShowS prettyLVars [] [] = showString " " prettyLVars (c : cs) (v : vs) = showString " " @@ -1993,25 +2010,25 @@ prettyLVars (c : cs) (v : vs) = prettyLVars [] (_ : _) = internalBug "more variables than conventions" prettyLVars (_ : _) [] = internalBug "more conventions than variables" -prettyRBind :: Var v => [v] -> ShowS +prettyRBind :: (Var v) => [v] -> ShowS prettyRBind [] = showString "()" prettyRBind [v] = pvar v prettyRBind (v : vs) = showParen True $ pvar v . foldr (\v r -> shows v . showString "," . r) id vs -prettySuperNormal :: Var v => Int -> SuperNormal v -> ShowS +prettySuperNormal :: (Var v) => Int -> SuperNormal v -> ShowS prettySuperNormal ind (Lambda ccs (ABTN.TAbss vs tm)) = prettyLVars ccs vs . showString "=" . prettyANF False (ind + 1) tm -reqSpace :: Var v => Bool -> ANormal v -> Bool +reqSpace :: (Var v) => Bool -> ANormal v -> Bool reqSpace _ TLets {} = True reqSpace _ TName {} = True reqSpace b _ = b -prettyANF :: Var v => Bool -> Int -> ANormal v -> ShowS +prettyANF :: (Var v) => Bool -> Int -> ANormal v -> ShowS prettyANF m ind tm = prettySpace (reqSpace m tm) ind . case tm of TLets _ vs _ bn bo -> @@ -2035,12 +2052,15 @@ prettyANF m ind tm = . showString " with" . prettyBranches (ind + 1) bs TShift r v bo -> - showString "shift[" . shows r . showString "]" + showString "shift[" + . shows r + . showString "]" . prettyVars [v] . showString "." . prettyANF False (ind + 1) bo THnd rs v bo -> - showString "handle" . prettyRefs rs + showString "handle" + . prettyRefs rs . prettyANF False (ind + 1) bo . showString " with " . pvar v @@ -2050,18 +2070,19 @@ prettySpace :: Bool -> Int -> ShowS prettySpace False _ = showString " " prettySpace True ind = showString "\n" . indent ind -prettyLZF :: Var v => Either Reference v -> ShowS +prettyLZF :: (Var v) => Either Reference v -> ShowS prettyLZF (Left w) = showString "ENV(" . shows w . showString ") " prettyLZF (Right v) = pvar v . showString " " prettyRefs :: [Reference] -> ShowS prettyRefs [] = showString "{}" prettyRefs (r : rs) = - showString "{" . shows r + showString "{" + . shows r . foldr (\t r -> shows t . showString "," . r) id rs . showString "}" -prettyFunc :: Var v => Func v -> ShowS +prettyFunc :: (Var v) => Func v -> ShowS prettyFunc (FVar v) = pvar v . showString " " prettyFunc (FCont v) = pvar v . showString " " prettyFunc (FComb w) = showString "ENV(" . shows w . showString ")" @@ -2079,7 +2100,7 @@ prettyFunc (FReq r t) = . showString ")" prettyFunc (FPrim op) = either shows shows op . showString " " -prettyBranches :: Var v => Int -> Branched (ANormal v) -> ShowS +prettyBranches :: (Var v) => Int -> Branched (ANormal v) -> ShowS prettyBranches ind bs = case bs of MatchEmpty -> showString "{}" MatchIntegral bs df -> @@ -2119,9 +2140,12 @@ prettyBranches ind bs = case bs of . shows c . showString ")" -prettyCase :: Var v => Int -> ShowS -> ANormal v -> ShowS -> ShowS +prettyCase :: (Var v) => Int -> ShowS -> ANormal v -> ShowS -> ShowS prettyCase ind sc (ABTN.TAbss vs e) r = - showString "\n" . indent ind . sc . prettyVars vs + showString "\n" + . indent ind + . sc + . prettyVars vs . showString " ->" . prettyANF False (ind + 1) e . r diff --git a/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs b/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs index 93e405070..0bfcdc70c 100644 --- a/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/ANF/Serialize.hs @@ -216,7 +216,7 @@ instance Tag CoTag where 2 -> pure PushT t -> unknownTag "CoTag" t -index :: Eq v => [v] -> v -> Maybe Word64 +index :: (Eq v) => [v] -> v -> Maybe Word64 index ctx u = go 0 ctx where go !_ [] = Nothing @@ -224,7 +224,7 @@ index ctx u = go 0 ctx | v == u = Just n | otherwise = go (n + 1) vs -deindex :: HasCallStack => [v] -> Word64 -> v +deindex :: (HasCallStack) => [v] -> Word64 -> v deindex [] _ = exn "deindex: bad index" deindex (v : vs) n | n == 0 = v @@ -233,34 +233,34 @@ deindex (v : vs) n pushCtx :: [v] -> [v] -> [v] pushCtx us vs = reverse us ++ vs -putIndex :: MonadPut m => Word64 -> m () +putIndex :: (MonadPut m) => Word64 -> m () putIndex = serialize . VarInt -getIndex :: MonadGet m => m Word64 +getIndex :: (MonadGet m) => m Word64 getIndex = unVarInt <$> deserialize -putVar :: MonadPut m => Eq v => [v] -> v -> m () +putVar :: (MonadPut m) => (Eq v) => [v] -> v -> m () putVar ctx v | Just i <- index ctx v = putIndex i | otherwise = exn "putVar: variable not in context" -getVar :: MonadGet m => [v] -> m v +getVar :: (MonadGet m) => [v] -> m v getVar ctx = deindex ctx <$> getIndex -putArgs :: MonadPut m => Eq v => [v] -> [v] -> m () +putArgs :: (MonadPut m) => (Eq v) => [v] -> [v] -> m () putArgs ctx is = putFoldable (putVar ctx) is -getArgs :: MonadGet m => [v] -> m [v] +getArgs :: (MonadGet m) => [v] -> m [v] getArgs ctx = getList (getVar ctx) -putCCs :: MonadPut m => [Mem] -> m () +putCCs :: (MonadPut m) => [Mem] -> m () putCCs ccs = putLength n *> traverse_ putCC ccs where n = length ccs putCC UN = putWord8 0 putCC BX = putWord8 1 -getCCs :: MonadGet m => m [Mem] +getCCs :: (MonadGet m) => m [Mem] getCCs = getList $ getWord8 <&> \case @@ -269,8 +269,8 @@ getCCs = _ -> exn "getCCs: bad calling convention" putGroup :: - MonadPut m => - Var v => + (MonadPut m) => + (Var v) => EC.EnumMap FOp Text -> SuperGroup v -> m () @@ -281,7 +281,7 @@ putGroup fops (Rec bs e) = (us, cs) = unzip bs ctx = pushCtx us [] -getGroup :: MonadGet m => Var v => m (SuperGroup v) +getGroup :: (MonadGet m) => (Var v) => m (SuperGroup v) getGroup = do l <- getLength let n = fromIntegral l @@ -291,8 +291,8 @@ getGroup = do Rec (zip vs cs) <$> getComb ctx n putComb :: - MonadPut m => - Var v => + (MonadPut m) => + (Var v) => EC.EnumMap FOp Text -> [v] -> SuperNormal v -> @@ -300,10 +300,10 @@ putComb :: putComb fops ctx (Lambda ccs (TAbss us e)) = putCCs ccs *> putNormal fops (pushCtx us ctx) e -getFresh :: Var v => Word64 -> v +getFresh :: (Var v) => Word64 -> v getFresh n = freshenId n $ typed ANFBlank -getComb :: MonadGet m => Var v => [v] -> Word64 -> m (SuperNormal v) +getComb :: (MonadGet m) => (Var v) => [v] -> Word64 -> m (SuperNormal v) getComb ctx frsh0 = do ccs <- getCCs let us = zipWith (\_ -> getFresh) ccs [frsh0 ..] @@ -311,8 +311,8 @@ getComb ctx frsh0 = do Lambda ccs . TAbss us <$> getNormal (pushCtx us ctx) frsh putNormal :: - MonadPut m => - Var v => + (MonadPut m) => + (Var v) => EC.EnumMap FOp Text -> [v] -> ANormal v -> @@ -328,20 +328,29 @@ putNormal fops ctx tm = case tm of TMatch v bs -> putTag MatchT *> putVar ctx v *> putBranches fops ctx bs TLit l -> putTag LitT *> putLit l TName v (Left r) as e -> - putTag NameRefT *> putReference r *> putArgs ctx as + putTag NameRefT + *> putReference r + *> putArgs ctx as *> putNormal fops (v : ctx) e TName v (Right u) as e -> - putTag NameVarT *> putVar ctx u *> putArgs ctx as + putTag NameVarT + *> putVar ctx u + *> putArgs ctx as *> putNormal fops (v : ctx) e TLets Direct us ccs l e -> - putTag LetDirT *> putCCs ccs *> putNormal fops ctx l + putTag LetDirT + *> putCCs ccs + *> putNormal fops ctx l *> putNormal fops (pushCtx us ctx) e TLets (Indirect w) us ccs l e -> - putTag LetIndT *> putWord16be w *> putCCs ccs *> putNormal fops ctx l + putTag LetIndT + *> putWord16be w + *> putCCs ccs + *> putNormal fops ctx l *> putNormal fops (pushCtx us ctx) e _ -> exn "putNormal: malformed term" -getNormal :: MonadGet m => Var v => [v] -> Word64 -> m (ANormal v) +getNormal :: (MonadGet m) => (Var v) => [v] -> Word64 -> m (ANormal v) getNormal ctx frsh0 = getTag >>= \case VarT -> TVar <$> getVar ctx @@ -387,8 +396,8 @@ getNormal ctx frsh0 = <*> getNormal (pushCtx us ctx) frsh putFunc :: - MonadPut m => - Var v => + (MonadPut m) => + (Var v) => EC.EnumMap FOp Text -> [v] -> Func v -> @@ -406,7 +415,7 @@ putFunc fops ctx f = case f of | otherwise -> exn $ "putFunc: could not serialize foreign operation: " ++ show f -getFunc :: MonadGet m => Var v => [v] -> m (Func v) +getFunc :: (MonadGet m) => (Var v) => [v] -> m (Func v) getFunc ctx = getTag >>= \case FVarT -> FVar <$> getVar ctx @@ -417,12 +426,12 @@ getFunc ctx = FPrimT -> FPrim . Left <$> getPOp FForeignT -> exn "getFunc: can't deserialize a foreign func" -putPOp :: MonadPut m => POp -> m () +putPOp :: (MonadPut m) => POp -> m () putPOp op | Just w <- Map.lookup op pop2word = putWord16be w | otherwise = exn $ "putPOp: unknown POp: " ++ show op -getPOp :: MonadGet m => m POp +getPOp :: (MonadGet m) => m POp getPOp = getWord16be >>= \w -> case Map.lookup w word2pop of Just op -> pure op @@ -562,7 +571,7 @@ word2pop = fromList $ swap <$> pOpAssoc where swap (x, y) = (y, x) -putLit :: MonadPut m => Lit -> m () +putLit :: (MonadPut m) => Lit -> m () putLit (I i) = putTag IT *> putInt i putLit (N n) = putTag NT *> putNat n putLit (F f) = putTag FT *> putFloat f @@ -571,7 +580,7 @@ putLit (C c) = putTag CT *> putChar c putLit (LM r) = putTag LMT *> putReferent r putLit (LY r) = putTag LYT *> putReference r -getLit :: MonadGet m => m Lit +getLit :: (MonadGet m) => m Lit getLit = getTag >>= \case IT -> I <$> getInt @@ -582,7 +591,7 @@ getLit = LMT -> LM <$> getReferent LYT -> LY <$> getReference -putBLit :: MonadPut m => BLit -> m () +putBLit :: (MonadPut m) => BLit -> m () putBLit (Text t) = putTag TextT *> putText (Util.Text.toText t) putBLit (List s) = putTag ListT *> putFoldable putValue s putBLit (TmLink r) = putTag TmLinkT *> putReferent r @@ -592,7 +601,7 @@ putBLit (Quote v) = putTag QuoteT *> putValue v putBLit (Code g) = putTag CodeT *> putGroup mempty g putBLit (BArr a) = putTag BArrT *> putByteArray a -getBLit :: MonadGet m => Version -> m BLit +getBLit :: (MonadGet m) => Version -> m BLit getBLit v = getTag >>= \case TextT -> Text . Util.Text.fromText <$> getText @@ -604,15 +613,15 @@ getBLit v = CodeT -> Code <$> getGroup BArrT -> BArr <$> getByteArray -putRefs :: MonadPut m => [Reference] -> m () +putRefs :: (MonadPut m) => [Reference] -> m () putRefs rs = putFoldable putReference rs -getRefs :: MonadGet m => m [Reference] +getRefs :: (MonadGet m) => m [Reference] getRefs = getList getReference putBranches :: - MonadPut m => - Var v => + (MonadPut m) => + (Var v) => EC.EnumMap FOp Text -> [v] -> Branched (ANormal v) -> @@ -644,7 +653,7 @@ putBranches fops ctx bs = case bs of _ -> exn "putBranches: malformed intermediate term" getBranches :: - MonadGet m => Var v => [v] -> Word64 -> m (Branched (ANormal v)) + (MonadGet m) => (Var v) => [v] -> Word64 -> m (Branched (ANormal v)) getBranches ctx frsh0 = getTag >>= \case MEmptyT -> pure MatchEmpty @@ -670,8 +679,8 @@ getBranches ctx frsh0 = MSumT -> MatchSum <$> getEnumMap getWord64be (getCase ctx frsh0) putCase :: - MonadPut m => - Var v => + (MonadPut m) => + (Var v) => EC.EnumMap FOp Text -> [v] -> ([Mem], ANormal v) -> @@ -679,7 +688,7 @@ putCase :: putCase fops ctx (ccs, (TAbss us e)) = putCCs ccs *> putNormal fops (pushCtx us ctx) e -getCase :: MonadGet m => Var v => [v] -> Word64 -> m ([Mem], ANormal v) +getCase :: (MonadGet m) => (Var v) => [v] -> Word64 -> m ([Mem], ANormal v) getCase ctx frsh0 = do ccs <- getCCs let l = length ccs @@ -687,20 +696,20 @@ getCase ctx frsh0 = do us = getFresh <$> take l [frsh0 ..] (,) ccs . TAbss us <$> getNormal (pushCtx us ctx) frsh -putCTag :: MonadPut m => CTag -> m () +putCTag :: (MonadPut m) => CTag -> m () putCTag c = serialize (VarInt $ fromEnum c) -getCTag :: MonadGet m => m CTag +getCTag :: (MonadGet m) => m CTag getCTag = toEnum . unVarInt <$> deserialize -putGroupRef :: MonadPut m => GroupRef -> m () +putGroupRef :: (MonadPut m) => GroupRef -> m () putGroupRef (GR r i) = putReference r *> putWord64be i -getGroupRef :: MonadGet m => m GroupRef +getGroupRef :: (MonadGet m) => m GroupRef getGroupRef = GR <$> getReference <*> getWord64be -putValue :: MonadPut m => Value -> m () +putValue :: (MonadPut m) => Value -> m () putValue (Partial gr ws vs) = putTag PartialT *> putGroupRef gr @@ -720,20 +729,21 @@ putValue (Cont us bs k) = putValue (BLit l) = putTag BLitT *> putBLit l -getValue :: MonadGet m => Version -> m Value +getValue :: (MonadGet m) => Version -> m Value getValue v = getTag >>= \case PartialT -> Partial <$> getGroupRef <*> getList getWord64be <*> getList (getValue v) DataT -> - Data <$> getReference + Data + <$> getReference <*> getWord64be <*> getList getWord64be <*> getList (getValue v) ContT -> Cont <$> getList getWord64be <*> getList (getValue v) <*> getCont v BLitT -> BLit <$> getBLit v -putCont :: MonadPut m => Cont -> m () +putCont :: (MonadPut m) => Cont -> m () putCont KE = putTag KET putCont (Mark ua ba rs ds k) = putTag MarkT @@ -751,7 +761,7 @@ putCont (Push i j m n gr k) = *> putGroupRef gr *> putCont k -getCont :: MonadGet m => Version -> m Cont +getCont :: (MonadGet m) => Version -> m Cont getCont v = getTag >>= \case KET -> pure KE @@ -763,13 +773,15 @@ getCont v = <*> getMap getReference (getValue v) <*> getCont v PushT -> - Push <$> getWord64be <*> getWord64be + Push + <$> getWord64be + <*> getWord64be <*> getWord64be <*> getWord64be <*> getGroupRef <*> getCont v -deserializeGroup :: Var v => ByteString -> Either String (SuperGroup v) +deserializeGroup :: (Var v) => ByteString -> Either String (SuperGroup v) deserializeGroup bs = runGetS (getVersion *> getGroup) bs where getVersion = @@ -778,7 +790,7 @@ deserializeGroup bs = runGetS (getVersion *> getGroup) bs n -> fail $ "deserializeGroup: unknown version: " ++ show n serializeGroup :: - Var v => EC.EnumMap FOp Text -> SuperGroup v -> ByteString + (Var v) => EC.EnumMap FOp Text -> SuperGroup v -> ByteString serializeGroup fops sg = runPutS (putVersion *> putGroup fops sg) where putVersion = putWord32be codeVersion diff --git a/parser-typechecker/src/Unison/Runtime/Array.hs b/parser-typechecker/src/Unison/Runtime/Array.hs index 3d3382fe0..748a37123 100644 --- a/parser-typechecker/src/Unison/Runtime/Array.hs +++ b/parser-typechecker/src/Unison/Runtime/Array.hs @@ -226,8 +226,8 @@ checkCMBArray _ = id #endif readArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableArray (PrimState m) a -> Int -> m a @@ -235,8 +235,8 @@ readArray = checkIMArray "readArray" PA.readArray {-# INLINE readArray #-} writeArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableArray (PrimState m) a -> Int -> a -> @@ -245,8 +245,8 @@ writeArray = checkIMArray "writeArray" PA.writeArray {-# INLINE writeArray #-} copyArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableArray (PrimState m) a -> Int -> Array a -> @@ -257,8 +257,8 @@ copyArray = checkCArray "copyArray" PA.copyArray {-# INLINE copyArray #-} cloneMutableArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableArray (PrimState m) a -> Int -> Int -> @@ -267,8 +267,8 @@ cloneMutableArray = checkRMArray "cloneMutableArray" PA.cloneMutableArray {-# INLINE cloneMutableArray #-} copyMutableArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableArray (PrimState m) a -> Int -> MutableArray (PrimState m) a -> @@ -280,9 +280,9 @@ copyMutableArray = checkCMArray "copyMutableArray" PA.copyMutableArray readByteArray :: forall a m. - CheckCtx => - PrimMonad m => - Prim a => + (CheckCtx) => + (PrimMonad m) => + (Prim a) => MutableByteArray (PrimState m) -> Int -> m a @@ -291,9 +291,9 @@ readByteArray = checkIMBArray @a "readByteArray" undefined PA.readByteArray writeByteArray :: forall a m. - CheckCtx => - PrimMonad m => - Prim a => + (CheckCtx) => + (PrimMonad m) => + (Prim a) => MutableByteArray (PrimState m) -> Int -> a -> @@ -303,8 +303,8 @@ writeByteArray = checkIMBArray @a "writeByteArray" undefined PA.writeByteArray indexByteArray :: forall a. - CheckCtx => - Prim a => + (CheckCtx) => + (Prim a) => ByteArray -> Int -> a @@ -312,8 +312,8 @@ indexByteArray = checkIBArray @a "indexByteArray" undefined PA.indexByteArray {-# INLINE indexByteArray #-} copyByteArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableByteArray (PrimState m) -> Int -> ByteArray -> @@ -324,8 +324,8 @@ copyByteArray = checkCBArray "copyByteArray" PA.copyByteArray {-# INLINE copyByteArray #-} copyMutableByteArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableByteArray (PrimState m) -> Int -> MutableByteArray (PrimState m) -> @@ -336,8 +336,8 @@ copyMutableByteArray = checkCMBArray "copyMutableByteArray" PA.copyMutableByteAr {-# INLINE copyMutableByteArray #-} moveByteArray :: - CheckCtx => - PrimMonad m => + (CheckCtx) => + (PrimMonad m) => MutableByteArray (PrimState m) -> Int -> MutableByteArray (PrimState m) -> @@ -348,9 +348,9 @@ moveByteArray = checkCMBArray "moveByteArray" PA.moveByteArray {-# INLINE moveByteArray #-} readPrimArray :: - CheckCtx => - PrimMonad m => - Prim a => + (CheckCtx) => + (PrimMonad m) => + (Prim a) => MutablePrimArray (PrimState m) a -> Int -> m a @@ -358,9 +358,9 @@ readPrimArray = checkIMPArray "readPrimArray" PA.readPrimArray {-# INLINE readPrimArray #-} writePrimArray :: - CheckCtx => - PrimMonad m => - Prim a => + (CheckCtx) => + (PrimMonad m) => + (Prim a) => MutablePrimArray (PrimState m) a -> Int -> a -> @@ -369,8 +369,8 @@ writePrimArray = checkIMPArray "writePrimArray" PA.writePrimArray {-# INLINE writePrimArray #-} indexPrimArray :: - CheckCtx => - Prim a => + (CheckCtx) => + (Prim a) => PrimArray a -> Int -> a diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index a38725729..f80d06292 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -36,7 +36,6 @@ import Control.Monad.Catch (MonadCatch) import qualified Control.Monad.Primitive as PA import Control.Monad.Reader (ReaderT (..), ask, runReaderT) import Control.Monad.State.Strict (State, execState, modify) -import Data.Digest.Murmur64 (hash64, asWord64) import qualified Crypto.Hash as Hash import qualified Crypto.MAC.HMAC as HMAC import Data.Bits (shiftL, shiftR, (.|.)) @@ -44,6 +43,7 @@ import qualified Data.ByteArray as BA import Data.ByteString (hGet, hGetSome, hPut) import qualified Data.ByteString.Lazy as L import Data.Default (def) +import Data.Digest.Murmur64 (asWord64, hash64) import Data.IORef as SYS ( IORef, newIORef, @@ -101,7 +101,7 @@ import System.Environment as SYS ( getArgs, getEnv, ) -import System.Exit as SYS (ExitCode(..)) +import System.Exit as SYS (ExitCode (..)) import System.FilePath (isPathSeparator) import System.IO (Handle) import System.IO as SYS @@ -130,7 +130,7 @@ import System.Process as SYS runInteractiveProcess, terminateProcess, waitForProcess, - withCreateProcess + withCreateProcess, ) import qualified System.X509 as X import Unison.ABT.Normalized hiding (TTm) @@ -156,28 +156,28 @@ import Unison.Symbol import qualified Unison.Type as Ty import qualified Unison.Util.Bytes as Bytes import Unison.Util.EnumContainers as EC -import Unison.Util.Text (Text) -import qualified Unison.Util.Text as Util.Text -import qualified Unison.Util.Text.Pattern as TPat import Unison.Util.RefPromise ( Promise, Ticket, - peekTicket, - readForCAS, casIORef, newPromise, + peekTicket, + readForCAS, readPromise, tryReadPromise, - writePromise + writePromise, ) +import Unison.Util.Text (Text) +import qualified Unison.Util.Text as Util.Text +import qualified Unison.Util.Text.Pattern as TPat import Unison.Var type Failure = F.Failure Closure -freshes :: Var v => Int -> [v] +freshes :: (Var v) => Int -> [v] freshes = freshes' mempty -freshes' :: Var v => Set v -> Int -> [v] +freshes' :: (Var v) => Set v -> Int -> [v] freshes' avoid0 = go avoid0 [] where go _ vs 0 = vs @@ -187,108 +187,108 @@ freshes' avoid0 = go avoid0 [] class Fresh t where fresh :: t -fresh1 :: Var v => v +fresh1 :: (Var v) => v fresh1 = head $ freshes 1 -instance Var v => Fresh (v, v) where +instance (Var v) => Fresh (v, v) where fresh = (v1, v2) where [v1, v2] = freshes 2 -instance Var v => Fresh (v, v, v) where +instance (Var v) => Fresh (v, v, v) where fresh = (v1, v2, v3) where [v1, v2, v3] = freshes 3 -instance Var v => Fresh (v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v) where fresh = (v1, v2, v3, v4) where [v1, v2, v3, v4] = freshes 4 -instance Var v => Fresh (v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5) where [v1, v2, v3, v4, v5] = freshes 5 -instance Var v => Fresh (v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6) where [v1, v2, v3, v4, v5, v6] = freshes 6 -instance Var v => Fresh (v, v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6, v7) where [v1, v2, v3, v4, v5, v6, v7] = freshes 7 -instance Var v => Fresh (v, v, v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6, v7, v8) where [v1, v2, v3, v4, v5, v6, v7, v8] = freshes 8 -instance Var v => Fresh (v, v, v, v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6, v7, v8, v9) where [v1, v2, v3, v4, v5, v6, v7, v8, v9] = freshes 9 -instance Var v => Fresh (v, v, v, v, v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) where [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10] = freshes 10 -instance Var v => Fresh (v, v, v, v, v, v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) where [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11] = freshes 11 -instance Var v => Fresh (v, v, v, v, v, v, v, v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v, v, v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) where [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13] = freshes 13 -instance Var v => Fresh (v, v, v, v, v, v, v, v, v, v, v, v, v, v) where +instance (Var v) => Fresh (v, v, v, v, v, v, v, v, v, v, v, v, v, v) where fresh = (v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) where [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14] = freshes 14 -fls, tru :: Var v => ANormal v +fls, tru :: (Var v) => ANormal v fls = TCon Ty.booleanRef 0 [] tru = TCon Ty.booleanRef 1 [] -none :: Var v => ANormal v +none :: (Var v) => ANormal v none = TCon Ty.optionalRef (fromIntegral Ty.noneId) [] -some, left, right :: Var v => v -> ANormal v +some, left, right :: (Var v) => v -> ANormal v some a = TCon Ty.optionalRef (fromIntegral Ty.someId) [a] left x = TCon Ty.eitherRef (fromIntegral Ty.eitherLeftId) [x] right x = TCon Ty.eitherRef (fromIntegral Ty.eitherRightId) [x] -seqViewEmpty :: Var v => ANormal v +seqViewEmpty :: (Var v) => ANormal v seqViewEmpty = TCon Ty.seqViewRef (fromIntegral Ty.seqViewEmpty) [] -seqViewElem :: Var v => v -> v -> ANormal v +seqViewElem :: (Var v) => v -> v -> ANormal v seqViewElem l r = TCon Ty.seqViewRef (fromIntegral Ty.seqViewElem) [l, r] -boolift :: Var v => v -> ANormal v +boolift :: (Var v) => v -> ANormal v boolift v = TMatch v $ MatchIntegral (mapFromList [(0, fls), (1, tru)]) Nothing -notlift :: Var v => v -> ANormal v +notlift :: (Var v) => v -> ANormal v notlift v = TMatch v $ MatchIntegral (mapFromList [(1, fls), (0, tru)]) Nothing -unbox :: Var v => v -> Reference -> v -> ANormal v -> ANormal v +unbox :: (Var v) => v -> Reference -> v -> ANormal v -> ANormal v unbox v0 r v b = TMatch v0 $ MatchData r (mapSingleton 0 $ ([UN], TAbs v b)) Nothing -unenum :: Var v => Int -> v -> Reference -> v -> ANormal v -> ANormal v +unenum :: (Var v) => Int -> v -> Reference -> v -> ANormal v -> ANormal v unenum n v0 r v nx = TMatch v0 $ MatchData r cases Nothing where mkCase i = (toEnum i, ([], TLetD v UN (TLit . I $ fromIntegral i) nx)) cases = mapFromList . fmap mkCase $ [0 .. n - 1] -unop0 :: Var v => Int -> ([v] -> ANormal v) -> SuperNormal v +unop0 :: (Var v) => Int -> ([v] -> ANormal v) -> SuperNormal v unop0 n f = Lambda [BX] . TAbss [x0] @@ -296,7 +296,7 @@ unop0 n f = where xs@(x0 : _) = freshes (1 + n) -binop0 :: Var v => Int -> ([v] -> ANormal v) -> SuperNormal v +binop0 :: (Var v) => Int -> ([v] -> ANormal v) -> SuperNormal v binop0 n f = Lambda [BX, BX] . TAbss [x0, y0] @@ -304,21 +304,21 @@ binop0 n f = where xs@(x0 : y0 : _) = freshes (2 + n) -unop :: Var v => POp -> Reference -> SuperNormal v +unop :: (Var v) => POp -> Reference -> SuperNormal v unop pop rf = unop' pop rf rf -unop' :: Var v => POp -> Reference -> Reference -> SuperNormal v +unop' :: (Var v) => POp -> Reference -> Reference -> SuperNormal v unop' pop rfi rfo = unop0 2 $ \[x0, x, r] -> unbox x0 rfi x . TLetD r UN (TPrm pop [x]) $ TCon rfo 0 [r] -binop :: Var v => POp -> Reference -> SuperNormal v +binop :: (Var v) => POp -> Reference -> SuperNormal v binop pop rf = binop' pop rf rf rf binop' :: - Var v => + (Var v) => POp -> Reference -> Reference -> @@ -331,7 +331,7 @@ binop' pop rfx rfy rfr = . TLetD r UN (TPrm pop [x, y]) $ TCon rfr 0 [r] -cmpop :: Var v => POp -> Reference -> SuperNormal v +cmpop :: (Var v) => POp -> Reference -> SuperNormal v cmpop pop rf = binop0 3 $ \[x0, y0, x, y, b] -> unbox x0 rf x @@ -339,7 +339,7 @@ cmpop pop rf = . TLetD b UN (TPrm pop [x, y]) $ boolift b -cmpopb :: Var v => POp -> Reference -> SuperNormal v +cmpopb :: (Var v) => POp -> Reference -> SuperNormal v cmpopb pop rf = binop0 3 $ \[x0, y0, x, y, b] -> unbox x0 rf x @@ -347,7 +347,7 @@ cmpopb pop rf = . TLetD b UN (TPrm pop [y, x]) $ boolift b -cmpopn :: Var v => POp -> Reference -> SuperNormal v +cmpopn :: (Var v) => POp -> Reference -> SuperNormal v cmpopn pop rf = binop0 3 $ \[x0, y0, x, y, b] -> unbox x0 rf x @@ -355,7 +355,7 @@ cmpopn pop rf = . TLetD b UN (TPrm pop [x, y]) $ notlift b -cmpopbn :: Var v => POp -> Reference -> SuperNormal v +cmpopbn :: (Var v) => POp -> Reference -> SuperNormal v cmpopbn pop rf = binop0 3 $ \[x0, y0, x, y, b] -> unbox x0 rf x @@ -363,7 +363,7 @@ cmpopbn pop rf = . TLetD b UN (TPrm pop [y, x]) $ notlift b -addi, subi, muli, divi, modi, shli, shri, powi :: Var v => SuperNormal v +addi, subi, muli, divi, modi, shli, shri, powi :: (Var v) => SuperNormal v addi = binop ADDI Ty.intRef subi = binop SUBI Ty.intRef muli = binop MULI Ty.intRef @@ -373,7 +373,7 @@ shli = binop' SHLI Ty.intRef Ty.natRef Ty.intRef shri = binop' SHRI Ty.intRef Ty.natRef Ty.intRef powi = binop' POWI Ty.intRef Ty.natRef Ty.intRef -addn, subn, muln, divn, modn, shln, shrn, pown :: Var v => SuperNormal v +addn, subn, muln, divn, modn, shln, shrn, pown :: (Var v) => SuperNormal v addn = binop ADDN Ty.natRef subn = binop' SUBN Ty.natRef Ty.natRef Ty.intRef muln = binop MULN Ty.natRef @@ -383,7 +383,7 @@ shln = binop SHLN Ty.natRef shrn = binop SHRN Ty.natRef pown = binop POWN Ty.natRef -eqi, eqn, lti, ltn, lei, len :: Var v => SuperNormal v +eqi, eqn, lti, ltn, lei, len :: (Var v) => SuperNormal v eqi = cmpop EQLI Ty.intRef lti = cmpopbn LEQI Ty.intRef lei = cmpop LEQI Ty.intRef @@ -391,21 +391,21 @@ eqn = cmpop EQLN Ty.natRef ltn = cmpopbn LEQN Ty.natRef len = cmpop LEQN Ty.natRef -gti, gtn, gei, gen :: Var v => SuperNormal v +gti, gtn, gei, gen :: (Var v) => SuperNormal v gti = cmpopn LEQI Ty.intRef gei = cmpopb LEQI Ty.intRef gtn = cmpopn LEQN Ty.intRef gen = cmpopb LEQN Ty.intRef -inci, incn :: Var v => SuperNormal v +inci, incn :: (Var v) => SuperNormal v inci = unop INCI Ty.intRef incn = unop INCN Ty.natRef -sgni, negi :: Var v => SuperNormal v +sgni, negi :: (Var v) => SuperNormal v sgni = unop SGNI Ty.intRef negi = unop NEGI Ty.intRef -lzeron, tzeron, lzeroi, tzeroi, popn, popi :: Var v => SuperNormal v +lzeron, tzeron, lzeroi, tzeroi, popn, popi :: (Var v) => SuperNormal v lzeron = unop LZRO Ty.natRef tzeron = unop TZRO Ty.natRef popn = unop POPC Ty.natRef @@ -413,7 +413,7 @@ popi = unop' POPC Ty.intRef Ty.natRef lzeroi = unop' LZRO Ty.intRef Ty.natRef tzeroi = unop' TZRO Ty.intRef Ty.natRef -andn, orn, xorn, compln, andi, ori, xori, compli :: Var v => SuperNormal v +andn, orn, xorn, compln, andi, ori, xori, compli :: (Var v) => SuperNormal v andn = binop ANDN Ty.natRef orn = binop IORN Ty.natRef xorn = binop XORN Ty.natRef @@ -431,7 +431,7 @@ addf, sqrtf, logf, logbf :: - Var v => SuperNormal v + (Var v) => SuperNormal v addf = binop ADDF Ty.floatRef subf = binop SUBF Ty.floatRef mulf = binop MULF Ty.floatRef @@ -441,11 +441,11 @@ sqrtf = unop SQRT Ty.floatRef logf = unop LOGF Ty.floatRef logbf = binop LOGB Ty.floatRef -expf, absf :: Var v => SuperNormal v +expf, absf :: (Var v) => SuperNormal v expf = unop EXPF Ty.floatRef absf = unop ABSF Ty.floatRef -cosf, sinf, tanf, acosf, asinf, atanf :: Var v => SuperNormal v +cosf, sinf, tanf, acosf, asinf, atanf :: (Var v) => SuperNormal v cosf = unop COSF Ty.floatRef sinf = unop SINF Ty.floatRef tanf = unop TANF Ty.floatRef @@ -460,7 +460,7 @@ coshf, asinhf, atanhf, atan2f :: - Var v => SuperNormal v + (Var v) => SuperNormal v coshf = unop COSH Ty.floatRef sinhf = unop SINH Ty.floatRef tanhf = unop TANH Ty.floatRef @@ -469,7 +469,7 @@ asinhf = unop ASNH Ty.floatRef atanhf = unop ATNH Ty.floatRef atan2f = binop ATN2 Ty.floatRef -ltf, gtf, lef, gef, eqf, neqf :: Var v => SuperNormal v +ltf, gtf, lef, gef, eqf, neqf :: (Var v) => SuperNormal v ltf = cmpopbn LEQF Ty.floatRef gtf = cmpopn LEQF Ty.floatRef lef = cmpop LEQF Ty.floatRef @@ -477,11 +477,11 @@ gef = cmpopb LEQF Ty.floatRef eqf = cmpop EQLF Ty.floatRef neqf = cmpopn EQLF Ty.floatRef -minf, maxf :: Var v => SuperNormal v +minf, maxf :: (Var v) => SuperNormal v minf = binop MINF Ty.floatRef maxf = binop MAXF Ty.floatRef -ceilf, floorf, truncf, roundf, i2f, n2f :: Var v => SuperNormal v +ceilf, floorf, truncf, roundf, i2f, n2f :: (Var v) => SuperNormal v ceilf = unop' CEIL Ty.floatRef Ty.intRef floorf = unop' FLOR Ty.floatRef Ty.intRef truncf = unop' TRNF Ty.floatRef Ty.intRef @@ -489,7 +489,7 @@ roundf = unop' RNDF Ty.floatRef Ty.intRef i2f = unop' ITOF Ty.intRef Ty.floatRef n2f = unop' NTOF Ty.natRef Ty.floatRef -trni :: Var v => SuperNormal v +trni :: (Var v) => SuperNormal v trni = unop0 3 $ \[x0, x, z, b] -> unbox x0 Ty.intRef x . TLetD z UN (TLit $ I 0) @@ -499,7 +499,7 @@ trni = unop0 3 $ \[x0, x, z, b] -> (mapSingleton 1 $ TCon Ty.natRef 0 [z]) (Just $ TCon Ty.natRef 0 [x]) -modular :: Var v => POp -> (Bool -> ANormal v) -> SuperNormal v +modular :: (Var v) => POp -> (Bool -> ANormal v) -> SuperNormal v modular pop ret = unop0 3 $ \[x0, x, m, t] -> unbox x0 Ty.intRef x @@ -510,13 +510,13 @@ modular pop ret = (mapSingleton 1 $ ret True) (Just $ ret False) -evni, evnn, oddi, oddn :: Var v => SuperNormal v +evni, evnn, oddi, oddn :: (Var v) => SuperNormal v evni = modular MODI (\b -> if b then fls else tru) oddi = modular MODI (\b -> if b then tru else fls) evnn = modular MODN (\b -> if b then fls else tru) oddn = modular MODN (\b -> if b then tru else fls) -dropn :: Var v => SuperNormal v +dropn :: (Var v) => SuperNormal v dropn = binop0 4 $ \[x0, y0, x, y, b, r] -> unbox x0 Ty.natRef x . unbox y0 Ty.natRef y @@ -532,7 +532,7 @@ dropn = binop0 4 $ \[x0, y0, x, y, b, r] -> ) $ TCon Ty.natRef 0 [r] -appendt, taket, dropt, sizet, unconst, unsnoct :: Var v => SuperNormal v +appendt, taket, dropt, sizet, unconst, unsnoct :: (Var v) => SuperNormal v appendt = binop0 0 $ \[x, y] -> TPrm CATT [x, y] taket = binop0 1 $ \[x0, y, x] -> unbox x0 Ty.natRef x $ @@ -578,17 +578,17 @@ unsnoct = unop0 7 $ \[x, t, c0, c, y, p, u, cp] -> ) ] -appends, conss, snocs :: Var v => SuperNormal v +appends, conss, snocs :: (Var v) => SuperNormal v appends = binop0 0 $ \[x, y] -> TPrm CATS [x, y] conss = binop0 0 $ \[x, y] -> TPrm CONS [x, y] snocs = binop0 0 $ \[x, y] -> TPrm SNOC [x, y] -coerceType :: Var v => Reference -> Reference -> SuperNormal v +coerceType :: (Var v) => Reference -> Reference -> SuperNormal v coerceType fromType toType = unop0 1 $ \[x, r] -> unbox x fromType r $ TCon toType 0 [r] -takes, drops, sizes, ats, emptys :: Var v => SuperNormal v +takes, drops, sizes, ats, emptys :: (Var v) => SuperNormal v takes = binop0 1 $ \[x0, y, x] -> unbox x0 Ty.natRef x $ TPrm TAKS [x, y] @@ -609,7 +609,7 @@ ats = binop0 3 $ \[x0, y, x, t, r] -> ] emptys = Lambda [] $ TPrm BLDS [] -viewls, viewrs :: Var v => SuperNormal v +viewls, viewrs :: (Var v) => SuperNormal v viewls = unop0 3 $ \[s, u, h, t] -> TLetD u UN (TPrm VWLS [s]) . TMatch u @@ -892,14 +892,15 @@ gen'trace = debug'text :: SuperNormal Symbol debug'text = - unop0 3 $ \[c,r,t,e] -> - TLetD r UN (TPrm DBTX [c]) . - TMatch r . MatchSum $ - mapFromList [ - (0, ([], none)), - (1, ([BX], TAbs t . TLetD e BX (left t) $ some e)), - (2, ([BX], TAbs t . TLetD e BX (right t) $ some e)) - ] + unop0 3 $ \[c, r, t, e] -> + TLetD r UN (TPrm DBTX [c]) + . TMatch r + . MatchSum + $ mapFromList + [ (0, ([], none)), + (1, ([BX], TAbs t . TLetD e BX (left t) $ some e)), + (2, ([BX], TAbs t . TLetD e BX (right t) $ some e)) + ] code'missing :: SuperNormal Symbol code'missing = @@ -1012,7 +1013,7 @@ seek'handle instr = where (arg1, arg2, arg3, seek, nat, stack1, stack2, stack3, unit, fail, result) = fresh -no'buf, line'buf, block'buf, sblock'buf :: Enum e => e +no'buf, line'buf, block'buf, sblock'buf :: (Enum e) => e no'buf = toEnum $ fromIntegral Ty.bufferModeNoBufferingId line'buf = toEnum $ fromIntegral Ty.bufferModeLineBufferingId block'buf = toEnum $ fromIntegral Ty.bufferModeBlockBufferingId @@ -1027,14 +1028,14 @@ start'process :: ForeignOp start'process instr = ([BX, BX],) . TAbss [exe, args] - . TLets Direct [hin,hout,herr,hproc] [BX,BX,BX,BX] (TFOp instr [exe, args]) + . TLets Direct [hin, hout, herr, hproc] [BX, BX, BX, BX] (TFOp instr [exe, args]) . TLetD un BX (TCon Ty.unitRef 0 []) . TLetD p3 BX (TCon Ty.pairRef 0 [hproc, un]) . TLetD p2 BX (TCon Ty.pairRef 0 [herr, p3]) . TLetD p1 BX (TCon Ty.pairRef 0 [hout, p2]) $ TCon Ty.pairRef 0 [hin, p1] where - (exe,args,hin,hout,herr,hproc,un,p3,p2,p1) = fresh + (exe, args, hin, hout, herr, hproc, un, p3, p2, p1) = fresh set'buffering :: ForeignOp set'buffering instr = @@ -1046,12 +1047,16 @@ set'buffering instr = [ no'buf --> [] --> k1 no'buf, line'buf --> [] --> k1 line'buf, block'buf --> [] --> k1 block'buf, - sblock'buf --> [BX] - --> TAbs n . TMatch n . MatchDataCover Ty.bufferModeRef + sblock'buf + --> [BX] + --> TAbs n + . TMatch n + . MatchDataCover Ty.bufferModeRef $ mapFromList - [ 0 --> [UN] + [ 0 + --> [UN] --> TAbs w - . TLetD tag UN (TLit (N sblock'buf)) + . TLetD tag UN (TLit (N sblock'buf)) $ k2 [tag, w] ] ] @@ -1064,7 +1069,7 @@ set'buffering instr = outIoFailUnit s1 s2 s3 u f r (handle, bmode, tag, n, w, s1, s2, s3, u, f, r) = fresh -get'buffering'output :: forall v. Var v => v -> v -> v -> v -> v -> v -> v -> v -> ANormal v +get'buffering'output :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> v -> v -> ANormal v get'buffering'output eitherResult stack1 stack2 stack3 resultTag anyVar failVar successVar = TMatch eitherResult . MatchSum $ mapFromList @@ -1075,19 +1080,23 @@ get'buffering'output eitherResult stack1 stack2 stack3 resultTag anyVar failVar . TMatch resultTag . MatchSum $ mapFromList - [ no'buf --> [] + [ no'buf + --> [] --> TLetD successVar BX (TCon Ty.bufferModeRef no'buf []) $ right successVar, - line'buf --> [] + line'buf + --> [] --> TLetD successVar BX (TCon Ty.bufferModeRef line'buf []) $ right successVar, - block'buf --> [] + block'buf + --> [] --> TLetD successVar BX (TCon Ty.bufferModeRef block'buf []) $ right successVar, - sblock'buf --> [UN] + sblock'buf + --> [UN] --> TAbs stack1 - . TLetD stack2 BX (TCon Ty.natRef 0 [stack1]) - . TLetD successVar BX (TCon Ty.bufferModeRef sblock'buf [stack2]) + . TLetD stack2 BX (TCon Ty.natRef 0 [stack1]) + . TLetD successVar BX (TCon Ty.bufferModeRef sblock'buf [stack2]) $ right successVar ] ) @@ -1119,7 +1128,6 @@ murmur'hash instr = where (x, vl, result) = fresh - crypto'hmac :: ForeignOp crypto'hmac instr = ([BX, BX, BX],) @@ -1145,19 +1153,19 @@ crypto'hmac instr = -- -- () -> ... -inUnit :: forall v. Var v => v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inUnit :: forall v. (Var v) => v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inUnit unit result cont instr = ([BX], TAbs unit $ TLetD result UN (TFOp instr []) cont) -- a -> ... -inBx :: forall v. Var v => v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inBx :: forall v. (Var v) => v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inBx arg result cont instr = ([BX],) . TAbs arg $ TLetD result UN (TFOp instr [arg]) cont -- Nat -> ... -inNat :: forall v. Var v => v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inNat :: forall v. (Var v) => v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inNat arg nat result cont instr = ([BX],) . TAbs arg @@ -1165,7 +1173,7 @@ inNat arg nat result cont instr = $ TLetD result UN (TFOp instr [nat]) cont -- Maybe a -> b -> ... -inMaybeBx :: forall v. Var v => v -> v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inMaybeBx :: forall v. (Var v) => v -> v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inMaybeBx arg1 arg2 arg3 mb result cont instr = ([BX, BX],) . TAbss [arg1, arg2] @@ -1182,14 +1190,14 @@ inMaybeBx arg1 arg2 arg3 mb result cont instr = ] -- a -> b -> ... -inBxBx :: forall v. Var v => v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inBxBx :: forall v. (Var v) => v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inBxBx arg1 arg2 result cont instr = ([BX, BX],) . TAbss [arg1, arg2] $ TLetD result UN (TFOp instr [arg1, arg2]) cont -- a -> b -> c -> ... -inBxBxBx :: forall v. Var v => v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inBxBxBx :: forall v. (Var v) => v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inBxBxBx arg1 arg2 arg3 result cont instr = ([BX, BX, BX],) . TAbss [arg1, arg2, arg3] @@ -1206,7 +1214,7 @@ set'echo instr = (arg1, arg2, bol, stack1, stack2, stack3, unit, fail, result) = fresh -- a -> Nat -> ... -inBxNat :: forall v. Var v => v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inBxNat :: forall v. (Var v) => v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inBxNat arg1 arg2 nat result cont instr = ([BX, BX],) . TAbss [arg1, arg2] @@ -1214,7 +1222,7 @@ inBxNat arg1 arg2 nat result cont instr = $ TLetD result UN (TFOp instr [arg1, nat]) cont inBxNatNat :: - Var v => v -> v -> v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) + (Var v) => v -> v -> v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inBxNatNat arg1 arg2 arg3 nat1 nat2 result cont instr = ([BX, BX, BX],) . TAbss [arg1, arg2, arg3] @@ -1222,7 +1230,7 @@ inBxNatNat arg1 arg2 arg3 nat1 nat2 result cont instr = . unbox arg3 Ty.natRef nat2 $ TLetD result UN (TFOp instr [arg1, nat1, nat2]) cont -inBxNatBx :: Var v => v -> v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inBxNatBx :: (Var v) => v -> v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inBxNatBx arg1 arg2 arg3 nat result cont instr = ([BX, BX, BX],) . TAbss [arg1, arg2, arg3] @@ -1230,14 +1238,13 @@ inBxNatBx arg1 arg2 arg3 nat result cont instr = $ TLetD result UN (TFOp instr [arg1, nat, arg3]) cont -- a -> IOMode -> ... -inBxIomr :: forall v. Var v => v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) +inBxIomr :: forall v. (Var v) => v -> v -> v -> v -> ANormal v -> FOp -> ([Mem], ANormal v) inBxIomr arg1 arg2 fm result cont instr = ([BX, BX],) . TAbss [arg1, arg2] . unenum 4 arg2 Ty.fileModeRef fm $ TLetD result UN (TFOp instr [arg1, fm]) cont - -- Output Shape -- these will represent different ways of translating -- the result of a foreign call to a Unison Term -- @@ -1250,7 +1257,7 @@ inBxIomr arg1 arg2 fm result cont instr = -- result of the foreign call -- -outMaybe :: forall v. Var v => v -> v -> ANormal v +outMaybe :: forall v. (Var v) => v -> v -> ANormal v outMaybe maybe result = TMatch result . MatchSum $ mapFromList @@ -1258,17 +1265,21 @@ outMaybe maybe result = (1, ([BX], TAbs maybe $ some maybe)) ] -outMaybeNat :: Var v => v -> v -> v -> ANormal v +outMaybeNat :: (Var v) => v -> v -> v -> ANormal v outMaybeNat tag result n = TMatch tag . MatchSum $ mapFromList [ (0, ([], none)), - (1, ([UN], - TAbs result . - TLetD n BX (TCon Ty.natRef 0 [n]) $ some n)) + ( 1, + ( [UN], + TAbs result + . TLetD n BX (TCon Ty.natRef 0 [n]) + $ some n + ) + ) ] -outMaybeNTup :: forall v. Var v => v -> v -> v -> v -> v -> v -> v -> ANormal v +outMaybeNTup :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> v -> ANormal v outMaybeNTup a b n u bp p result = TMatch result . MatchSum $ mapFromList @@ -1285,7 +1296,7 @@ outMaybeNTup a b n u bp p result = ) ] -outMaybeTup :: Var v => v -> v -> v -> v -> v -> v -> ANormal v +outMaybeTup :: (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outMaybeTup a b u bp ap result = TMatch result . MatchSum $ mapFromList @@ -1301,7 +1312,7 @@ outMaybeTup a b u bp ap result = ) ] -outIoFail :: forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v +outIoFail :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoFail stack1 stack2 stack3 any fail result = TMatch result . MatchSum $ mapFromList @@ -1309,7 +1320,7 @@ outIoFail stack1 stack2 stack3 any fail result = (1, ([BX], TAbs stack1 $ right stack1)) ] -outIoFailNat :: forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v +outIoFailNat :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoFailNat stack1 stack2 stack3 fail extra result = TMatch result . MatchSum $ mapFromList @@ -1322,7 +1333,7 @@ outIoFailNat stack1 stack2 stack3 fail extra result = ) ] -outIoFailChar :: forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v +outIoFailChar :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoFailChar stack1 stack2 stack3 fail extra result = TMatch result . MatchSum $ mapFromList @@ -1336,25 +1347,27 @@ outIoFailChar stack1 stack2 stack3 fail extra result = ] failureCase :: - Var v => v -> v -> v -> v -> v -> (Word64, ([Mem], ANormal v)) + (Var v) => v -> v -> v -> v -> v -> (Word64, ([Mem], ANormal v)) failureCase stack1 stack2 stack3 any fail = - (0,) . ([BX, BX, BX],) + (0,) + . ([BX, BX, BX],) . TAbss [stack1, stack2, stack3] . TLetD any BX (TCon Ty.anyRef 0 [stack3]) . TLetD fail BX (TCon Ty.failureRef 0 [stack1, stack2, any]) $ left fail exnCase :: - Var v => v -> v -> v -> v -> v -> (Word64, ([Mem], ANormal v)) + (Var v) => v -> v -> v -> v -> v -> (Word64, ([Mem], ANormal v)) exnCase stack1 stack2 stack3 any fail = - (0,) . ([BX, BX, BX],) + (0,) + . ([BX, BX, BX],) . TAbss [stack1, stack2, stack3] . TLetD any BX (TCon Ty.anyRef 0 [stack3]) . TLetD fail BX (TCon Ty.failureRef 0 [stack1, stack2, any]) $ TReq Ty.exceptionRef 0 [fail] outIoExnNat :: - forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v + forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoExnNat stack1 stack2 stack3 any fail result = TMatch result . MatchSum $ mapFromList @@ -1367,7 +1380,7 @@ outIoExnNat stack1 stack2 stack3 any fail result = ] outIoExnUnit :: - forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v + forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoExnUnit stack1 stack2 stack3 any fail result = TMatch result . MatchSum $ mapFromList @@ -1376,7 +1389,7 @@ outIoExnUnit stack1 stack2 stack3 any fail result = ] outIoExnBox :: - Var v => v -> v -> v -> v -> v -> v -> ANormal v + (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoExnBox stack1 stack2 stack3 any fail result = TMatch result . MatchSum $ mapFromList @@ -1384,7 +1397,7 @@ outIoExnBox stack1 stack2 stack3 any fail result = (1, ([BX], TAbs stack1 $ TVar stack1)) ] -outIoFailBox :: forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v +outIoFailBox :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoFailBox stack1 stack2 stack3 any fail result = TMatch result . MatchSum $ mapFromList @@ -1396,7 +1409,7 @@ outIoFailBox stack1 stack2 stack3 any fail result = ) ] -outIoFailUnit :: forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v +outIoFailUnit :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoFailUnit stack1 stack2 stack3 extra fail result = TMatch result . MatchSum $ mapFromList @@ -1409,7 +1422,7 @@ outIoFailUnit stack1 stack2 stack3 extra fail result = ) ] -outIoFailBool :: forall v. Var v => v -> v -> v -> v -> v -> v -> ANormal v +outIoFailBool :: forall v. (Var v) => v -> v -> v -> v -> v -> v -> ANormal v outIoFailBool stack1 stack2 stack3 extra fail result = TMatch result . MatchSum $ mapFromList @@ -1423,7 +1436,7 @@ outIoFailBool stack1 stack2 stack3 extra fail result = ] outIoFailG :: - Var v => + (Var v) => v -> v -> v -> @@ -2177,22 +2190,28 @@ declareForeigns = do declareForeign Tracked "IO.putBytes.impl.v3" boxBoxToEF0 . mkForeignIOF $ \(h, bs) -> hPut h (Bytes.toArray bs) declareForeign Tracked "IO.systemTime.impl.v3" unitToEFNat $ - mkForeignIOF $ \() -> getPOSIXTime + mkForeignIOF $ + \() -> getPOSIXTime declareForeign Tracked "IO.systemTimeMicroseconds.v1" unitToInt $ - mkForeign $ \() -> fmap (1e6 *) getPOSIXTime + mkForeign $ + \() -> fmap (1e6 *) getPOSIXTime declareForeign Tracked "Clock.internals.monotonic.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime Monotonic + mkForeignIOF $ + \() -> getTime Monotonic declareForeign Tracked "Clock.internals.realtime.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime Realtime + mkForeignIOF $ + \() -> getTime Realtime declareForeign Tracked "Clock.internals.processCPUTime.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime ProcessCPUTime + mkForeignIOF $ + \() -> getTime ProcessCPUTime declareForeign Tracked "Clock.internals.threadCPUTime.v1" unitToEFBox $ - mkForeignIOF $ \() -> getTime ThreadCPUTime + mkForeignIOF $ + \() -> getTime ThreadCPUTime declareForeign Tracked "Clock.internals.sec.v1" boxToInt $ mkForeign (\n -> pure (fromIntegral $ sec n :: Word64)) @@ -2205,7 +2224,8 @@ declareForeigns = do let chop = reverse . dropWhile isPathSeparator . reverse declareForeign Tracked "IO.getTempDirectory.impl.v3" unitToEFBox $ - mkForeignIOF $ \() -> chop <$> getTemporaryDirectory + mkForeignIOF $ + \() -> chop <$> getTemporaryDirectory declareForeign Tracked "IO.createTempDirectory.impl.v3" boxToEFBox $ mkForeignIOF $ \prefix -> do @@ -2226,28 +2246,33 @@ declareForeigns = do mkForeignIOF getEnv declareForeign Tracked "IO.getArgs.impl.v1" unitToEFBox $ - mkForeignIOF $ \() -> fmap Util.Text.pack <$> SYS.getArgs + mkForeignIOF $ + \() -> fmap Util.Text.pack <$> SYS.getArgs declareForeign Tracked "IO.isDirectory.impl.v3" boxToEFBool $ mkForeignIOF doesDirectoryExist declareForeign Tracked "IO.createDirectory.impl.v3" boxToEF0 $ - mkForeignIOF $ createDirectoryIfMissing True + mkForeignIOF $ + createDirectoryIfMissing True declareForeign Tracked "IO.removeDirectory.impl.v3" boxToEF0 $ mkForeignIOF removeDirectoryRecursive declareForeign Tracked "IO.renameDirectory.impl.v3" boxBoxToEF0 $ - mkForeignIOF $ uncurry renameDirectory + mkForeignIOF $ + uncurry renameDirectory declareForeign Tracked "IO.directoryContents.impl.v3" boxToEFBox $ - mkForeignIOF $ (fmap Util.Text.pack <$>) . getDirectoryContents + mkForeignIOF $ + (fmap Util.Text.pack <$>) . getDirectoryContents declareForeign Tracked "IO.removeFile.impl.v3" boxToEF0 $ mkForeignIOF removeFile declareForeign Tracked "IO.renameFile.impl.v3" boxBoxToEF0 $ - mkForeignIOF $ uncurry renameFile + mkForeignIOF $ + uncurry renameFile declareForeign Tracked "IO.getFileTimestamp.impl.v3" boxToEFNat . mkForeignIOF @@ -2583,7 +2608,7 @@ declareForeigns = do . mkForeign $ pure . deserializeValue . Bytes.toArray -- Hashing functions - let declareHashAlgorithm :: forall alg. Hash.HashAlgorithm alg => Data.Text.Text -> alg -> FDecl Symbol () + let declareHashAlgorithm :: forall alg. (Hash.HashAlgorithm alg) => Data.Text.Text -> alg -> FDecl Symbol () declareHashAlgorithm txt alg = do let algoRef = Builtin ("crypto.HashAlgorithm." <> txt) declareForeign Untracked ("crypto.HashAlgorithm." <> txt) direct . mkForeign $ \() -> @@ -2614,7 +2639,7 @@ declareForeigns = do declareForeign Untracked "crypto.hash" crypto'hash . mkForeign $ \(HashAlgorithm _ alg, x) -> let hashlazy :: - Hash.HashAlgorithm a => + (Hash.HashAlgorithm a) => a -> L.ByteString -> Hash.Digest a @@ -2624,7 +2649,7 @@ declareForeigns = do declareForeign Untracked "crypto.hmac" crypto'hmac . mkForeign $ \(HashAlgorithm _ alg, key, x) -> let hmac :: - Hash.HashAlgorithm a => a -> L.ByteString -> HMAC.HMAC a + (Hash.HashAlgorithm a) => a -> L.ByteString -> HMAC.HMAC a hmac _ s = HMAC.finalize . HMAC.updates diff --git a/parser-typechecker/src/Unison/Runtime/Debug.hs b/parser-typechecker/src/Unison/Runtime/Debug.hs index f40358650..143543a73 100644 --- a/parser-typechecker/src/Unison/Runtime/Debug.hs +++ b/parser-typechecker/src/Unison/Runtime/Debug.hs @@ -33,7 +33,7 @@ traceCombs _ False c = c traceCombs w True c = trace (prettyCombs w c "") c tracePretty :: - Var v => + (Var v) => PrettyPrintEnv -> Bool -> Term v -> @@ -42,7 +42,7 @@ tracePretty _ False tm = tm tracePretty ppe True tm = trace (toANSI 50 $ pretty ppe tm) tm tracePrettyGroup :: - Var v => + (Var v) => Word64 -> Bool -> SuperGroup v -> diff --git a/parser-typechecker/src/Unison/Runtime/Decompile.hs b/parser-typechecker/src/Unison/Runtime/Decompile.hs index c1907ab7a..42f88920c 100644 --- a/parser-typechecker/src/Unison/Runtime/Decompile.hs +++ b/parser-typechecker/src/Unison/Runtime/Decompile.hs @@ -61,14 +61,14 @@ import qualified Unison.Util.Text as Text import Unison.Var (Var) import Unsafe.Coerce -- for Int -> Double -con :: Var v => Reference -> Word64 -> Term v () +con :: (Var v) => Reference -> Word64 -> Term v () con rf ct = constructor () (ConstructorReference rf $ fromIntegral ct) err :: String -> Either Error a err = Left . lit . fromString decompile :: - Var v => + (Var v) => (Word64 -> Word64 -> Maybe (Term v ())) -> Closure -> Either Error (Term v ()) @@ -105,7 +105,7 @@ tag2bool 0 = Right False tag2bool 1 = Right True tag2bool _ = err "bad boolean tag" -substitute :: Var v => Term v () -> [Term v ()] -> Term v () +substitute :: (Var v) => Term v () -> [Term v ()] -> Term v () substitute = align [] where align vts (LamNamed' v bd) (t : ts) = align ((v, t) : vts) bd ts @@ -114,7 +114,7 @@ substitute = align [] align vts tm ts = apps' (substs vts tm) ts decompileUnboxed :: - Var v => Reference -> Word64 -> Int -> Either Error (Term v ()) + (Var v) => Reference -> Word64 -> Int -> Either Error (Term v ()) decompileUnboxed r _ i | r == natRef = pure . nat () $ fromIntegral i | r == intRef = pure . int () $ fromIntegral i @@ -124,7 +124,7 @@ decompileUnboxed r _ _ = err $ "cannot decompile unboxed data type with reference: " ++ show r decompileForeign :: - Var v => + (Var v) => (Word64 -> Word64 -> Maybe (Term v ())) -> Foreign -> Either Error (Term v ()) @@ -141,14 +141,14 @@ decompileForeign topTerms f decompileForeign _ f = err $ "cannot decompile Foreign: " ++ show f -decompileBytes :: Var v => By.Bytes -> Term v () +decompileBytes :: (Var v) => By.Bytes -> Term v () decompileBytes = app () (builtin () $ fromString "Bytes.fromList") . list () . fmap (nat () . fromIntegral) . By.toWord8s -decompileHashAlgorithm :: Var v => HashAlgorithm -> Term v () +decompileHashAlgorithm :: (Var v) => HashAlgorithm -> Term v () decompileHashAlgorithm (HashAlgorithm r _) = ref () r unwrapSeq :: Foreign -> Maybe (Seq Closure) diff --git a/parser-typechecker/src/Unison/Runtime/Exception.hs b/parser-typechecker/src/Unison/Runtime/Exception.hs index 4f6fe1903..11f5fdbc1 100644 --- a/parser-typechecker/src/Unison/Runtime/Exception.hs +++ b/parser-typechecker/src/Unison/Runtime/Exception.hs @@ -4,19 +4,19 @@ import Control.Exception import Data.String (fromString) import Data.Text import GHC.Stack +import Unison.Reference (Reference) import Unison.Runtime.Stack import Unison.Util.Pretty as P -import Unison.Reference (Reference) data RuntimeExn = PE CallStack (P.Pretty P.ColorText) - | BU [(Reference,Int)] Text Closure + | BU [(Reference, Int)] Text Closure deriving (Show) instance Exception RuntimeExn -die :: HasCallStack => String -> IO a +die :: (HasCallStack) => String -> IO a die = throwIO . PE callStack . P.lit . fromString -exn :: HasCallStack => String -> a +exn :: (HasCallStack) => String -> a exn = throw . PE callStack . P.lit . fromString diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index 81b7b2a2a..77c9945d8 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -227,7 +227,7 @@ instance BuiltinForeign TimeSpec where foreignRef = Tagged Ty.timeSpecRef data HashAlgorithm where -- Reference is a reference to the hash algorithm - HashAlgorithm :: Hash.HashAlgorithm a => Reference -> a -> HashAlgorithm + HashAlgorithm :: (Hash.HashAlgorithm a) => Reference -> a -> HashAlgorithm newtype Tls = Tls TLS.Context @@ -238,15 +238,15 @@ instance BuiltinForeign HashAlgorithm where foreignRef = Tagged Ty.hashAlgorithm instance BuiltinForeign CPattern where foreignRef = Tagged Ty.patternRef -wrapBuiltin :: forall f. BuiltinForeign f => f -> Foreign +wrapBuiltin :: forall f. (BuiltinForeign f) => f -> Foreign wrapBuiltin x = Wrap r x where Tagged r = foreignRef :: Tagged f Reference -unwrapBuiltin :: BuiltinForeign f => Foreign -> f +unwrapBuiltin :: (BuiltinForeign f) => Foreign -> f unwrapBuiltin (Wrap _ x) = unsafeCoerce x -maybeUnwrapBuiltin :: forall f. BuiltinForeign f => Foreign -> Maybe f +maybeUnwrapBuiltin :: forall f. (BuiltinForeign f) => Foreign -> Maybe f maybeUnwrapBuiltin (Wrap r x) | r == r0 = Just (unsafeCoerce x) | otherwise = Nothing diff --git a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs index 5ec505629..db8636417 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign/Function.hs @@ -15,8 +15,8 @@ import Control.Concurrent (ThreadId) import Control.Concurrent.MVar (MVar) import Control.Concurrent.STM (TVar) import Control.Exception (evaluate) -import qualified Data.Char as Char import Data.Atomics (Ticket) +import qualified Data.Char as Char import Data.Foldable (toList) import Data.IORef (IORef) import Data.Primitive.Array as PA @@ -48,8 +48,8 @@ import Unison.Type typeLinkRef, ) import Unison.Util.Bytes (Bytes) -import Unison.Util.Text (Text, pack, unpack) import Unison.Util.RefPromise (Promise) +import Unison.Util.Text (Text, pack, unpack) -- Foreign functions operating on stacks data ForeignFunc where @@ -151,7 +151,7 @@ instance ForeignConvention POSIXTime where readForeign = readForeignAs (fromIntegral :: Int -> POSIXTime) writeForeign = writeForeignAs (round :: POSIXTime -> Int) -instance ForeignConvention a => ForeignConvention (Maybe a) where +instance (ForeignConvention a) => ForeignConvention (Maybe a) where readForeign (i : us) bs ustk bstk = peekOff ustk i >>= \case 0 -> pure (us, bs, Nothing) @@ -217,7 +217,7 @@ instance ForeignConvention IOException where writeForeign = writeForeignAs (ioeEncode . ioe_type) readForeignAs :: - ForeignConvention a => + (ForeignConvention a) => (a -> b) -> [Int] -> [Int] -> @@ -227,7 +227,7 @@ readForeignAs :: readForeignAs f us bs ustk bstk = fmap f <$> readForeign us bs ustk bstk writeForeignAs :: - ForeignConvention b => + (ForeignConvention b) => (a -> b) -> Stack 'UN -> Stack 'BX -> @@ -236,7 +236,7 @@ writeForeignAs :: writeForeignAs f ustk bstk x = writeForeign ustk bstk (f x) readForeignEnum :: - Enum a => + (Enum a) => [Int] -> [Int] -> Stack 'UN -> @@ -245,7 +245,7 @@ readForeignEnum :: readForeignEnum = readForeignAs toEnum writeForeignEnum :: - Enum a => + (Enum a) => Stack 'UN -> Stack 'BX -> a -> @@ -253,7 +253,7 @@ writeForeignEnum :: writeForeignEnum = writeForeignAs fromEnum readForeignBuiltin :: - BuiltinForeign b => + (BuiltinForeign b) => [Int] -> [Int] -> Stack 'UN -> @@ -262,7 +262,7 @@ readForeignBuiltin :: readForeignBuiltin = readForeignAs (unwrapBuiltin . marshalToForeign) writeForeignBuiltin :: - BuiltinForeign b => + (BuiltinForeign b) => Stack 'UN -> Stack 'BX -> b -> @@ -324,7 +324,7 @@ instance (ustk, bstk) <- writeForeign ustk bstk y writeForeign ustk bstk x -instance ForeignConvention a => ForeignConvention (Failure a) where +instance (ForeignConvention a) => ForeignConvention (Failure a) where readForeign us bs ustk bstk = do (us, bs, typeref) <- readTypelink us bs ustk bstk (us, bs, message) <- readForeign us bs ustk bstk @@ -491,13 +491,14 @@ instance ForeignConvention PA.ByteArray where readForeign = readForeignAs (unwrapForeign . marshalToForeign) writeForeign = writeForeignAs (Foreign . Wrap ibytearrayRef) -instance {-# OVERLAPPABLE #-} BuiltinForeign b => ForeignConvention b where +instance {-# OVERLAPPABLE #-} (BuiltinForeign b) => ForeignConvention b where readForeign = readForeignBuiltin writeForeign = writeForeignBuiltin -instance {-# OVERLAPPABLE #-} BuiltinForeign b => ForeignConvention [b] where +instance {-# OVERLAPPABLE #-} (BuiltinForeign b) => ForeignConvention [b] where readForeign us (i : bs) _ bstk = - (us,bs,) . fmap (unwrapForeign . marshalToForeign) + (us,bs,) + . fmap (unwrapForeign . marshalToForeign) . toList <$> peekOffS bstk i readForeign _ _ _ _ = foreignCCError "[b]" diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index 289b50e2e..f784e9576 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -58,7 +58,7 @@ termNamed s = codeLookup :: CodeLookup Symbol Identity Ann codeLookup = CL.fromTypecheckedUnisonFile typecheckedFile -codeLookupM :: Applicative m => CodeLookup Symbol m Ann +codeLookupM :: (Applicative m) => CodeLookup Symbol m Ann codeLookupM = hoist (pure . runIdentity) codeLookup typeNamedId :: String -> R.Id diff --git a/parser-typechecker/src/Unison/Runtime/Interface.hs b/parser-typechecker/src/Unison/Runtime/Interface.hs index b9eb97c98..22ca1cfe4 100644 --- a/parser-typechecker/src/Unison/Runtime/Interface.hs +++ b/parser-typechecker/src/Unison/Runtime/Interface.hs @@ -77,8 +77,8 @@ import Unison.Runtime.MCode import Unison.Runtime.MCode.Serialize import Unison.Runtime.Machine ( ActiveThreads, - Tracer (..), CCache (..), + Tracer (..), apply0, baseCCache, cacheAdd, @@ -273,7 +273,7 @@ backrefLifted ref tm dcmp = Map.fromList . (fmap . fmap) (Map.singleton 0) $ (ref, tm) : dcmp intermediateTerms :: - HasCallStack => + (HasCallStack) => PrettyPrintEnv -> EvalCtx -> [(Reference, Term Symbol)] -> @@ -284,7 +284,7 @@ intermediateTerms ppe ctx rtms = foldMap (\(ref, tm) -> intermediateTerm ppe ref ctx tm) rtms intermediateTerm :: - HasCallStack => + (HasCallStack) => PrettyPrintEnv -> Reference -> EvalCtx -> @@ -311,7 +311,7 @@ intermediateTerm ppe ref ctx tm = tmName = HQ.toString . termName ppe $ RF.Ref ref prepareEvaluation :: - HasCallStack => + (HasCallStack) => PrettyPrintEnv -> Term Symbol -> EvalCtx -> @@ -319,7 +319,8 @@ prepareEvaluation :: prepareEvaluation ppe tm ctx = do missing <- cacheAdd rgrp (ccache ctx) when (not . null $ missing) . fail $ - reportBug "E029347" $ "Error in prepareEvaluation, cache is missing: " <> show missing + reportBug "E029347" $ + "Error in prepareEvaluation, cache is missing: " <> show missing (,) (backrefAdd rbkr ctx) <$> refNumTm (ccache ctx) rmn where (rmn, rtms) @@ -370,7 +371,8 @@ evalInContext ppe ctx activeThreads w = do Right dv -> SimpleTrace . fmt $ pretty ppe dv Left _ -> MsgTrace ("Couldn't decompile value") (show c) where - fmt | fancy = toANSI 50 + fmt + | fancy = toANSI 50 | otherwise = toPlain 50 result <- @@ -410,7 +412,8 @@ bugMsg ppe tr name tm | name == "blank expression" = P.callout icon . P.lines $ [ P.wrap - ( "I encountered a" <> P.red (P.text name) + ( "I encountered a" + <> P.red (P.text name) <> "with the following name/message:" ), "", @@ -421,7 +424,8 @@ bugMsg ppe tr name tm | "pattern match failure" `isPrefixOf` name = P.callout icon . P.lines $ [ P.wrap - ( "I've encountered a" <> P.red (P.text name) + ( "I've encountered a" + <> P.red (P.text name) <> "while scrutinizing:" ), "", @@ -445,7 +449,8 @@ bugMsg ppe tr name tm "pattern match failure" `isPrefixOf` msg = P.callout icon . P.lines $ [ P.wrap - ( "I've encountered a" <> P.red (P.text msg) + ( "I've encountered a" + <> P.red (P.text msg) <> "while scrutinizing:" ), "", @@ -459,7 +464,8 @@ bugMsg ppe tr name tm bugMsg ppe tr name tm = P.callout icon . P.lines $ [ P.wrap - ( "I've encountered a call to" <> P.red (P.text name) + ( "I've encountered a call to" + <> P.red (P.text name) <> "with the following value:" ), "", @@ -551,7 +557,7 @@ startRuntime sandboxed runtimeHost version = do ioTestType = builtinTest External } -withRuntime :: MonadUnliftIO m => Bool -> RuntimeHost -> Text -> (Runtime Symbol -> m a) -> m a +withRuntime :: (MonadUnliftIO m) => Bool -> RuntimeHost -> Text -> (Runtime Symbol -> m a) -> m a withRuntime sandboxed runtimeHost version action = UnliftIO.bracket (liftIO $ startRuntime sandboxed runtimeHost version) (liftIO . terminate) action @@ -578,7 +584,7 @@ data StoredCache (Map Reference (Set Reference)) deriving (Show) -putStoredCache :: MonadPut m => StoredCache -> m () +putStoredCache :: (MonadPut m) => StoredCache -> m () putStoredCache (SCache cs crs trs ftm fty int rtm rty sbs) = do putEnumMap putNat (putEnumMap putNat putComb) cs putEnumMap putNat putReference crs @@ -590,7 +596,7 @@ putStoredCache (SCache cs crs trs ftm fty int rtm rty sbs) = do putMap putReference putNat rty putMap putReference (putFoldable putReference) sbs -getStoredCache :: MonadGet m => m StoredCache +getStoredCache :: (MonadGet m) => m StoredCache getStoredCache = SCache <$> getEnumMap getNat (getEnumMap getNat getComb) diff --git a/parser-typechecker/src/Unison/Runtime/MCode.hs b/parser-typechecker/src/Unison/Runtime/MCode.hs index ec1c8a8e2..811e4a0e1 100644 --- a/parser-typechecker/src/Unison/Runtime/MCode.hs +++ b/parser-typechecker/src/Unison/Runtime/MCode.hs @@ -631,7 +631,7 @@ ctx vs cs = pushCtx (zip vs cs) ECtx -- Look up a variable in the context, getting its position on the -- relevant stack and its calling convention if it is there. -ctxResolve :: Var v => Ctx v -> v -> Maybe (Int, Mem) +ctxResolve :: (Var v) => Ctx v -> v -> Maybe (Int, Mem) ctxResolve ctx v = walk 0 0 ctx where walk _ _ ECtx = Nothing @@ -655,7 +655,7 @@ catCtx (Block l) r = Block $ catCtx l r catCtx (Var v m l) r = Var v m $ catCtx l r -- Split the context after a particular variable -breakAfter :: Eq v => (v -> Bool) -> Ctx v -> (Ctx v, Ctx v) +breakAfter :: (Eq v) => (v -> Bool) -> Ctx v -> (Ctx v, Ctx v) breakAfter _ ECtx = (ECtx, ECtx) breakAfter p (Tag vs) = first Tag $ breakAfter p vs breakAfter p (Block vs) = first Block $ breakAfter p vs @@ -667,13 +667,13 @@ breakAfter p (Var v m vs) = (Var v m lvs, rvs) -- Modify the context to contain the variables introduced by an -- unboxed sum -sumCtx :: Var v => Ctx v -> v -> [(v, Mem)] -> Ctx v +sumCtx :: (Var v) => Ctx v -> v -> [(v, Mem)] -> Ctx v sumCtx ctx v vcs | (lctx, rctx) <- breakAfter (== v) ctx = catCtx lctx $ pushCtx vcs rctx -- Look up a variable in the top let rec context -rctxResolve :: Var v => RCtx v -> v -> Maybe Word64 +rctxResolve :: (Var v) => RCtx v -> v -> Maybe Word64 rctxResolve ctx u = M.lookup u ctx -- Compile a top-level definition group to a collection of combinators. @@ -681,7 +681,7 @@ rctxResolve ctx u = M.lookup u ctx -- and intra-group calls are numbered locally, with 0 specifying -- the global entry point. emitCombs :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -753,7 +753,7 @@ countCtx0 ui bi (Block ctx) = countCtx0 ui bi ctx countCtx0 ui bi ECtx = (ui, bi) emitComb :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -770,7 +770,7 @@ addCount i j = onCount $ \(C u b x) -> C (u + i) (b + j) x -- Emit a machine code section from an ANF term emitSection :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -806,14 +806,16 @@ emitSection _ _ grpn rec ctx (TVar v) emitSection _ _ grpn _ ctx (TPrm p args) = -- 3 is a conservative estimate of how many extra stack slots -- a prim op will need for its results. - addCount 3 3 . countCtx ctx + addCount 3 3 + . countCtx ctx . Ins (emitPOp p $ emitArgs grpn ctx args) . Yield $ DArgV i j where (i, j) = countBlock ctx emitSection _ _ grpn _ ctx (TFOp p args) = - addCount 3 3 . countCtx ctx + addCount 3 3 + . countCtx ctx . Ins (emitFOp p $ emitArgs grpn ctx args) . Yield $ DArgV i j @@ -899,7 +901,7 @@ emitSection _ _ _ _ _ tm = -- Emit the code for a function call emitFunction :: - Var v => + (Var v) => RefNums -> Word64 -> -- self combinator number RCtx v -> -- recursive binding group @@ -1016,7 +1018,7 @@ litArg _ = UArg1 0 -- require a machine code Let, which uses more complicated stack -- manipulation. emitLet :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -1047,7 +1049,8 @@ emitLet rns grpr grpn rec d vcs ctx bnd internalBug $ "unsupported compound direct let: " ++ show bnd | Indirect w <- d = \esect -> - f <$> emitSection rns grpr grpn rec (Block ctx) bnd + f + <$> emitSection rns grpr grpn rec (Block ctx) bnd <*> record (pushCtx vcs ctx) w esect where f s w = Let s (CIx grpr grpn w) @@ -1240,7 +1243,7 @@ emitBP2 p a = ++ show (p, a) emitDataMatching :: - Var v => + (Var v) => Reference -> RefNums -> Reference -> @@ -1266,7 +1269,7 @@ emitDataMatching r rns grpr grpn rec ctx cs df = -- already there, but it was unknown how many there were until -- branching on the tag. emitSumMatching :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -1282,7 +1285,7 @@ emitSumMatching rns grpr grpn rec ctx v i cs = edf = Die "uncovered unboxed sum case" emitRequestMatching :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -1301,8 +1304,8 @@ emitRequestMatching rns grpr grpn rec ctx hs df = MatchW 0 edf <$> tops edf = Die "unhandled ability" emitLitMatching :: - Var v => - Traversable f => + (Var v) => + (Traversable f) => (Int -> Section -> f Section -> Section) -> String -> RefNums -> @@ -1322,7 +1325,7 @@ emitLitMatching con err rns grpr grpn rec ctx i cs df = | otherwise = countCtx ctx $ Die err emitCase :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -1334,7 +1337,7 @@ emitCase rns grpr grpn rec ctx (ccs, TAbss vs bo) = emitSection rns grpr grpn rec (Tag $ pushCtx (zip vs ccs) ctx) bo emitSumCase :: - Var v => + (Var v) => RefNums -> Reference -> Word64 -> @@ -1364,7 +1367,7 @@ emitLit l = Lit $ case l of -- these allocations and passes the appropriate context into the -- provided continuation. emitClosures :: - Var v => + (Var v) => Word64 -> RCtx v -> Ctx v -> @@ -1382,12 +1385,14 @@ emitClosures grpn rec ctx args k = | otherwise = internalBug $ "emitClosures: unknown reference: " ++ show a -emitArgs :: Var v => Word64 -> Ctx v -> [v] -> Args +emitArgs :: (Var v) => Word64 -> Ctx v -> [v] -> Args emitArgs grpn ctx args | Just l <- traverse (ctxResolve ctx) args = demuxArgs l | otherwise = internalBug $ - "emitArgs[" ++ show grpn ++ "]: " + "emitArgs[" + ++ show grpn + ++ "]: " ++ "could not resolve argument variables: " ++ show args @@ -1466,7 +1471,10 @@ prettyCombs w es = prettyComb :: Word64 -> Word64 -> Comb -> ShowS prettyComb w i (Lam ua ba _ _ s) = - shows w . showString ":" . shows i . shows [ua, ba] + shows w + . showString ":" + . shows i + . shows [ua, ba] . showString ":\n" . prettySection 2 s @@ -1483,13 +1491,16 @@ prettySection ind sec = Jump i as -> showString "Jump " . shows i . showString " " . prettyArgs as Match i bs -> - showString "Match " . shows i . showString "\n" + showString "Match " + . shows i + . showString "\n" . prettyBranches (ind + 1) bs Yield as -> showString "Yield " . prettyArgs as Ins i nx -> prettyIns i . showString "\n" . prettySection ind nx Let s n -> - showString "Let\n" . prettySection (ind + 2) s + showString "Let\n" + . prettySection (ind + 2) s . showString "\n" . indent ind . prettyIx n @@ -1498,7 +1509,8 @@ prettySection ind sec = prettyIx :: CombIx -> ShowS prettyIx (CIx _ c s) = - showString "Resume[" . shows c + showString "Resume[" + . shows c . showString "," . shows s . showString "]" @@ -1515,10 +1527,16 @@ prettyBranches ind bs = where pdf e = indent ind . showString "DFLT ->\n" . prettySection (ind + 1) e ptcase t e = - showString "\n" . indent ind . shows t . showString " ->\n" + showString "\n" + . indent ind + . shows t + . showString " ->\n" . prettySection (ind + 1) e picase i e = - showString "\n" . indent ind . shows i . showString " ->\n" + showString "\n" + . indent ind + . shows i + . showString " ->\n" . prettySection (ind + 1) e un :: ShowS @@ -1529,7 +1547,8 @@ bx = ('B' :) prettyIns :: Instr -> ShowS prettyIns (Pack r i as) = - showString "Pack " . showsPrec 10 r + showString "Pack " + . showsPrec 10 r . (' ' :) . shows i . (' ' :) @@ -1546,13 +1565,17 @@ prettyArgs (DArg2 i j) = un . shows [i] . (' ' :) . bx . shows [j] prettyArgs (UArgR i l) = un . shows (Prelude.take l [i ..]) prettyArgs (BArgR i l) = bx . shows (Prelude.take l [i ..]) prettyArgs (DArgR i l j k) = - un . shows (Prelude.take l [i ..]) . (' ' :) + un + . shows (Prelude.take l [i ..]) + . (' ' :) . bx . shows (Prelude.take k [j ..]) prettyArgs (UArgN v) = un . shows (primArrayToList v) prettyArgs (BArgN v) = bx . shows (primArrayToList v) prettyArgs (DArgN u b) = - un . shows (primArrayToList u) . (' ' :) + un + . shows (primArrayToList u) + . (' ' :) . bx . shows (primArrayToList b) prettyArgs (DArgV i j) = ('V' :) . shows [i, j] diff --git a/parser-typechecker/src/Unison/Runtime/MCode/Serialize.hs b/parser-typechecker/src/Unison/Runtime/MCode/Serialize.hs index 76c22a51e..dbeaa226a 100644 --- a/parser-typechecker/src/Unison/Runtime/MCode/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/MCode/Serialize.hs @@ -19,11 +19,11 @@ import Unison.Runtime.MCode hiding (MatchT) import Unison.Runtime.Serialize import qualified Unison.Util.Text as Util.Text -putComb :: MonadPut m => Comb -> m () +putComb :: (MonadPut m) => Comb -> m () putComb (Lam ua ba uf bf body) = pInt ua *> pInt ba *> pInt uf *> pInt bf *> putSection body -getComb :: MonadGet m => m Comb +getComb :: (MonadGet m) => m Comb getComb = Lam <$> gInt <*> gInt <*> gInt <*> gInt <*> getSection data SectionT @@ -59,7 +59,7 @@ instance Tag SectionT where word2tag 8 = pure ExitT word2tag i = unknownTag "SectionT" i -putSection :: MonadPut m => Section -> m () +putSection :: (MonadPut m) => Section -> m () putSection (App b r a) = putTag AppT *> serialize b *> putRef r *> putArgs a putSection (Call b w a) = @@ -79,7 +79,7 @@ putSection (Die s) = putSection Exit = putTag ExitT -getSection :: MonadGet m => m Section +getSection :: (MonadGet m) => m Section getSection = getTag >>= \case AppT -> App <$> deserialize <*> getRef <*> getArgs @@ -152,7 +152,7 @@ instance Tag InstrT where word2tag 17 = pure TryForceT word2tag n = unknownTag "InstrT" n -putInstr :: MonadPut m => Instr -> m () +putInstr :: (MonadPut m) => Instr -> m () putInstr (UPrim1 up i) = putTag UPrim1T *> putTag up *> pInt i putInstr (UPrim2 up i j) = @@ -190,7 +190,7 @@ putInstr (Seq a) = putInstr (TryForce i) = putTag TryForceT *> pInt i -getInstr :: MonadGet m => m Instr +getInstr :: (MonadGet m) => m Instr getInstr = getTag >>= \case UPrim1T -> UPrim1 <$> getTag <*> gInt @@ -257,7 +257,7 @@ instance Tag ArgsT where word2tag 12 = pure DArgVT word2tag n = unknownTag "ArgsT" n -putArgs :: MonadPut m => Args -> m () +putArgs :: (MonadPut m) => Args -> m () putArgs ZArgs = putTag ZArgsT putArgs (UArg1 i) = putTag UArg1T *> pInt i putArgs (UArg2 i j) = putTag UArg1T *> pInt i *> pInt j @@ -274,7 +274,7 @@ putArgs (DArgN ua ba) = putTag DArgNT *> putIntArr ua *> putIntArr ba putArgs (DArgV i j) = putTag DArgVT *> pInt i *> pInt j -getArgs :: MonadGet m => m Args +getArgs :: (MonadGet m) => m Args getArgs = getTag >>= \case ZArgsT -> pure ZArgs @@ -303,22 +303,22 @@ instance Tag RefT where word2tag 2 = pure DynT word2tag n = unknownTag "RefT" n -putRef :: MonadPut m => Ref -> m () +putRef :: (MonadPut m) => Ref -> m () putRef (Stk i) = putTag StkT *> pInt i putRef (Env i j) = putTag EnvT *> pWord i *> pWord j putRef (Dyn i) = putTag DynT *> pWord i -getRef :: MonadGet m => m Ref +getRef :: (MonadGet m) => m Ref getRef = getTag >>= \case StkT -> Stk <$> gInt EnvT -> Env <$> gWord <*> gWord DynT -> Dyn <$> gWord -putCombIx :: MonadPut m => CombIx -> m () +putCombIx :: (MonadPut m) => CombIx -> m () putCombIx (CIx r n i) = putReference r *> pWord n *> pWord i -getCombIx :: MonadGet m => m CombIx +getCombIx :: (MonadGet m) => m CombIx getCombIx = CIx <$> getReference <*> gWord <*> gWord data MLitT = MIT | MDT | MTT | MMT | MYT @@ -337,14 +337,14 @@ instance Tag MLitT where word2tag 4 = pure MYT word2tag n = unknownTag "MLitT" n -putLit :: MonadPut m => MLit -> m () +putLit :: (MonadPut m) => MLit -> m () putLit (MI i) = putTag MIT *> pInt i putLit (MD d) = putTag MDT *> putFloat d putLit (MT t) = putTag MTT *> putText (Util.Text.toText t) putLit (MM r) = putTag MMT *> putReferent r putLit (MY r) = putTag MYT *> putReference r -getLit :: MonadGet m => m MLit +getLit :: (MonadGet m) => m MLit getLit = getTag >>= \case MIT -> MI <$> gInt @@ -367,7 +367,7 @@ instance Tag BranchT where word2tag 3 = pure TestTT word2tag n = unknownTag "BranchT" n -putBranch :: MonadPut m => Branch -> m () +putBranch :: (MonadPut m) => Branch -> m () putBranch (Test1 w s d) = putTag Test1T *> pWord w *> putSection s *> putSection d putBranch (Test2 a sa b sb d) = @@ -382,32 +382,34 @@ putBranch (TestW d m) = putBranch (TestT d m) = putTag TestTT *> putSection d *> putMap (putText . Util.Text.toText) putSection m -getBranch :: MonadGet m => m Branch +getBranch :: (MonadGet m) => m Branch getBranch = getTag >>= \case Test1T -> Test1 <$> gWord <*> getSection <*> getSection Test2T -> - Test2 <$> gWord <*> getSection + Test2 + <$> gWord + <*> getSection <*> gWord <*> getSection <*> getSection TestWT -> TestW <$> getSection <*> getEnumMap gWord getSection TestTT -> TestT <$> getSection <*> getMap (Util.Text.fromText <$> getText) getSection -gInt :: MonadGet m => m Int +gInt :: (MonadGet m) => m Int gInt = unVarInt <$> deserialize -pInt :: MonadPut m => Int -> m () +pInt :: (MonadPut m) => Int -> m () pInt i = serialize (VarInt i) -gWord :: MonadGet m => m Word64 +gWord :: (MonadGet m) => m Word64 gWord = unVarInt <$> deserialize -pWord :: MonadPut m => Word64 -> m () +pWord :: (MonadPut m) => Word64 -> m () pWord w = serialize (VarInt w) -putIntArr :: MonadPut m => PrimArray Int -> m () +putIntArr :: (MonadPut m) => PrimArray Int -> m () putIntArr pa = putFoldable pInt $ toList pa -getIntArr :: MonadGet m => m (PrimArray Int) +getIntArr :: (MonadGet m) => m (PrimArray Int) getIntArr = fromList <$> getList gInt diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index 0eb3f0d5f..3ea45194c 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -135,7 +135,7 @@ baseCCache sandboxed = do (\k v -> let r = builtinTermBackref ! k in emitComb @Symbol rns r k mempty (0, v)) numberedTermLookup -info :: Show a => String -> a -> IO () +info :: (Show a) => String -> a -> IO () info ctx x = infos ctx (show x) infos :: String -> String -> IO () @@ -344,7 +344,8 @@ exec !env !denv !_activeThreads !ustk !bstk !k _ (BPrim1 LOAD i) Left miss -> do poke ustk 0 pokeS bstk $ - Sq.fromList $ Foreign . Wrap Rf.termLinkRef . Ref <$> miss + Sq.fromList $ + Foreign . Wrap Rf.termLinkRef . Ref <$> miss Right x -> do poke ustk 1 poke bstk x @@ -932,7 +933,8 @@ dumpData !_ !ustk !bstk (DataG _ t us bs) = do pure (ustk, bstk) dumpData !mr !_ !_ clo = die $ - "dumpData: bad closure: " ++ show clo + "dumpData: bad closure: " + ++ show clo ++ maybe "" (\r -> "\nexpected type: " ++ show r) mr {-# INLINE dumpData #-} @@ -949,7 +951,8 @@ closeArgs :: Args -> IO (Seg 'UN, Seg 'BX) closeArgs mode !ustk !bstk !useg !bseg args = - (,) <$> augSeg mode ustk useg uargs + (,) + <$> augSeg mode ustk useg uargs <*> augSeg mode bstk bseg bargs where (uargs, bargs) = case args of @@ -1441,7 +1444,8 @@ bprim1 !ustk !bstk PAKT i = do bprim1 !ustk !bstk UPKT i = do t <- peekOffBi bstk i bstk <- bump bstk - pokeS bstk . Sq.fromList + pokeS bstk + . Sq.fromList . fmap (DataU1 Rf.charRef charTag . fromEnum) . Util.Text.unpack $ t @@ -1772,14 +1776,15 @@ resolve _ denv _ (Dyn i) = case EC.lookup i denv of Just clo -> pure clo _ -> die $ "resolve: unhandled ability request: " ++ show i -combSection :: HasCallStack => CCache -> CombIx -> IO Comb +combSection :: (HasCallStack) => CCache -> CombIx -> IO Comb combSection env (CIx _ n i) = readTVarIO (combs env) >>= \cs -> case EC.lookup n cs of Just cmbs -> case EC.lookup i cmbs of Just cmb -> pure cmb Nothing -> die $ - "unknown section `" ++ show i + "unknown section `" + ++ show i ++ "` of combinator `" ++ show n ++ "`." @@ -1791,7 +1796,7 @@ dummyRef = Builtin (DTx.pack "dummy") reserveIds :: Word64 -> TVar Word64 -> IO Word64 reserveIds n free = atomically . stateTVar free $ \i -> (i, i + n) -updateMap :: Semigroup s => s -> TVar s -> STM s +updateMap :: (Semigroup s) => s -> TVar s -> STM s updateMap new r = stateTVar r $ \old -> let total = new <> old in (total, total) @@ -2043,7 +2048,8 @@ reifyValue0 (rty, rtm) = goV goK ANF.KE = pure KE goK (ANF.Mark ua ba ps de k) = - mrk <$> traverse refTy ps + mrk + <$> traverse refTy ps <*> traverse (\(k, v) -> (,) <$> refTy k <*> goV v) (M.toList de) <*> goK k where @@ -2055,7 +2061,8 @@ reifyValue0 (rty, rtm) = goV (fromIntegral bf) (fromIntegral ua) (fromIntegral ba) - <$> (goIx gr) <*> goK k + <$> (goIx gr) + <*> goK k goL (ANF.Text t) = pure . Foreign $ Wrap Rf.textRef t goL (ANF.List l) = Foreign . Wrap Rf.listRef <$> traverse goV l diff --git a/parser-typechecker/src/Unison/Runtime/Pattern.hs b/parser-typechecker/src/Unison/Runtime/Pattern.hs index 96ec92ebe..8bb29326a 100644 --- a/parser-typechecker/src/Unison/Runtime/Pattern.hs +++ b/parser-typechecker/src/Unison/Runtime/Pattern.hs @@ -103,7 +103,7 @@ builtinDataSpec = Map.fromList decls data PatternMatrix v = PM {_rows :: [PatternRow v]} deriving (Show) -usedVars :: Ord v => PatternMatrix v -> Set v +usedVars :: (Ord v) => PatternMatrix v -> Set v usedVars (PM rs) = foldMap usedR rs where usedR (PR ps g b) = @@ -139,12 +139,12 @@ firstRow _ _ = Nothing heuristics :: [Heuristic v] heuristics = [firstRow $ fmap loc . listToMaybe] -extractVar :: Var v => P.Pattern v -> Maybe v +extractVar :: (Var v) => P.Pattern v -> Maybe v extractVar p | P.Unbound {} <- p = Nothing | otherwise = Just (loc p) -extractVars :: Var v => [P.Pattern v] -> [v] +extractVars :: (Var v) => [P.Pattern v] -> [v] extractVars = catMaybes . fmap extractVar -- Splits a data type pattern, yielding its subpatterns. The provided @@ -158,7 +158,7 @@ extractVars = catMaybes . fmap extractVar -- but elsewhere these results are added to a list, so it is more -- convenient to yield a list here. decomposePattern :: - Var v => + (Var v) => Maybe Reference -> Int -> Int -> @@ -260,7 +260,7 @@ data SeqCover v -- Determines how a pattern corresponds to a sequence matching -- compilation target. -decomposeSeqP :: Var v => Set v -> SeqMatch -> P.Pattern v -> SeqCover v +decomposeSeqP :: (Var v) => Set v -> SeqMatch -> P.Pattern v -> SeqCover v decomposeSeqP _ E (P.SequenceLiteral _ []) = Cover [] decomposeSeqP _ E _ = Disjoint decomposeSeqP _ C (P.SequenceOp _ l Cons r) = Cover [l, r] @@ -316,7 +316,7 @@ decomposeSeqP _ _ _ = Overlap -- is used as the result value to indicate success or failure to match, -- because these results are accumulated into a larger list elsewhere. splitRow :: - Var v => + (Var v) => v -> Maybe Reference -> Int -> @@ -335,7 +335,7 @@ splitRow _ _ _ _ row = [([], row)] -- matched against the variable that may be collected to determine the -- cases the built-in value is matched against. splitRowBuiltin :: - Var v => + (Var v) => v -> PatternRow v -> [(P.Pattern (), [([P.Pattern v], PatternRow v)])] @@ -350,7 +350,7 @@ splitRowBuiltin _ r = [(P.Unbound (), [([], r)])] -- compilation. The outer list result is used to indicate success or -- failure. splitRowSeq :: - Var v => + (Var v) => Set v -> v -> SeqMatch -> @@ -368,7 +368,7 @@ splitRowSeq _ _ _ r = [([], r)] -- Renames the variables annotating the patterns in a row, for once a -- canonical choice has been made. -renameRow :: Var v => Map v v -> PatternRow v -> PatternRow v +renameRow :: (Var v) => Map v v -> PatternRow v -> PatternRow v renameRow m (PR p0 g0 b0) = PR p g b where access k @@ -383,7 +383,7 @@ renameRow m (PR p0 g0 b0) = PR p g b -- the variables in the first row, because it may have been generated -- by decomposing a variable or unbound pattern, which will make up -- variables for subpatterns. -chooseVars :: Var v => [[P.Pattern v]] -> [v] +chooseVars :: (Var v) => [[P.Pattern v]] -> [v] chooseVars [] = [] chooseVars ([] : rs) = chooseVars rs chooseVars ((P.Unbound {} : _) : rs) = chooseVars rs @@ -394,7 +394,7 @@ chooseVars (r : _) = extractVars r -- yields an indication of the type of the variables that the -- subpatterns match against, if possible. buildMatrix :: - Var v => + (Var v) => [([P.Pattern v], PatternRow v)] -> ([(v, PType)], PatternMatrix v) buildMatrix [] = ([], PM []) @@ -411,7 +411,7 @@ buildMatrix vrs = (zip cvs rs, PM $ fixRow <$> vrs) -- variables (although currently builtin patterns do not introduce -- variables). splitMatrixBuiltin :: - Var v => + (Var v) => v -> PatternMatrix v -> [(P.Pattern (), [(v, PType)], PatternMatrix v)] @@ -424,7 +424,7 @@ splitMatrixBuiltin v (PM rs) = $ splitRowBuiltin v =<< rs expandIrrefutable :: - Var v => + (Var v) => [(P.Pattern (), [([P.Pattern v], PatternRow v)])] -> [(P.Pattern (), [([P.Pattern v], PatternRow v)])] expandIrrefutable rss = concatMap expand rss @@ -452,7 +452,7 @@ matchPattern vrs = \case -- variables introduced for each case with their types, and new -- matricies for subsequent compilation. splitMatrixSeq :: - Var v => + (Var v) => Set v -> v -> PatternMatrix v -> @@ -474,7 +474,7 @@ splitMatrixSeq avoid v (PM rs) = -- ability match. Yields a new matrix for each constructor, with -- variables introduced and their types for each case. splitMatrix :: - Var v => + (Var v) => v -> Maybe Reference -> NCons -> @@ -490,7 +490,7 @@ splitMatrix v rf cons (PM rs) = -- prepared, and a variable renaming mapping. type PPM v a = State (Word64, [v], Map v v) a -freshVar :: Var v => PPM v v +freshVar :: (Var v) => PPM v v freshVar = state $ \(fw, vs, rn) -> let v = freshenId fw $ typed Pattern in (v, (fw + 1, vs, rn)) @@ -500,7 +500,7 @@ useVar = state $ \case (avoid, v : vs, rn) -> (v, (avoid, vs, rn)) _ -> error "useVar: Expected multiple vars" -renameTo :: Var v => v -> v -> PPM v () +renameTo :: (Var v) => v -> v -> PPM v () renameTo to from = modify $ \(avoid, vs, rn) -> ( avoid, @@ -538,7 +538,7 @@ normalizeSeqP p = p -- function, however, is used when a candidate variable for a pattern -- has already been chosen, as with an As pattern. This allows turning -- redundant names (like with the pattern u@v) into renamings. -prepareAs :: Var v => P.Pattern a -> v -> PPM v (P.Pattern v) +prepareAs :: (Var v) => P.Pattern a -> v -> PPM v (P.Pattern v) prepareAs (P.Unbound _) u = pure $ P.Var u prepareAs (P.As _ p) u = (useVar >>= renameTo u) *> prepareAs p u prepareAs (P.Var _) u = P.Var u <$ (renameTo u =<< useVar) @@ -563,7 +563,7 @@ prepareAs p u = pure $ u <$ p -- pattern is matching against. As patterns are eliminated and the -- variables they bind are used as candidates for what that level of -- the pattern matches against. -preparePattern :: Var v => P.Pattern a -> PPM v (P.Pattern v) +preparePattern :: (Var v) => P.Pattern a -> PPM v (P.Pattern v) preparePattern p = prepareAs p =<< freshVar buildPattern :: Bool -> ConstructorReference -> [v] -> Int -> P.Pattern () @@ -595,7 +595,7 @@ lookupAbil rf (Map.lookup rf -> Just econs) = Left cs -> Right $ fmap (1 +) cs lookupAbil rf _ = Left $ "unknown ability reference: " ++ show rf -compile :: Var v => DataSpec -> Ctx v -> PatternMatrix v -> Term v +compile :: (Var v) => DataSpec -> Ctx v -> PatternMatrix v -> Term v compile _ _ (PM []) = apps' bu [text () "pattern match failure"] where bu = ref () (Builtin "bug") @@ -638,7 +638,7 @@ compile spec ctx m@(PM (r : rs)) ty = Map.findWithDefault Unknown v ctx buildCaseBuiltin :: - Var v => + (Var v) => DataSpec -> Ctx v -> (P.Pattern (), [(v, PType)], PatternMatrix v) -> @@ -650,7 +650,7 @@ buildCaseBuiltin spec ctx0 (p, vrs, m) = ctx = Map.fromList vrs <> ctx0 buildCasePure :: - Var v => + (Var v) => DataSpec -> Ctx v -> (Int, [(v, PType)], PatternMatrix v) -> @@ -666,7 +666,7 @@ buildCasePure spec ctx0 (_, vts, m) = ctx = Map.fromList vts <> ctx0 buildCase :: - Var v => + (Var v) => DataSpec -> Reference -> Bool -> @@ -682,7 +682,7 @@ buildCase spec r eff cons ctx0 (t, vts, m) = ctx = Map.fromList vts <> ctx0 mkRow :: - Var v => + (Var v) => v -> MatchCase a (Term v) -> State Word64 (PatternRow v) @@ -706,7 +706,7 @@ mkRow sv (MatchCase (normalizeSeqP -> p0) g0 (AbsN' vs b)) = Nothing -> Nothing initialize :: - Var v => + (Var v) => PType -> Term v -> [MatchCase () (Term v)] -> @@ -722,7 +722,7 @@ initialize r sc cs = | pv <- freshenId 0 $ typed Pattern = (Just pv, pv) -splitPatterns :: Var v => DataSpec -> Term v -> Term v +splitPatterns :: (Var v) => DataSpec -> Term v -> Term v splitPatterns spec0 = visitPure $ \case Match' sc0 cs0 | ty <- determineType $ p <$> cs0, @@ -749,7 +749,7 @@ builtinCase = Rf.charRef ] -determineType :: Show a => [P.Pattern a] -> PType +determineType :: (Show a) => [P.Pattern a] -> PType determineType = foldMap f where f (P.As _ p) = f p diff --git a/parser-typechecker/src/Unison/Runtime/Serialize.hs b/parser-typechecker/src/Unison/Runtime/Serialize.hs index ae7464e7c..6fae504ee 100644 --- a/parser-typechecker/src/Unison/Runtime/Serialize.hs +++ b/parser-typechecker/src/Unison/Runtime/Serialize.hs @@ -37,48 +37,51 @@ import Unison.Runtime.MCode import qualified Unison.Util.Bytes as Bytes import Unison.Util.EnumContainers as EC -unknownTag :: MonadGet m => String -> Word8 -> m a +unknownTag :: (MonadGet m) => String -> Word8 -> m a unknownTag t w = remaining >>= \r -> exn $ - "unknown " ++ t ++ " word: " ++ show w + "unknown " + ++ t + ++ " word: " + ++ show w ++ " (" ++ show (fromIntegral @_ @Int r) ++ " bytes remaining)" class Tag t where tag2word :: t -> Word8 - word2tag :: MonadGet m => Word8 -> m t + word2tag :: (MonadGet m) => Word8 -> m t -putTag :: MonadPut m => Tag t => t -> m () +putTag :: (MonadPut m) => (Tag t) => t -> m () putTag = putWord8 . tag2word -getTag :: MonadGet m => Tag t => m t +getTag :: (MonadGet m) => (Tag t) => m t getTag = word2tag =<< getWord8 -- Some basics, moved over from V1 serialization -putChar :: MonadPut m => Char -> m () +putChar :: (MonadPut m) => Char -> m () putChar = serialize . VarInt . fromEnum -getChar :: MonadGet m => m Char +getChar :: (MonadGet m) => m Char getChar = toEnum . unVarInt <$> deserialize -putFloat :: MonadPut m => Double -> m () +putFloat :: (MonadPut m) => Double -> m () putFloat = serializeBE -getFloat :: MonadGet m => m Double +getFloat :: (MonadGet m) => m Double getFloat = deserializeBE -putNat :: MonadPut m => Word64 -> m () +putNat :: (MonadPut m) => Word64 -> m () putNat = putWord64be -getNat :: MonadGet m => m Word64 +getNat :: (MonadGet m) => m Word64 getNat = getWord64be -putInt :: MonadPut m => Int64 -> m () +putInt :: (MonadPut m) => Int64 -> m () putInt = serializeBE -getInt :: MonadGet m => m Int64 +getInt :: (MonadGet m) => m Int64 getInt = deserializeBE putLength :: @@ -108,81 +111,81 @@ putFoldable putA as = do putLength (length as) traverse_ putA as -putMap :: MonadPut m => (a -> m ()) -> (b -> m ()) -> Map a b -> m () +putMap :: (MonadPut m) => (a -> m ()) -> (b -> m ()) -> Map a b -> m () putMap putA putB m = putFoldable (putPair putA putB) (Map.toList m) -getList :: MonadGet m => m a -> m [a] +getList :: (MonadGet m) => m a -> m [a] getList a = getLength >>= (`replicateM` a) getMap :: (MonadGet m, Ord a) => m a -> m b -> m (Map a b) getMap getA getB = Map.fromList <$> getList (getPair getA getB) putEnumMap :: - MonadPut m => - EnumKey k => + (MonadPut m) => + (EnumKey k) => (k -> m ()) -> (v -> m ()) -> EnumMap k v -> m () putEnumMap pk pv m = putFoldable (putPair pk pv) (mapToList m) -getEnumMap :: MonadGet m => EnumKey k => m k -> m v -> m (EnumMap k v) +getEnumMap :: (MonadGet m) => (EnumKey k) => m k -> m v -> m (EnumMap k v) getEnumMap gk gv = mapFromList <$> getList (getPair gk gv) -putEnumSet :: MonadPut m => EnumKey k => (k -> m ()) -> EnumSet k -> m () +putEnumSet :: (MonadPut m) => (EnumKey k) => (k -> m ()) -> EnumSet k -> m () putEnumSet pk s = putLength (setSize s) *> traverseSet_ pk s -getEnumSet :: MonadGet m => EnumKey k => m k -> m (EnumSet k) +getEnumSet :: (MonadGet m) => (EnumKey k) => m k -> m (EnumSet k) getEnumSet gk = setFromList <$> getList gk -putMaybe :: MonadPut m => Maybe a -> (a -> m ()) -> m () +putMaybe :: (MonadPut m) => Maybe a -> (a -> m ()) -> m () putMaybe Nothing _ = putWord8 0 putMaybe (Just a) putA = putWord8 1 *> putA a -getMaybe :: MonadGet m => m a -> m (Maybe a) +getMaybe :: (MonadGet m) => m a -> m (Maybe a) getMaybe getA = getWord8 >>= \tag -> case tag of 0 -> pure Nothing 1 -> Just <$> getA _ -> unknownTag "Maybe" tag -putPair :: MonadPut m => (a -> m ()) -> (b -> m ()) -> (a, b) -> m () +putPair :: (MonadPut m) => (a -> m ()) -> (b -> m ()) -> (a, b) -> m () putPair putA putB (a, b) = putA a *> putB b -getPair :: MonadGet m => m a -> m b -> m (a, b) +getPair :: (MonadGet m) => m a -> m b -> m (a, b) getPair = liftA2 (,) -getBytes :: MonadGet m => m Bytes.Bytes +getBytes :: (MonadGet m) => m Bytes.Bytes getBytes = Bytes.fromChunks <$> getList getBlock -putBytes :: MonadPut m => Bytes.Bytes -> m () +putBytes :: (MonadPut m) => Bytes.Bytes -> m () putBytes = putFoldable putBlock . Bytes.chunks -getByteArray :: MonadGet m => m PA.ByteArray +getByteArray :: (MonadGet m) => m PA.ByteArray getByteArray = PA.byteArrayFromList <$> getList getWord8 -putByteArray :: MonadPut m => PA.ByteArray -> m () +putByteArray :: (MonadPut m) => PA.ByteArray -> m () putByteArray a = putFoldable putWord8 (IL.toList a) -getBlock :: MonadGet m => m Bytes.Chunk +getBlock :: (MonadGet m) => m Bytes.Chunk getBlock = getLength >>= fmap Bytes.byteStringToChunk . getByteString -putBlock :: MonadPut m => Bytes.Chunk -> m () +putBlock :: (MonadPut m) => Bytes.Chunk -> m () putBlock b = putLength (BA.length b) *> putByteString (Bytes.chunkToByteString b) -putHash :: MonadPut m => Hash -> m () +putHash :: (MonadPut m) => Hash -> m () putHash h = do let bs = Hash.toByteString h putLength (B.length bs) putByteString bs -getHash :: MonadGet m => m Hash +getHash :: (MonadGet m) => m Hash getHash = do len <- getLength bs <- B.copy <$> Ser.getBytes len pure $ Hash.fromByteString bs -putReferent :: MonadPut m => Referent -> m () +putReferent :: (MonadPut m) => Referent -> m () putReferent = \case Ref r -> do putWord8 0 @@ -192,7 +195,7 @@ putReferent = \case putConstructorReference r putConstructorType ct -getReferent :: MonadGet m => m Referent +getReferent :: (MonadGet m) => m Referent getReferent = do tag <- getWord8 case tag of @@ -200,31 +203,31 @@ getReferent = do 1 -> Con <$> getConstructorReference <*> getConstructorType _ -> unknownTag "getReferent" tag -getConstructorType :: MonadGet m => m CT.ConstructorType +getConstructorType :: (MonadGet m) => m CT.ConstructorType getConstructorType = getWord8 >>= \case 0 -> pure CT.Data 1 -> pure CT.Effect t -> unknownTag "getConstructorType" t -putConstructorType :: MonadPut m => CT.ConstructorType -> m () +putConstructorType :: (MonadPut m) => CT.ConstructorType -> m () putConstructorType = \case CT.Data -> putWord8 0 CT.Effect -> putWord8 1 -putText :: MonadPut m => Text -> m () +putText :: (MonadPut m) => Text -> m () putText text = do let bs = encodeUtf8 text putLength $ B.length bs putByteString bs -getText :: MonadGet m => m Text +getText :: (MonadGet m) => m Text getText = do len <- getLength bs <- B.copy <$> Ser.getBytes len pure $ decodeUtf8 bs -putReference :: MonadPut m => Reference -> m () +putReference :: (MonadPut m) => Reference -> m () putReference r = case r of Builtin name -> do putWord8 0 @@ -234,7 +237,7 @@ putReference r = case r of putHash hash putLength i -getReference :: MonadGet m => m Reference +getReference :: (MonadGet m) => m Reference getReference = do tag <- getWord8 case tag of @@ -242,12 +245,12 @@ getReference = do 1 -> DerivedId <$> (Id <$> getHash <*> getLength) _ -> unknownTag "Reference" tag -putConstructorReference :: MonadPut m => ConstructorReference -> m () +putConstructorReference :: (MonadPut m) => ConstructorReference -> m () putConstructorReference (ConstructorReference r i) = do putReference r putLength i -getConstructorReference :: MonadGet m => m ConstructorReference +getConstructorReference :: (MonadGet m) => m ConstructorReference getConstructorReference = ConstructorReference <$> getReference <*> getLength diff --git a/parser-typechecker/src/Unison/Runtime/Stack.hs b/parser-typechecker/src/Unison/Runtime/Stack.hs index 7e02a74ac..7a08a6a3d 100644 --- a/parser-typechecker/src/Unison/Runtime/Stack.hs +++ b/parser-typechecker/src/Unison/Runtime/Stack.hs @@ -193,7 +193,7 @@ pattern CapV k ua ba us bs <- {-# COMPLETE DataC, PApV, CapV, Foreign, BlackHole #-} -marshalToForeign :: HasCallStack => Closure -> Foreign +marshalToForeign :: (HasCallStack) => Closure -> Foreign marshalToForeign (Foreign x) = x marshalToForeign c = error $ "marshalToForeign: unhandled closure: " ++ show c @@ -502,19 +502,19 @@ pokeOffD :: Stack 'UN -> Int -> Double -> IO () pokeOffD (US _ _ sp stk) i d = writeByteArray stk (sp - i) d {-# INLINE pokeOffD #-} -pokeBi :: BuiltinForeign b => Stack 'BX -> b -> IO () +pokeBi :: (BuiltinForeign b) => Stack 'BX -> b -> IO () pokeBi bstk x = poke bstk (Foreign $ wrapBuiltin x) {-# INLINE pokeBi #-} -pokeOffBi :: BuiltinForeign b => Stack 'BX -> Int -> b -> IO () +pokeOffBi :: (BuiltinForeign b) => Stack 'BX -> Int -> b -> IO () pokeOffBi bstk i x = pokeOff bstk i (Foreign $ wrapBuiltin x) {-# INLINE pokeOffBi #-} -peekBi :: BuiltinForeign b => Stack 'BX -> IO b +peekBi :: (BuiltinForeign b) => Stack 'BX -> IO b peekBi bstk = unwrapForeign . marshalToForeign <$> peek bstk {-# INLINE peekBi #-} -peekOffBi :: BuiltinForeign b => Stack 'BX -> Int -> IO b +peekOffBi :: (BuiltinForeign b) => Stack 'BX -> Int -> IO b peekOffBi bstk i = unwrapForeign . marshalToForeign <$> peekOff bstk i {-# INLINE peekOffBi #-} @@ -678,7 +678,7 @@ instance MEM 'BX where asize (BS ap fp _ _) = fp - ap -frameView :: MEM b => Show (Elem b) => Stack b -> IO () +frameView :: (MEM b) => (Show (Elem b)) => Stack b -> IO () frameView stk = putStr "|" >> gof False 0 where fsz = fsize stk @@ -702,7 +702,7 @@ uscount seg = words $ sizeofByteArray seg bscount :: Seg 'BX -> Int bscount seg = sizeofArray seg -closureTermRefs :: Monoid m => (Reference -> m) -> (Closure -> m) +closureTermRefs :: (Monoid m) => (Reference -> m) -> (Closure -> m) closureTermRefs f (PAp (CIx r _ _) _ cs) = f r <> foldMap (closureTermRefs f) cs closureTermRefs f (DataB1 _ _ c) = closureTermRefs f c @@ -717,7 +717,7 @@ closureTermRefs f (Foreign fo) foldMap (closureTermRefs f) cs closureTermRefs _ _ = mempty -contTermRefs :: Monoid m => (Reference -> m) -> K -> m +contTermRefs :: (Monoid m) => (Reference -> m) -> K -> m contTermRefs f (Mark _ _ _ m k) = foldMap (closureTermRefs f) m <> contTermRefs f k contTermRefs f (Push _ _ _ _ (CIx r _ _) k) = diff --git a/parser-typechecker/src/Unison/Runtime/Vector.hs b/parser-typechecker/src/Unison/Runtime/Vector.hs index fcdfc472d..ed9422231 100644 --- a/parser-typechecker/src/Unison/Runtime/Vector.hs +++ b/parser-typechecker/src/Unison/Runtime/Vector.hs @@ -9,7 +9,7 @@ import Unison.Prelude -- A `Vec a` denotes a `Nat -> Maybe a` data Vec a where Scalar :: a -> Vec a - Vec :: UV.Unbox a => UV.Vector a -> Vec a + Vec :: (UV.Unbox a) => UV.Vector a -> Vec a Pair :: Vec a -> Vec b -> Vec (a, b) Choose :: Vec Bool -> Vec a -> Vec a -> Vec a Mux :: Vec Nat -> Vec (Vec a) -> Vec a diff --git a/parser-typechecker/src/Unison/Syntax/DeclPrinter.hs b/parser-typechecker/src/Unison/Syntax/DeclPrinter.hs index ae3a193ea..360d28f21 100644 --- a/parser-typechecker/src/Unison/Syntax/DeclPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/DeclPrinter.hs @@ -38,7 +38,7 @@ import qualified Unison.Var as Var type SyntaxText = S.SyntaxText' Reference prettyDecl :: - Var v => + (Var v) => PrettyPrintEnvDecl -> Reference -> HQ.HashQualified Name -> @@ -49,7 +49,7 @@ prettyDecl ppe r hq d = case d of Right dd -> prettyDataDecl ppe r hq dd prettyEffectDecl :: - Var v => + (Var v) => PrettyPrintEnv -> Reference -> HQ.HashQualified Name -> @@ -58,7 +58,7 @@ prettyEffectDecl :: prettyEffectDecl ppe r name = prettyGADT ppe CT.Effect r name . toDataDecl prettyGADT :: - Var v => + (Var v) => PrettyPrintEnv -> CT.ConstructorType -> Reference -> @@ -75,7 +75,7 @@ prettyGADT env ctorType r name dd = constructor (n, (_, _, t)) = prettyPattern env ctorType name (ConstructorReference r n) <> fmt S.TypeAscriptionColon " :" - `P.hang` TypePrinter.prettySyntax env t + `P.hang` TypePrinter.prettySyntax env t header = prettyEffectHeader name (DD.EffectDeclaration dd) <> fmt S.ControlKeyword " where" prettyPattern :: @@ -97,7 +97,7 @@ prettyPattern env ctorType namespace ref = conRef = Referent.Con ref ctorType prettyDataDecl :: - Var v => + (Var v) => PrettyPrintEnvDecl -> Reference -> HQ.HashQualified Name -> @@ -146,7 +146,7 @@ prettyDataDecl (PrettyPrintEnvDecl unsuffixifiedPPE suffixifiedPPE) r name dd = -- the expected record naming convention. fieldNames :: forall v a. - Var v => + (Var v) => PrettyPrintEnv -> Reference -> HQ.HashQualified Name -> @@ -205,7 +205,7 @@ prettyModifier (DD.Unique _uid) = fmt S.DataTypeModifier "unique" -- <> ("[" <> P.text uid <> "] ") prettyDataHeader :: - Var v => HQ.HashQualified Name -> DD.DataDeclaration v a -> Pretty SyntaxText + (Var v) => HQ.HashQualified Name -> DD.DataDeclaration v a -> Pretty SyntaxText prettyDataHeader name dd = P.sepNonEmpty " " @@ -216,7 +216,7 @@ prettyDataHeader name dd = ] prettyEffectHeader :: - Var v => + (Var v) => HQ.HashQualified Name -> DD.EffectDeclaration v a -> Pretty SyntaxText @@ -232,7 +232,7 @@ prettyEffectHeader name ed = ] prettyDeclHeader :: - Var v => + (Var v) => HQ.HashQualified Name -> Either (DD.EffectDeclaration v a) (DD.DataDeclaration v a) -> Pretty SyntaxText @@ -240,7 +240,7 @@ prettyDeclHeader name (Left e) = prettyEffectHeader name e prettyDeclHeader name (Right d) = prettyDataHeader name d prettyDeclOrBuiltinHeader :: - Var v => + (Var v) => HQ.HashQualified Name -> DD.DeclOrBuiltin v a -> Pretty SyntaxText diff --git a/parser-typechecker/src/Unison/Syntax/FileParser.hs b/parser-typechecker/src/Unison/Syntax/FileParser.hs index ceed0ba1b..a95d042bf 100644 --- a/parser-typechecker/src/Unison/Syntax/FileParser.hs +++ b/parser-typechecker/src/Unison/Syntax/FileParser.hs @@ -34,10 +34,10 @@ import qualified Unison.Var as Var import qualified Unison.WatchKind as UF import Prelude hiding (readFile) -resolutionFailures :: Ord v => [Names.ResolutionFailure v Ann] -> P v x +resolutionFailures :: (Ord v) => [Names.ResolutionFailure v Ann] -> P v x resolutionFailures es = P.customFailure (ResolutionFailures es) -file :: forall v. Var v => P v (UnisonFile v Ann) +file :: forall v. (Var v) => P v (UnisonFile v Ann) file = do _ <- openBlock -- The file may optionally contain top-level imports, @@ -131,7 +131,7 @@ file = do pure uf -- | Final validations and sanity checks to perform before finishing parsing. -validateUnisonFile :: forall v. Var v => UnisonFile v Ann -> P v () +validateUnisonFile :: forall v. (Var v) => UnisonFile v Ann -> P v () validateUnisonFile uf = checkForDuplicateTermsAndConstructors uf @@ -189,14 +189,14 @@ data Stanza v term | Bindings [((Ann, v), term)] deriving (Foldable, Traversable, Functor) -getVars :: Var v => Stanza v term -> [v] +getVars :: (Var v) => Stanza v term -> [v] getVars = \case WatchBinding _ _ ((_, v), _) -> [v] WatchExpression _ guid _ _ -> [Var.unnamedTest guid] Binding ((_, v), _) -> [v] Bindings bs -> [v | ((_, v), _) <- bs] -stanza :: Var v => P v (Stanza v (Term v Ann)) +stanza :: (Var v) => P v (Stanza v (Term v Ann)) stanza = watchExpression <|> unexpectedAction <|> binding where unexpectedAction = failureIf (TermParser.blockTerm $> getErr) binding @@ -229,7 +229,7 @@ stanza = watchExpression <|> unexpectedAction <|> binding Nothing -> Binding binding Just doc -> Bindings [((ann doc, Var.joinDot v (Var.named "doc")), doc), binding] -watched :: Var v => P v (UF.WatchKind, Text, Ann) +watched :: (Var v) => P v (UF.WatchKind, Text, Ann) watched = P.try $ do kind <- optional wordyIdString guid <- uniqueName 10 @@ -248,7 +248,7 @@ watched = P.try $ do type Accessors v = [(L.Token v, [(L.Token v, Type v Ann)])] declarations :: - Var v => + (Var v) => P v ( Map v (DataDeclaration v Ann), @@ -259,7 +259,7 @@ declarations = do declarations <- many $ declaration <* optional semi let (dataDecls0, effectDecls) = partitionEithers declarations dataDecls = [(a, b) | (a, b, _) <- dataDecls0] - multimap :: Ord k => [(k, v)] -> Map k [v] + multimap :: (Ord k) => [(k, v)] -> Map k [v] multimap = foldl' mi Map.empty mi m (k, v) = Map.insertWith (++) k [v] m mds = multimap dataDecls @@ -279,7 +279,7 @@ declarations = do <> [(v, DD.annotation . DD.toDataDecl <$> es) | (v, es) <- Map.toList mesBad] -- unique[someguid] type Blah = ... -modifier :: Var v => P v (Maybe (L.Token DD.Modifier)) +modifier :: (Var v) => P v (Maybe (L.Token DD.Modifier)) modifier = do optional (unique <|> structural) where @@ -296,7 +296,7 @@ modifier = do pure (DD.Structural <$ tok) declaration :: - Var v => + (Var v) => P v ( Either @@ -309,13 +309,14 @@ declaration = do dataDeclaration :: forall v. - Var v => + (Var v) => Maybe (L.Token DD.Modifier) -> P v (v, DataDeclaration v Ann, Accessors v) dataDeclaration mod = do keywordTok <- fmap void (reserved "type") <|> openBlockWith "type" (name, typeArgs) <- - (,) <$> TermParser.verifyRelativeVarName prefixDefinitionName + (,) + <$> TermParser.verifyRelativeVarName prefixDefinitionName <*> many (TermParser.verifyRelativeVarName prefixDefinitionName) let typeArgVs = L.payload <$> typeArgs eq <- reserved "=" @@ -367,7 +368,7 @@ dataDeclaration mod = do ) effectDeclaration :: - Var v => Maybe (L.Token DD.Modifier) -> P v (v, EffectDeclaration v Ann) + (Var v) => Maybe (L.Token DD.Modifier) -> P v (v, EffectDeclaration v Ann) effectDeclaration mod = do keywordTok <- fmap void (reserved "ability") <|> openBlockWith "ability" name <- TermParser.verifyRelativeVarName prefixDefinitionName @@ -393,7 +394,7 @@ effectDeclaration mod = do ) where constructor :: - Var v => [L.Token v] -> L.Token v -> P v (Ann, v, Type v Ann) + (Var v) => [L.Token v] -> L.Token v -> P v (Ann, v, Type v Ann) constructor typeArgs name = explodeToken <$> TermParser.verifyRelativeVarName prefixDefinitionName diff --git a/parser-typechecker/src/Unison/Syntax/NamePrinter.hs b/parser-typechecker/src/Unison/Syntax/NamePrinter.hs index 4b6910476..49a79ab83 100644 --- a/parser-typechecker/src/Unison/Syntax/NamePrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/NamePrinter.hs @@ -18,7 +18,7 @@ import qualified Unison.Util.SyntaxText as S type SyntaxText = S.SyntaxText' Reference -prettyName :: IsString s => Name -> Pretty s +prettyName :: (IsString s) => Name -> Pretty s prettyName = PP.text . Name.toText prettyHashQualified :: HQ.HashQualified Name -> Pretty SyntaxText @@ -27,7 +27,7 @@ prettyHashQualified hq = styleHashQualified' id (fmt $ S.HashQualifier hq) hq prettyHashQualified' :: HQ'.HashQualified Name -> Pretty SyntaxText prettyHashQualified' = prettyHashQualified . HQ'.toHQ -prettyHashQualified0 :: IsString s => HQ.HashQualified Name -> Pretty s +prettyHashQualified0 :: (IsString s) => HQ.HashQualified Name -> Pretty s prettyHashQualified0 = PP.text . HQ.toText -- | Pretty-print a reference as a name and the given number of characters of @@ -55,15 +55,15 @@ prettyReferent len = prettyLabeledDependency :: Int -> LabeledDependency -> Pretty SyntaxText prettyLabeledDependency len = LD.fold (prettyReference len) (prettyReferent len) -prettyShortHash :: IsString s => ShortHash -> Pretty s +prettyShortHash :: (IsString s) => ShortHash -> Pretty s prettyShortHash = fromString . SH.toString styleHashQualified :: - IsString s => (Pretty s -> Pretty s) -> HQ.HashQualified Name -> Pretty s + (IsString s) => (Pretty s -> Pretty s) -> HQ.HashQualified Name -> Pretty s styleHashQualified style hq = styleHashQualified' style id hq styleHashQualified' :: - IsString s => + (IsString s) => (Pretty s -> Pretty s) -> (Pretty s -> Pretty s) -> HQ.HashQualified Name -> diff --git a/parser-typechecker/src/Unison/Syntax/TermParser.hs b/parser-typechecker/src/Unison/Syntax/TermParser.hs index 02c44a84f..4d624f7d9 100644 --- a/parser-typechecker/src/Unison/Syntax/TermParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TermParser.hs @@ -47,7 +47,7 @@ import Unison.Var (Var) import qualified Unison.Var as Var import Prelude hiding (and, or, seq) -watch :: Show a => String -> a -> a +watch :: (Show a) => String -> a -> a watch msg a = let !_ = trace (msg ++ ": " ++ show a) () in a {- @@ -62,13 +62,13 @@ Sections / partial application of infix operators is not implemented. type TermP v = P v (Term v Ann) -term :: Var v => TermP v +term :: (Var v) => TermP v term = term2 -term2 :: Var v => TermP v +term2 :: (Var v) => TermP v term2 = lam term2 <|> term3 -term3 :: Var v => TermP v +term3 :: (Var v) => TermP v term3 = do t <- infixAppOrBooleanOp ot <- optional (reserved ":" *> TypeParser.computationType) @@ -76,10 +76,10 @@ term3 = do Nothing -> t Just y -> Term.ann (mkAnn t y) t y -keywordBlock :: Var v => TermP v +keywordBlock :: (Var v) => TermP v keywordBlock = letBlock <|> handle <|> ifthen <|> match <|> lamCase -typeLink' :: Var v => P v (L.Token Reference) +typeLink' :: (Var v) => P v (L.Token Reference) typeLink' = do id <- hqPrefixId ns <- asks names @@ -88,7 +88,7 @@ typeLink' = do | Set.size s == 1 -> pure $ const (Set.findMin s) <$> id | otherwise -> customFailure $ UnknownType id s -termLink' :: Var v => P v (L.Token Referent) +termLink' :: (Var v) => P v (L.Token Referent) termLink' = do id <- hqPrefixId ns <- asks names @@ -97,7 +97,7 @@ termLink' = do | Set.size s == 1 -> pure $ const (Set.findMin s) <$> id | otherwise -> customFailure $ UnknownTerm id s -link' :: Var v => P v (Either (L.Token Reference) (L.Token Referent)) +link' :: (Var v) => P v (Either (L.Token Reference) (L.Token Referent)) link' = do id <- hqPrefixId ns <- asks names @@ -106,7 +106,7 @@ link' = do (s, s2) | Set.size s2 == 1 && Set.null s -> pure . Left $ const (Set.findMin s2) <$> id (s, s2) -> customFailure $ UnknownId id s s2 -link :: Var v => TermP v +link :: (Var v) => TermP v link = termLink <|> typeLink where typeLink = do @@ -120,10 +120,10 @@ link = termLink <|> typeLink -- We disallow type annotations and lambdas, -- just function application and operators -blockTerm :: Var v => TermP v +blockTerm :: (Var v) => TermP v blockTerm = lam term <|> infixAppOrBooleanOp -match :: Var v => TermP v +match :: (Var v) => TermP v match = do start <- openBlockWith "match" scrutinee <- term @@ -140,7 +140,7 @@ match = do scrutinee (toList cases) -matchCases1 :: Var v => L.Token () -> P v (NonEmpty (Int, Term.MatchCase Ann (Term v Ann))) +matchCases1 :: (Var v) => L.Token () -> P v (NonEmpty (Int, Term.MatchCase Ann (Term v Ann))) matchCases1 start = do cases <- (sepBy semi matchCase) @@ -159,7 +159,7 @@ matchCases1 start = do -- -- 42, x -> ... -- (42, x) -> ... -matchCase :: Var v => P v (Int, [Term.MatchCase Ann (Term v Ann)]) +matchCase :: (Var v) => P v (Int, [Term.MatchCase Ann (Term v Ann)]) matchCase = do pats <- sepBy1 (label "\",\"" $ reserved ",") parsePattern let boundVars' = [v | (_, vs) <- pats, (_ann, v) <- vs] @@ -186,7 +186,7 @@ matchCase = do let mk (guard, t) = Term.MatchCase pat (fmap (absChain boundVars') guard) (absChain boundVars' t) pure $ (length pats, mk <$> guardsAndBlocks) -parsePattern :: forall v. Var v => P v (Pattern Ann, [(Ann, v)]) +parsePattern :: forall v. (Var v) => P v (Pattern Ann, [(Ann, v)]) parsePattern = label "pattern" root where root = chainl1 patternCandidates patternInfixApp @@ -208,7 +208,11 @@ parsePattern = label "pattern" root -- This order treats ambiguous patterns as nullary constructors if there's -- a constructor with a matching name. leaf = - literal <|> nullaryCtor <|> varOrAs <|> unbound <|> seqLiteral + literal + <|> nullaryCtor + <|> varOrAs + <|> unbound + <|> seqLiteral <|> parenthesizedOrTuplePattern <|> effect literal = (,[]) <$> asum [true, false, number, text, char] @@ -305,12 +309,12 @@ parsePattern = label "pattern" root where f loc = unzipPatterns ((,) . Pattern.SequenceLiteral loc) -lam :: Var v => TermP v -> TermP v +lam :: (Var v) => TermP v -> TermP v lam p = label "lambda" $ mkLam <$> P.try (some prefixDefinitionName <* reserved "->") <*> p where mkLam vs b = Term.lam' (ann (head vs) <> ann b) (map L.payload vs) b -letBlock, handle, ifthen :: Var v => TermP v +letBlock, handle, ifthen :: (Var v) => TermP v letBlock = label "let" $ block "let" handle = label "handle" $ do b <- block "handle" @@ -323,7 +327,7 @@ checkCasesArities cases@((i, _) NonEmpty.:| rest) = Nothing -> pure (i, snd <$> cases) Just (j, a) -> P.customFailure $ PatternArityMismatch i j (ann a) -lamCase :: Var v => TermP v +lamCase :: (Var v) => TermP v lamCase = do start <- openBlockWith "cases" cases <- matchCases1 start @@ -349,27 +353,27 @@ ifthen = label "if" $ do f <- block "else" pure $ Term.iff (ann start <> ann f) c t f -text :: Var v => TermP v +text :: (Var v) => TermP v text = tok Term.text <$> string -char :: Var v => TermP v +char :: (Var v) => TermP v char = tok Term.char <$> character -boolean :: Var v => TermP v +boolean :: (Var v) => TermP v boolean = ((\t -> Term.boolean (ann t) True) <$> reserved "true") <|> ((\t -> Term.boolean (ann t) False) <$> reserved "false") -list :: Var v => TermP v -> TermP v +list :: (Var v) => TermP v -> TermP v list = Parser.seq Term.list -hashQualifiedPrefixTerm :: Var v => TermP v +hashQualifiedPrefixTerm :: (Var v) => TermP v hashQualifiedPrefixTerm = resolveHashQualified =<< hqPrefixId -hashQualifiedInfixTerm :: Var v => TermP v +hashQualifiedInfixTerm :: (Var v) => TermP v hashQualifiedInfixTerm = resolveHashQualified =<< hqInfixId -quasikeyword :: Ord v => String -> P v (L.Token ()) +quasikeyword :: (Ord v) => String -> P v (L.Token ()) quasikeyword kw = queryToken $ \case L.WordyId s Nothing | s == kw -> Just () _ -> Nothing @@ -377,7 +381,7 @@ quasikeyword kw = queryToken $ \case -- If the hash qualified is name only, it is treated as a var, if it -- has a short hash, we resolve that short hash immediately and fail -- committed if that short hash can't be found in the current environment -resolveHashQualified :: Var v => L.Token (HQ.HashQualified Name) -> TermP v +resolveHashQualified :: (Var v) => L.Token (HQ.HashQualified Name) -> TermP v resolveHashQualified tok = do names <- asks names case L.payload tok of @@ -388,7 +392,7 @@ resolveHashQualified tok = do | Set.size s > 1 -> failCommitted $ UnknownTerm tok s | otherwise -> pure $ Term.fromReferent (ann tok) (Set.findMin s) -termLeaf :: forall v. Var v => TermP v +termLeaf :: forall v. (Var v) => TermP v termLeaf = asum [ hashQualifiedPrefixTerm, @@ -441,7 +445,7 @@ termLeaf = -- variables that will be looked up in the environment like anything else. This -- means that the documentation syntax can have its meaning changed by -- overriding what functions the names `syntax.doc*` correspond to. -doc2Block :: forall v. Var v => TermP v +doc2Block :: forall v. (Var v) => TermP v doc2Block = P.lookAhead (openBlockWith "syntax.docUntitledSection") *> elem where @@ -539,7 +543,7 @@ doc2Block = pure $ Term.apps' f [addDelay tm] _ -> regular -docBlock :: Var v => TermP v +docBlock :: (Var v) => TermP v docBlock = do openTok <- openBlockWith "[:" segs <- many segment @@ -662,7 +666,8 @@ docNormalize tm = case tm of _ -> error $ "unexpected doc structure: " ++ show tm where normalize = - Sequence.fromList . (map TupleE.fst3) + Sequence.fromList + . (map TupleE.fst3) . (tracing "after unbreakParas") . unbreakParas . (tracing "after full preprocess") @@ -680,7 +685,7 @@ docNormalize tm = case tm of seqs = map fst xs miniPreProcess seqs = zip (toList seqs) (lineStarteds seqs) unIndent :: - Ord v => + (Ord v) => [(Term v a, UnbreakCase)] -> [(Term v a, UnbreakCase)] unIndent tms = map go tms @@ -756,7 +761,9 @@ docNormalize tm = case tm of tr = const id $ trace $ - "\nprocessElement on blob " ++ (show txt) ++ ", result' = " + "\nprocessElement on blob " + ++ (show txt) + ++ ", result' = " ++ (show result') ++ ", lines: " ++ (show ls) @@ -807,7 +814,7 @@ docNormalize tm = case tm of -- See test2 in transcript doc-formatting.md for an example of how -- this looks when there is whitespace immediately following @[source] -- or @[evaluate]. - lastLines :: Show v => Sequence.Seq (Term v a) -> [Maybe UnbreakCase] + lastLines :: (Show v) => Sequence.Seq (Term v a) -> [Maybe UnbreakCase] lastLines tms = (flip fmap) (toList tms) $ \case DD.DocBlob txt -> unbreakCase txt DD.DocLink _ -> Nothing @@ -838,13 +845,15 @@ docNormalize tm = case tm of -- fighting to break free - overwriting elements that are 'shadowed' by -- a preceding element for which the predicate is true, with a copy of -- that element. - lineStarteds :: Show v => Sequence.Seq (Term v a) -> [UnbreakCase] + lineStarteds :: (Show v) => Sequence.Seq (Term v a) -> [UnbreakCase] lineStarteds tms = tr $ quenchRuns LineEnds StartsUnindented $ xs'' where tr = const id $ trace $ - "lineStarteds: xs = " ++ (show xs) ++ ", xss = " + "lineStarteds: xs = " + ++ (show xs) + ++ ", xss = " ++ (show xss) ++ ", xs' = " ++ (show xs') @@ -885,46 +894,46 @@ docNormalize tm = case tm of [] -> [] x : rest -> (fFirst x) : (map fRest rest) mapExceptLast fRest fLast = reverse . (mapExceptFirst fRest fLast) . reverse - tracing :: Show a => [Char] -> a -> a + tracing :: (Show a) => [Char] -> a -> a tracing when x = (const id $ trace ("at " ++ when ++ ": " ++ (show x) ++ "\n")) x blob aa ac at txt = Term.app aa (Term.constructor ac (ConstructorReference DD.docRef DD.docBlobId)) (Term.text at txt) join aa ac as segs = Term.app aa (Term.constructor ac (ConstructorReference DD.docRef DD.docJoinId)) (Term.list' as segs) - mapBlob :: Ord v => (Text -> Text) -> Term v a -> Term v a + mapBlob :: (Ord v) => (Text -> Text) -> Term v a -> Term v a -- this pattern is just `DD.DocBlob txt` but exploded to capture the annotations as well mapBlob f (aa@(Term.App' ac@(Term.Constructor' (ConstructorReference DD.DocRef DD.DocBlobId)) at@(Term.Text' txt))) = blob (ABT.annotation aa) (ABT.annotation ac) (ABT.annotation at) (f txt) mapBlob _ t = t -delayQuote :: Var v => TermP v +delayQuote :: (Var v) => TermP v delayQuote = P.label "quote" $ do start <- reserved "'" e <- termLeaf pure $ DD.delayTerm (ann start <> ann e) e -delayBlock :: Var v => TermP v +delayBlock :: (Var v) => TermP v delayBlock = P.label "do" $ do b <- block "do" pure $ DD.delayTerm (ann b) b -bang :: Var v => TermP v +bang :: (Var v) => TermP v bang = P.label "bang" $ do start <- reserved "!" e <- termLeaf pure $ DD.forceTerm (ann start <> ann e) (ann start) e -var :: Var v => L.Token v -> Term v Ann +var :: (Var v) => L.Token v -> Term v Ann var t = Term.var (ann t) (L.payload t) -seqOp :: Ord v => P v Pattern.SeqOp +seqOp :: (Ord v) => P v Pattern.SeqOp seqOp = (Pattern.Snoc <$ matchToken (L.SymbolyId ":+" Nothing)) <|> (Pattern.Cons <$ matchToken (L.SymbolyId "+:" Nothing)) <|> (Pattern.Concat <$ matchToken (L.SymbolyId "++" Nothing)) -term4 :: Var v => TermP v +term4 :: (Var v) => TermP v term4 = f <$> some termLeaf where f (func : args) = Term.apps func ((\a -> (ann func <> ann a, a)) <$> args) @@ -932,7 +941,7 @@ term4 = f <$> some termLeaf -- e.g. term4 + term4 - term4 -- or term4 || term4 && term4 -infixAppOrBooleanOp :: Var v => TermP v +infixAppOrBooleanOp :: (Var v) => TermP v infixAppOrBooleanOp = chainl1 term4 (or <|> and <|> infixApp) where or = orf <$> label "or" (reserved "||") @@ -942,25 +951,26 @@ infixAppOrBooleanOp = chainl1 term4 (or <|> and <|> infixApp) infixApp = infixAppf <$> label "infixApp" (hashQualifiedInfixTerm <* optional semi) infixAppf op lhs rhs = Term.apps' op [lhs, rhs] -typedecl :: Var v => P v (L.Token v, Type v Ann) +typedecl :: (Var v) => P v (L.Token v, Type v Ann) typedecl = - (,) <$> P.try (prefixDefinitionName <* reserved ":") + (,) + <$> P.try (prefixDefinitionName <* reserved ":") <*> TypeParser.valueType <* semi -verifyRelativeVarName :: Var v => P v (L.Token v) -> P v (L.Token v) +verifyRelativeVarName :: (Var v) => P v (L.Token v) -> P v (L.Token v) verifyRelativeVarName p = do v <- p verifyRelativeName' (Name.unsafeFromVar <$> v) pure v -verifyRelativeName :: Ord v => P v (L.Token Name) -> P v (L.Token Name) +verifyRelativeName :: (Ord v) => P v (L.Token Name) -> P v (L.Token Name) verifyRelativeName name = do name <- name verifyRelativeName' name pure name -verifyRelativeName' :: Ord v => L.Token Name -> P v () +verifyRelativeName' :: (Ord v) => L.Token Name -> P v () verifyRelativeName' name = do let txt = Name.toText . L.payload $ name when (Text.isPrefixOf "." txt && txt /= ".") $ @@ -977,7 +987,7 @@ verifyRelativeName' name = do -- (x,y) -> match [1,2,3] with -- hd +: tl | hd < 10 -> stuff -- -destructuringBind :: forall v. Var v => P v (Ann, Term v Ann -> Term v Ann) +destructuringBind :: forall v. (Var v) => P v (Ann, Term v Ann -> Term v Ann) destructuringBind = do -- We have to look ahead as far as the `=` to know if this is a bind or -- just an action, for instance: @@ -1007,7 +1017,7 @@ destructuringBind = do -- binding) and the entire body. -- * If the binding is a lambda, the lambda node includes the entire LHS of the binding, -- including the name as well. -binding :: forall v. Var v => P v ((Ann, v), Term v Ann) +binding :: forall v. (Var v) => P v ((Ann, v), Term v Ann) binding = label "binding" do typ <- optional typedecl -- a ++ b = ... @@ -1034,7 +1044,8 @@ binding = label "binding" do (lhsLoc, name, args) <- lhs verifyRelativeName' (fmap Name.unsafeFromVar name) when (L.payload name /= L.payload nameT) $ - customFailure $ SignatureNeedsAccompanyingBody nameT + customFailure $ + SignatureNeedsAccompanyingBody nameT body <- block "=" pure $ fmap @@ -1045,10 +1056,10 @@ binding = label "binding" do mkBinding loc f args body = ((loc, f), Term.lam' (loc <> ann body) (L.payload <$> args) body) -customFailure :: P.MonadParsec e s m => e -> m a +customFailure :: (P.MonadParsec e s m) => e -> m a customFailure = P.customFailure -block :: forall v. Var v => String -> TermP v +block :: forall v. (Var v) => String -> TermP v block s = block' False s (openBlockWith s) closeBlock -- example: use Foo.bar.Baz + ++ x @@ -1061,7 +1072,7 @@ block s = block' False s (openBlockWith s) closeBlock -- names in the environment prefixed by `foo` -- -- todo: doesn't support use Foo.bar ++#abc, which lets you use `++` unqualified to refer to `Foo.bar.++#abc` -importp :: Ord v => P v [(Name, Name)] +importp :: (Ord v) => P v [(Name, Name)] importp = do kw <- reserved "use" -- we allow symbolyId here and parse the suffix optionaly, so we can generate @@ -1087,7 +1098,7 @@ data BlockElement v | DestructuringBind (Ann, Term v Ann -> Term v Ann) | Action (Term v Ann) -instance Show v => Show (BlockElement v) where +instance (Show v) => Show (BlockElement v) where show (Binding ((pos, name), _)) = show ("binding: " :: Text, pos, name) show (DestructuringBind (pos, _)) = show ("destructuring bind: " :: Text, pos) show (Action tm) = show ("action: " :: Text, ann tm) @@ -1095,7 +1106,7 @@ instance Show v => Show (BlockElement v) where -- subst -- use Foo.Bar + blah -- use Bar.Baz zonk zazzle -imports :: Var v => P v (NamesWithHistory, [(v, v)]) +imports :: (Var v) => P v (NamesWithHistory, [(v, v)]) imports = do let sem = P.try (semi <* P.lookAhead (reserved "use")) imported <- mconcat . reverse <$> sepBy sem importp @@ -1105,7 +1116,7 @@ imports = do -- A key feature of imports is we want to be able to say: -- `use foo.bar Baz qux` without having to specify whether `Baz` or `qux` are -- terms or types. -substImports :: Var v => NamesWithHistory -> [(v, v)] -> Term v Ann -> Term v Ann +substImports :: (Var v) => NamesWithHistory -> [(v, v)] -> Term v Ann -> Term v Ann substImports ns imports = ABT.substsInheritAnnotation [ (suffix, Term.var () full) @@ -1118,12 +1129,12 @@ substImports ns imports = NamesWithHistory.hasTypeNamed (Name.unsafeFromVar full) ns ] -block' :: Var v => IsTop -> String -> P v (L.Token ()) -> P v (L.Token ()) -> TermP v +block' :: (Var v) => IsTop -> String -> P v (L.Token ()) -> P v (L.Token ()) -> TermP v block' isTop = block'' isTop False block'' :: forall v b. - Var v => + (Var v) => IsTop -> Bool -> -- `True` means insert `()` at end of block if it ends with a statement String -> @@ -1182,10 +1193,10 @@ block'' isTop implicitUnitAtEnd s openBlock closeBlock = do else (toList bs, Term.var a (positionalVar a Var.missingResult)) in toTm bs -number :: Var v => TermP v +number :: (Var v) => TermP v number = number' (tok Term.int) (tok Term.nat) (tok Term.float) -bytes :: Var v => TermP v +bytes :: (Var v) => TermP v bytes = do b <- bytesToken let a = ann b @@ -1196,7 +1207,7 @@ bytes = do (Term.list a $ Term.nat a . fromIntegral <$> Bytes.toWord8s (L.payload b)) number' :: - Ord v => + (Ord v) => (L.Token Int64 -> a) -> (L.Token Word64 -> a) -> (L.Token Double -> a) -> @@ -1210,7 +1221,7 @@ number' i u f = fmap go numeric | take 1 p == "-" = i (read <$> num) | otherwise = u (read <$> num) -tupleOrParenthesizedTerm :: Var v => TermP v +tupleOrParenthesizedTerm :: (Var v) => TermP v tupleOrParenthesizedTerm = label "tuple" $ tupleOrParenthesized term DD.unitTerm pair where pair t1 t2 = diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index 696085a11..9ed7c6d06 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -63,18 +63,18 @@ import qualified Unison.Var as Var type SyntaxText = S.SyntaxText' Reference -pretty :: Var v => PrettyPrintEnv -> Term v a -> Pretty ColorText +pretty :: (Var v) => PrettyPrintEnv -> Term v a -> Pretty ColorText pretty ppe tm = PP.syntaxToColor . runPretty ppe $ pretty0 emptyAc $ printAnnotate ppe tm -prettyBlock :: Var v => Bool -> PrettyPrintEnv -> Term v a -> Pretty ColorText +prettyBlock :: (Var v) => Bool -> PrettyPrintEnv -> Term v a -> Pretty ColorText prettyBlock elideUnit ppe = PP.syntaxToColor . prettyBlock' elideUnit ppe -prettyBlock' :: Var v => Bool -> PrettyPrintEnv -> Term v a -> Pretty SyntaxText +prettyBlock' :: (Var v) => Bool -> PrettyPrintEnv -> Term v a -> Pretty SyntaxText prettyBlock' elideUnit ppe tm = runPretty ppe . pretty0 (emptyBlockAc {elideUnit = elideUnit}) $ printAnnotate ppe tm -pretty' :: Var v => Maybe Width -> PrettyPrintEnv -> Term v a -> ColorText +pretty' :: (Var v) => Maybe Width -> PrettyPrintEnv -> Term v a -> ColorText pretty' (Just width) n t = PP.render width . PP.syntaxToColor . runPretty n $ pretty0 emptyAc (printAnnotate n t) pretty' Nothing n t = @@ -172,7 +172,7 @@ data DocLiteralContext pretty0 :: forall v m. - MonadPretty v m => + (MonadPretty v m) => AmbientContext -> Term3 v PrintAnnotation -> m (Pretty SyntaxText) @@ -285,7 +285,8 @@ pretty0 PP.group <$> do xs' <- traverse (pretty0 (ac 0 Normal im doc)) xs pure $ - fmt S.DelimiterChar (l "[") <> optSpace + fmt S.DelimiterChar (l "[") + <> optSpace <> intercalateMap (fmt S.DelimiterChar (l ",") <> PP.softbreak <> optSpace <> optSpace) (PP.indentNAfterNewline 2) @@ -531,7 +532,7 @@ pretty0 Constructor' (ConstructorReference DD.DocRef _) -> False _ -> True - nonUnitArgPred :: Var v => v -> Bool + nonUnitArgPred :: (Var v) => v -> Bool nonUnitArgPred v = Var.name v /= "()" -- Render a binary infix operator sequence, like [(a2, f2), (a1, f1)], @@ -588,7 +589,7 @@ pretty0 prettyPattern :: forall v loc. - Var v => + (Var v) => PrettyPrintEnv -> AmbientContext -> Int -> @@ -673,7 +674,7 @@ prettyPattern n c@AmbientContext {imports = im} p vs patt = case patt of Pattern.Snoc -> f 0 ":+" Pattern.Concat -> f 0 "++" where - l :: IsString s => String -> s + l :: (IsString s) => String -> s l = fromString patterns p vs (pat : pats) = let (printed, tail_vs) = @@ -699,7 +700,7 @@ arity1Branches bs = [([pat], guard, body) | MatchCase pat guard body <- bs] -- -- Foo x y, [x,y], [(blah1 x, body1), (blah2 y, body2)] groupCases :: - Ord v => + (Ord v) => [MatchCase' () (Term3 v ann)] -> [([Pattern ()], [v], [(Maybe (Term3 v ann), Term3 v ann)])] groupCases ms = go0 ms @@ -712,7 +713,7 @@ groupCases ms = go0 ms | otherwise = (p0, vs0, reverse acc) : go0 ms printCase :: - MonadPretty v m => + (MonadPretty v m) => Imports -> DocLiteralContext -> [MatchCase' () (Term3 v PrintAnnotation)] -> @@ -755,7 +756,8 @@ printCase im doc ms0 = patLhs env vs pats = case pats of [pat] -> PP.group (fst (prettyPattern env (ac 0 Block im doc) (-1) vs pat)) - pats -> PP.group . PP.sep (PP.indentAfterNewline " " $ "," <> PP.softbreak) + pats -> PP.group + . PP.sep (PP.indentAfterNewline " " $ "," <> PP.softbreak) . (`evalState` vs) . for pats $ \pat -> do @@ -818,7 +820,7 @@ renderPrettyBindingWithoutTypeSignature PrettyBinding {term} = -- (+) : t -> t -> t -- a + b = ... prettyBinding :: - Var v => + (Var v) => PrettyPrintEnv -> HQ.HashQualified Name -> Term2 v at ap v a -> @@ -828,7 +830,7 @@ prettyBinding = -- | Like 'prettyBinding', but elides the type signature (if any). prettyBindingWithoutTypeSignature :: - Var v => + (Var v) => PrettyPrintEnv -> HQ.HashQualified Name -> Term2 v at ap v a -> @@ -837,7 +839,7 @@ prettyBindingWithoutTypeSignature = prettyBinding_ renderPrettyBindingWithoutTypeSignature prettyBinding_ :: - Var v => + (Var v) => (PrettyBinding -> Pretty SyntaxText) -> PrettyPrintEnv -> HQ.HashQualified Name -> @@ -846,7 +848,7 @@ prettyBinding_ :: prettyBinding_ go ppe n = runPretty ppe . fmap go . prettyBinding0 (ac (-1) Block Map.empty MaybeDoc) n prettyBinding' :: - Var v => + (Var v) => PrettyPrintEnv -> Width -> HQ.HashQualified Name -> @@ -856,7 +858,7 @@ prettyBinding' ppe width v t = PP.render width . PP.syntaxToColor $ prettyBinding ppe v t prettyBinding0 :: - MonadPretty v m => + (MonadPretty v m) => AmbientContext -> HQ.HashQualified Name -> Term2 v at ap v a -> @@ -892,7 +894,9 @@ prettyBinding0 a@AmbientContext {imports = im, docContext = doc} v term = term = PP.group $ PP.group - ( defnLhs v vs <> fmt S.BindingEquals " =" <> " " + ( defnLhs v vs + <> fmt S.BindingEquals " =" + <> " " <> fmt S.ControlKeyword "cases" @@ -957,7 +961,7 @@ isDocLiteral term = case term of _ -> False -- Similar to DisplayValues.displayDoc, but does not follow and expand references. -prettyDoc :: Var v => PrettyPrintEnv -> Imports -> Term3 v a -> Pretty SyntaxText +prettyDoc :: (Var v) => PrettyPrintEnv -> Imports -> Term3 v a -> Pretty SyntaxText prettyDoc n im term = mconcat [ fmt S.DocDelimiter $ l "[: ", @@ -1003,7 +1007,7 @@ parenIfInfix :: parenIfInfix name ic = if isSymbolic name && ic == NonInfix then paren True else id -l :: IsString s => String -> Pretty s +l :: (IsString s) => String -> Pretty s l = fromString isSymbolic :: HQ.HashQualified Name -> Bool @@ -1170,7 +1174,7 @@ instance Semigroup PrintAnnotation where instance Monoid PrintAnnotation where mempty = PrintAnnotation {usages = Map.empty} -suffixCounterTerm :: Var v => PrettyPrintEnv -> Term2 v at ap v a -> PrintAnnotation +suffixCounterTerm :: (Var v) => PrettyPrintEnv -> Term2 v at ap v a -> PrintAnnotation suffixCounterTerm n = \case Var' v -> countHQ $ HQ.unsafeFromVar v Ref' r -> countHQ $ PrettyPrintEnv.termName n (Referent.Ref r) @@ -1183,7 +1187,7 @@ suffixCounterTerm n = \case in foldMap (countPatternUsages n . pat) bs _ -> mempty -suffixCounterType :: Var v => PrettyPrintEnv -> Type v a -> PrintAnnotation +suffixCounterType :: (Var v) => PrettyPrintEnv -> Type v a -> PrintAnnotation suffixCounterType n = \case Type.Var' v -> countHQ $ HQ.unsafeFromVar v Type.Ref' r | noImportRefs r || r == Type.listRef -> mempty @@ -1193,7 +1197,7 @@ suffixCounterType n = \case printAnnotate :: (Var v, Ord v) => PrettyPrintEnv -> Term2 v at ap v a -> Term3 v PrintAnnotation printAnnotate n tm = fmap snd (go (reannotateUp (suffixCounterTerm n) tm)) where - go :: Ord v => Term2 v at ap v b -> Term2 v () () v b + go :: (Ord v) => Term2 v at ap v b -> Term2 v () () v b go = extraMap' id (const ()) (const ()) countTypeUsages :: (Var v, Ord v) => PrettyPrintEnv -> Type v a -> PrintAnnotation @@ -1294,7 +1298,8 @@ calcImports im tm = (im', render $ getUses result) -- Keep only names P.S where there is no other Q with Q.S also used in this scope. uniqueness :: Map Suffix (Map Prefix Int) -> Map Suffix (Prefix, Int) uniqueness m = - m |> Map.filter (\ps -> Map.size ps == 1) + m + |> Map.filter (\ps -> Map.size ps == 1) |> Map.map (head . Map.toList) -- Keep only names where the number of usages in this scope -- - is > 1, or @@ -1364,7 +1369,8 @@ calcImports im tm = (im', render $ getUses result) getImportMapAdditions = Map.map (\(_, s, _) -> s) getUses :: Map Name (Prefix, Suffix, Int) -> Map Prefix (Set Suffix) getUses m = - Map.elems m |> map (\(p, s, _) -> (p, Set.singleton s)) + Map.elems m + |> map (\(p, s, _) -> (p, Set.singleton s)) |> Map.fromListWith Set.union render :: Map Prefix (Set Suffix) -> [Pretty SyntaxText] -> Pretty SyntaxText render m rest = @@ -1470,7 +1476,7 @@ immediateChildBlockTerms = \case -- Has shadowing, is rendered as a regular `match`. -- match blah with 42 -> body -- Pattern has (is) a literal, rendered as a regular match (rather than `42 = blah; body`) -isDestructuringBind :: Ord v => ABT.Term f v a -> [MatchCase loc (ABT.Term f v a)] -> Bool +isDestructuringBind :: (Ord v) => ABT.Term f v a -> [MatchCase loc (ABT.Term f v a)] -> Bool isDestructuringBind scrutinee [MatchCase pat _ (ABT.AbsN' vs _)] = all (`Set.notMember` ABT.freeVars scrutinee) vs && not (hasLiteral pat) where @@ -1491,7 +1497,7 @@ isDestructuringBind scrutinee [MatchCase pat _ (ABT.AbsN' vs _)] = Pattern.Unbound _ -> False isDestructuringBind _ _ = False -isBlock :: Ord v => Term2 vt at ap v a -> Bool +isBlock :: (Ord v) => Term2 vt at ap v a -> Bool isBlock tm = case tm of If' {} -> True @@ -1501,7 +1507,7 @@ isBlock tm = _ -> False pattern LetBlock :: - Ord v => + (Ord v) => [(v, Term2 vt at ap v a)] -> Term2 vt at ap v a -> Term2 vt at ap v a @@ -1512,7 +1518,7 @@ pattern LetBlock bindings body <- (unLetBlock -> Just (bindings, body)) -- We preserve nesting when the inner block shadows definitions in the -- outer block. unLetBlock :: - Ord v => + (Ord v) => Term2 vt at ap v a -> Maybe ([(v, Term2 vt at ap v a)], Term2 vt at ap v a) unLetBlock t = rec t @@ -1539,7 +1545,7 @@ unLetBlock t = rec t _ -> Just (bindings, body) pattern LamsNamedMatch' :: - Var v => + (Var v) => [v] -> [([Pattern ap], Maybe (Term2 vt at ap v a), Term2 vt at ap v a)] -> Term2 vt at ap v a @@ -1577,7 +1583,7 @@ pattern LamsNamedMatch' vs branches <- (unLamsMatch' -> Just (vs, branches)) -- (For instance, `x -> match (x, 42) with ...` can't be written using -- lambda case) unLamsMatch' :: - Var v => + (Var v) => Term2 vt at ap v a -> Maybe ([v], [([Pattern ap], Maybe (Term2 vt at ap v a), Term2 vt at ap v a)]) unLamsMatch' t = case unLamsUntilDelay' t of @@ -1634,14 +1640,17 @@ toBytes _ = Nothing prettyDoc2 :: forall v m. - MonadPretty v m => + (MonadPretty v m) => AmbientContext -> Term3 v PrintAnnotation -> m (Maybe (Pretty SyntaxText)) prettyDoc2 ac tm = do ppe <- getPPE let brace p = - fmt S.DocDelimiter "{{" <> PP.softbreak <> p <> PP.softbreak + fmt S.DocDelimiter "{{" + <> PP.softbreak + <> p + <> PP.softbreak <> fmt S.DocDelimiter "}}" @@ -1823,7 +1832,7 @@ toDocVerbatim ppe (App' (Ref' r) (toDocWord ppe -> Just txt)) | nameEndsWith ppe ".docVerbatim" r = Just txt toDocVerbatim _ _ = Nothing -toDocEval :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) +toDocEval :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) toDocEval ppe (App' (Ref' r) (Delay' tm)) | nameEndsWith ppe ".docEval" r = Just tm | r == _oldDocEval = Just tm @@ -1838,17 +1847,17 @@ _oldDocEval, _oldDocEvalInline :: Reference _oldDocEval = Reference.unsafeFromText "#m2bmkdos2669tt46sh2gf6cmb4td5le8lcqnmsl9nfaqiv7s816q8bdtjdbt98tkk11ejlesepe7p7u8p0asu9758gdseffh0t78m2o" _oldDocEvalInline = Reference.unsafeFromText "#7pjlvdu42gmfvfntja265dmi08afk08l54kpsuu55l9hq4l32fco2jlrm8mf2jbn61esfsi972b6e66d9on4i5bkmfchjdare1v5npg" -toDocEvalInline :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) +toDocEvalInline :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) toDocEvalInline ppe (App' (Ref' r) (Delay' tm)) | nameEndsWith ppe ".docEvalInline" r = Just tm | r == _oldDocEvalInline = Just tm toDocEvalInline _ _ = Nothing -toDocExample, toDocExampleBlock :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) +toDocExample, toDocExampleBlock :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) toDocExample = toDocExample' ".docExample" toDocExampleBlock = toDocExample' ".docExampleBlock" -toDocExample' :: Ord v => Text -> PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) +toDocExample' :: (Ord v) => Text -> PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Term3 v PrintAnnotation) toDocExample' suffix ppe (Apps' (Ref' r) [Nat' n, l@(LamsNamed' vs tm)]) | nameEndsWith ppe suffix r, ABT.freeVars l == mempty, @@ -1864,7 +1873,7 @@ toDocTransclude ppe (App' (Ref' r) tm) | nameEndsWith ppe ".docTransclude" r = Just tm toDocTransclude _ _ = Nothing -toDocLink :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Either Reference Referent) +toDocLink :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Either Reference Referent) toDocLink ppe (App' (Ref' r) tm) | nameEndsWith ppe ".docLink" r = case tm of (toDocEmbedTermLink ppe -> Just tm) -> Just (Right tm) @@ -1892,7 +1901,7 @@ toDocParagraph ppe (App' (Ref' r) (List' tms)) | nameEndsWith ppe ".docParagraph" r = Just (toList tms) toDocParagraph _ _ = Nothing -toDocEmbedTermLink :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe Referent +toDocEmbedTermLink :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe Referent toDocEmbedTermLink ppe (App' (Ref' r) (Delay' (Referent' tm))) | nameEndsWith ppe ".docEmbedTermLink" r = Just tm toDocEmbedTermLink _ _ = Nothing @@ -1902,10 +1911,10 @@ toDocEmbedTypeLink ppe (App' (Ref' r) (TypeLink' typeref)) | nameEndsWith ppe ".docEmbedTypeLink" r = Just typeref toDocEmbedTypeLink _ _ = Nothing -toDocSourceAnnotations :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe [Referent] +toDocSourceAnnotations :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe [Referent] toDocSourceAnnotations _ppe _tm = Just [] -- todo fetch annotations -toDocSourceElement :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Either Reference Referent, [Referent]) +toDocSourceElement :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe (Either Reference Referent, [Referent]) toDocSourceElement ppe (Apps' (Ref' r) [tm, toDocSourceAnnotations ppe -> Just annotations]) | nameEndsWith ppe ".docSourceElement" r = (,annotations) <$> ok tm @@ -1916,7 +1925,7 @@ toDocSourceElement ppe (Apps' (Ref' r) [tm, toDocSourceAnnotations ppe -> Just a toDocSourceElement _ _ = Nothing toDocSource' :: - Ord v => + (Ord v) => Text -> PrettyPrintEnv -> Term3 v PrintAnnotation -> @@ -1930,19 +1939,19 @@ toDocSource' _ _ _ = Nothing toDocSource, toDocFoldedSource :: - Ord v => + (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe [(Either Reference Referent, [Referent])] toDocSource = toDocSource' ".docSource" toDocFoldedSource = toDocSource' ".docFoldedSource" -toDocSignatureInline :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe Referent +toDocSignatureInline :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe Referent toDocSignatureInline ppe (App' (Ref' r) (toDocEmbedSignatureLink ppe -> Just tm)) | nameEndsWith ppe ".docSignatureInline" r = Just tm toDocSignatureInline _ _ = Nothing -toDocEmbedSignatureLink :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe Referent +toDocEmbedSignatureLink :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe Referent toDocEmbedSignatureLink ppe (App' (Ref' r) (Delay' (Referent' tm))) | nameEndsWith ppe ".docEmbedSignatureLink" r = Just tm toDocEmbedSignatureLink _ _ = Nothing @@ -1960,7 +1969,7 @@ toDocEmbedSignatureLink _ _ = Nothing -- _ -> Nothing -- toDocEmbedAnnotations _ _ = Nothing -toDocSignature :: Ord v => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe [Referent] +toDocSignature :: (Ord v) => PrettyPrintEnv -> Term3 v PrintAnnotation -> Maybe [Referent] toDocSignature ppe (App' (Ref' r) (List' tms)) | nameEndsWith ppe ".docSignature" r = case [tm | Just tm <- toDocEmbedSignatureLink ppe <$> toList tms] of diff --git a/parser-typechecker/src/Unison/Syntax/TypeParser.hs b/parser-typechecker/src/Unison/Syntax/TypeParser.hs index 2f7e33522..8af9a2a3a 100644 --- a/parser-typechecker/src/Unison/Syntax/TypeParser.hs +++ b/parser-typechecker/src/Unison/Syntax/TypeParser.hs @@ -6,10 +6,10 @@ import qualified Text.Megaparsec as P import qualified Unison.Builtin.Decls as DD import qualified Unison.HashQualified as HQ import qualified Unison.NamesWithHistory as Names -import qualified Unison.Syntax.Name as Name (toVar) import Unison.Parser.Ann (Ann (..)) import Unison.Prelude import qualified Unison.Syntax.Lexer as L +import qualified Unison.Syntax.Name as Name (toVar) import Unison.Syntax.Parser import Unison.Type (Type) import qualified Unison.Type as Type @@ -22,20 +22,20 @@ type TypeP v = P v (Type v Ann) -- Value types cannot have effects, unless those effects appear to -- the right of a function arrow: -- valueType ::= Int | Text | App valueType valueType | Arrow valueType computationType -valueType :: Var v => TypeP v +valueType :: (Var v) => TypeP v valueType = forall type1 <|> type1 -- Computation -- computationType ::= [{effect*}] valueType -computationType :: Var v => TypeP v +computationType :: (Var v) => TypeP v computationType = effect <|> valueType -valueTypeLeaf :: Var v => TypeP v +valueTypeLeaf :: (Var v) => TypeP v valueTypeLeaf = tupleOrParenthesizedType valueType <|> typeAtom <|> sequenceTyp -- Examples: Optional, Optional#abc, woot, #abc -typeAtom :: Var v => TypeP v +typeAtom :: (Var v) => TypeP v typeAtom = hqPrefixId >>= \tok -> case L.payload tok of HQ.NameOnly n -> pure $ Type.var (ann tok) (Name.toVar n) @@ -46,13 +46,13 @@ typeAtom = then P.customFailure (UnknownType tok matches) else pure $ Type.ref (ann tok) (Set.findMin matches) -type1 :: Var v => TypeP v +type1 :: (Var v) => TypeP v type1 = arrow type2a -type2a :: Var v => TypeP v +type2a :: (Var v) => TypeP v type2a = delayed <|> type2 -delayed :: Var v => TypeP v +delayed :: (Var v) => TypeP v delayed = do q <- reserved "'" t <- effect <|> type2a @@ -62,27 +62,27 @@ delayed = do (DD.unitType (ann q)) t -type2 :: Var v => TypeP v +type2 :: (Var v) => TypeP v type2 = do hd <- valueTypeLeaf tl <- many (effectList <|> valueTypeLeaf) pure $ foldl' (\a b -> Type.app (ann a <> ann b) a b) hd tl -- ex : {State Text, IO} (List Int) -effect :: Var v => TypeP v +effect :: (Var v) => TypeP v effect = do es <- effectList t <- type2 pure (Type.effect1 (ann es <> ann t) es t) -effectList :: Var v => TypeP v +effectList :: (Var v) => TypeP v effectList = do open <- openBlockWith "{" es <- sepBy (reserved ",") valueType close <- closeBlock pure $ Type.effects (ann open <> ann close) es -sequenceTyp :: Var v => TypeP v +sequenceTyp :: (Var v) => TypeP v sequenceTyp = do open <- openBlockWith "[" t <- valueType @@ -90,7 +90,7 @@ sequenceTyp = do let a = ann open <> ann close pure $ Type.app a (Type.list a) t -tupleOrParenthesizedType :: Var v => TypeP v -> TypeP v +tupleOrParenthesizedType :: (Var v) => TypeP v -> TypeP v tupleOrParenthesizedType rec = tupleOrParenthesized rec DD.unitType pair where pair t1 t2 = @@ -98,7 +98,7 @@ tupleOrParenthesizedType rec = tupleOrParenthesized rec DD.unitType pair in Type.app a (Type.app (ann t1) (DD.pairType a) t1) t2 -- valueType ::= ... | Arrow valueType computationType -arrow :: Var v => TypeP v -> TypeP v +arrow :: (Var v) => TypeP v -> TypeP v arrow rec = let eff = mkArr <$> optional effectList mkArr Nothing a b = Type.arrow (ann a <> ann b) a b @@ -106,7 +106,7 @@ arrow rec = in chainr1 (effect <|> rec) (reserved "->" *> eff) -- "forall a b . List a -> List b -> Maybe Text" -forall :: Var v => TypeP v -> TypeP v +forall :: (Var v) => TypeP v -> TypeP v forall rec = do kw <- reserved "forall" <|> reserved "∀" vars <- fmap (fmap L.payload) . some $ prefixDefinitionName diff --git a/parser-typechecker/src/Unison/Syntax/TypePrinter.hs b/parser-typechecker/src/Unison/Syntax/TypePrinter.hs index 02ca5156f..5e7c3dcab 100644 --- a/parser-typechecker/src/Unison/Syntax/TypePrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TypePrinter.hs @@ -39,13 +39,13 @@ import qualified Unison.Var as Var type SyntaxText = S.SyntaxText' Reference -pretty :: Var v => PrettyPrintEnv -> Type v a -> Pretty ColorText +pretty :: (Var v) => PrettyPrintEnv -> Type v a -> Pretty ColorText pretty ppe t = PP.syntaxToColor $ prettySyntax ppe t -prettySyntax :: Var v => PrettyPrintEnv -> Type v a -> Pretty SyntaxText +prettySyntax :: (Var v) => PrettyPrintEnv -> Type v a -> Pretty SyntaxText prettySyntax ppe = runPretty ppe . pretty0 Map.empty (-1) -prettyStr :: Var v => Maybe Width -> PrettyPrintEnv -> Type v a -> String +prettyStr :: (Var v) => Maybe Width -> PrettyPrintEnv -> Type v a -> String prettyStr (Just width) ppe t = toPlain . PP.render width . PP.syntaxToColor . runPretty ppe $ pretty0 Map.empty (-1) t prettyStr Nothing ppe t = @@ -75,7 +75,7 @@ prettyStr Nothing ppe t = pretty0 :: forall v a m. - MonadPretty v m => + (MonadPretty v m) => Imports -> Int -> Type v a -> @@ -84,7 +84,7 @@ pretty0 im p tp = prettyRaw im p (cleanup (removePureEffects tp)) prettyRaw :: forall v a m. - MonadPretty v m => + (MonadPretty v m) => Imports -> Int -> Type v a -> @@ -133,7 +133,7 @@ prettyRaw im p tp = go im p tp case fst of Var' v | Var.name v == "()" -> - PP.parenthesizeIf (p >= 10) <$> arrows True True rest + PP.parenthesizeIf (p >= 10) <$> arrows True True rest _ -> PP.parenthesizeIf (p >= 0) <$> ((<>) <$> go im 0 fst <*> arrows False False rest) @@ -182,14 +182,14 @@ fmt = PP.withSyntax -- todo: provide sample output in comment prettySignaturesCT :: - Var v => + (Var v) => PrettyPrintEnv -> [(Referent, HashQualified Name, Type v a)] -> [Pretty ColorText] prettySignaturesCT ppe ts = map PP.syntaxToColor $ prettySignaturesST ppe ts prettySignaturesCTCollapsed :: - Var v => + (Var v) => PrettyPrintEnv -> [(Referent, HashQualified Name, Type v a)] -> Pretty ColorText @@ -199,7 +199,7 @@ prettySignaturesCTCollapsed ppe ts = $ prettySignaturesCT ppe ts prettySignaturesST :: - Var v => + (Var v) => PrettyPrintEnv -> [(Referent, HashQualified Name, Type v a)] -> [Pretty SyntaxText] @@ -215,7 +215,7 @@ prettySignaturesST ppe ts = -- todo: provide sample output in comment; different from prettySignatures' prettySignaturesAlt' :: - Var v => + (Var v) => PrettyPrintEnv -> [([HashQualified Name], Type v a)] -> [Pretty ColorText] @@ -224,7 +224,7 @@ prettySignaturesAlt' ppe ts = runPretty ppe $ ts' <- traverse f ts pure $ map PP.syntaxToColor $ PP.align ts' where - f :: MonadPretty v m => ([HashQualified Name], Type v a) -> m (Pretty SyntaxText, Pretty SyntaxText) + f :: (MonadPretty v m) => ([HashQualified Name], Type v a) -> m (Pretty SyntaxText, Pretty SyntaxText) f (names, typ) = do typ' <- pretty0 Map.empty (-1) typ let col = fmt S.TypeAscriptionColon ": " @@ -237,7 +237,7 @@ prettySignaturesAlt' ppe ts = runPretty ppe $ -- prettySignatures'' env ts = prettySignatures' env (first HQ.fromName <$> ts) prettySignaturesAlt :: - Var v => + (Var v) => PrettyPrintEnv -> [([HashQualified Name], Type v a)] -> Pretty ColorText diff --git a/parser-typechecker/src/Unison/Typechecker.hs b/parser-typechecker/src/Unison/Typechecker.hs index 9a0a0beda..712d30f2b 100644 --- a/parser-typechecker/src/Unison/Typechecker.hs +++ b/parser-typechecker/src/Unison/Typechecker.hs @@ -102,13 +102,13 @@ synthesize env t = (TypeVar.liftTerm t) in Result.hoist (pure . runIdentity) $ fmap TypeVar.lowerType result -isSubtype :: Var v => Type v loc -> Type v loc -> Bool +isSubtype :: (Var v) => Type v loc -> Type v loc -> Bool isSubtype t1 t2 = handleCompilerBug (Context.isSubtype (tvar $ void t1) (tvar $ void t2)) where tvar = TypeVar.liftType -handleCompilerBug :: Var v => Either (Context.CompilerBug v ()) a -> a +handleCompilerBug :: (Var v) => Either (Context.CompilerBug v ()) a -> a handleCompilerBug = \case Left bug -> error $ "compiler bug encountered: " ++ show bug Right b -> b @@ -129,12 +129,12 @@ handleCompilerBug = \case -- @ -- exists x. '{IO, Exception} x -- @ -fitsScheme :: Var v => Type v loc -> Type v loc -> Bool +fitsScheme :: (Var v) => Type v loc -> Type v loc -> Bool fitsScheme t1 t2 = handleCompilerBug (Context.fitsScheme (tvar $ void t1) (tvar $ void t2)) where tvar = TypeVar.liftType -isEqual :: Var v => Type v loc -> Type v loc -> Bool +isEqual :: (Var v) => Type v loc -> Type v loc -> Bool isEqual t1 t2 = isSubtype t1 t2 && isSubtype t2 t1 type TDNR f v loc a = @@ -166,10 +166,10 @@ typeError note = do tell $ Notes mempty [note] mempty Control.Monad.Fail.fail "" -btw :: Monad f => Context.InfoNote v loc -> ResultT (Notes v loc) f () +btw :: (Monad f) => Context.InfoNote v loc -> ResultT (Notes v loc) f () btw note = tell $ Notes mempty mempty [note] -liftResult :: Monad f => Result (Notes v loc) a -> TDNR f v loc a +liftResult :: (Monad f) => Result (Notes v loc) a -> TDNR f v loc a liftResult = lift . MaybeT . WriterT . pure . runIdentity . runResultT -- Resolve "solved blanks". If a solved blank's type and name matches the type diff --git a/parser-typechecker/src/Unison/Typechecker/Components.hs b/parser-typechecker/src/Unison/Typechecker/Components.hs index 33e25a0db..ae1358e64 100644 --- a/parser-typechecker/src/Unison/Typechecker/Components.hs +++ b/parser-typechecker/src/Unison/Typechecker/Components.hs @@ -14,10 +14,10 @@ import Unison.Term (Term') import qualified Unison.Term as Term import Unison.Var (Var) -unordered :: Var v => [(v, Term' vt v a)] -> [[(v, Term' vt v a)]] +unordered :: (Var v) => [(v, Term' vt v a)] -> [[(v, Term' vt v a)]] unordered = ABT.components -ordered :: Var v => [(v, Term' vt v a)] -> [[(v, Term' vt v a)]] +ordered :: (Var v) => [(v, Term' vt v a)] -> [[(v, Term' vt v a)]] ordered = ABT.orderedComponents -- | Algorithm for minimizing cycles of a `let rec`. This can @@ -41,7 +41,8 @@ minimize :: minimize (Term.LetRecNamedAnnotatedTop' isTop blockAnn bs e) = let bindings = first snd <$> bs group = - map (fst . head &&& map (ABT.annotation . snd)) . groupBy ((==) `on` fst) + map (fst . head &&& map (ABT.annotation . snd)) + . groupBy ((==) `on` fst) . sortBy (compare `on` fst) grouped = group bindings diff --git a/parser-typechecker/src/Unison/Typechecker/Context.hs b/parser-typechecker/src/Unison/Typechecker/Context.hs index ce92c55e1..161b07c28 100644 --- a/parser-typechecker/src/Unison/Typechecker/Context.hs +++ b/parser-typechecker/src/Unison/Typechecker/Context.hs @@ -115,13 +115,13 @@ pattern Existential b v <- Var (TypeVar.Existential b v) existential :: v -> Element v loc existential v = Var (TypeVar.Existential B.Blank v) -existential' :: Ord v => a -> B.Blank loc -> v -> Type.Type (TypeVar v loc) a +existential' :: (Ord v) => a -> B.Blank loc -> v -> Type.Type (TypeVar v loc) a existential' a blank v = ABT.annotatedVar a (TypeVar.Existential blank v) -existentialp :: Ord v => a -> v -> Type v a +existentialp :: (Ord v) => a -> v -> Type v a existentialp a = existential' a B.Blank -universal' :: Ord v => a -> v -> Type.Type (TypeVar v loc) a +universal' :: (Ord v) => a -> v -> Type.Type (TypeVar v loc) a universal' a v = ABT.annotatedVar a (TypeVar.Universal v) -- | Elements of an ordered algorithmic context @@ -310,7 +310,7 @@ data InfoNote v loc | TopLevelComponent [(v, Type.Type v loc, RedundantTypeAnnotation)] deriving (Show) -topLevelComponent :: Var v => [(v, Type.Type v loc, RedundantTypeAnnotation)] -> InfoNote v loc +topLevelComponent :: (Var v) => [(v, Type.Type v loc, RedundantTypeAnnotation)] -> InfoNote v loc topLevelComponent = TopLevelComponent . fmap (over _2 removeSyntheticTypeVars) -- The typechecker generates synthetic type variables as part of type inference. @@ -320,7 +320,7 @@ topLevelComponent = TopLevelComponent . fmap (over _2 removeSyntheticTypeVars) -- It also attempts to pick "nice" type variable names, based on what sort of -- synthetic type variable it is and what type variable names are not already -- being used. -removeSyntheticTypeVars :: Var v => Type.Type v loc -> Type.Type v loc +removeSyntheticTypeVars :: (Var v) => Type.Type v loc -> Type.Type v loc removeSyntheticTypeVars typ = flip evalState (Set.fromList (ABT.allVars typ), mempty) $ ABT.vmapM go typ where @@ -413,7 +413,7 @@ data Info v loc = Info context0 :: Context v loc context0 = Context [] -occursAnn :: Var v => Ord loc => TypeVar v loc -> Context v loc -> Bool +occursAnn :: (Var v) => (Ord loc) => TypeVar v loc -> Context v loc -> Bool occursAnn v (Context eis) = any p es where es = fst <$> eis @@ -514,7 +514,7 @@ ordered ctx v v2 = Set.member v (existentials (retract' (existential v2) ctx)) debugEnabled :: Bool debugEnabled = False -debugShow :: Show a => a -> Bool +debugShow :: (Show a) => a -> Bool debugShow e | debugEnabled = traceShow e False debugShow _ = False @@ -527,7 +527,7 @@ _logContext msg = when debugEnabled $ do let !_ = trace ("\n" ++ msg ++ ": " ++ show ctx) () setContext ctx -usedVars :: Ord v => Context v loc -> Set v +usedVars :: (Ord v) => Context v loc -> Set v usedVars = allVars . info getContext :: M v loc (Context v loc) @@ -545,7 +545,7 @@ modifyContext f = do appendContext :: (Var v, Ord loc) => [Element v loc] -> M v loc () appendContext = traverse_ extendContext -extendContext :: Var v => Element v loc -> M v loc () +extendContext :: (Var v) => Element v loc -> M v loc () extendContext e = isReserved (varOf e) >>= \case True -> modifyContext (extend e) @@ -574,16 +574,16 @@ varOf (Solved _ v _) = v varOf (Ann v _) = v varOf (Marker v) = v -isReserved :: Var v => v -> M v loc Bool +isReserved :: (Var v) => v -> M v loc Bool isReserved v = (v `isReservedIn`) <$> get -isReservedIn :: Var v => v -> Env v loc -> Bool +isReservedIn :: (Var v) => v -> Env v loc -> Bool isReservedIn v e = freshId e > Var.freshId v -universals :: Ord v => Context v loc -> Set v +universals :: (Ord v) => Context v loc -> Set v universals = universalVars . info -existentials :: Ord v => Context v loc -> Set v +existentials :: (Ord v) => Context v loc -> Set v existentials = existentialVars . info -- | "Reserves" the given variables in this typechecking environment, @@ -593,14 +593,14 @@ reserveAll vs = let maxId = foldr (max . Var.freshId) 0 vs in modEnv (\e -> e {freshId = freshId e `max` maxId + 1}) -freshenVar :: Var v => v -> M v0 loc v +freshenVar :: (Var v) => v -> M v0 loc v freshenVar v = modEnv' ( \e -> let id = freshId e in (Var.freshenId id v, e {freshId = freshId e + 1}) ) -freshenTypeVar :: Var v => TypeVar v loc -> M v loc v +freshenTypeVar :: (Var v) => TypeVar v loc -> M v loc v freshenTypeVar v = modEnv' ( \e -> @@ -608,10 +608,10 @@ freshenTypeVar v = in (Var.freshenId id (TypeVar.underlying v), e {freshId = id + 1}) ) -isClosed :: Var v => Term v loc -> M v loc Bool +isClosed :: (Var v) => Term v loc -> M v loc Bool isClosed e = Set.null <$> freeVars e -freeVars :: Var v => Term v loc -> M v loc (Set v) +freeVars :: (Var v) => Term v loc -> M v loc (Set v) freeVars e = do ctx <- getContext pure $ ABT.freeVars e `Set.difference` previouslyTypecheckedVars (info ctx) @@ -620,7 +620,7 @@ freeVars e = do -- todo: or maybe a note / list of notes, or an M -- | Check that the type is well formed wrt the given `Context`, see Figure 7 of paper -wellformedType :: Var v => Context v loc -> Type v loc -> Bool +wellformedType :: (Var v) => Context v loc -> Type v loc -> Bool wellformedType c t = case t of Type.Var' (TypeVar.Existential _ v) -> Set.member v (existentials c) Type.Var' (TypeVar.Universal v) -> Set.member v (universals c) @@ -643,14 +643,14 @@ wellformedType c t = case t of in (v, ctx') -- | Return the `Info` associated with the last element of the context, or the zero `Info`. -info :: Ord v => Context v loc -> Info v loc +info :: (Ord v) => Context v loc -> Info v loc info (Context []) = Info mempty mempty mempty mempty mempty mempty info (Context ((_, i) : _)) = i -- | Add an element onto the end of this `Context`. Takes `O(log N)` time, -- including updates to the accumulated `Info` value. -- Fail if the new context is not well formed (see Figure 7 of paper). -extend' :: Var v => Element v loc -> Context v loc -> Either (CompilerBug v loc) (Context v loc) +extend' :: (Var v) => Element v loc -> Context v loc -> Either (CompilerBug v loc) (Context v loc) extend' e c@(Context ctx) = Context . (: ctx) . (e,) <$> i' where Info es ses us uas vs pvs = info c @@ -695,12 +695,12 @@ extend' e c@(Context ctx) = Context . (: ctx) . (e,) <$> i' else crash $ "marker variable " <> show v <> " already defined in the context" crash reason = Left $ IllegalContextExtension c e reason -extend :: Var v => Element v loc -> Context v loc -> M v loc (Context v loc) +extend :: (Var v) => Element v loc -> Context v loc -> M v loc (Context v loc) extend e c = either compilerCrash pure $ extend' e c -- | Add the given elements onto the end of the given `Context`. -- Fail if the new context is not well-formed. -extendN :: Var v => Context v loc -> [Element v loc] -> M v loc (Context v loc) +extendN :: (Var v) => Context v loc -> [Element v loc] -> M v loc (Context v loc) extendN ctx es = foldM (flip extend) ctx es -- | doesn't combine notes @@ -773,7 +773,7 @@ getEffectConstructorType = getConstructorType' Effect go -- Encountered an unknown constructor in the typechecker; unknown constructors -- should have been detected earlier though. getConstructorType' :: - Var v => + (Var v) => Unknown -> (Reference -> M v loc (DataDeclaration v loc)) -> ConstructorReference -> @@ -796,7 +796,7 @@ extendExistential v = do extendContext (Var (TypeVar.Existential B.Blank v')) pure v' -extendExistentialTV :: Var v => v -> M v loc (TypeVar v loc) +extendExistentialTV :: (Var v) => v -> M v loc (TypeVar v loc) extendExistentialTV v = TypeVar.Existential B.Blank <$> extendExistential v @@ -839,8 +839,8 @@ loc = ABT.annotation -- | Post-processes an action that wants abilities by filtering out -- some handled abilities. withEffects :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => [Type v loc] -> M v loc (Wanted v loc) -> M v loc (Wanted v loc) @@ -926,12 +926,12 @@ vectorConstructorOfArity loc arity = do vt = Type.forall loc elementVar (Type.arrows args resultType) pure vt -generalizeAndUnTypeVar :: Var v => Type v a -> Type.Type v a +generalizeAndUnTypeVar :: (Var v) => Type v a -> Type.Type v a generalizeAndUnTypeVar t = Type.cleanup . ABT.vmap TypeVar.underlying . Type.generalize (Set.toList $ ABT.freeVars t) $ t generalizeExistentials' :: - Var v => Type v a -> Type v a + (Var v) => Type v a -> Type v a generalizeExistentials' t = Type.generalize (filter isExistential . Set.toList $ ABT.freeVars t) t where @@ -964,8 +964,8 @@ noteTopLevelType e binding typ = case binding of [(Var.reset (ABT.variable e), generalizeAndUnTypeVar typ, True)] synthesizeTop :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Term v loc -> M v loc (Type v loc) synthesizeTop tm = do @@ -985,8 +985,8 @@ synthesizeTop tm = do -- the process. Also collect wanted abilities. -- | Figure 11 from the paper synthesize :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Term v loc -> M v loc (Type v loc, Wanted v loc) synthesize e | debugShow ("synthesize" :: String, e) = undefined @@ -1001,8 +1001,8 @@ synthesize e = scope (InSynthesize e) $ -- | Helper function for turning an ability request's type into the -- results used by type checking. wantRequest :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Term v loc -> Type v loc -> (Type v loc, Wanted v loc) @@ -1018,8 +1018,8 @@ wantRequest loc ty = -- The return value is the synthesized type together with a list of -- wanted abilities. synthesizeWanted :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Term v loc -> M v loc (Type v loc, Wanted v loc) synthesizeWanted (Term.Var' v) = @@ -1220,8 +1220,8 @@ synthesizeWanted e synthesizeWanted _e = compilerCrash PatternMatchFailure checkCases :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Type v loc -> Type v loc -> [Term.MatchCase loc (Term v loc)] -> @@ -1246,7 +1246,7 @@ checkCases scrutType outType cases@(Term.MatchCase _ _ t : _) = -- g. In such a situation, we have no good way of solving via the general check -- for {A,B,e} < {A,B,g} with a fresh `e` existential, but the `e` is actually -- useless in this scenario. -ensureReqEffects :: Var v => Ord loc => Type v loc -> [Type v loc] -> M v loc () +ensureReqEffects :: (Var v) => (Ord loc) => Type v loc -> [Type v loc] -> M v loc () ensureReqEffects (Type.Apps' (Type.Ref' req) [hes, _]) res | req == Type.effectRef = expandAbilities [hes] >>= \hes -> abilityCheck' hes res ensureReqEffects sty res = do @@ -1260,7 +1260,7 @@ ensureReqEffects sty res = do subtype (Type.effectV lo (lo, Type.effects lo es') (lo, vt)) sty getEffect :: - Var v => Ord loc => ConstructorReference -> M v loc (Type v loc) + (Var v) => (Ord loc) => ConstructorReference -> M v loc (Type v loc) getEffect ref = do ect <- getEffectConstructorType ref uect <- ungeneralize ect @@ -1273,7 +1273,7 @@ getEffect ref = do _ -> compilerCrash PatternMatchFailure requestType :: - Var v => Ord loc => [Pattern loc] -> M v loc (Maybe [Type v loc]) + (Var v) => (Ord loc) => [Pattern loc] -> M v loc (Maybe [Type v loc]) requestType ps = traverse (traverse getEffect . nubBy ((==) `on` view reference_)) $ Foldable.foldlM (\acc p -> (++ acc) <$> single p) [] ps @@ -1491,10 +1491,10 @@ checkPattern scrutineeType p = applyM :: (Var v, Ord loc) => Type v loc -> M v loc (Type v loc) applyM t = (`apply` t) <$> getContext -lookupAnn :: Ord v => Context v loc -> v -> Maybe (Type v loc) +lookupAnn :: (Ord v) => Context v loc -> v -> Maybe (Type v loc) lookupAnn ctx v = Map.lookup v (termVarAnnotations . info $ ctx) -lookupSolved :: Ord v => Context v loc -> v -> Maybe (Monotype v loc) +lookupSolved :: (Ord v) => Context v loc -> v -> Maybe (Monotype v loc) lookupSolved ctx v = Map.lookup v (solvedExistentials . info $ ctx) resetContextAfter :: a -> M v loc a -> M v loc a @@ -1584,7 +1584,7 @@ annotateLetRecBindings isTop letrec = appendContext annotations pure (body, vs `zip` bindingTypesGeneralized) -ensureGuardedCycle :: Var v => [(v, Term v loc)] -> M v loc () +ensureGuardedCycle :: (Var v) => [(v, Term v loc)] -> M v loc () ensureGuardedCycle bindings = let -- We make sure that nonLambdas can depend only on lambdas, not on each other nonLambdas = Set.fromList [v | (v, b) <- bindings, Term.arity b == 0] @@ -1597,7 +1597,7 @@ ensureGuardedCycle bindings = then pure () else failWith $ UnguardedLetRecCycle (fst <$> notok) bindings -existentialFunctionTypeFor :: Var v => Term v loc -> M v loc (Type v loc) +existentialFunctionTypeFor :: (Var v) => Term v loc -> M v loc (Type v loc) existentialFunctionTypeFor lam@(Term.LamNamed' v body) = do v <- extendExistential v e <- extendExistential Var.inferAbility @@ -1611,7 +1611,7 @@ existentialFunctionTypeFor e = do v <- extendExistential Var.inferOutput pure $ existentialp (loc e) v -existentializeArrows :: Var v => Type v loc -> M v loc (Type v loc) +existentializeArrows :: (Var v) => Type v loc -> M v loc (Type v loc) existentializeArrows t = do let newVar = extendExistentialTV Var.inferAbility t <- Type.existentializeArrows newVar t @@ -1645,8 +1645,8 @@ ungeneralize' t = pure ([], t) -- de-generalized, and replaces simple freshening of the -- polymorphic variable. tweakEffects :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => TypeVar v loc -> Type v loc -> M v loc ([v], Type v loc) @@ -1696,7 +1696,7 @@ tweakEffects v0 t0 where a = loc ty -isEffectVar :: Var v => TypeVar v loc -> Type v loc -> Bool +isEffectVar :: (Var v) => TypeVar v loc -> Type v loc -> Bool isEffectVar u (Type.ForallNamed' v t) | u == v = False | otherwise = isEffectVar u t @@ -1710,7 +1710,7 @@ isEffectVar _ _ = False -- Checks that a variable only occurs in variant positions. This may mean that -- it occurs in both covariant and contravariant positions, so long as it -- doesn't occur in a single position that is invariant, like the `x` in `F x`. -isVariant :: Var v => TypeVar v loc -> Type v loc -> Bool +isVariant :: (Var v) => TypeVar v loc -> Type v loc -> Bool isVariant u = walk True where walk var (Type.ForallNamed' v t) @@ -1723,8 +1723,8 @@ isVariant u = walk True walk _ _ = True skolemize :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => (Type v loc -> Set (TypeVar v loc)) -> Type v loc -> M v loc (Type v loc) @@ -1769,8 +1769,8 @@ generalizeExistentials ctx ty0 = generalizeP pred ctx ty | otherwise = Nothing generalizeP :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => (Element v loc -> Maybe (TypeVar v loc, v)) -> [Element v loc] -> Type v loc -> @@ -1825,8 +1825,8 @@ checkScoped e t = do (t,) <$> check e t checkScopedWith :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Term v loc -> Type v loc -> [Type v loc] -> @@ -1836,8 +1836,8 @@ checkScopedWith tm ty ab = do subAbilities want ab markThenRetractWanted :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => v -> M v loc (Wanted v loc) -> M v loc (Wanted v loc) @@ -1864,8 +1864,8 @@ markThenRetractWanted v m = -- more complicated, and inference harder. So in that scenario, we -- default the variable to {} and omit it. coalesceWanted' :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => (TypeVar v loc -> Bool) -> Wanted v loc -> Wanted v loc -> @@ -1893,8 +1893,8 @@ coalesceWanted' keep ((loc, n) : new) old -- expanded and calculates some necessary information for the main -- procedure. coalesceWanted :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> Wanted v loc -> M v loc (Wanted v loc) @@ -1910,7 +1910,7 @@ coalesceWanted new old = do coalesceWanted' keep new old coalesceWanteds :: - Var v => Ord loc => [Wanted v loc] -> M v loc (Wanted v loc) + (Var v) => (Ord loc) => [Wanted v loc] -> M v loc (Wanted v loc) coalesceWanteds = foldM (flip coalesceWanted) [] -- | This implements the subtraction of handled effects from the @@ -1919,8 +1919,8 @@ coalesceWanteds = foldM (flip coalesceWanted) [] -- scope, and will impose subtyping relations between the wanted and -- handled abilities. pruneWanted :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> Wanted v loc -> [Type v loc] -> @@ -1944,8 +1944,8 @@ pruneWanted acc ((loc, w) : want) handled -- of scope cause an error, because it is unclear what they ought -- to be solved to. substAndDefaultWanted :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> [Element v loc] -> M v loc (Wanted v loc) @@ -1975,7 +1975,7 @@ substAndDefaultWanted want ctx q _ = True -- Defaults unsolved ability variables to the empty row -defaultAbility :: Var v => Ord loc => Type v loc -> M v loc Bool +defaultAbility :: (Var v) => (Ord loc) => Type v loc -> M v loc Bool defaultAbility e@(Type.Var' (TypeVar.Existential b v)) = (True <$ instantiateL b v eff0) `orElse` pure False where @@ -1988,7 +1988,7 @@ defaultAbility _ = pure False -- -- Expects a fully substituted type, so that it is unnecessary to -- check if an existential in the type has been solved. -discardCovariant :: Var v => Set v -> Type v loc -> Type v loc +discardCovariant :: (Var v) => Set v -> Type v loc -> Type v loc discardCovariant _ ty | debugShow ("discardCovariant" :: Text, ty) = undefined discardCovariant gens ty = ABT.rewriteDown (strip $ keepVarsT True ty) ty @@ -2043,7 +2043,7 @@ discardCovariant gens ty = -- but this is only used for type directed name resolution. A -- separate type check must pass if the candidate is allowed, which -- will ensure that the location has the right abilities. -relax :: Var v => Ord loc => Type v loc -> Type v loc +relax :: (Var v) => (Ord loc) => Type v loc -> Type v loc relax t = relax' True v t where fvs = foldMap f $ Type.freeVars t @@ -2067,7 +2067,7 @@ relax t = relax' True v t -- type is just `T`. However, it is undesirable to add these variables -- when relax' is used during variable instantiation, because it just -- adds ability inference ambiguity. -relax' :: Var v => Ord loc => Bool -> v -> Type v loc -> Type v loc +relax' :: (Var v) => (Ord loc) => Bool -> v -> Type v loc -> Type v loc relax' nonArrow v t | Type.Arrow' i o <- t = Type.arrow (ABT.annotation t) i $ relax' nonArrow v o @@ -2087,8 +2087,8 @@ relax' nonArrow v t tv = Type.var loc (TypeVar.Existential B.Blank v) checkWantedScoped :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> Term v loc -> Type v loc -> @@ -2097,8 +2097,8 @@ checkWantedScoped want m ty = scope (InCheck m ty) $ checkWanted want m ty checkWanted :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> Term v loc -> Type v loc -> @@ -2146,8 +2146,8 @@ checkWanted want e t = do -- `m` has type `t` with abilities `es`, -- updating the context in the process. checkWithAbilities :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => [Type v loc] -> Term v loc -> Type v loc -> @@ -2162,8 +2162,8 @@ checkWithAbilities es m t = do -- `m` has type `t` -- updating the context in the process. check :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Term v loc -> Type v loc -> M v loc (Wanted v loc) @@ -2255,7 +2255,7 @@ subtype tx ty = scope (InSubtype tx ty) $ do Type.Ref' _ -> True _ -> False -equate :: Var v => Ord loc => Type v loc -> Type v loc -> M v loc () +equate :: (Var v) => (Ord loc) => Type v loc -> Type v loc -> M v loc () equate t1 t2 = scope (InEquate t1 t2) $ do ctx <- getContext guardWF ctx t1 @@ -2268,8 +2268,8 @@ equate t1 t2 = scope (InEquate t1 t2) $ do guardWF _ _ = pure () equate0 :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Type v loc -> Type v loc -> M v loc () @@ -2421,13 +2421,13 @@ instantiateL blank v (Type.stripIntroOuters -> t) = instantiateL B.Blank v (ABT.bindInheritAnnotation body (universal' () v1)) _ -> failWith $ TypeMismatch ctx -nameFrom :: Var v => v -> Type v loc -> v +nameFrom :: (Var v) => v -> Type v loc -> v nameFrom _ (Type.Var' v) = TypeVar.underlying (Var.reset v) nameFrom ifNotVar _ = ifNotVar refineEffectVar :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => loc -> [Type v loc] -> B.Blank loc -> @@ -2558,19 +2558,19 @@ solve ctx v t = case lookupSolved ctx v of _ -> compilerCrash $ UnknownExistentialVariable v ctx expandAbilities :: - Var v => Ord loc => [Type v loc] -> M v loc [Type v loc] + (Var v) => (Ord loc) => [Type v loc] -> M v loc [Type v loc] expandAbilities = fmap (concatMap Type.flattenEffects) . traverse applyM expandWanted :: - Var v => Ord loc => Wanted v loc -> M v loc (Wanted v loc) + (Var v) => (Ord loc) => Wanted v loc -> M v loc (Wanted v loc) expandWanted = (fmap . concatMap) (\(l, es) -> (,) l <$> Type.flattenEffects es) . (traverse . traverse) applyM matchConcrete :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => [Type v loc] -> [Type v loc] -> [Type v loc] -> @@ -2591,8 +2591,8 @@ matchConcrete common acc (l : ls) rs | otherwise = matchConcrete common (l : acc) ls rs pruneConcrete :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => (Maybe (Term v loc) -> Type v loc -> M v loc ()) -> Wanted v loc -> Wanted v loc -> @@ -2608,8 +2608,8 @@ pruneConcrete missing acc ((loc, w) : ws) have | otherwise = pruneConcrete missing ((loc, w) : acc) ws have matchVariables :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => [Type v loc] -> [Type v loc] -> [Type v loc] -> @@ -2625,8 +2625,8 @@ matchVariables com acc (l : ls) rs matchVariables com acc [] rs = (com, reverse acc, rs) pruneVariables :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> Wanted v loc -> M v loc (Wanted v loc) @@ -2639,8 +2639,8 @@ pruneVariables acc ((loc, v) : vs) = do else pruneVariables ((loc, v) : acc) vs pruneAbilities :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> [Type v loc] -> M v loc (Wanted v loc) @@ -2674,8 +2674,8 @@ isExistential (Type.Var' TypeVar.Existential {}) = True isExistential _ = False matchAbilities :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => [Type v loc] -> [Type v loc] -> M v loc ([Type v loc], [Type v loc], [Type v loc]) @@ -2689,8 +2689,8 @@ matchAbilities ls0 rs0 = do else pure $ matchVariables [] [] ls rs equateAbilities :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => [Type v loc] -> [Type v loc] -> M v loc () @@ -2750,8 +2750,8 @@ equateAbilities ls rs = cn | common = [Var.inferAbility] | otherwise = [] subAbilities :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => Wanted v loc -> [Type v loc] -> M v loc () @@ -2787,8 +2787,8 @@ subAbilities want have = do -- In this way, a lambda whose body uses multiple effects can be -- inferred properly. subAmbient :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => M v loc () -> [Type v loc] -> Type v loc -> @@ -2807,8 +2807,8 @@ subAmbient die ambient r vars _ = [] abilityCheckSingle :: - Var v => - Ord loc => + (Var v) => + (Ord loc) => M v loc () -> [Type v loc] -> Type v loc -> @@ -2835,12 +2835,12 @@ abilityCheckSingle die ambient r `orElse` die | otherwise = subAmbient die ambient r -headMatch :: Var v => Ord loc => Type v loc -> Type v loc -> Bool +headMatch :: (Var v) => (Ord loc) => Type v loc -> Type v loc -> Bool headMatch (Type.App' f _) (Type.App' f2 _) = headMatch f f2 headMatch r r2 = r == r2 abilityCheck' :: - Var v => Ord loc => [Type v loc] -> [Type v loc] -> M v loc () + (Var v) => (Ord loc) => [Type v loc] -> [Type v loc] -> M v loc () abilityCheck' ambient0 requested0 = go ambient0 requested0 where go _ [] = pure () @@ -2888,7 +2888,7 @@ synthesizeClosed abilities lookupType term0 = *> verifyClosedTerm term synthesizeClosed' abilities term -verifyClosedTerm :: forall v loc. Ord v => Term v loc -> Result v loc () +verifyClosedTerm :: forall v loc. (Ord v) => Term v loc -> Result v loc () verifyClosedTerm t = do ok1 <- verifyClosed t id let freeTypeVars = Map.toList $ Term.freeTypeVarAnnotations t @@ -3020,7 +3020,8 @@ instance (Var v) => Show (Element v loc) where e -> show e show (Solved _ v t) = "'" ++ Text.unpack (Var.name v) ++ " = " ++ TP.prettyStr Nothing PPE.empty (Type.getPolytype t) show (Ann v t) = - Text.unpack (Var.name v) ++ " : " + Text.unpack (Var.name v) + ++ " : " ++ TP.prettyStr Nothing PPE.empty t show (Marker v) = "|" ++ Text.unpack (Var.name v) ++ "|" @@ -3034,19 +3035,19 @@ instance (Ord loc, Var v) => Show (Context v loc) where showElem ctx (Ann v t) = Text.unpack (Var.name v) ++ " : " ++ TP.prettyStr Nothing PPE.empty (apply ctx t) showElem _ (Marker v) = "|" ++ Text.unpack (Var.name v) ++ "|" -instance Monad f => Monad (MT v loc f) where +instance (Monad f) => Monad (MT v loc f) where return = pure m >>= f = MT \datas effects env0 -> do (a, env1) <- runM m datas effects env0 runM (f a) datas effects $! env1 -instance Monad f => MonadFail.MonadFail (MT v loc f) where +instance (Monad f) => MonadFail.MonadFail (MT v loc f) where fail = error -instance Monad f => Applicative (MT v loc f) where +instance (Monad f) => Applicative (MT v loc f) where pure a = MT (\_ _ env -> pure (a, env)) (<*>) = ap -instance Monad f => MonadState (Env v loc) (MT v loc f) where +instance (Monad f) => MonadState (Env v loc) (MT v loc f) where get = MT \_ _ env -> pure (env, env) put env = MT \_ _ _ -> pure ((), env) diff --git a/parser-typechecker/src/Unison/Typechecker/Extractor.hs b/parser-typechecker/src/Unison/Typechecker/Extractor.hs index d6e9a7046..8d1952b1d 100644 --- a/parser-typechecker/src/Unison/Typechecker/Extractor.hs +++ b/parser-typechecker/src/Unison/Typechecker/Extractor.hs @@ -36,13 +36,13 @@ extract = runReader . runMaybeT subseqExtractor :: (C.ErrorNote v loc -> [Ranged a]) -> SubseqExtractor v loc a subseqExtractor f = SubseqExtractor' f -traceSubseq :: Show a => String -> SubseqExtractor' n a -> SubseqExtractor' n a +traceSubseq :: (Show a) => String -> SubseqExtractor' n a -> SubseqExtractor' n a traceSubseq s ex = SubseqExtractor' $ \n -> let rs = runSubseq ex n in trace (if null s then show rs else s ++ ": " ++ show rs) rs traceNote :: - Show a => String -> ErrorExtractor v loc a -> ErrorExtractor v loc a + (Show a) => String -> ErrorExtractor v loc a -> ErrorExtractor v loc a traceNote s ex = extractor $ \n -> let result = extract ex n in trace (if null s then show result else s ++ ": " ++ show result) result @@ -260,7 +260,7 @@ unknownSymbol = C.UnknownSymbol loc v -> pure (loc, v) _ -> mzero -unknownTerm :: Var v => ErrorExtractor v loc (loc, v, [C.Suggestion v loc], C.Type v loc) +unknownTerm :: (Var v) => ErrorExtractor v loc (loc, v, [C.Suggestion v loc], C.Type v loc) unknownTerm = cause >>= \case C.UnknownTerm loc v suggestions expectedType -> do diff --git a/parser-typechecker/src/Unison/Typechecker/TypeError.hs b/parser-typechecker/src/Unison/Typechecker/TypeError.hs index 9cfceff0c..f09d1ffe4 100644 --- a/parser-typechecker/src/Unison/Typechecker/TypeError.hs +++ b/parser-typechecker/src/Unison/Typechecker/TypeError.hs @@ -189,7 +189,7 @@ unknownType = do n <- Ex.errorNote pure $ UnknownType v loc n -unknownTerm :: Var v => Ex.ErrorExtractor v loc (TypeError v loc) +unknownTerm :: (Var v) => Ex.ErrorExtractor v loc (TypeError v loc) unknownTerm = do (loc, v, suggs, typ) <- Ex.unknownTerm n <- Ex.errorNote @@ -295,7 +295,7 @@ ifBody = existentialMismatch0 IfBody (Ex.inSynthesizeApp >> Ex.inIfBody) listBody = existentialMismatch0 ListBody (Ex.inSynthesizeApp >> Ex.inVector) matchBody = existentialMismatch0 CaseBody (Ex.inMatchBody >> Ex.inMatch) -applyingNonFunction :: Var v => Ex.ErrorExtractor v loc (TypeError v loc) +applyingNonFunction :: (Var v) => Ex.ErrorExtractor v loc (TypeError v loc) applyingNonFunction = do _ <- Ex.typeMismatch n <- Ex.errorNote diff --git a/parser-typechecker/src/Unison/Typechecker/TypeVar.hs b/parser-typechecker/src/Unison/Typechecker/TypeVar.hs index 6ddd6ff1b..8a76f88a6 100644 --- a/parser-typechecker/src/Unison/Typechecker/TypeVar.hs +++ b/parser-typechecker/src/Unison/Typechecker/TypeVar.hs @@ -12,12 +12,12 @@ import qualified Unison.Var as Var data TypeVar b v = Universal v | Existential b v deriving (Functor) -instance Eq v => Eq (TypeVar b v) where +instance (Eq v) => Eq (TypeVar b v) where Universal v == Universal v2 = v == v2 Existential _ v == Existential _ v2 = v == v2 _ == _ = False -instance Ord v => Ord (TypeVar b v) where +instance (Ord v) => Ord (TypeVar b v) where Universal v `compare` Universal v2 = compare v v2 Existential _ v `compare` Existential _ v2 = compare v v2 Universal _ `compare` Existential _ _ = LT @@ -27,27 +27,27 @@ underlying :: TypeVar b v -> v underlying (Universal v) = v underlying (Existential _ v) = v -instance Show v => Show (TypeVar b v) where +instance (Show v) => Show (TypeVar b v) where show (Universal v) = show v show (Existential _ v) = "'" ++ show v -instance ABT.Var v => ABT.Var (TypeVar b v) where +instance (ABT.Var v) => ABT.Var (TypeVar b v) where freshIn s v = ABT.freshIn (Set.map underlying s) <$> v -instance Var v => Var (TypeVar b v) where +instance (Var v) => Var (TypeVar b v) where typed t = Universal (Var.typed t) typeOf v = Var.typeOf (underlying v) freshId v = Var.freshId (underlying v) freshenId id v = Var.freshenId id <$> v -liftType :: Ord v => Type v a -> Type (TypeVar b v) a +liftType :: (Ord v) => Type v a -> Type (TypeVar b v) a liftType = ABT.vmap Universal -lowerType :: Ord v => Type (TypeVar b v) a -> Type v a +lowerType :: (Ord v) => Type (TypeVar b v) a -> Type v a lowerType = ABT.vmap underlying -liftTerm :: Ord v => Term v a -> Term' (TypeVar b v) v a +liftTerm :: (Ord v) => Term v a -> Term' (TypeVar b v) v a liftTerm = Term.vtmap Universal -lowerTerm :: Ord v => Term' (TypeVar b v) v a -> Term v a +lowerTerm :: (Ord v) => Term' (TypeVar b v) v a -> Term v a lowerTerm = Term.vtmap underlying diff --git a/parser-typechecker/src/Unison/UnisonFile.hs b/parser-typechecker/src/Unison/UnisonFile.hs index 724feda25..add8b0587 100644 --- a/parser-typechecker/src/Unison/UnisonFile.hs +++ b/parser-typechecker/src/Unison/UnisonFile.hs @@ -99,7 +99,7 @@ hashTerms = fmap (over _1 Reference.DerivedId) . hashTermsId typecheckedUnisonFile :: forall v a. - Var v => + (Var v) => Map v (Reference.Id, DataDeclaration v a) -> Map v (Reference.Id, EffectDeclaration v a) -> [[(v, Term v a, Type v a)]] -> @@ -128,7 +128,7 @@ typecheckedUnisonFile datas effects tlcs watches = ] lookupDecl :: - Ord v => + (Ord v) => v -> TypecheckedUnisonFile v a -> Maybe (Reference.Id, DD.Decl v a) @@ -153,7 +153,7 @@ indexByReference uf = (tms, tys) -- The returned terms refer to other definitions in the file by their -- var, not by reference. -- Includes test watches. -allTerms :: Ord v => TypecheckedUnisonFile v a -> Map v (Term v a) +allTerms :: (Ord v) => TypecheckedUnisonFile v a -> Map v (Term v a) allTerms uf = Map.fromList [(v, t) | (v, t, _) <- join $ topLevelComponents uf] @@ -166,7 +166,7 @@ topLevelComponents file = -- External type references that appear in the types of the file's terms termSignatureExternalLabeledDependencies :: - Ord v => TypecheckedUnisonFile v a -> Set LabeledDependency + (Ord v) => TypecheckedUnisonFile v a -> Set LabeledDependency termSignatureExternalLabeledDependencies (TypecheckedUnisonFile dataDeclarations' effectDeclarations' _ _ hashTerms) = Set.difference @@ -197,7 +197,7 @@ discardTypes (TypecheckedUnisonFileId datas effects terms watches _) = g tup3s = [(v, e) | (v, e, _t) <- tup3s] in UnisonFileId datas effects [(a, b) | (a, b, _) <- join terms] watches' -declsToTypeLookup :: Var v => UnisonFile v a -> TL.TypeLookup v a +declsToTypeLookup :: (Var v) => UnisonFile v a -> TL.TypeLookup v a declsToTypeLookup uf = TL.TypeLookup mempty @@ -215,7 +215,7 @@ nonEmpty uf = || any (not . null) (watchComponents uf) hashConstructors :: - forall v a. Ord v => TypecheckedUnisonFile v a -> Map v Referent.Id + forall v a. (Ord v) => TypecheckedUnisonFile v a -> Map v Referent.Id hashConstructors file = let ctors1 = Map.elems (dataDeclarationsId' file) >>= \(ref, dd) -> @@ -226,7 +226,7 @@ hashConstructors file = in Map.fromList (ctors1 ++ ctors2) -- | Returns the set of constructor names for decls whose names in the given Set. -constructorsForDecls :: Ord v => Set v -> TypecheckedUnisonFile v a -> Set v +constructorsForDecls :: (Ord v) => Set v -> TypecheckedUnisonFile v a -> Set v constructorsForDecls types uf = let dataConstructors = dataDeclarationsId' uf diff --git a/parser-typechecker/src/Unison/UnisonFile/Names.hs b/parser-typechecker/src/Unison/UnisonFile/Names.hs index 5ace47338..199471300 100644 --- a/parser-typechecker/src/Unison/UnisonFile/Names.hs +++ b/parser-typechecker/src/Unison/UnisonFile/Names.hs @@ -23,13 +23,13 @@ import qualified Unison.Util.Relation as Relation import Unison.Var (Var) import qualified Unison.WatchKind as WK -toNames :: Var v => UnisonFile v a -> Names +toNames :: (Var v) => UnisonFile v a -> Names toNames uf = datas <> effects where datas = foldMap (DD.Names.dataDeclToNames' Name.unsafeFromVar) (Map.toList (UF.dataDeclarationsId uf)) effects = foldMap (DD.Names.effectDeclToNames' Name.unsafeFromVar) (Map.toList (UF.effectDeclarationsId uf)) -typecheckedToNames :: Var v => TypecheckedUnisonFile v a -> Names +typecheckedToNames :: (Var v) => TypecheckedUnisonFile v a -> Names typecheckedToNames uf = Names (terms <> ctors) types where terms = @@ -53,7 +53,7 @@ typecheckedToNames uf = Names (terms <> ctors) types . UF.hashConstructors $ uf -typecheckedUnisonFile0 :: Ord v => TypecheckedUnisonFile v a +typecheckedUnisonFile0 :: (Ord v) => TypecheckedUnisonFile v a typecheckedUnisonFile0 = TypecheckedUnisonFileId Map.empty Map.empty mempty mempty mempty -- Substitutes free type and term variables occurring in the terms of this @@ -65,7 +65,7 @@ typecheckedUnisonFile0 = TypecheckedUnisonFileId Map.empty Map.empty mempty memp -- we are done parsing, whereas `math.sqrt#abc` can be resolved immediately -- as it can't refer to a local definition. bindNames :: - Var v => + (Var v) => Names -> UnisonFile v a -> Names.ResolutionResult v a (UnisonFile v a) @@ -88,7 +88,7 @@ bindNames names (UnisonFileId d e ts ws) = do -- left. environmentFor :: forall v a. - Var v => + (Var v) => Names -> Map v (DataDeclaration v a) -> Map v (EffectDeclaration v a) -> diff --git a/parser-typechecker/src/Unison/UnisonFile/Type.hs b/parser-typechecker/src/Unison/UnisonFile/Type.hs index 22f590deb..680062d19 100644 --- a/parser-typechecker/src/Unison/UnisonFile/Type.hs +++ b/parser-typechecker/src/Unison/UnisonFile/Type.hs @@ -72,7 +72,7 @@ pattern TypecheckedUnisonFile ds es tlcs wcs hts <- wcs (fmap (over _1 Reference.DerivedId) -> hts) -instance Ord v => Functor (TypecheckedUnisonFile v) where +instance (Ord v) => Functor (TypecheckedUnisonFile v) where fmap f (TypecheckedUnisonFileId ds es tlcs wcs hashTerms) = TypecheckedUnisonFileId ds' es' tlcs' wcs' hashTerms' where diff --git a/parser-typechecker/src/Unison/Util/CyclicEq.hs b/parser-typechecker/src/Unison/Util/CyclicEq.hs index b6dfd4451..71cf456bb 100644 --- a/parser-typechecker/src/Unison/Util/CyclicEq.hs +++ b/parser-typechecker/src/Unison/Util/CyclicEq.hs @@ -52,18 +52,18 @@ bothEq h1 h2 a1 a2 b1 b2 = then cyclicEq h1 h2 b1 b2 else pure False -instance CyclicEq a => CyclicEq [a] where +instance (CyclicEq a) => CyclicEq [a] where cyclicEq h1 h2 (x : xs) (y : ys) = bothEq h1 h2 x y xs ys cyclicEq _ _ [] [] = pure True cyclicEq _ _ _ _ = pure False -instance CyclicEq a => CyclicEq (S.Seq a) where +instance (CyclicEq a) => CyclicEq (S.Seq a) where cyclicEq h1 h2 xs ys = if S.length xs == S.length ys then cyclicEq h1 h2 (toList xs) (toList ys) else pure False -instance CyclicEq a => CyclicEq (Vector a) where +instance (CyclicEq a) => CyclicEq (Vector a) where cyclicEq h1 h2 xs ys = if V.length xs /= V.length ys then pure False diff --git a/parser-typechecker/src/Unison/Util/CyclicOrd.hs b/parser-typechecker/src/Unison/Util/CyclicOrd.hs index 85f151bb2..daab2527f 100644 --- a/parser-typechecker/src/Unison/Util/CyclicOrd.hs +++ b/parser-typechecker/src/Unison/Util/CyclicOrd.hs @@ -45,16 +45,16 @@ bothOrd h1 h2 a1 a2 b1 b2 = then cyclicOrd h1 h2 b1 b2 else pure b -instance CyclicOrd a => CyclicOrd [a] where +instance (CyclicOrd a) => CyclicOrd [a] where cyclicOrd h1 h2 (x : xs) (y : ys) = bothOrd h1 h2 x y xs ys cyclicOrd _ _ [] [] = pure EQ cyclicOrd _ _ [] _ = pure LT cyclicOrd _ _ _ [] = pure GT -instance CyclicOrd a => CyclicOrd (S.Seq a) where +instance (CyclicOrd a) => CyclicOrd (S.Seq a) where cyclicOrd h1 h2 xs ys = cyclicOrd h1 h2 (toList xs) (toList ys) -instance CyclicOrd a => CyclicOrd (Vector a) where +instance (CyclicOrd a) => CyclicOrd (Vector a) where cyclicOrd h1 h2 xs ys = go 0 h1 h2 xs ys where go !i !h1 !h2 !xs !ys = diff --git a/parser-typechecker/src/Unison/Util/EnumContainers.hs b/parser-typechecker/src/Unison/Util/EnumContainers.hs index 22f559d36..a5f7d7017 100644 --- a/parser-typechecker/src/Unison/Util/EnumContainers.hs +++ b/parser-typechecker/src/Unison/Util/EnumContainers.hs @@ -73,26 +73,26 @@ newtype EnumSet k = ES IS.IntSet Semigroup ) -mapFromList :: EnumKey k => [(k, a)] -> EnumMap k a +mapFromList :: (EnumKey k) => [(k, a)] -> EnumMap k a mapFromList = EM . IM.fromList . fmap (first keyToInt) -setFromList :: EnumKey k => [k] -> EnumSet k +setFromList :: (EnumKey k) => [k] -> EnumSet k setFromList = ES . IS.fromList . fmap keyToInt -setToList :: EnumKey k => EnumSet k -> [k] +setToList :: (EnumKey k) => EnumSet k -> [k] setToList (ES s) = intToKey <$> IS.toList s -mapSingleton :: EnumKey k => k -> a -> EnumMap k a +mapSingleton :: (EnumKey k) => k -> a -> EnumMap k a mapSingleton e a = EM $ IM.singleton (keyToInt e) a -setSingleton :: EnumKey k => k -> EnumSet k +setSingleton :: (EnumKey k) => k -> EnumSet k setSingleton e = ES . IS.singleton $ keyToInt e -mapInsert :: EnumKey k => k -> a -> EnumMap k a -> EnumMap k a +mapInsert :: (EnumKey k) => k -> a -> EnumMap k a -> EnumMap k a mapInsert e x (EM m) = EM $ IM.insert (keyToInt e) x m unionWith :: - EnumKey k => + (EnumKey k) => (a -> a -> a) -> EnumMap k a -> EnumMap k a -> @@ -106,52 +106,52 @@ intersectionWith :: EnumMap k c intersectionWith f (EM l) (EM r) = EM $ IM.intersectionWith f l r -keys :: EnumKey k => EnumMap k a -> [k] +keys :: (EnumKey k) => EnumMap k a -> [k] keys (EM m) = fmap intToKey . IM.keys $ m -keysSet :: EnumKey k => EnumMap k a -> EnumSet k +keysSet :: (EnumKey k) => EnumMap k a -> EnumSet k keysSet (EM m) = ES (IM.keysSet m) -restrictKeys :: EnumKey k => EnumMap k a -> EnumSet k -> EnumMap k a +restrictKeys :: (EnumKey k) => EnumMap k a -> EnumSet k -> EnumMap k a restrictKeys (EM m) (ES s) = EM $ IM.restrictKeys m s -withoutKeys :: EnumKey k => EnumMap k a -> EnumSet k -> EnumMap k a +withoutKeys :: (EnumKey k) => EnumMap k a -> EnumSet k -> EnumMap k a withoutKeys (EM m) (ES s) = EM $ IM.withoutKeys m s -member :: EnumKey k => k -> EnumSet k -> Bool +member :: (EnumKey k) => k -> EnumSet k -> Bool member e (ES s) = IS.member (keyToInt e) s -hasKey :: EnumKey k => k -> EnumMap k a -> Bool +hasKey :: (EnumKey k) => k -> EnumMap k a -> Bool hasKey k (EM m) = IM.member (keyToInt k) m -lookup :: EnumKey k => k -> EnumMap k a -> Maybe a +lookup :: (EnumKey k) => k -> EnumMap k a -> Maybe a lookup e (EM m) = IM.lookup (keyToInt e) m -lookupWithDefault :: EnumKey k => a -> k -> EnumMap k a -> a +lookupWithDefault :: (EnumKey k) => a -> k -> EnumMap k a -> a lookupWithDefault d e (EM m) = IM.findWithDefault d (keyToInt e) m -mapWithKey :: EnumKey k => (k -> a -> b) -> EnumMap k a -> EnumMap k b +mapWithKey :: (EnumKey k) => (k -> a -> b) -> EnumMap k a -> EnumMap k b mapWithKey f (EM m) = EM $ IM.mapWithKey (f . intToKey) m -foldMapWithKey :: EnumKey k => Monoid m => (k -> a -> m) -> EnumMap k a -> m +foldMapWithKey :: (EnumKey k) => (Monoid m) => (k -> a -> m) -> EnumMap k a -> m foldMapWithKey f (EM m) = IM.foldMapWithKey (f . intToKey) m -mapToList :: EnumKey k => EnumMap k a -> [(k, a)] +mapToList :: (EnumKey k) => EnumMap k a -> [(k, a)] mapToList (EM m) = first intToKey <$> IM.toList m -(!) :: EnumKey k => EnumMap k a -> k -> a +(!) :: (EnumKey k) => EnumMap k a -> k -> a (!) (EM m) e = m IM.! keyToInt e -findMin :: EnumKey k => EnumSet k -> k +findMin :: (EnumKey k) => EnumSet k -> k findMin (ES s) = intToKey $ IS.findMin s traverseSet_ :: - Applicative f => EnumKey k => (k -> f ()) -> EnumSet k -> f () + (Applicative f) => (EnumKey k) => (k -> f ()) -> EnumSet k -> f () traverseSet_ f (ES s) = IS.foldr (\i r -> f (intToKey i) *> r) (pure ()) s interverse :: - Applicative f => + (Applicative f) => (a -> b -> f c) -> EnumMap k a -> EnumMap k b -> @@ -160,8 +160,8 @@ interverse f (EM l) (EM r) = fmap EM . traverse id $ IM.intersectionWith f l r traverseWithKey :: - Applicative f => - EnumKey k => + (Applicative f) => + (EnumKey k) => (k -> a -> f b) -> EnumMap k a -> f (EnumMap k b) diff --git a/parser-typechecker/src/Unison/Util/Exception.hs b/parser-typechecker/src/Unison/Util/Exception.hs index b23746c18..a2a394d21 100644 --- a/parser-typechecker/src/Unison/Util/Exception.hs +++ b/parser-typechecker/src/Unison/Util/Exception.hs @@ -7,7 +7,7 @@ import Unison.Prelude -- License is MIT: https://github.com/snoyberg/classy-prelude/blob/ccd19f2c62882c69d5dcdd3da5c0df1031334c5a/classy-prelude/LICENSE -- Catch all exceptions except asynchronous exceptions. -tryAny :: MonadIO m => IO a -> m (Either SomeException a) +tryAny :: (MonadIO m) => IO a -> m (Either SomeException a) tryAny action = liftIO $ withAsync action waitCatch -- Catch all exceptions except asynchronous exceptions. diff --git a/parser-typechecker/src/Unison/Util/PinBoard.hs b/parser-typechecker/src/Unison/Util/PinBoard.hs index f7482f94a..36056d1db 100644 --- a/parser-typechecker/src/Unison/Util/PinBoard.hs +++ b/parser-typechecker/src/Unison/Util/PinBoard.hs @@ -57,7 +57,7 @@ import Unison.Prelude newtype PinBoard a = PinBoard (MVar (IntMap (Bucket a))) -new :: MonadIO m => m (PinBoard a) +new :: (MonadIO m) => m (PinBoard a) new = liftIO (PinBoard <$> newMVar IntMap.empty) @@ -90,7 +90,7 @@ pin (PinBoard boardVar) x = liftIO do n = hash x -debugDump :: MonadIO m => (a -> Text) -> PinBoard a -> m () +debugDump :: (MonadIO m) => (a -> Text) -> PinBoard a -> m () debugDump f (PinBoard boardVar) = liftIO do board <- readMVar boardVar contents <- (traverse . traverse) bucketToList (IntMap.toList board) @@ -129,7 +129,7 @@ bucketCompact (Bucket weaks) = bucketFromList <$> mapMaybeM (\w -> (w <$) <$> deRefWeak w) weaks -- | Look up a value in a bucket per its Eq instance. -bucketFind :: Eq a => Bucket a -> a -> IO (Maybe a) +bucketFind :: (Eq a) => Bucket a -> a -> IO (Maybe a) bucketFind bucket x = find (== x) <$> bucketToList bucket diff --git a/parser-typechecker/src/Unison/Util/Pretty/MegaParsec.hs b/parser-typechecker/src/Unison/Util/Pretty/MegaParsec.hs index 303c80f91..0e54f8363 100644 --- a/parser-typechecker/src/Unison/Util/Pretty/MegaParsec.hs +++ b/parser-typechecker/src/Unison/Util/Pretty/MegaParsec.hs @@ -42,10 +42,11 @@ prettyPrintParseError input errBundle = message = [expected] <> catMaybes [found] in P.oxfordCommasWith "." message -showErrorFancy :: Parser.ShowErrorComponent e => Parser.ErrorFancy e -> String +showErrorFancy :: (Parser.ShowErrorComponent e) => Parser.ErrorFancy e -> String showErrorFancy (Parser.ErrorFail msg) = msg showErrorFancy (Parser.ErrorIndentation ord ref actual) = - "incorrect indentation (got " <> show (Parser.unPos actual) + "incorrect indentation (got " + <> show (Parser.unPos actual) <> ", should be " <> p <> show (Parser.unPos ref) diff --git a/parser-typechecker/src/Unison/Util/RefPromise.hs b/parser-typechecker/src/Unison/Util/RefPromise.hs index 6410c17c5..40d959ca8 100644 --- a/parser-typechecker/src/Unison/Util/RefPromise.hs +++ b/parser-typechecker/src/Unison/Util/RefPromise.hs @@ -7,30 +7,30 @@ module Unison.Util.RefPromise newPromise, readPromise, tryReadPromise, - writePromise + writePromise, ) where -import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, tryReadMVar, tryPutMVar) -import Data.Atomics (Ticket, peekTicket, readForCAS, casIORef) +import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, tryPutMVar, tryReadMVar) +import Data.Atomics (Ticket, casIORef, peekTicket, readForCAS) -newtype Promise a = Promise { state :: MVar a} +newtype Promise a = Promise {state :: MVar a} -- create an empty promise newPromise :: IO (Promise a) -newPromise = fmap Promise newEmptyMVar +newPromise = fmap Promise newEmptyMVar -- read the value of the promise -- return immediately if the promise if full, block if empty readPromise :: Promise a -> IO a -readPromise Promise { state } = readMVar state +readPromise Promise {state} = readMVar state -- try to read the value of the promise -- immediately return Nothing if the promise is empty tryReadPromise :: Promise a -> IO (Maybe a) -tryReadPromise Promise { state } = tryReadMVar state +tryReadPromise Promise {state} = tryReadMVar state -- if the promise is empty, write the value, awake all readers and return True -- if full, ignore the write and return False writePromise :: Promise a -> a -> IO Bool -writePromise Promise { state } value = tryPutMVar state value +writePromise Promise {state} value = tryPutMVar state value diff --git a/parser-typechecker/src/Unison/Util/Star3.hs b/parser-typechecker/src/Unison/Util/Star3.hs index 29d79e764..61a994ffd 100644 --- a/parser-typechecker/src/Unison/Util/Star3.hs +++ b/parser-typechecker/src/Unison/Util/Star3.hs @@ -201,7 +201,7 @@ deleteD2 (f, x) s = garbageCollect f (Star3 (fact s) (d1 s) d2' (d3 s)) -- | Given a possibly-invalid Star3, which may contain the given fact in its fact set that are not related to any d1, -- d2, or d3, return a valid Star3, with this fact possibly removed. -garbageCollect :: Ord fact => fact -> Star3 fact d1 d2 d3 -> Star3 fact d1 d2 d3 +garbageCollect :: (Ord fact) => fact -> Star3 fact d1 d2 d3 -> Star3 fact d1 d2 d3 garbageCollect f star = star { fact = diff --git a/parser-typechecker/src/Unison/Util/TQueue.hs b/parser-typechecker/src/Unison/Util/TQueue.hs index 6d2395c75..0e3191753 100644 --- a/parser-typechecker/src/Unison/Util/TQueue.hs +++ b/parser-typechecker/src/Unison/Util/TQueue.hs @@ -8,7 +8,7 @@ import UnliftIO.STM hiding (TQueue) data TQueue a = TQueue (TVar (Seq a)) (TVar Word64) -newIO :: MonadIO m => m (TQueue a) +newIO :: (MonadIO m) => m (TQueue a) newIO = TQueue <$> newTVarIO mempty <*> newTVarIO 0 size :: TQueue a -> STM Int @@ -68,7 +68,7 @@ enqueue (TQueue v count) a = do modifyTVar' v (|> a) modifyTVar' count (+ 1) -raceIO :: MonadIO m => STM a -> STM b -> m (Either a b) +raceIO :: (MonadIO m) => STM a -> STM b -> m (Either a b) raceIO a b = liftIO do aa <- Async.async $ atomically a ab <- Async.async $ atomically b diff --git a/parser-typechecker/src/Unison/Util/TransitiveClosure.hs b/parser-typechecker/src/Unison/Util/TransitiveClosure.hs index 666187cdd..f72a4a09e 100644 --- a/parser-typechecker/src/Unison/Util/TransitiveClosure.hs +++ b/parser-typechecker/src/Unison/Util/TransitiveClosure.hs @@ -20,7 +20,7 @@ transitiveClosure getDependencies open = go (Set.insert h closed) (toList deps ++ t) in go Set.empty (toList open) -transitiveClosure' :: Ord a => (a -> Set a) -> Set a -> Set a +transitiveClosure' :: (Ord a) => (a -> Set a) -> Set a -> Set a transitiveClosure' f as = runIdentity $ transitiveClosure (pure . f) as transitiveClosure1 :: @@ -31,5 +31,5 @@ transitiveClosure1 :: m (Set a) transitiveClosure1 f a = transitiveClosure f (Set.singleton a) -transitiveClosure1' :: Ord a => (a -> Set a) -> a -> Set a +transitiveClosure1' :: (Ord a) => (a -> Set a) -> a -> Set a transitiveClosure1' f a = runIdentity $ transitiveClosure1 (pure . f) a diff --git a/parser-typechecker/tests/Unison/Test/ANF.hs b/parser-typechecker/tests/Unison/Test/ANF.hs index d0a93a522..62558bb04 100644 --- a/parser-typechecker/tests/Unison/Test/ANF.hs +++ b/parser-typechecker/tests/Unison/Test/ANF.hs @@ -13,7 +13,7 @@ import qualified Unison.ABT as ABT import Unison.ABT.Normalized (Term (TAbs)) import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.Pattern as P -import Unison.Reference (Reference(Builtin)) +import Unison.Reference (Reference (Builtin)) import Unison.Runtime.ANF as ANF import Unison.Runtime.MCode (RefNums (..), emitCombs) import qualified Unison.Term as Term @@ -38,7 +38,7 @@ simpleRefs r | r == Ty.charRef = 5 | otherwise = 100 -runANF :: Var v => ANFM v a -> a +runANF :: (Var v) => ANFM v a -> a runANF m = evalState (runReaderT m Set.empty) (0, 1, []) testANF :: String -> Test () @@ -59,7 +59,7 @@ testLift s = case cs of !_ -> ok . lamLift $ tm s -denormalize :: Var v => ANormal v -> Term.Term0 v +denormalize :: (Var v) => ANormal v -> Term.Term0 v denormalize (TVar v) = Term.var () v denormalize (TLit l) = case l of I i -> Term.int () i @@ -116,7 +116,7 @@ backReference :: Word64 -> Reference backReference _ = error "backReference" denormalizeMatch :: - Var v => Branched (ANormal v) -> [Term.MatchCase () (Term.Term0 v)] + (Var v) => Branched (ANormal v) -> [Term.MatchCase () (Term.Term0 v)] denormalizeMatch b | MatchEmpty <- b = [] | MatchIntegral m df <- b = @@ -141,7 +141,7 @@ denormalizeMatch b where (n, dbr) = denormalizeBranch br - ipat :: Integral a => Reference -> p -> a -> P.Pattern () + ipat :: (Integral a) => Reference -> p -> a -> P.Pattern () ipat r _ i | r == Ty.natRef = P.Nat () $ fromIntegral i | otherwise = P.Int () $ fromIntegral i @@ -157,7 +157,7 @@ denormalizeBranch (TAbs v br) = (n + 1, ABT.abs v dbr) denormalizeBranch tm = (0, denormalize tm) denormalizeHandler :: - Var v => + (Var v) => Map.Map Reference (EnumMap CTag ([Mem], ANormal v)) -> ANormal v -> [Term.MatchCase () (Term.Term0 v)] diff --git a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs index 78bfad9f8..221d9f41b 100644 --- a/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs +++ b/parser-typechecker/tests/Unison/Test/Codebase/Causal.hs @@ -14,6 +14,7 @@ import Unison.Prelude -- Dummy instances for this test suite. Would probably be better if they weren't orphans. instance Hashing.ContentAddressable Int64 where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow + instance Hashing.ContentAddressable (Set Int64) where contentHash = Hash.fromByteString . Text.encodeUtf8 . tShow test :: Test () @@ -38,7 +39,7 @@ test = -- $ prop_mergeCommutative {- , scope "threeWayMerge.commonAncestor" . expect - $ testCommonAncestor + \$ testCommonAncestor -- $ prop_mergeCommonAncestor --} scope "lca.hasLca" lcaPairTest, scope "lca.noLca" noLcaPairTest, @@ -140,13 +141,13 @@ testThreeWay = runIdentity $ threeWayMerge' oneRemoved twoRemoved -setCombine :: Applicative m => Ord a => Set a -> Set a -> m (Set a) +setCombine :: (Applicative m) => (Ord a) => Set a -> Set a -> m (Set a) setCombine a b = pure $ a <> b -setDiff :: Applicative m => Ord a => Set a -> Set a -> m (Set a, Set a) +setDiff :: (Applicative m) => (Ord a) => Set a -> Set a -> m (Set a, Set a) setDiff old new = pure (Set.difference new old, Set.difference old new) -setPatch :: Applicative m => Ord a => Set a -> (Set a, Set a) -> m (Set a) +setPatch :: (Applicative m) => (Ord a) => Set a -> (Set a, Set a) -> m (Set a) setPatch s (added, removed) = pure (added <> Set.difference s removed) -- merge x x == x, should not add a new head, and also the value at the head should be the same of course diff --git a/parser-typechecker/tests/Unison/Test/Codebase/Path.hs b/parser-typechecker/tests/Unison/Test/Codebase/Path.hs index c497ef69d..6b9c5085a 100644 --- a/parser-typechecker/tests/Unison/Test/Codebase/Path.hs +++ b/parser-typechecker/tests/Unison/Test/Codebase/Path.hs @@ -32,7 +32,8 @@ test = let s = "foo.bar.baz#abc" in scope s . expect $ isLeft $ parseSplit' wordyNameSegment s, let s = "foo.bar.+" in scope s . expect $ - isLeft $ parseSplit' wordyNameSegment s + isLeft $ + parseSplit' wordyNameSegment s ], scope "definitionNameSegment" . tests $ [ let s = "foo.bar.+" diff --git a/parser-typechecker/tests/Unison/Test/Common.hs b/parser-typechecker/tests/Unison/Test/Common.hs index 10de1a5dc..43fbff855 100644 --- a/parser-typechecker/tests/Unison/Test/Common.hs +++ b/parser-typechecker/tests/Unison/Test/Common.hs @@ -52,7 +52,7 @@ tm s = Parser.run (Parser.root TermParser.term) s parsingEnv showParseError :: - Var v => + (Var v) => String -> MPE.ParseError Parser.Input (Parser.Error v) -> String diff --git a/parser-typechecker/tests/Unison/Test/Syntax/FileParser.hs b/parser-typechecker/tests/Unison/Test/Syntax/FileParser.hs index 7939e7a23..525e45306 100644 --- a/parser-typechecker/tests/Unison/Test/Syntax/FileParser.hs +++ b/parser-typechecker/tests/Unison/Test/Syntax/FileParser.hs @@ -81,7 +81,7 @@ emptyWatchTest = scope "emptyWatchTest" $ expectFileParseFailure ">" expectation where - expectation :: Var e => P.Error e -> Test () + expectation :: (Var e) => P.Error e -> Test () expectation e = case e of P.EmptyWatch _ann -> ok _ -> crash "Error wasn't EmptyWatch" @@ -91,7 +91,7 @@ signatureNeedsAccompanyingBodyTest = scope "signatureNeedsAccompanyingBodyTest" $ expectFileParseFailure (unlines ["f : Nat -> Nat", "", "g a = a + 1"]) expectation where - expectation :: Var e => P.Error e -> Test () + expectation :: (Var e) => P.Error e -> Test () expectation e = case e of P.SignatureNeedsAccompanyingBody _ -> ok _ -> crash "Error wasn't SignatureNeedsAccompanyingBody" @@ -101,7 +101,7 @@ emptyBlockTest = scope "emptyBlockTest" $ expectFileParseFailure (unlines ["f a =", "", "> 1 + 1"]) expectation where - expectation :: Var e => P.Error e -> Test () + expectation :: (Var e) => P.Error e -> Test () expectation e = case e of P.EmptyBlock _ -> ok _ -> crash "Error wasn't EmptyBlock" @@ -111,7 +111,7 @@ expectedBlockOpenTest = scope "expectedBlockOpenTest" $ expectFileParseFailure "f a b = match a b" expectation where - expectation :: Var e => P.Error e -> Test () + expectation :: (Var e) => P.Error e -> Test () expectation e = case e of P.ExpectedBlockOpen _ _ -> ok _ -> crash "Error wasn't ExpectedBlockOpen" @@ -121,7 +121,7 @@ unknownDataConstructorTest = scope "unknownDataConstructorTest" $ expectFileParseFailure "m a = match a with A -> 1" expectation where - expectation :: Var e => P.Error e -> Test () + expectation :: (Var e) => P.Error e -> Test () expectation e = case e of P.UnknownDataConstructor _ _ -> ok _ -> crash "Error wasn't UnknownDataConstructor" @@ -131,7 +131,7 @@ unknownAbilityConstructorTest = scope "unknownAbilityConstructorTest" $ expectFileParseFailure "f e = match e with {E t -> u} -> 1" expectation where - expectation :: Var e => P.Error e -> Test () + expectation :: (Var e) => P.Error e -> Test () expectation e = case e of P.UnknownAbilityConstructor _ _ -> ok _ -> crash "Error wasn't UnknownAbilityConstructor" diff --git a/parser-typechecker/tests/Unison/Test/Type.hs b/parser-typechecker/tests/Unison/Test/Type.hs index e2f3b0bf3..3ca27b51e 100644 --- a/parser-typechecker/tests/Unison/Test/Type.hs +++ b/parser-typechecker/tests/Unison/Test/Type.hs @@ -10,7 +10,7 @@ import qualified Unison.Var as Var infixr 1 --> -(-->) :: Ord v => Type v () -> Type v () -> Type v () +(-->) :: (Ord v) => Type v () -> Type v () -> Type v () (-->) a b = arrow () a b test :: Test () diff --git a/parser-typechecker/tests/Unison/Test/UnisonSources.hs b/parser-typechecker/tests/Unison/Test/UnisonSources.hs index 57518c473..d6f2a3f29 100644 --- a/parser-typechecker/tests/Unison/Test/UnisonSources.hs +++ b/parser-typechecker/tests/Unison/Test/UnisonSources.hs @@ -90,7 +90,7 @@ go rt files how = do files' <- liftIO files tests (makePassingTest rt how <$> files') -showNotes :: Foldable f => String -> PrintError.Env -> f Note -> String +showNotes :: (Foldable f) => String -> PrintError.Env -> f Note -> String showNotes source env = intercalateMap "\n\n" $ PrintError.renderNoteAsANSI 60 env source Path.absoluteEmpty diff --git a/parser-typechecker/tests/Unison/Test/Util/Text.hs b/parser-typechecker/tests/Unison/Test/Util/Text.hs index 04f3bf58b..4725b8f1c 100644 --- a/parser-typechecker/tests/Unison/Test/Util/Text.hs +++ b/parser-typechecker/tests/Unison/Test/Util/Text.hs @@ -45,8 +45,10 @@ test = scope "<>" . expect' $ Text.toText (t1s <> t2s <> t3s) == t1 <> t2 <> t3 scope "Ord" . expect' $ - (t1 <> t2 <> t3) `compare` t3 - == (t1s <> t2s <> t3s) `compare` t3s + (t1 <> t2 <> t3) + `compare` t3 + == (t1s <> t2s <> t3s) + `compare` t3s scope "take" . expect' $ Text.toText (Text.take k (t1s <> t2s)) == T.take k (t1 <> t2) scope "drop" . expect' $ diff --git a/unison-cli/src/Compat.hs b/unison-cli/src/Compat.hs index 550643997..2287e9ec2 100644 --- a/unison-cli/src/Compat.hs +++ b/unison-cli/src/Compat.hs @@ -8,6 +8,7 @@ import System.Mem.Weak (deRefWeak) import Unison.Prelude import qualified UnliftIO +{- ORMOLU_DISABLE -} #if defined(mingw32_HOST_OS) import qualified GHC.ConsoleHandler as WinSig #else @@ -15,13 +16,13 @@ import qualified System.Posix.Signals as Sig #endif onWindows :: Bool -onWindows = +onWindows = #if defined(mingw32_HOST_OS) True #else False #endif - +{- ORMOLU_ENABLE -} -- | Constructs a default interrupt handler which builds an interrupt handler which throws a -- UserInterrupt exception to the thread in which the setup was initially called. @@ -48,6 +49,7 @@ withInterruptHandler handler action = do -- Installs the new handler and returns an action to restore the old handlers. installNewHandlers :: IO (IO ()) installNewHandlers = do +{- ORMOLU_DISABLE -} #if defined(mingw32_HOST_OS) let sig_handler WinSig.ControlC = handler sig_handler WinSig.Break = handler @@ -63,3 +65,4 @@ withInterruptHandler handler action = do #endif restoreOldHandlers :: IO () -> IO () restoreOldHandlers restore = restore +{- ORMOLU_ENABLE -} diff --git a/unison-cli/src/Unison/Auth/CredentialFile.hs b/unison-cli/src/Unison/Auth/CredentialFile.hs index 4437258a0..d19a87eb7 100644 --- a/unison-cli/src/Unison/Auth/CredentialFile.hs +++ b/unison-cli/src/Unison/Auth/CredentialFile.hs @@ -20,14 +20,14 @@ lockfileConfig = where sleepTimeMicros = 100_000 -- 100ms -getCredentialJSONFilePath :: MonadIO m => m FilePath +getCredentialJSONFilePath :: (MonadIO m) => m FilePath getCredentialJSONFilePath = do unisonDataDir <- getXdgDirectory XdgData "unisonlanguage" pure (unisonDataDir "credentials.json") -- | Atomically update the credential storage file. -- Creates an empty file automatically if one doesn't exist. -atomicallyModifyCredentialsFile :: MonadIO m => (Credentials -> Credentials) -> m Credentials +atomicallyModifyCredentialsFile :: (MonadIO m) => (Credentials -> Credentials) -> m Credentials atomicallyModifyCredentialsFile f = liftIO $ do credentialJSONPath <- getCredentialJSONFilePath doesFileExist credentialJSONPath >>= \case diff --git a/unison-cli/src/Unison/Auth/CredentialManager.hs b/unison-cli/src/Unison/Auth/CredentialManager.hs index 98780efef..8729282f6 100644 --- a/unison-cli/src/Unison/Auth/CredentialManager.hs +++ b/unison-cli/src/Unison/Auth/CredentialManager.hs @@ -22,23 +22,23 @@ import qualified UnliftIO newtype CredentialManager = CredentialManager (UnliftIO.MVar Credentials) -- | Saves credentials to the active profile. -saveCredentials :: UnliftIO.MonadUnliftIO m => CredentialManager -> CodeserverId -> CodeserverCredentials -> m () +saveCredentials :: (UnliftIO.MonadUnliftIO m) => CredentialManager -> CodeserverId -> CodeserverCredentials -> m () saveCredentials credManager aud creds = do void . modifyCredentials credManager $ setCodeserverCredentials aud creds -- | Atomically update the credential storage file, and update the in-memory cache. -modifyCredentials :: UnliftIO.MonadUnliftIO m => CredentialManager -> (Credentials -> Credentials) -> m Credentials +modifyCredentials :: (UnliftIO.MonadUnliftIO m) => CredentialManager -> (Credentials -> Credentials) -> m Credentials modifyCredentials (CredentialManager credsVar) f = do UnliftIO.modifyMVar credsVar $ \_ -> do newCreds <- atomicallyModifyCredentialsFile f pure (newCreds, newCreds) -getCredentials :: MonadIO m => CredentialManager -> CodeserverId -> m (Either CredentialFailure CodeserverCredentials) +getCredentials :: (MonadIO m) => CredentialManager -> CodeserverId -> m (Either CredentialFailure CodeserverCredentials) getCredentials (CredentialManager credsVar) aud = do creds <- UnliftIO.readMVar credsVar pure $ getCodeserverCredentials aud creds -newCredentialManager :: MonadIO m => m CredentialManager +newCredentialManager :: (MonadIO m) => m CredentialManager newCredentialManager = do credentials <- atomicallyModifyCredentialsFile id credentialsVar <- UnliftIO.newMVar credentials diff --git a/unison-cli/src/Unison/Auth/Discovery.hs b/unison-cli/src/Unison/Auth/Discovery.hs index 4c2c07d4b..050047ffc 100644 --- a/unison-cli/src/Unison/Auth/Discovery.hs +++ b/unison-cli/src/Unison/Auth/Discovery.hs @@ -15,7 +15,7 @@ discoveryURIForCodeserver cs = let uri = codeserverToURI cs in uri {uriPath = uriPath uri <> "/.well-known/openid-configuration"} -fetchDiscoveryDoc :: MonadIO m => URI -> m (Either CredentialFailure DiscoveryDoc) +fetchDiscoveryDoc :: (MonadIO m) => URI -> m (Either CredentialFailure DiscoveryDoc) fetchDiscoveryDoc discoveryURI = liftIO . UnliftIO.try @_ @CredentialFailure $ do unauthenticatedHttpClient <- HTTP.getGlobalManager req <- HTTP.requestFromURI discoveryURI diff --git a/unison-cli/src/Unison/Auth/HTTPClient.hs b/unison-cli/src/Unison/Auth/HTTPClient.hs index 441f0a93f..10ecc746d 100644 --- a/unison-cli/src/Unison/Auth/HTTPClient.hs +++ b/unison-cli/src/Unison/Auth/HTTPClient.hs @@ -15,7 +15,7 @@ newtype AuthenticatedHttpClient = AuthenticatedHttpClient HTTP.Manager -- | Returns a new http manager which applies the appropriate Authorization header to -- any hosts our UCM is authenticated with. -newAuthenticatedHTTPClient :: MonadIO m => TokenProvider -> UCMVersion -> m AuthenticatedHttpClient +newAuthenticatedHTTPClient :: (MonadIO m) => TokenProvider -> UCMVersion -> m AuthenticatedHttpClient newAuthenticatedHTTPClient tokenProvider ucmVersion = liftIO $ do let managerSettings = HTTP.tlsManagerSettings diff --git a/unison-cli/src/Unison/Auth/Tokens.hs b/unison-cli/src/Unison/Auth/Tokens.hs index 412e2ae24..135fc3874 100644 --- a/unison-cli/src/Unison/Auth/Tokens.hs +++ b/unison-cli/src/Unison/Auth/Tokens.hs @@ -20,7 +20,7 @@ import Web.JWT import qualified Web.JWT as JWT -- | Checks whether a JWT access token is expired. -isExpired :: MonadIO m => AccessToken -> m Bool +isExpired :: (MonadIO m) => AccessToken -> m Bool isExpired accessToken = liftIO do jwt <- JWT.decode accessToken `whenNothing` (throwIO $ InvalidJWT "Failed to decode JWT") now <- getPOSIXTime @@ -48,7 +48,7 @@ newTokenProvider manager host = UnliftIO.try @_ @CredentialFailure $ do -- | Don't yet support automatically refreshing tokens. -- -- Specification: https://datatracker.ietf.org/doc/html/rfc6749#section-6 -performTokenRefresh :: MonadIO m => URI -> Tokens -> m (Either CredentialFailure Tokens) +performTokenRefresh :: (MonadIO m) => URI -> Tokens -> m (Either CredentialFailure Tokens) performTokenRefresh discoveryURI (Tokens {refreshToken = currentRefreshToken}) = runExceptT $ case currentRefreshToken of Nothing -> diff --git a/unison-cli/src/Unison/Cli/Monad.hs b/unison-cli/src/Unison/Cli/Monad.hs index 5d31cdcff..40b88ee51 100644 --- a/unison-cli/src/Unison/Cli/Monad.hs +++ b/unison-cli/src/Unison/Cli/Monad.hs @@ -192,7 +192,7 @@ data LoopState = LoopState instance {-# OVERLAPS #-} - Functor f => + (Functor f) => IsLabel "currentPath" ((Path.Absolute -> f Path.Absolute) -> (LoopState -> f LoopState)) where fromLabel :: (Path.Absolute -> f Path.Absolute) -> (LoopState -> f LoopState) diff --git a/unison-cli/src/Unison/Cli/MonadUtils.hs b/unison-cli/src/Unison/Cli/MonadUtils.hs index 41985cc88..4a018a5d0 100644 --- a/unison-cli/src/Unison/Cli/MonadUtils.hs +++ b/unison-cli/src/Unison/Cli/MonadUtils.hs @@ -114,7 +114,7 @@ import UnliftIO.STM -- .unisonConfig things -- | Lookup a config value by key. -getConfig :: Configurator.Configured a => Text -> Cli (Maybe a) +getConfig :: (Configurator.Configured a) => Text -> Cli (Maybe a) getConfig key = do Cli.Env {config} <- ask liftIO (Configurator.lookup config key) @@ -322,7 +322,7 @@ stepAtM :: stepAtM cause = stepManyAtM @[] cause . pure stepManyAt :: - Foldable f => + (Foldable f) => Text -> f (Path, Branch0 IO -> Branch0 IO) -> Cli () @@ -331,7 +331,7 @@ stepManyAt reason actions = do syncRoot reason stepManyAt' :: - Foldable f => + (Foldable f) => Text -> f (Path, Branch0 IO -> Cli (Branch0 IO)) -> Cli Bool @@ -341,7 +341,7 @@ stepManyAt' reason actions = do pure res stepManyAtNoSync' :: - Foldable f => + (Foldable f) => f (Path, Branch0 IO -> Cli (Branch0 IO)) -> Cli Bool stepManyAtNoSync' actions = do @@ -352,14 +352,14 @@ stepManyAtNoSync' actions = do -- Like stepManyAt, but doesn't update the last saved root stepManyAtNoSync :: - Foldable f => + (Foldable f) => f (Path, Branch0 IO -> Branch0 IO) -> Cli () stepManyAtNoSync actions = void . modifyRootBranch $ Branch.stepManyAt actions stepManyAtM :: - Foldable f => + (Foldable f) => Text -> f (Path, Branch0 IO -> IO (Branch0 IO)) -> Cli () @@ -368,7 +368,7 @@ stepManyAtM reason actions = do syncRoot reason stepManyAtMNoSync :: - Foldable f => + (Foldable f) => f (Path, Branch0 IO -> IO (Branch0 IO)) -> Cli () stepManyAtMNoSync actions = do diff --git a/unison-cli/src/Unison/Cli/NamesUtils.hs b/unison-cli/src/Unison/Cli/NamesUtils.hs index 20eeeea0f..6486db16d 100644 --- a/unison-cli/src/Unison/Cli/NamesUtils.hs +++ b/unison-cli/src/Unison/Cli/NamesUtils.hs @@ -51,7 +51,7 @@ basicNames' nameScoping = do -- | Produce a `Names` needed to display all the hashes used in the given file. displayNames :: - Var v => + (Var v) => TypecheckedUnisonFile v a -> Cli NamesWithHistory displayNames unisonFile = diff --git a/unison-cli/src/Unison/Cli/TypeCheck.hs b/unison-cli/src/Unison/Cli/TypeCheck.hs index 382ad2e41..8105d3542 100644 --- a/unison-cli/src/Unison/Cli/TypeCheck.hs +++ b/unison-cli/src/Unison/Cli/TypeCheck.hs @@ -51,7 +51,7 @@ typecheck ambient names sourceName source = (fst source) typecheckHelper :: - MonadIO m => + (MonadIO m) => Codebase IO Symbol Ann -> IO Parser.UniqueName -> [Type Symbol Ann] -> diff --git a/unison-cli/src/Unison/Codebase/Editor/AuthorInfo.hs b/unison-cli/src/Unison/Codebase/Editor/AuthorInfo.hs index c9d61df37..c059d5f40 100644 --- a/unison-cli/src/Unison/Codebase/Editor/AuthorInfo.hs +++ b/unison-cli/src/Unison/Codebase/Editor/AuthorInfo.hs @@ -23,7 +23,7 @@ import UnliftIO (liftIO) data AuthorInfo v a = AuthorInfo {guid, author, copyrightHolder :: (Reference.Id, Term v a, Type v a)} -createAuthorInfo :: forall m v a. MonadIO m => Var v => a -> Text -> m (AuthorInfo v a) +createAuthorInfo :: forall m v a. (MonadIO m) => (Var v) => a -> Text -> m (AuthorInfo v a) createAuthorInfo a t = createAuthorInfo' . unpack <$> liftIO (getRandomBytes 32) where createAuthorInfo' :: [Word8] -> AuthorInfo v a diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 37b526000..c5fcaac66 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -359,7 +359,7 @@ loop e = do resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> hq') rootNames <- Branch.toNames <$> Cli.getRootBranch0 let name = Path.unsafeToName (Path.unsplit resolvedPath) - toRel :: Ord ref => Set ref -> R.Relation Name ref + toRel :: (Ord ref) => Set ref -> R.Relation Name ref toRel = R.fromList . fmap (name,) . toList -- these names are relative to the root toDelete = Names (toRel terms) (toRel types) @@ -496,13 +496,15 @@ loop e = do squashedb <- liftIO (Branch.merge'' (Codebase.lca codebase) Branch.SquashMerge headb baseb) -- Perform all child updates in a single step. Cli.updateAt description destAbs $ Branch.step \destBranch0 -> - destBranch0 & Branch.children - %~ ( \childMap -> - childMap & at "base" ?~ baseb - & at "head" ?~ headb - & at "merged" ?~ mergedb - & at "squashed" ?~ squashedb - ) + destBranch0 + & Branch.children + %~ ( \childMap -> + childMap + & at "base" ?~ baseb + & at "head" ?~ headb + & at "merged" ?~ mergedb + & at "squashed" ?~ squashedb + ) let base = snoc dest0 "base" head = snoc dest0 "head" merged = snoc dest0 "merged" @@ -1317,7 +1319,7 @@ loop e = do let seen h = State.gets (Set.member h) set h = State.modify (Set.insert h) getCausal b = (Branch.headHash b, pure $ Branch._history b) - goCausal :: forall m. Monad m => [(CausalHash, m (Branch.UnwrappedBranch m))] -> StateT (Set CausalHash) m () + goCausal :: forall m. (Monad m) => [(CausalHash, m (Branch.UnwrappedBranch m))] -> StateT (Set CausalHash) m () goCausal [] = pure () goCausal ((h, mc) : queue) = do ifM (seen h) (goCausal queue) do @@ -1325,7 +1327,7 @@ loop e = do Causal.One h _bh b -> goBranch h b mempty queue Causal.Cons h _bh b tail -> goBranch h b [fst tail] (tail : queue) Causal.Merge h _bh b (Map.toList -> tails) -> goBranch h b (map fst tails) (tails ++ queue) - goBranch :: forall m. Monad m => CausalHash -> Branch0 m -> [CausalHash] -> [(CausalHash, m (Branch.UnwrappedBranch m))] -> StateT (Set CausalHash) m () + goBranch :: forall m. (Monad m) => CausalHash -> Branch0 m -> [CausalHash] -> [(CausalHash, m (Branch.UnwrappedBranch m))] -> StateT (Set CausalHash) m () goBranch h b (Set.fromList -> causalParents) queue = case b of Branch0 terms0 types0 children0 patches0 _ _ _ _ _ _ _ -> let wrangleMetadata :: (Ord r, Ord n) => Metadata.Star r n -> r -> (r, (Set n, Set Metadata.Value)) @@ -1342,7 +1344,9 @@ loop e = do set h goCausal (map getCausal (Foldable.toList children0) ++ queue) prettyDump (h, Output.DN.DumpNamespace terms types patches children causalParents) = - P.lit "Namespace " <> P.shown h <> P.newline + P.lit "Namespace " + <> P.shown h + <> P.newline <> ( P.indentN 2 $ P.linesNonEmpty [ Monoid.unlessM (null causalParents) $ P.lit "Causal Parents:" <> P.newline <> P.indentN 2 (P.lines (map P.shown $ Set.toList causalParents)), @@ -2551,7 +2555,7 @@ searchResultsFor ns terms types = searchBranchScored :: forall score. - Ord score => + (Ord score) => Names -> (Name -> Name -> Maybe score) -> [HQ.HashQualified Name] -> @@ -2765,7 +2769,7 @@ racketOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] racketOpts gendir statdir file args = libs ++ [file] ++ args where includes = [gendir, statdir "common", statdir "racket"] - libs = concatMap (\dir -> ["-S",dir]) includes + libs = concatMap (\dir -> ["-S", dir]) includes chezOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] chezOpts gendir statdir file args = @@ -2782,7 +2786,7 @@ runScheme bk file args0 = do ensureSchemeExists gendir <- getSchemeGenLibDir statdir <- getSchemeStaticLibDir - let cmd = case bk of Racket -> "racket" ; Chez -> "scheme" + let cmd = case bk of Racket -> "racket"; Chez -> "scheme" opts = case bk of Racket -> racketOpts gendir statdir file args0 Chez -> chezOpts gendir statdir file args0 @@ -3107,7 +3111,7 @@ parseType input src = do Type.bindNames Name.unsafeFromVar mempty (NamesWithHistory.currentNames names) (Type.generalizeLowercase mempty typ) & onLeft \errs -> Cli.returnEarly (ParseResolutionFailures src (toList errs)) -getTermsIncludingHistorical :: Monad m => Path.HQSplit -> Branch0 m -> Cli (Set Referent) +getTermsIncludingHistorical :: (Monad m) => Path.HQSplit -> Branch0 m -> Cli (Set Referent) getTermsIncludingHistorical (p, hq) b = case Set.toList refs of [] -> case hq of HQ'.HashQualified n hs -> do @@ -3129,7 +3133,7 @@ data GetTermResult -- -- Otherwise, returns `Nothing`. addWatch :: - Var v => + (Var v) => String -> Maybe (TypecheckedUnisonFile v Ann) -> Maybe (v, TypecheckedUnisonFile v Ann) @@ -3241,7 +3245,7 @@ createWatcherFile v tm typ = [(magicMainWatcherString, [(v2, tm, typ)])] executePPE :: - Var v => + (Var v) => TypecheckedUnisonFile v a -> Cli PPE.PrettyPrintEnv executePPE unisonFile = @@ -3271,7 +3275,7 @@ hqNameQuery query = do -- | Select a definition from the given branch. -- Returned names will match the provided 'Position' type. -fuzzySelectDefinition :: MonadIO m => Position -> Branch0 m0 -> m (Maybe [HQ.HashQualified Name]) +fuzzySelectDefinition :: (MonadIO m) => Position -> Branch0 m0 -> m (Maybe [HQ.HashQualified Name]) fuzzySelectDefinition pos searchBranch0 = liftIO do let termsAndTypes = Relation.dom (Names.hashQualifyTermsRelation (Relation.swap $ Branch.deepTerms searchBranch0)) @@ -3285,7 +3289,7 @@ fuzzySelectDefinition pos searchBranch0 = liftIO do -- | Select a namespace from the given branch. -- Returned Path's will match the provided 'Position' type. -fuzzySelectNamespace :: MonadIO m => Position -> Branch0 m0 -> m (Maybe [Path']) +fuzzySelectNamespace :: (MonadIO m) => Position -> Branch0 m0 -> m (Maybe [Path']) fuzzySelectNamespace pos searchBranch0 = liftIO do let intoPath' :: Path -> Path' intoPath' = case pos of diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs index 9faed3bcf..41cab5239 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/AuthLogin.hs @@ -141,7 +141,7 @@ addQueryParam key val uri = newParam = (key, Just val) in uri {uriQuery = BSC.unpack $ renderQuery True (existingQuery <> [newParam])} -generateParams :: MonadIO m => m (PKCEVerifier, PKCEChallenge, OAuthState) +generateParams :: (MonadIO m) => m (PKCEVerifier, PKCEChallenge, OAuthState) generateParams = liftIO $ do verifier <- BE.convertToBase @ByteString BE.Base64URLUnpadded <$> getRandomBytes 50 let digest = Crypto.hashWith Crypto.SHA256 verifier @@ -151,7 +151,7 @@ generateParams = liftIO $ do -- | Exchange an authorization code for tokens. exchangeCode :: - MonadIO m => + (MonadIO m) => HTTP.Manager -> URI -> Code -> diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MetadataUtils.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MetadataUtils.hs index 3e1d8d62d..d988843be 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/MetadataUtils.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/MetadataUtils.hs @@ -78,7 +78,7 @@ manageLinks :: [Path.HQSplit'] -> [HQ.HashQualified Name] -> ( forall r. - Ord r => + (Ord r) => (r, Metadata.Type, Metadata.Value) -> Branch.Star r NameSegment -> Branch.Star r NameSegment diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs index 24555f0f7..2f65ebe67 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Update.hs @@ -171,7 +171,7 @@ handleUpdate input optionalPatch requestedNames = do step1 p (_, r, r') = Patch.updateType r (TypeEdit.Replace r') p step2 p (_, r, r') = Patch.updateTerm typing r (TermEdit.Replace r' (typing r r')) p (p, seg) = Path.toAbsoluteSplit currentPath' patchPath - updatePatches :: Monad m => Branch0 m -> m (Branch0 m) + updatePatches :: (Monad m) => Branch0 m -> m (Branch0 m) updatePatches = Branch.modifyPatches seg updatePatch pure (updatePatch ye'ol'Patch, updatePatches, p) @@ -202,7 +202,8 @@ handleUpdate input optionalPatch requestedNames = do Cli.syncRoot case patchPath of Nothing -> "update.nopatch" Just p -> - p & Path.unsplit' + p + & Path.unsplit' & Path.resolve @_ @_ @Path.Absolute currentPath' & tShow @@ -564,7 +565,7 @@ getSlurpResultForUpdate requestedNames slurpCheckNames = do pure slurp1 -rewriteTermReferences :: Ord v => Map TermReference TermReferenceId -> Term v a -> Term v a +rewriteTermReferences :: (Ord v) => Map TermReference TermReferenceId -> Term v a -> Term v a rewriteTermReferences mapping = ABT.rebuildUp \term -> case term of @@ -577,7 +578,7 @@ rewriteTermReferences mapping = -- updates the namespace for adding `slurp` doSlurpAdds :: forall m. - Monad m => + (Monad m) => SlurpComponent -> TypecheckedUnisonFile Symbol Ann -> (Branch0 m -> Branch0 m) @@ -621,7 +622,7 @@ doSlurpAdds slurp uf = Branch.batchUpdates (typeActions <> termActions) errorMissingVar v = error $ "expected to find " ++ show v ++ " in " ++ show uf doSlurpUpdates :: - Monad m => + (Monad m) => [(Name, TypeReference, TypeReference)] -> [(Name, TermReference, TermReference)] -> [(Name, Referent)] -> diff --git a/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs b/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs index b231559f4..c468cd0c4 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Output/BranchDiff.hs @@ -67,7 +67,8 @@ data BranchDiffOutput v a = BranchDiffOutput isEmpty :: BranchDiffOutput v a -> Bool isEmpty BranchDiffOutput {..} = - null updatedTypes && null updatedTerms + null updatedTypes + && null updatedTerms && null newTypeConflicts && null newTermConflicts && null resolvedTypeConflicts @@ -172,7 +173,7 @@ type PatchDisplay = (Name, P.PatchDiff) toOutput :: forall m v a. - Monad m => + (Monad m) => (Referent -> m (Maybe (Type v a))) -> (Reference -> m (Maybe (DeclOrBuiltin v a))) -> Int -> @@ -194,7 +195,7 @@ toOutput -- any of the old references associated with the name -- removes: not-attached metadata that had been attached to any of -- the old references associated with the name - getNewMetadataDiff :: Ord r => Bool -> DiffSlice r -> Name -> Set r -> r -> MetadataDiff Metadata.Value + getNewMetadataDiff :: (Ord r) => Bool -> DiffSlice r -> Name -> Set r -> r -> MetadataDiff Metadata.Value getNewMetadataDiff hidePropagatedMd s n rs_old r_new = let old_metadatas :: [Set Metadata.Value] = toList . R.toMultimap . R.restrictDom rs_old . R3.lookupD2 n $ @@ -215,7 +216,7 @@ toOutput -- must not have been removed and the name must not have been removed or added -- or updated 😅 -- "getMetadataUpdates" = a defn has been updated via change of metadata - getMetadataUpdates :: Ord r => DiffSlice r -> Map Name (Set r, Set r) + getMetadataUpdates :: (Ord r) => DiffSlice r -> Map Name (Set r, Set r) getMetadataUpdates s = Map.fromList [ (n, (Set.singleton r, Set.singleton r)) -- the reference is unchanged @@ -237,7 +238,7 @@ toOutput v /= isPropagatedValue ] - let isSimpleUpdate, isNewConflict, isResolvedConflict :: Eq r => (Set r, Set r) -> Bool + let isSimpleUpdate, isNewConflict, isResolvedConflict :: (Eq r) => (Set r, Set r) -> Bool isSimpleUpdate (old, new) = Set.size old == 1 && Set.size new == 1 isNewConflict (_old, new) = Set.size new > 1 -- should already be the case that old /= new isResolvedConflict (old, new) = Set.size old > 1 && Set.size new == 1 @@ -384,7 +385,8 @@ toOutput for typeAdds $ \(r, nsmd) -> do hqmds :: [(HashQualified Name, [MetadataDisplay v a])] <- for nsmd $ \(n, mdRefs) -> - (,) <$> pure (Names.hqTypeName hqLen names2 n r) + (,) + <$> pure (Names.hqTypeName hqLen names2 n r) <*> fillMetadata ppe mdRefs (hqmds,r,) <$> declOrBuiltin r @@ -401,7 +403,8 @@ toOutput ] for termAdds $ \(r, nsmd) -> do hqmds <- for nsmd $ \(n, mdRefs) -> - (,) <$> pure (Names.hqTermName hqLen names2 n r) + (,) + <$> pure (Names.hqTermName hqLen names2 n r) <*> fillMetadata ppe mdRefs (hqmds,r,) <$> typeOf r @@ -413,18 +416,22 @@ toOutput removedTypes :: [RemovedTypeDisplay v a] <- let typeRemoves :: [(Reference, [Name])] = sortOn snd $ - Map.toList . fmap toList . R.toMultimap . BranchDiff.tallremoves $ typesDiff + Map.toList . fmap toList . R.toMultimap . BranchDiff.tallremoves $ + typesDiff in for typeRemoves $ \(r, ns) -> - (,,) <$> pure ((\n -> Names.hqTypeName hqLen names1 n r) <$> ns) + (,,) + <$> pure ((\n -> Names.hqTypeName hqLen names1 n r) <$> ns) <*> pure r <*> declOrBuiltin r removedTerms :: [RemovedTermDisplay v a] <- let termRemoves :: [(Referent, [Name])] = sortOn snd $ - Map.toList . fmap toList . R.toMultimap . BranchDiff.tallremoves $ termsDiff + Map.toList . fmap toList . R.toMultimap . BranchDiff.tallremoves $ + termsDiff in for termRemoves $ \(r, ns) -> - (,,) <$> pure ((\n -> Names.hqTermName hqLen names1 n r) <$> ns) + (,,) + <$> pure ((\n -> Names.hqTermName hqLen names1 n r) <$> ns) <*> pure r <*> typeOf r @@ -436,7 +443,8 @@ toOutput let renamedTerm :: Map Referent (Set Name, Set Name) -> m [RenameTermDisplay v a] renamedTerm renames = for (sortOn snd $ Map.toList renames) $ \(r, (ol'names, new'names)) -> - (,,,) <$> pure r + (,,,) + <$> pure r <*> typeOf r <*> pure (Set.map (\n -> Names.hqTermName hqLen names1 n r) ol'names) <*> pure (Set.map (\n -> Names.hqTermName hqLen names2 n r) new'names) @@ -444,7 +452,8 @@ toOutput let renamedType :: Map Reference (Set Name, Set Name) -> m [RenameTypeDisplay v a] renamedType renames = for (sortOn snd $ Map.toList renames) $ \(r, (ol'names, new'names)) -> - (,,,) <$> pure r + (,,,) + <$> pure r <*> declOrBuiltin r <*> pure (Set.map (\n -> Names.hqTypeName hqLen names1 n r) ol'names) <*> pure (Set.map (\n -> Names.hqTypeName hqLen names2 n r) new'names) @@ -472,13 +481,13 @@ toOutput renamedTerms } where - fillMetadata :: Traversable t => PPE.PrettyPrintEnv -> t Metadata.Value -> m (t (MetadataDisplay v a)) + fillMetadata :: (Traversable t) => PPE.PrettyPrintEnv -> t Metadata.Value -> m (t (MetadataDisplay v a)) fillMetadata ppe = traverse $ -- metadata values are all terms \(Referent.Ref -> mdRef) -> let name = PPE.termName ppe mdRef in (name,mdRef,) <$> typeOf mdRef - getMetadata :: Ord r => r -> Name -> R3.Relation3 r Name Metadata.Value -> Set Metadata.Value + getMetadata :: (Ord r) => r -> Name -> R3.Relation3 r Name Metadata.Value -> Set Metadata.Value getMetadata r n = R.lookupDom n . R3.lookupD1 r - getAddedMetadata :: Ord r => r -> Name -> BranchDiff.DiffSlice r -> Set Metadata.Value + getAddedMetadata :: (Ord r) => r -> Name -> BranchDiff.DiffSlice r -> Set Metadata.Value getAddedMetadata r n slice = getMetadata r n $ BranchDiff.taddedMetadata slice diff --git a/unison-cli/src/Unison/Codebase/Editor/Propagate.hs b/unison-cli/src/Unison/Codebase/Editor/Propagate.hs index 9f6897540..af90bd55f 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Propagate.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Propagate.hs @@ -582,7 +582,7 @@ unhashTypeComponent' h = where reshuffle (r, (v, decl)) = (v, (r, decl)) -applyDeprecations :: Applicative m => Patch -> Branch0 m -> Branch0 m +applyDeprecations :: (Applicative m) => Patch -> Branch0 m -> Branch0 m applyDeprecations patch = deleteDeprecatedTerms deprecatedTerms . deleteDeprecatedTypes deprecatedTypes @@ -604,7 +604,7 @@ applyDeprecations patch = -- | Things in the patch are not marked as propagated changes, but every other -- definition that is created by the `Edits` which is passed in is marked as -- a propagated change. -applyPropagate :: forall m. Applicative m => Patch -> Edits Symbol -> Branch0 m -> Branch0 m +applyPropagate :: forall m. (Applicative m) => Patch -> Edits Symbol -> Branch0 m -> Branch0 m applyPropagate patch Edits {newTerms, termReplacements, typeReplacements, constructorReplacements} = do let termTypes = Map.map (Hashing.typeToReference . snd) newTerms -- recursively update names and delete deprecated definitions @@ -647,7 +647,7 @@ applyPropagate patch Edits {newTerms, termReplacements, typeReplacements, constr Star3.replaceFacts replaceType typeEdits _types updateMetadatas :: - Ord r => + (Ord r) => Star3.Star3 r NameSegment Metadata.Type (Metadata.Type, Metadata.Value) -> Star3.Star3 r NameSegment Metadata.Type (Metadata.Type, Metadata.Value) updateMetadatas s = Star3.mapD3 go s @@ -694,7 +694,7 @@ applyPropagate patch Edits {newTerms, termReplacements, typeReplacements, constr -- 2. Are not themselves edited in the given patch. -- 3. Pass the given predicate. computeDirty :: - Monad m => + (Monad m) => (Reference -> m (Set Reference)) -> -- eg Codebase.dependents codebase Patch -> (Reference -> Bool) -> diff --git a/unison-cli/src/Unison/Codebase/Editor/Slurp.hs b/unison-cli/src/Unison/Codebase/Editor/Slurp.hs index 837bd474a..b1866a64f 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Slurp.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Slurp.hs @@ -22,8 +22,8 @@ import Unison.Prelude import Unison.Referent (Referent) import qualified Unison.Referent as Referent import qualified Unison.Referent' as Referent -import qualified Unison.Syntax.Name as Name (toText, unsafeFromVar) import Unison.Symbol (Symbol) +import qualified Unison.Syntax.Name as Name (toText, unsafeFromVar) import qualified Unison.UnisonFile as UF import qualified Unison.UnisonFile.Names as UF import qualified Unison.Util.Map as Map @@ -156,12 +156,12 @@ computeNamesWithDeprecations uf unalteredCodebaseNames involvedVars = \case constructorsUnderConsideration = Map.toList (UF.dataDeclarationsId' uf) <> (fmap . fmap . fmap) DD.toDataDecl (Map.toList (UF.effectDeclarationsId' uf)) - & filter (\(typeV, _) -> Set.member (TypeVar typeV) involvedVars) - & concatMap (\(_typeV, (_refId, decl)) -> DD.constructors' decl) - & fmap - ( \(_ann, v, _typ) -> Name.unsafeFromVar v - ) - & Set.fromList + & filter (\(typeV, _) -> Set.member (TypeVar typeV) involvedVars) + & concatMap (\(_typeV, (_refId, decl)) -> DD.constructors' decl) + & fmap + ( \(_ann, v, _typ) -> Name.unsafeFromVar v + ) + & Set.fromList deprecatedConstructors :: Set Name deprecatedConstructors = @@ -215,7 +215,7 @@ computeSelfStatuses vars varReferences codebaseNames = [r] | LD.referent r == ld -> Duplicated _ -> Updated -computeDepStatuses :: Ord k => Map k (Set k) -> Map k DefnStatus -> Map k DepStatus +computeDepStatuses :: (Ord k) => Map k (Set k) -> Map k DefnStatus -> Map k DepStatus computeDepStatuses varDeps selfStatuses = selfStatuses & Map.mapWithKey \name status -> do varDeps @@ -456,11 +456,11 @@ toSlurpResult uf op requestedVars involvedVars fileNames codebaseNames selfStatu (Rel.mapRan Referent.Ref $ Names.types fileNames) (SC.types duplicates) - varFromName :: Var v => Name -> v + varFromName :: (Var v) => Name -> v varFromName name = Var.named (Name.toText name) -- | Sort out a set of variables by whether it is a term or type. -partitionVars :: Foldable f => f TaggedVar -> SlurpComponent +partitionVars :: (Foldable f) => f TaggedVar -> SlurpComponent partitionVars = foldMap ( \case diff --git a/unison-cli/src/Unison/Codebase/Editor/SlurpComponent.hs b/unison-cli/src/Unison/Codebase/Editor/SlurpComponent.hs index e9ec534b8..348a88b36 100644 --- a/unison-cli/src/Unison/Codebase/Editor/SlurpComponent.hs +++ b/unison-cli/src/Unison/Codebase/Editor/SlurpComponent.hs @@ -126,7 +126,7 @@ closeWithDependencies uf inputs = seenDefns {ctors = constructorDeps} typeNames :: Map Reference Symbol typeNames = invert (fst <$> UF.dataDeclarations' uf) <> invert (fst <$> UF.effectDeclarations' uf) - invert :: forall k v. Ord k => Ord v => Map k v -> Map v k + invert :: forall k v. (Ord k) => (Ord v) => Map k v -> Map v k invert m = Map.fromList (swap <$> Map.toList m) fromTypes :: Set Symbol -> SlurpComponent diff --git a/unison-cli/src/Unison/Codebase/Editor/SlurpResult.hs b/unison-cli/src/Unison/Codebase/Editor/SlurpResult.hs index 0e55966ab..e91b935fe 100644 --- a/unison-cli/src/Unison/Codebase/Editor/SlurpResult.hs +++ b/unison-cli/src/Unison/Codebase/Editor/SlurpResult.hs @@ -115,7 +115,7 @@ prettyStatus s = case s of type IsPastTense = Bool -prettyVar :: Var v => v -> P.Pretty P.ColorText +prettyVar :: (Var v) => v -> P.Pretty P.ColorText prettyVar = P.text . Var.name aliasesToShow :: Int @@ -197,8 +197,8 @@ pretty isPast ppe sr = Just (_, _, _, ty) -> ( plus <> P.bold (prettyVar v), Just $ ": " <> P.indentNAfterNewline 2 (TP.pretty ppe ty) - ) : - ((,Nothing) <$> aliases) + ) + : ((,Nothing) <$> aliases) where aliases = fmap (P.indentN 2) . aliasesMessage . Map.lookup v $ termAlias sr ok _ _ sc | null (SC.terms sc) && null (SC.types sc) = mempty diff --git a/unison-cli/src/Unison/Codebase/Editor/TodoOutput.hs b/unison-cli/src/Unison/Codebase/Editor/TodoOutput.hs index 3639dfd5f..56e67825c 100644 --- a/unison-cli/src/Unison/Codebase/Editor/TodoOutput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/TodoOutput.hs @@ -34,7 +34,7 @@ data TodoOutput v a = TodoOutput editConflicts :: Patch } -labeledDependencies :: Ord v => TodoOutput v a -> Set LabeledDependency +labeledDependencies :: (Ord v) => TodoOutput v a -> Set LabeledDependency labeledDependencies TodoOutput {..} = Set.fromList ( -- term refs diff --git a/unison-cli/src/Unison/Codebase/Editor/UriParser.hs b/unison-cli/src/Unison/Codebase/Editor/UriParser.hs index 76619a59d..cd01f605e 100644 --- a/unison-cli/src/Unison/Codebase/Editor/UriParser.hs +++ b/unison-cli/src/Unison/Codebase/Editor/UriParser.hs @@ -309,7 +309,8 @@ parseGitProtocol = parseHostInfo :: P HostInfo parseHostInfo = P.label "parseHostInfo" $ - HostInfo <$> parseHost + HostInfo + <$> parseHost <*> ( P.optional $ do void $ C.char ':' P.takeWhile1P (Just "digits") isDigit @@ -365,7 +366,8 @@ absolutePath = do nameSegment :: P NameSegment nameSegment = NameSegment . Text.pack - <$> ( (:) <$> P.satisfy Unison.Syntax.Lexer.wordyIdStartChar + <$> ( (:) + <$> P.satisfy Unison.Syntax.Lexer.wordyIdStartChar <*> P.many (P.satisfy Unison.Syntax.Lexer.wordyIdChar) ) diff --git a/unison-cli/src/Unison/Codebase/TranscriptParser.hs b/unison-cli/src/Unison/Codebase/TranscriptParser.hs index 545860f63..4728921f0 100644 --- a/unison-cli/src/Unison/Codebase/TranscriptParser.hs +++ b/unison-cli/src/Unison/Codebase/TranscriptParser.hs @@ -177,7 +177,7 @@ type TranscriptRunner = withTranscriptRunner :: forall m r. - UnliftIO.MonadUnliftIO m => + (UnliftIO.MonadUnliftIO m) => UCMVersion -> Maybe FilePath -> (TranscriptRunner -> m r) -> @@ -334,7 +334,9 @@ run dir stanzas codebase runtime sbRuntime config ucmVersion baseURL = UnliftIO. pure $ Right QuitI Just (s, idx) -> do putStr $ - "\r⚙️ Processing stanza " ++ show idx ++ " of " + "\r⚙️ Processing stanza " + ++ show idx + ++ " of " ++ show (length stanzas) ++ "." IO.hFlush IO.stdout diff --git a/unison-cli/src/Unison/CommandLine.hs b/unison-cli/src/Unison/CommandLine.hs index fcaf55bc6..cec8da4f9 100644 --- a/unison-cli/src/Unison/CommandLine.hs +++ b/unison-cli/src/Unison/CommandLine.hs @@ -79,7 +79,7 @@ watchFileSystem q dir = do warnNote :: String -> String warnNote s = "⚠️ " <> s -backtick :: IsString s => P.Pretty s -> P.Pretty s +backtick :: (IsString s) => P.Pretty s -> P.Pretty s backtick s = P.group ("`" <> s <> "`") tip :: (ListLike s Char, IsString s) => P.Pretty s -> P.Pretty s @@ -173,11 +173,11 @@ prompt = "> " -- `plural [] "cat" "cats" = "cats"` -- `plural ["meow"] "cat" "cats" = "cat"` -- `plural ["meow", "meow"] "cat" "cats" = "cats"` -plural :: Foldable f => f a -> b -> b -> b +plural :: (Foldable f) => f a -> b -> b -> b plural items one other = case toList items of [_] -> one _ -> other -plural' :: Integral a => a -> b -> b -> b +plural' :: (Integral a) => a -> b -> b -> b plural' 1 one _other = one plural' _ _one other = other diff --git a/unison-cli/src/Unison/CommandLine/Completion.hs b/unison-cli/src/Unison/CommandLine/Completion.hs index 66c10cff8..15984121f 100644 --- a/unison-cli/src/Unison/CommandLine/Completion.hs +++ b/unison-cli/src/Unison/CommandLine/Completion.hs @@ -64,7 +64,7 @@ import Prelude hiding (readFile, writeFile) -- | A completion func for use with Haskeline haskelineTabComplete :: - MonadIO m => + (MonadIO m) => Map String IP.InputPattern -> Codebase m v a -> AuthenticatedHttpClient -> @@ -92,7 +92,7 @@ data CompletionType -- | The empty completor. noCompletions :: - MonadIO m => + (MonadIO m) => String -> Codebase m v a -> AuthenticatedHttpClient -> @@ -339,14 +339,14 @@ fixupCompletion q cs@(h : t) = else cs sharePathCompletion :: - MonadIO m => + (MonadIO m) => AuthenticatedHttpClient -> String -> m [Completion] sharePathCompletion = shareCompletion (NESet.singleton NamespaceCompletion) shareCompletion :: - MonadIO m => + (MonadIO m) => NESet CompletionType -> AuthenticatedHttpClient -> String -> @@ -391,7 +391,7 @@ shareCompletion completionTypes authHTTPClient str = ) & pure -fetchShareNamespaceInfo :: MonadIO m => AuthenticatedHttpClient -> Text -> Path.Path -> m (Maybe NamespaceListing) +fetchShareNamespaceInfo :: (MonadIO m) => AuthenticatedHttpClient -> Text -> Path.Path -> m (Maybe NamespaceListing) fetchShareNamespaceInfo (AuthenticatedHttpClient httpManager) userHandle path = runMaybeT do let uri = (Share.codeserverToURI Codeserver.defaultCodeserver) @@ -406,7 +406,7 @@ fetchShareNamespaceInfo (AuthenticatedHttpClient httpManager) userHandle path = resp <- either (const empty) pure $ fullResp MaybeT . pure . Aeson.decode @Server.NamespaceListing $ HTTP.responseBody resp -searchUsers :: MonadIO m => AuthenticatedHttpClient -> Text -> m [Text] +searchUsers :: (MonadIO m) => AuthenticatedHttpClient -> Text -> m [Text] searchUsers _ "" = pure [] searchUsers (AuthenticatedHttpClient httpManager) userHandlePrefix = fromMaybe [] <$> runMaybeT do diff --git a/unison-cli/src/Unison/CommandLine/DisplayValues.hs b/unison-cli/src/Unison/CommandLine/DisplayValues.hs index e1f817b39..506071956 100644 --- a/unison-cli/src/Unison/CommandLine/DisplayValues.hs +++ b/unison-cli/src/Unison/CommandLine/DisplayValues.hs @@ -39,7 +39,7 @@ import Unison.Var (Var) type Pretty = P.Pretty P.ColorText displayTerm :: - Monad m => + (Monad m) => PPE.PrettyPrintEnvDecl -> (Reference -> m (Maybe (Term Symbol ()))) -> (Referent -> m (Maybe (Type Symbol ()))) -> @@ -62,7 +62,7 @@ displayTerm = displayTerm' False type ElideUnit = Bool displayTerm' :: - Monad m => + (Monad m) => ElideUnit -> PPE.PrettyPrintEnvDecl -> (Reference -> m (Maybe (Term Symbol ()))) -> @@ -75,16 +75,16 @@ displayTerm' elideUnit pped terms typeOf eval types = \case tm@(Term.Apps' (Term.Constructor' (ConstructorReference typ _)) _) | typ == DD.docRef -> displayDoc pped terms typeOf eval types tm | typ == DD.doc2Ref -> do - -- Pretty.get (doc.formatConsole tm) - let tm' = - Term.app - () - (Term.ref () DD.prettyGetRef) - (Term.app () (Term.ref () DD.doc2FormatConsoleRef) tm) - tm <- eval tm' - case tm of - Nothing -> pure $ errMsg tm' - Just tm -> displayTerm pped terms typeOf eval types tm + -- Pretty.get (doc.formatConsole tm) + let tm' = + Term.app + () + (Term.ref () DD.prettyGetRef) + (Term.app () (Term.ref () DD.doc2FormatConsoleRef) tm) + tm <- eval tm' + case tm of + Nothing -> pure $ errMsg tm' + Just tm -> displayTerm pped terms typeOf eval types tm | typ == DD.prettyAnnotatedRef -> displayPretty pped terms typeOf eval types tm tm@(Term.Constructor' (ConstructorReference typ _)) | typ == DD.prettyAnnotatedRef -> displayPretty pped terms typeOf eval types tm @@ -110,7 +110,7 @@ displayTerm' elideUnit pped terms typeOf eval types = \case -- Pretty.Annotated ann (Either SpecialForm ConsoleText) displayPretty :: forall m. - Monad m => + (Monad m) => PPE.PrettyPrintEnvDecl -> (Reference -> m (Maybe (Term Symbol ()))) -> (Referent -> m (Maybe (Type Symbol ()))) -> diff --git a/unison-cli/src/Unison/CommandLine/Globbing.hs b/unison-cli/src/Unison/CommandLine/Globbing.hs index a52c82b24..5bb2b3176 100644 --- a/unison-cli/src/Unison/CommandLine/Globbing.hs +++ b/unison-cli/src/Unison/CommandLine/Globbing.hs @@ -74,7 +74,8 @@ expandGlobToNameSegments targets branch globPath = matchingTypes = matchingNamesInStar predicate (Branch._types branch) matchingNamesInStar :: (NameSegment -> Bool) -> Branch.Star a NameSegment -> [[NameSegment]] matchingNamesInStar predicate star = - star & Star3.d1 + star + & Star3.d1 & Relation.ran & Set.toList & filter predicate diff --git a/unison-cli/src/Unison/CommandLine/InputPattern.hs b/unison-cli/src/Unison/CommandLine/InputPattern.hs index be1a7108b..6962eebfe 100644 --- a/unison-cli/src/Unison/CommandLine/InputPattern.hs +++ b/unison-cli/src/Unison/CommandLine/InputPattern.hs @@ -51,7 +51,7 @@ data ArgumentType = ArgumentType -- | Generate completion suggestions for this argument type suggestions :: forall m v a. - MonadIO m => + (MonadIO m) => String -> Codebase m v a -> AuthenticatedHttpClient -> @@ -86,7 +86,8 @@ argType ip i = go (i, argTypes ip) -- The argument list spec is invalid if something follows a vararg go args = error $ - "Input pattern " <> show (patternName ip) + "Input pattern " + <> show (patternName ip) <> " has an invalid argument list: " <> show args diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index b56854b6a..7ba5d47dd 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -1098,7 +1098,9 @@ pullExhaustive = [(Required, remoteNamespaceArg), (Optional, namespaceArg)] ( P.lines [ P.wrap $ - "The " <> makeExample' pullExhaustive <> "command can be used in place of" + "The " + <> makeExample' pullExhaustive + <> "command can be used in place of" <> makeExample' pullVerbose <> "to complete namespaces" <> "which were pulled incompletely due to a bug in UCM" @@ -1286,7 +1288,9 @@ pushExhaustive = [(Required, remoteNamespaceArg), (Optional, namespaceArg)] ( P.lines [ P.wrap $ - "The " <> makeExample' pushExhaustive <> "command can be used in place of" + "The " + <> makeExample' pushExhaustive + <> "command can be used in place of" <> makeExample' push <> "to repair remote namespaces" <> "which were pushed incompletely due to a bug in UCM" @@ -1662,7 +1666,8 @@ helpTopicsMap = testCacheMsg = P.callout "🎈" . P.lines $ [ P.wrap $ - "Unison caches the results of " <> P.blue "test>" + "Unison caches the results of " + <> P.blue "test>" <> "watch expressions. Since these expressions are pure and" <> "always yield the same result when evaluated, there's no need" <> "to run them more than once!", @@ -1674,7 +1679,8 @@ helpTopicsMap = pathnamesMsg = P.callout "\129488" . P.lines $ [ P.wrap $ - "There are two kinds of namespaces," <> P.group (P.blue "absolute" <> ",") + "There are two kinds of namespaces," + <> P.group (P.blue "absolute" <> ",") <> "such as" <> P.group ("(" <> P.blue ".foo.bar") <> "or" @@ -1697,12 +1703,15 @@ helpTopicsMap = P.indentN 2 $ P.green "x" <> " = 41", "", P.wrap $ - "then doing an" <> P.blue "add" + "then doing an" + <> P.blue "add" <> "will create the definition with the absolute name" <> P.group (P.blue ".foo.bar.x" <> " = 41"), "", P.wrap $ - "and you can refer to" <> P.green "x" <> "by its absolute name " + "and you can refer to" + <> P.green "x" + <> "by its absolute name " <> P.blue ".foo.bar.x" <> "elsewhere" <> "in your code. For instance:", @@ -2154,7 +2163,7 @@ runScheme = ] ) ( \case - (main:args) -> + (main : args) -> flip Input.ExecuteSchemeI args <$> parseHashQualifiedName main _ -> Left $ showPatternHelp runScheme ) @@ -2595,10 +2604,11 @@ explainRemote pushPull = where gitRepo = PushPull.fold @(P.Pretty P.ColorText) "git@github.com:" "https://github.com/" pushPull -showErrorFancy :: P.ShowErrorComponent e => P.ErrorFancy e -> String +showErrorFancy :: (P.ShowErrorComponent e) => P.ErrorFancy e -> String showErrorFancy (P.ErrorFail msg) = msg showErrorFancy (P.ErrorIndentation ord ref actual) = - "incorrect indentation (got " <> show (P.unPos actual) + "incorrect indentation (got " + <> show (P.unPos actual) <> ", should be " <> p <> show (P.unPos ref) diff --git a/unison-cli/src/Unison/CommandLine/Main.hs b/unison-cli/src/Unison/CommandLine/Main.hs index 670bd9592..9eb5f4a2b 100644 --- a/unison-cli/src/Unison/CommandLine/Main.hs +++ b/unison-cli/src/Unison/CommandLine/Main.hs @@ -15,7 +15,7 @@ import qualified Data.Text as Text import qualified Data.Text.Lazy.IO as Text.Lazy import qualified Ki import qualified System.Console.Haskeline as Line -import System.IO (hPutStrLn, stderr, hGetEcho, hSetEcho, stdin) +import System.IO (hGetEcho, hPutStrLn, hSetEcho, stderr, stdin) import System.IO.Error (isDoesNotExistError) import Text.Pretty.Simple (pShow) import qualified U.Codebase.Sqlite.Operations as Operations diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index c0e02e1ec..07b256a28 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -222,7 +222,8 @@ notifyNumbered o = case o of p, "", tip $ - "You can use " <> IP.makeExample' IP.todo + "You can use " + <> IP.makeExample' IP.todo <> "to see if this generated any work to do in this namespace" <> "and " <> IP.makeExample' IP.test @@ -240,7 +241,8 @@ notifyNumbered o = case o of ( \p -> P.lines [ P.wrap $ - "Here's what's changed in " <> prettyPath' dest' + "Here's what's changed in " + <> prettyPath' dest' <> "after applying the patch at " <> P.group (prettyPath' patchPath' <> ":"), "", @@ -331,7 +333,9 @@ notifyNumbered o = case o of [ p, "", tip $ - "Add" <> prettyName "License" <> "values for" + "Add" + <> prettyName "License" + <> "values for" <> prettyName (Name.fromSegment authorNS) <> "under" <> P.group (prettyPath' authorPath' <> ".") @@ -416,7 +420,8 @@ notifyNumbered o = case o of P.indentN 2 $ prettyDiff diff ] ex = - "Use" <> IP.makeExample IP.history ["#som3n4m3space"] + "Use" + <> IP.makeExample IP.history ["#som3n4m3space"] <> "to view history starting from a given namespace hash." DeletedDespiteDependents ppeDecl endangerments -> ( P.warnCallout $ @@ -434,7 +439,8 @@ notifyNumbered o = case o of undoTip :: P.Pretty P.ColorText undoTip = tip $ - "You can use" <> IP.makeExample' IP.undo + "You can use" + <> IP.makeExample' IP.undo <> "or" <> IP.makeExample' IP.viewReflog <> "to undo this change." @@ -549,7 +555,8 @@ notifyUser dir o = case o of pure . P.warnCallout . P.wrap - $ "Cannot save the last run result into" <> P.backticked (P.string (Name.toString name)) + $ "Cannot save the last run result into" + <> P.backticked (P.string (Name.toString name)) <> "because that name conflicts with a name in the scratch file." NoLastRunResult -> pure @@ -612,7 +619,8 @@ notifyUser dir o = case o of P.wrap $ "Now might be a good time to make a backup of your codebase. 😬", "", P.wrap $ - "After that, you might try using the" <> makeExample' IP.forkLocal + "After that, you might try using the" + <> makeExample' IP.forkLocal <> "command to inspect the namespaces listed above, and decide which" <> "one you want as your root." <> "You can also use" @@ -690,7 +698,8 @@ notifyUser dir o = case o of cache = P.bold "Cached test results " <> "(`help testcache` to learn more)" TestIncrementalOutputStart ppe (n, total) r _src -> do putPretty' $ - P.shown (total - n) <> " tests left to run, current test: " + P.shown (total - n) + <> " tests left to run, current test: " <> P.syntaxToColor (prettyHashQualified (PPE.termName ppe $ Referent.Ref r)) pure mempty TestIncrementalOutputEnd _ppe (_n, _total) _r result -> do @@ -711,7 +720,8 @@ notifyUser dir o = case o of MetadataMissingType ppe ref -> pure . P.fatalCallout . P.lines $ [ P.wrap $ - "The metadata value " <> P.red (prettyTermName ppe ref) + "The metadata value " + <> P.red (prettyTermName ppe ref) <> "is missing a type signature in the codebase.", "", P.wrap $ @@ -720,7 +730,8 @@ notifyUser dir o = case o of <> "are being deleted external to UCM." ] MetadataAmbiguous hq _ppe [] -> - pure . P.warnCallout + pure + . P.warnCallout . P.wrap $ "I couldn't find any metadata matching " <> P.syntaxToColor (prettyHashQualified hq) @@ -797,7 +808,8 @@ notifyUser dir o = case o of pure . P.callout "😶" $ P.lines [ P.wrap $ - "I looked for a function" <> P.backticked (P.string main) + "I looked for a function" + <> P.backticked (P.string main) <> "in the most recently typechecked file and codebase but couldn't find one. It has to have the type:", "", P.indentN 2 $ P.lines [P.string main <> " : " <> TypePrinter.pretty ppe t | t <- ts] @@ -862,7 +874,9 @@ notifyUser dir o = case o of DeletedEverything -> pure . P.wrap . P.lines $ [ "Okay, I deleted everything except the history.", - "Use " <> IP.makeExample' IP.undo <> " to undo, or " + "Use " + <> IP.makeExample' IP.undo + <> " to undo, or " <> IP.makeExample' IP.mergeBuiltins <> " to restore the absolute " <> "basics to the current path." @@ -870,7 +884,8 @@ notifyUser dir o = case o of DeleteEverythingConfirmation -> pure . P.warnCallout . P.lines $ [ "Are you sure you want to clear away everything?", - "You could use " <> IP.makeExample' IP.cd + "You could use " + <> IP.makeExample' IP.cd <> " to switch to a new namespace instead." ] DeleteBranchConfirmation _uniqueDeletions -> error "todo" @@ -968,12 +983,12 @@ notifyUser dir o = case o of then P.lit "nothing to show" else numberedEntries ppe entries where - numberedEntries :: Var v => PPE.PrettyPrintEnv -> [ShallowListEntry v a] -> Pretty + numberedEntries :: (Var v) => PPE.PrettyPrintEnv -> [ShallowListEntry v a] -> Pretty numberedEntries ppe entries = (P.column3 . fmap f) ([(1 :: Integer) ..] `zip` fmap (formatEntry ppe) entries) where f (i, (p1, p2)) = (P.hiBlack . fromString $ show i <> ".", p1, p2) - formatEntry :: Var v => PPE.PrettyPrintEnv -> ShallowListEntry v a -> (Pretty, Pretty) + formatEntry :: (Var v) => PPE.PrettyPrintEnv -> ShallowListEntry v a -> (Pretty, Pretty) formatEntry ppe = \case ShallowTermEntry termEntry -> ( P.syntaxToColor . prettyHashQualified' . fmap Name.fromSegment . Backend.termEntryHQName $ termEntry, @@ -1047,11 +1062,11 @@ notifyUser dir o = case o of let prettyBindings = P.bracket . P.lines $ - P.wrap "The watch expression(s) reference these definitions:" : - "" : - [ P.syntaxToColor $ TermPrinter.prettyBinding ppe (HQ.unsafeFromVar v) b - | (v, b) <- bindings - ] + P.wrap "The watch expression(s) reference these definitions:" + : "" + : [ P.syntaxToColor $ TermPrinter.prettyBinding ppe (HQ.unsafeFromVar v) b + | (v, b) <- bindings + ] prettyWatches = P.sep "\n\n" @@ -1075,7 +1090,7 @@ notifyUser dir o = case o of where terms = R.dom termNamespace types = R.dom typeNamespace - showConflicts :: Foldable f => Pretty -> f Name -> Pretty + showConflicts :: (Foldable f) => Pretty -> f Name -> Pretty showConflicts thingsName things = if (null things) then mempty @@ -1153,12 +1168,14 @@ notifyUser dir o = case o of <> P.backticked' (P.string localPath) "." CodebaseRequiresMigration (SchemaVersion fromSv) (SchemaVersion toSv) -> do P.wrap $ - "The specified codebase codebase is on version " <> P.shown fromSv + "The specified codebase codebase is on version " + <> P.shown fromSv <> " but needs to be on version " <> P.shown toSv UnrecognizedSchemaVersion repo localPath (SchemaVersion v) -> P.wrap $ - "I don't know how to interpret schema version " <> P.shown v + "I don't know how to interpret schema version " + <> P.shown v <> "in the repository at" <> prettyReadGitRepo repo <> "in the cache directory at" @@ -1179,12 +1196,18 @@ notifyUser dir o = case o of <> P.group (P.shown e) CloneException repo msg -> P.wrap $ - "I couldn't clone the repository at" <> prettyReadGitRepo repo <> ";" + "I couldn't clone the repository at" + <> prettyReadGitRepo repo + <> ";" <> "the error was:" <> (P.indentNAfterNewline 2 . P.group . P.string) msg CopyException srcRepoPath destPath msg -> P.wrap $ - "I couldn't copy the repository at" <> P.string srcRepoPath <> "into" <> P.string destPath <> ";" + "I couldn't copy the repository at" + <> P.string srcRepoPath + <> "into" + <> P.string destPath + <> ";" <> "the error was:" <> (P.indentNAfterNewline 2 . P.group . P.string) msg PushNoOp repo -> @@ -1192,7 +1215,9 @@ notifyUser dir o = case o of "The repository at" <> prettyWriteGitRepo repo <> "is already up-to-date." PushException repo msg -> P.wrap $ - "I couldn't push to the repository at" <> prettyWriteGitRepo repo <> ";" + "I couldn't push to the repository at" + <> prettyWriteGitRepo repo + <> ";" <> "the error was:" <> (P.indentNAfterNewline 2 . P.group . P.string) msg RemoteRefNotFound repo ref -> @@ -1217,7 +1242,8 @@ notifyUser dir o = case o of PushDestinationHasNewStuff repo -> P.callout "⏸" . P.lines $ [ P.wrap $ - "The repository at" <> prettyWriteGitRepo repo + "The repository at" + <> prettyWriteGitRepo repo <> "has some changes I don't know about.", "", P.wrap $ "Try" <> pull <> "to merge these changes locally, then" <> push <> "again." @@ -1240,7 +1266,8 @@ notifyUser dir o = case o of <> prettyReadGitRepo repo CouldntLoadSyncedBranch ns h -> P.wrap $ - "I just finished importing the branch" <> P.red (P.shown h) + "I just finished importing the branch" + <> P.red (P.shown h) <> "from" <> P.red (prettyReadRemoteNamespace (RemoteRepo.ReadRemoteNamespaceGit ns)) <> "but now I can't find it." @@ -1252,13 +1279,15 @@ notifyUser dir o = case o of <> prettyReadGitRepo repo NoRemoteNamespaceWithHash repo sch -> P.wrap $ - "The repository at" <> prettyReadGitRepo repo + "The repository at" + <> prettyReadGitRepo repo <> "doesn't contain a namespace with the hash prefix" <> (P.blue . P.text . SCH.toText) sch RemoteNamespaceHashAmbiguous repo sch hashes -> P.lines [ P.wrap $ - "The namespace hash" <> prettySCH sch + "The namespace hash" + <> prettySCH sch <> "at" <> prettyReadGitRepo repo <> "is ambiguous." @@ -1285,12 +1314,13 @@ notifyUser dir o = case o of case (new, old) of ([], []) -> error "BustedBuiltins busted, as there were no busted builtins." ([], old) -> - P.wrap ("This codebase includes some builtins that are considered deprecated. Use the " <> makeExample' IP.updateBuiltins <> " command when you're ready to work on eliminating them from your codebase:") : - "" : - fmap (P.text . Reference.toText) old + P.wrap ("This codebase includes some builtins that are considered deprecated. Use the " <> makeExample' IP.updateBuiltins <> " command when you're ready to work on eliminating them from your codebase:") + : "" + : fmap (P.text . Reference.toText) old (new, []) -> - P.wrap ("This version of Unison provides builtins that are not part of your codebase. Use " <> makeExample' IP.updateBuiltins <> " to add them:") : - "" : fmap (P.text . Reference.toText) new + P.wrap ("This version of Unison provides builtins that are not part of your codebase. Use " <> makeExample' IP.updateBuiltins <> " to add them:") + : "" + : fmap (P.text . Reference.toText) new (new@(_ : _), old@(_ : _)) -> [ P.wrap ( "Sorry and/or good news! This version of Unison supports a different set of builtins than this codebase uses. You can use " @@ -1351,18 +1381,21 @@ notifyUser dir o = case o of <> prettyAbsolute p <> "in .unisonConfig", P.wrap $ - "The value I found was" <> (P.backticked . P.blue . P.text) url + "The value I found was" + <> (P.backticked . P.blue . P.text) url <> "but I encountered the following error when trying to parse it:", "", P.string err, "", P.wrap $ - "Type" <> P.backticked ("help " <> PushPull.fold "push" "pull" pp) + "Type" + <> P.backticked ("help " <> PushPull.fold "push" "pull" pp) <> "for more information." ] NoBranchWithHash _h -> pure . P.callout "😶" $ - P.wrap $ "I don't know of a namespace with that hash." + P.wrap $ + "I don't know of a namespace with that hash." NotImplemented -> pure $ P.wrap "That's not implemented yet. Sorry! 😬" BranchAlreadyExists p -> pure . P.wrap $ @@ -1413,7 +1446,9 @@ notifyUser dir o = case o of HashAmbiguous h rs -> pure . P.callout "\129300" . P.lines $ [ P.wrap $ - "The hash" <> prettyShortHash h <> "is ambiguous." + "The hash" + <> prettyShortHash h + <> "is ambiguous." <> "Did you mean one of these hashes?", "", P.indentN 2 $ P.lines (P.shown <$> Set.toList rs), @@ -1423,7 +1458,9 @@ notifyUser dir o = case o of BranchHashAmbiguous h rs -> pure . P.callout "\129300" . P.lines $ [ P.wrap $ - "The namespace hash" <> prettySCH h <> "is ambiguous." + "The namespace hash" + <> prettySCH h + <> "is ambiguous." <> "Did you mean one of these hashes?", "", P.indentN 2 $ P.lines (prettySCH <$> Set.toList rs), @@ -1503,12 +1540,15 @@ notifyUser dir o = case o of PullAlreadyUpToDate ns dest -> pure . P.callout "😶" $ P.wrap $ - prettyPath' dest <> "was already up-to-date with" + prettyPath' dest + <> "was already up-to-date with" <> P.group (prettyReadRemoteNamespace ns <> ".") PullSuccessful ns dest -> pure . P.okCallout $ P.wrap $ - "Successfully updated" <> prettyPath' dest <> "from" + "Successfully updated" + <> prettyPath' dest + <> "from" <> P.group (prettyReadRemoteNamespace ns <> ".") MergeOverEmpty dest -> pure . P.okCallout $ @@ -1517,12 +1557,14 @@ notifyUser dir o = case o of MergeAlreadyUpToDate src dest -> pure . P.callout "😶" $ P.wrap $ - prettyPath' dest <> "was already up-to-date with" + prettyPath' dest + <> "was already up-to-date with" <> P.group (prettyPath' src <> ".") PreviewMergeAlreadyUpToDate src dest -> pure . P.callout "😶" $ P.wrap $ - prettyPath' dest <> "is already up-to-date with" + prettyPath' dest + <> "is already up-to-date with" <> P.group (prettyPath' src <> ".") DumpNumberedArgs args -> pure . P.numberedList $ fmap P.string args NoConflictsOrEdits -> @@ -1538,7 +1580,9 @@ notifyUser dir o = case o of where renderHash = take 10 . Text.unpack . Hash.toBase32HexText . unCausalHash renderLine head tail = - (renderHash head) ++ "|" ++ intercalateMap " " renderHash tail + (renderHash head) + ++ "|" + ++ intercalateMap " " renderHash tail ++ case Map.lookup (Hash.toBase32HexText . unCausalHash $ head) tags of Just t -> "|tag: " ++ t Nothing -> "" @@ -1591,17 +1635,19 @@ notifyUser dir o = case o of if names == mempty && missing == mempty then c (prettyLabeledDependency hqLength ld) <> " doesn't have any dependencies." else - "Dependencies of " <> c (prettyLabeledDependency hqLength ld) <> ":\n\n" + "Dependencies of " + <> c (prettyLabeledDependency hqLength ld) + <> ":\n\n" <> (P.indentN 2 (P.numberedColumn2Header num pairs)) where num n = P.hiBlack $ P.shown n <> "." header = (P.hiBlack "Reference", P.hiBlack "Name") pairs = - header : - ( fmap (first c . second c) $ - [(p $ Reference.toShortHash r, prettyName n) | (n, r) <- names] - ++ [(p $ Reference.toShortHash r, "(no name available)") | r <- toList missing] - ) + header + : ( fmap (first c . second c) $ + [(p $ Reference.toShortHash r, prettyName n) | (n, r) <- names] + ++ [(p $ Reference.toShortHash r, "(no name available)") | r <- toList missing] + ) p = prettyShortHash . SH.take hqLength c = P.syntaxToColor ListNamespaceDependencies _ppe _path Empty -> pure $ "This namespace has no external dependencies." @@ -1665,7 +1711,8 @@ notifyUser dir o = case o of Auth.ReauthRequired host -> P.lines [ "Authentication for host " <> P.red (P.shown host) <> " is required.", - "Run " <> IP.makeExample IP.help [IP.patternName IP.authLogin] + "Run " + <> IP.makeExample IP.help [IP.patternName IP.authLogin] <> " to learn how." ] Auth.CredentialParseFailure fp txt -> @@ -1941,22 +1988,22 @@ prettyRelative = P.blue . P.shown prettyAbsolute :: Path.Absolute -> Pretty prettyAbsolute = P.blue . P.shown -prettySCH :: IsString s => ShortCausalHash -> P.Pretty s +prettySCH :: (IsString s) => ShortCausalHash -> P.Pretty s prettySCH hash = P.group $ "#" <> P.text (SCH.toText hash) -prettyCausalHash :: IsString s => CausalHash -> P.Pretty s +prettyCausalHash :: (IsString s) => CausalHash -> P.Pretty s prettyCausalHash hash = P.group $ "#" <> P.text (Hash.toBase32HexText . unCausalHash $ hash) -prettyBase32Hex :: IsString s => Base32Hex -> P.Pretty s +prettyBase32Hex :: (IsString s) => Base32Hex -> P.Pretty s prettyBase32Hex = P.text . Base32Hex.toText -prettyBase32Hex# :: IsString s => Base32Hex -> P.Pretty s +prettyBase32Hex# :: (IsString s) => Base32Hex -> P.Pretty s prettyBase32Hex# b = P.group $ "#" <> prettyBase32Hex b -prettyHash :: IsString s => Hash.Hash -> P.Pretty s +prettyHash :: (IsString s) => Hash.Hash -> P.Pretty s prettyHash = prettyBase32Hex# . Hash.toBase32Hex -prettyHash32 :: IsString s => Hash32 -> P.Pretty s +prettyHash32 :: (IsString s) => Hash32 -> P.Pretty s prettyHash32 = prettyBase32Hex# . Hash32.toBase32Hex formatMissingStuff :: @@ -1977,8 +2024,8 @@ formatMissingStuff terms types = ) displayDefinitions' :: - Var v => - Ord a1 => + (Var v) => + (Ord a1) => PPED.PrettyPrintEnvDecl -> Map Reference.Reference (DisplayObject () (DD.Decl v a1)) -> Map Reference.Reference (DisplayObject (Type v a1) (Term v a1)) -> @@ -2011,7 +2058,9 @@ displayDefinitions' ppe0 types terms = P.syntaxToColor $ P.sep "\n\n" (prettyTyp builtin n = P.wrap $ "--" <> prettyHashQualified n <> " is built-in." missing n r = P.wrap - ( "-- The name " <> prettyHashQualified n <> " is assigned to the " + ( "-- The name " + <> prettyHashQualified n + <> " is assigned to the " <> "reference " <> fromString (show r ++ ",") <> "which is missing from the codebase." @@ -2079,7 +2128,8 @@ displayDefinitions DisplayDefinitionsOutput {isTest, outputFile, prettyPrintEnv P.indentN 2 code, "", P.wrap $ - "You can edit them there, then do" <> makeExample' IP.update + "You can edit them there, then do" + <> makeExample' IP.update <> "to replace the definitions currently in this namespace." ] @@ -2132,7 +2182,9 @@ displayDefinitions DisplayDefinitionsOutput {isTest, outputFile, prettyPrintEnv builtin n = P.wrap $ "--" <> prettyHashQualified n <> " is built-in." missing n r = P.wrap - ( "-- The name " <> prettyHashQualified n <> " is assigned to the " + ( "-- The name " + <> prettyHashQualified n + <> " is assigned to the " <> "reference " <> fromString (show r ++ ",") <> "which is missing from the codebase." @@ -2171,7 +2223,8 @@ displayTestResults showTip ppe oksUnsorted failsUnsorted = then mempty else tip $ - "Use " <> P.blue ("view " <> P.text (fst $ head (fails ++ oks))) + "Use " + <> P.blue ("view " <> P.text (fst $ head (fails ++ oks))) <> "to view the source of a test." in if null oks && null fails then "😶 No tests available." @@ -2184,7 +2237,7 @@ displayTestResults showTip ppe oksUnsorted failsUnsorted = ] unsafePrettyTermResultSig' :: - Var v => + (Var v) => PPE.PrettyPrintEnv -> SR'.TermResult' v a -> Pretty @@ -2197,7 +2250,7 @@ unsafePrettyTermResultSig' ppe = \case -- -- #5v5UtREE1fTiyTsTK2zJ1YNqfiF25SkfUnnji86Lms#0 -- Optional.None, Maybe.Nothing : Maybe a unsafePrettyTermResultSigFull' :: - Var v => + (Var v) => PPE.PrettyPrintEnv -> SR'.TermResult' v a -> Pretty @@ -2206,7 +2259,8 @@ unsafePrettyTermResultSigFull' ppe = \case P.lines [ P.hiBlack "-- " <> greyHash (HQ.fromReferent r), P.group $ - P.commas (fmap greyHash $ hq : map HQ'.toHQ (toList aliases)) <> " : " + P.commas (fmap greyHash $ hq : map HQ'.toHQ (toList aliases)) + <> " : " <> P.syntaxToColor (TypePrinter.prettySyntax ppe typ), mempty ] @@ -2214,7 +2268,7 @@ unsafePrettyTermResultSigFull' ppe = \case where greyHash = styleHashQualified' id P.hiBlack -prettyTypeResultHeader' :: Var v => SR'.TypeResult' v a -> Pretty +prettyTypeResultHeader' :: (Var v) => SR'.TypeResult' v a -> Pretty prettyTypeResultHeader' (SR'.TypeResult' name dt r _aliases) = prettyDeclTriple (name, r, dt) @@ -2222,20 +2276,20 @@ prettyTypeResultHeader' (SR'.TypeResult' name dt r _aliases) = -- -- #5v5UtREE1fTiyTsTK2zJ1YNqfiF25SkfUnnji86Lms -- type Optional -- type Maybe -prettyTypeResultHeaderFull' :: Var v => SR'.TypeResult' v a -> Pretty +prettyTypeResultHeaderFull' :: (Var v) => SR'.TypeResult' v a -> Pretty prettyTypeResultHeaderFull' (SR'.TypeResult' name dt r aliases) = P.lines stuff <> P.newline where stuff = - (P.hiBlack "-- " <> greyHash (HQ.fromReference r)) : - fmap - (\name -> prettyDeclTriple (name, r, dt)) - (name : map HQ'.toHQ (toList aliases)) + (P.hiBlack "-- " <> greyHash (HQ.fromReference r)) + : fmap + (\name -> prettyDeclTriple (name, r, dt)) + (name : map HQ'.toHQ (toList aliases)) where greyHash = styleHashQualified' id P.hiBlack prettyDeclTriple :: - Var v => + (Var v) => (HQ.HashQualified Name, Reference.Reference, DisplayObject () (DD.Decl v a)) -> Pretty prettyDeclTriple (name, _, displayDecl) = case displayDecl of @@ -2244,7 +2298,7 @@ prettyDeclTriple (name, _, displayDecl) = case displayDecl of UserObject decl -> P.syntaxToColor $ DeclPrinter.prettyDeclHeader name decl prettyDeclPair :: - Var v => + (Var v) => PPE.PrettyPrintEnv -> (Reference, DisplayObject () (DD.Decl v a)) -> Pretty @@ -2298,7 +2352,10 @@ renderNameConflicts ppe conflictedNames = do n <- addNumberedArg (HQ.toString hash) pure $ formatNum n <> (P.blue . P.syntaxToColor . prettyHashQualified $ hash) pure . P.wrap $ - ( "The " <> thingKind <> " " <> P.green (prettyName name) + ( "The " + <> thingKind + <> " " + <> P.green (prettyName name) <> " has conflicting definitions:" ) `P.hang` P.lines prettyConflicts @@ -2309,7 +2366,8 @@ renderEditConflicts ppe Patch {..} = do formattedConflicts <- for editConflicts formatConflict pure . Monoid.unlessM (null editConflicts) . P.callout "❓" . P.sep "\n\n" $ [ P.wrap $ - "These" <> P.bold "definitions were edited differently" + "These" + <> P.bold "definitions were edited differently" <> "in namespaces that have been merged into this one." <> "You'll have to tell me what to use as the new definition:", P.indentN 2 (P.lines formattedConflicts) @@ -2332,12 +2390,14 @@ renderEditConflicts ppe Patch {..} = do replacedType <- numberedHQName (PPE.typeName ppe r) replacements <- for [PPE.typeName ppe r | TypeEdit.Replace r <- es] numberedHQName pure . P.wrap $ - "The type" <> replacedType <> "was" + "The type" + <> replacedType + <> "was" <> ( if TypeEdit.Deprecate `elem` es then "deprecated and also replaced with" else "replaced with" ) - `P.hang` P.lines replacements + `P.hang` P.lines replacements formatTermEdits :: (Reference.TermReference, Set TermEdit.TermEdit) -> Numbered Pretty @@ -2345,12 +2405,14 @@ renderEditConflicts ppe Patch {..} = do replacedTerm <- numberedHQName (PPE.termName ppe (Referent.Ref r)) replacements <- for [PPE.termName ppe (Referent.Ref r) | TermEdit.Replace r _ <- es] numberedHQName pure . P.wrap $ - "The term" <> replacedTerm <> "was" + "The term" + <> replacedTerm + <> "was" <> ( if TermEdit.Deprecate `elem` es then "deprecated and also replaced with" else "replaced with" ) - `P.hang` P.lines replacements + `P.hang` P.lines replacements formatConflict :: Either (Reference, Set TypeEdit.TypeEdit) @@ -2374,7 +2436,7 @@ runNumbered m = let (a, (_, args)) = State.runState m (0, mempty) in (a, Foldable.toList args) -todoOutput :: Var v => PPED.PrettyPrintEnvDecl -> TO.TodoOutput v a -> (Pretty, NumberedArgs) +todoOutput :: (Var v) => PPED.PrettyPrintEnvDecl -> TO.TodoOutput v a -> (Pretty, NumberedArgs) todoOutput ppe todo = runNumbered do conflicts <- todoConflicts edits <- todoEdits @@ -2443,7 +2505,8 @@ todoOutput ppe todo = runNumbered do pure $ Monoid.unlessM (TO.noEdits todo) . P.callout "🚧" . P.sep "\n\n" . P.nonEmpty $ [ P.wrap - ( "The namespace has" <> fromString (show (TO.todoScore todo)) + ( "The namespace has" + <> fromString (show (TO.todoScore todo)) <> "transitive dependent(s) left to upgrade." <> "Your edit frontier is the dependents of these definitions:" ), @@ -2459,12 +2522,12 @@ todoOutput ppe todo = runNumbered do unscore (_score, b, c) = (b, c) listOfDefinitions :: - Var v => Input.FindScope -> PPE.PrettyPrintEnv -> E.ListDetailed -> [SR'.SearchResult' v a] -> IO Pretty + (Var v) => Input.FindScope -> PPE.PrettyPrintEnv -> E.ListDetailed -> [SR'.SearchResult' v a] -> IO Pretty listOfDefinitions fscope ppe detailed results = pure $ listOfDefinitions' fscope ppe detailed results listOfLinks :: - Var v => PPE.PrettyPrintEnv -> [(HQ.HashQualified Name, Maybe (Type v a))] -> IO Pretty + (Var v) => PPE.PrettyPrintEnv -> [(HQ.HashQualified Name, Maybe (Type v a))] -> IO Pretty listOfLinks _ [] = pure . P.callout "😶" . P.wrap $ "No results. Try using the " @@ -2479,7 +2542,8 @@ listOfLinks ppe results = ], "", tip $ - "Try using" <> IP.makeExample IP.display ["1"] + "Try using" + <> IP.makeExample IP.display ["1"] <> "to display the first result or" <> IP.makeExample IP.view ["1"] <> "to view its source." @@ -2496,7 +2560,7 @@ data ShowNumbers = ShowNumbers | HideNumbers -- numbered args showDiffNamespace :: forall v. - Var v => + (Var v) => ShowNumbers -> PPE.PrettyPrintEnv -> Input.AbsBranchId -> @@ -2940,7 +3004,7 @@ noResults fscope = <> "can be used to search outside the current namespace." listOfDefinitions' :: - Var v => + (Var v) => Input.FindScope -> PPE.PrettyPrintEnv -> -- for printing types of terms :-\ E.ListDetailed -> @@ -2952,24 +3016,23 @@ listOfDefinitions' fscope ppe detailed results = else P.lines . P.nonEmpty - $ prettyNumberedResults : - [ formatMissingStuff termsWithMissingTypes missingTypes, - Monoid.unlessM (null missingBuiltins) - . bigproblem - $ P.wrap - "I encountered an inconsistency in the codebase; these definitions refer to built-ins that this version of unison doesn't know about:" - `P.hang` P.column2 - ( (P.bold "Name", P.bold "Built-in") - -- : ("-", "-") - : - fmap - ( bimap - (P.syntaxToColor . prettyHashQualified) - (P.text . Referent.toText) + $ prettyNumberedResults + : [ formatMissingStuff termsWithMissingTypes missingTypes, + Monoid.unlessM (null missingBuiltins) + . bigproblem + $ P.wrap + "I encountered an inconsistency in the codebase; these definitions refer to built-ins that this version of unison doesn't know about:" + `P.hang` P.column2 + ( (P.bold "Name", P.bold "Built-in") + -- : ("-", "-") + : fmap + ( bimap + (P.syntaxToColor . prettyHashQualified) + (P.text . Referent.toText) + ) + missingBuiltins ) - missingBuiltins - ) - ] + ] where prettyNumberedResults = P.numberedList prettyResults -- todo: group this by namespace @@ -3004,7 +3067,7 @@ listOfDefinitions' fscope ppe detailed results = _ -> [] watchPrinter :: - Var v => + (Var v) => Text -> PPE.PrettyPrintEnv -> Ann -> @@ -3136,8 +3199,8 @@ prettyDiff diff = "", P.indentN 2 $ P.column2 $ - (P.hiBlack "Original name", P.hiBlack "New name") : - [(prettyName n, prettyName n2) | (n, n2) <- moved] + (P.hiBlack "Original name", P.hiBlack "New name") + : [(prettyName n, prettyName n2) | (n, n2) <- moved] ] else mempty, if not $ null copied @@ -3147,10 +3210,10 @@ prettyDiff diff = "", P.indentN 2 $ P.column2 $ - (P.hiBlack "Original name", P.hiBlack "New name(s)") : - [ (prettyName n, P.sep " " (prettyName <$> ns)) - | (n, ns) <- copied - ] + (P.hiBlack "Original name", P.hiBlack "New name(s)") + : [ (prettyName n, P.sep " " (prettyName <$> ns)) + | (n, ns) <- copied + ] ] else mempty ] diff --git a/unison-cli/src/Unison/LSP/Diagnostics.hs b/unison-cli/src/Unison/LSP/Diagnostics.hs index 0a90ac32e..5d7552a04 100644 --- a/unison-cli/src/Unison/LSP/Diagnostics.hs +++ b/unison-cli/src/Unison/LSP/Diagnostics.hs @@ -25,7 +25,7 @@ uToLspRange :: Range.Range -> Range uToLspRange (Range.Range start end) = Range (uToLspPos start) (uToLspPos end) reportDiagnostics :: - Foldable f => + (Foldable f) => Uri -> Maybe FileVersion -> -- | Note, it's important to still send an empty list of diagnostics if there aren't any diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 88977ab20..74cf42685 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -66,7 +66,7 @@ import Unison.WatchKind (pattern TestWatch) import UnliftIO (atomically, modifyTVar', readTVar, readTVarIO, writeTVar) -- | Lex, parse, and typecheck a file. -checkFile :: HasUri d Uri => d -> Lsp (Maybe FileAnalysis) +checkFile :: (HasUri d Uri) => d -> Lsp (Maybe FileAnalysis) checkFile doc = runMaybeT $ do let fileUri = doc ^. uri (fileVersion, contents) <- VFS.getFileContents fileUri @@ -151,12 +151,14 @@ mkFileSummary parsed typechecked = case (parsed, typechecked) of where declsRefMap :: (Ord v, Ord r) => Map v (r, a) -> Map r (Map v a) declsRefMap m = - m & Map.toList + m + & Map.toList & fmap (\(v, (r, a)) -> (r, Map.singleton v a)) & Map.fromListWith (<>) termsRefMap :: (Ord v, Ord r) => Map v (r, a, b) -> Map r (Map v (a, b)) termsRefMap m = - m & Map.toList + m + & Map.toList & fmap (\(v, (r, a, b)) -> (r, Map.singleton v (a, b))) & Map.fromListWith (<>) -- Gets the user provided type annotation for a term if there is one. @@ -189,7 +191,7 @@ fileAnalysisWorker = forever do for freshlyCheckedFiles \(FileAnalysis {fileUri, fileVersion, diagnostics}) -> do reportDiagnostics fileUri (Just fileVersion) $ fold diagnostics -analyseFile :: Foldable f => Uri -> Text -> f (Note Symbol Ann) -> Lsp ([Diagnostic], [RangedCodeAction]) +analyseFile :: (Foldable f) => Uri -> Text -> f (Note Symbol Ann) -> Lsp ([Diagnostic], [RangedCodeAction]) analyseFile fileUri srcText notes = do pped <- PPED.suffixifiedPPE <$> LSP.globalPPED analyseNotes fileUri pped (Text.unpack srcText) notes @@ -203,7 +205,7 @@ getTokenMap tokens = ) & fold -analyseNotes :: Foldable f => Uri -> PrettyPrintEnv -> String -> f (Note Symbol Ann) -> Lsp ([Diagnostic], [RangedCodeAction]) +analyseNotes :: (Foldable f) => Uri -> PrettyPrintEnv -> String -> f (Note Symbol Ann) -> Lsp ([Diagnostic], [RangedCodeAction]) analyseNotes fileUri ppe src notes = do currentPath <- getCurrentPath flip foldMapM notes \note -> case note of diff --git a/unison-cli/src/Unison/LSP/NotificationHandlers.hs b/unison-cli/src/Unison/LSP/NotificationHandlers.hs index 85264c360..138dec5ca 100644 --- a/unison-cli/src/Unison/LSP/NotificationHandlers.hs +++ b/unison-cli/src/Unison/LSP/NotificationHandlers.hs @@ -9,7 +9,7 @@ import Unison.LSP.Types initializedHandler :: NotificationMessage 'Initialized -> Lsp () initializedHandler _ = pure () -withDebugging :: Show m => (m -> Lsp ()) -> (m -> Lsp ()) +withDebugging :: (Show m) => (m -> Lsp ()) -> (m -> Lsp ()) withDebugging handler message = do Debug.debugM Debug.LSP "Notification" message handler message diff --git a/unison-cli/src/Unison/LSP/Queries.hs b/unison-cli/src/Unison/LSP/Queries.hs index 192a7b43d..1c66632bb 100644 --- a/unison-cli/src/Unison/LSP/Queries.hs +++ b/unison-cli/src/Unison/LSP/Queries.hs @@ -362,7 +362,7 @@ annIsFilePosition = \case -- So for now we crawl the term and remove any Ann nodes from within. The downside being you -- can no longer hover on Type signatures within a term, but the benefit is that hover -- actually works. -removeInferredTypeAnnotations :: Ord v => Term.Term v Ann -> Term.Term v Ann +removeInferredTypeAnnotations :: (Ord v) => Term.Term v Ann -> Term.Term v Ann removeInferredTypeAnnotations = Lens.transformOf (field @"out" . traversed) \case ABT.Term {out = ABT.Tm (Term.Ann trm typ)} diff --git a/unison-cli/src/Unison/Share/Sync.hs b/unison-cli/src/Unison/Share/Sync.hs index 161144cf4..a4e8e6f56 100644 --- a/unison-cli/src/Unison/Share/Sync.hs +++ b/unison-cli/src/Unison/Share/Sync.hs @@ -289,7 +289,7 @@ data Step a -- we'd return -- -- Just [] -dagbfs :: forall a m. Monad m => (a -> Bool) -> (a -> m [a]) -> a -> m (Maybe [a]) +dagbfs :: forall a m. (Monad m) => (a -> Bool) -> (a -> m [a]) -> a -> m (Maybe [a]) dagbfs goal children = let -- The loop state: all distinct paths from the root to the frontier (not including the root, because it's implied, -- as an input to this function), in reverse order, with the invariant that we haven't found a goal state yet. diff --git a/unison-cli/tests/Unison/Test/GitSync.hs b/unison-cli/tests/Unison/Test/GitSync.hs index 93bb5f285..82d8b9eab 100644 --- a/unison-cli/tests/Unison/Test/GitSync.hs +++ b/unison-cli/tests/Unison/Test/GitSync.hs @@ -35,20 +35,20 @@ writeTranscriptOutput = False test :: Test () test = scope "gitsync22" . tests $ - fastForwardPush : - nonFastForwardPush : - destroyedRemote : - flip - map - [(Ucm.CodebaseFormat2, "sc")] - \(fmt, name) -> - scope name $ - tests - [ pushPullTest - "pull-over-deleted-namespace" - fmt - ( \repo -> - [i| + fastForwardPush + : nonFastForwardPush + : destroyedRemote + : flip + map + [(Ucm.CodebaseFormat2, "sc")] + \(fmt, name) -> + scope name $ + tests + [ pushPullTest + "pull-over-deleted-namespace" + fmt + ( \repo -> + [i| ```unison:hide x = 1 ``` @@ -57,9 +57,9 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```unison:hide child.y = 2 ``` @@ -71,12 +71,12 @@ test = .> pull git(${repo}) child ``` |] - ), - pushPullTest - "pull.without-history" - fmt - ( \repo -> - [i| + ), + pushPullTest + "pull.without-history" + fmt + ( \repo -> + [i| ```unison:hide child.x = 1 ``` @@ -102,9 +102,9 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| Should be able to pull the branch from the remote without its history. Note that this only tests that the pull succeeds, since (at time of writing) we don't track/test transcript output for these tests in the unison repo. @@ -113,12 +113,12 @@ test = .> history .child ``` |] - ), - pushPullTest - "push-over-deleted-namespace" - fmt - ( \repo -> - [i| + ), + pushPullTest + "push-over-deleted-namespace" + fmt + ( \repo -> + [i| ```unison:hide child.x = 1 y = 2 @@ -129,9 +129,9 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```unison:hide child.z = 3 ``` @@ -142,12 +142,12 @@ test = .> push.create git(${repo}).child child ``` |] - ), - pushPullTest - "typeAlias" - fmt - ( \repo -> - [i| + ), + pushPullTest + "typeAlias" + fmt + ( \repo -> + [i| ```ucm .> alias.type ##Nat builtin.Nat .> history @@ -155,9 +155,9 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) ``` @@ -166,12 +166,12 @@ test = x = 3 ``` |] - ), - pushPullTest - "topLevelTerm" - fmt - ( \repo -> - [i| + ), + pushPullTest + "topLevelTerm" + fmt + ( \repo -> + [i| ```unison:hide y = 3 ``` @@ -181,9 +181,9 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) .> find @@ -192,12 +192,12 @@ test = > y ``` |] - ), - pushPullTest - "metadataForTerm" - fmt - ( \repo -> - [i| + ), + pushPullTest + "metadataForTerm" + fmt + ( \repo -> + [i| ```unison:hide doc = "y is the number 3" y = 3 @@ -211,20 +211,20 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) .> links y ``` |] - ), - pushPullTest - "metadataForType" - fmt - ( \repo -> - [i| + ), + pushPullTest + "metadataForType" + fmt + ( \repo -> + [i| ```unison:hide doc = "Nat means natural number" ``` @@ -235,20 +235,20 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) .> links Nat ``` |] - ), - pushPullTest - "subNamespace" - fmt - ( \repo -> - [i| + ), + pushPullTest + "subNamespace" + fmt + ( \repo -> + [i| ```ucm .> alias.type ##Nat builtin.Nat ``` @@ -261,9 +261,9 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull.silent git(${repo}) .> find @@ -272,12 +272,12 @@ test = > a.b.C.C a.b.d ``` |] - ), - pushPullTest - "accessPatch" - fmt - ( \repo -> - [i| + ), + pushPullTest + "accessPatch" + fmt + ( \repo -> + [i| ```ucm .> alias.type ##Nat builtin.Nat ``` @@ -302,20 +302,20 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull.silent git(${repo}) .> view.patch patch ``` |] - ), - pushPullTest - "history" - fmt - ( \repo -> - [i| + ), + pushPullTest + "history" + fmt + ( \repo -> + [i| ```unison foo = 3 ``` @@ -331,9 +331,9 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) .> history @@ -341,19 +341,19 @@ test = .> history ``` |] -- Not sure why this hash is here. - -- Is it to test `reset-root`? - -- Or to notice a change in hashing? - -- Or to test that two distinct points of history were pulled? - -- It would be great to not need the explicit hash here, - -- since it does change periodically. - -- Though, I guess that should also be rare, so maybe this is fine. - ), - pushPullTest - "one-term" - fmt - -- simplest-author - ( \repo -> - [i| + -- Is it to test `reset-root`? + -- Or to notice a change in hashing? + -- Or to test that two distinct points of history were pulled? + -- It would be great to not need the explicit hash here, + -- since it does change periodically. + -- Though, I guess that should also be rare, so maybe this is fine. + ), + pushPullTest + "one-term" + fmt + -- simplest-author + ( \repo -> + [i| ```unison c = 3 ``` @@ -363,10 +363,10 @@ test = .myLib> push.create git(${repo}) ``` |] - ) - -- simplest-user - ( \repo -> - [i| + ) + -- simplest-user + ( \repo -> + [i| ```ucm .yourLib> pull git(${repo}) ``` @@ -374,13 +374,13 @@ test = > c ``` |] - ), - pushPullTest - "one-type" - fmt - -- simplest-author - ( \repo -> - [i| + ), + pushPullTest + "one-type" + fmt + -- simplest-author + ( \repo -> + [i| ```unison structural type Foo = Foo ``` @@ -390,10 +390,10 @@ test = .myLib> push.create git(${repo}) ``` |] - ) - -- simplest-user - ( \repo -> - [i| + ) + -- simplest-user + ( \repo -> + [i| ```ucm .yourLib> pull git(${repo}) ``` @@ -401,12 +401,12 @@ test = > Foo.Foo ``` |] - ), - pushPullTest - "patching" - fmt - ( \repo -> - [i| + ), + pushPullTest + "patching" + fmt + ( \repo -> + [i| ```ucm .myLib> alias.term ##Nat.+ + ``` @@ -429,9 +429,9 @@ test = .workaround1552.myLib> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .myApp> pull git(${repo}).v1 external.yourLib .myApp> alias.term ##Nat.* * @@ -454,13 +454,13 @@ test = > greatApp ``` |] - ), - -- TODO: remove the alias.type .defns.A A line once patch syncing is fixed - pushPullTest - "lightweightPatch" - fmt - ( \repo -> - [i| + ), + -- TODO: remove the alias.type .defns.A A line once patch syncing is fixed + pushPullTest + "lightweightPatch" + fmt + ( \repo -> + [i| ```ucm .> builtins.merge ``` @@ -478,21 +478,21 @@ test = .patches> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> builtins.merge .> pull git(${repo}) patches .> view.patch patches.patch ``` |] - ), - watchPushPullTest - "test-watches" - fmt - ( \repo -> - [i| + ), + watchPushPullTest + "test-watches" + fmt + ( \repo -> + [i| ```ucm .> builtins.merge ``` @@ -504,60 +504,60 @@ test = .> push.create git(${repo}) ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) ``` |] - ) - ( \cb -> do - Codebase.runTransaction cb do - void . fmap (fromJust . sequence) $ - traverse (Codebase.getWatch cb TestWatch) - =<< Codebase.watches TestWatch - ), - gistTest fmt, - pushPullBranchesTests fmt, - pushPullTest - "fix2068_a_" - fmt - -- this triggers - {- - gitsync22.sc.fix2068(a) EXCEPTION!!!: Called SqliteCodebase.setNamespaceRoot on unknown causal hash CausalHash (fromBase32Hex "codddvgt1ep57qpdkhe2j4pe1ehlpi5iitcrludtb8ves1aaqjl453onvfphqg83vukl7bbrj49itceqfob2b3alf47u4vves5s7pog") - CallStack (from HasCallStack): - error, called at src/Unison/Codebase/SqliteCodebase.hs:1072:17 in unison-parser-typechecker-0.0.0-6U6boimwb8GAC5qrhLfs8h:Unison.Codebase.SqliteCodebase - -} - ( \repo -> - [i| + ) + ( \cb -> do + Codebase.runTransaction cb do + void . fmap (fromJust . sequence) $ + traverse (Codebase.getWatch cb TestWatch) + =<< Codebase.watches TestWatch + ), + gistTest fmt, + pushPullBranchesTests fmt, + pushPullTest + "fix2068_a_" + fmt + -- this triggers + {- + gitsync22.sc.fix2068(a) EXCEPTION!!!: Called SqliteCodebase.setNamespaceRoot on unknown causal hash CausalHash (fromBase32Hex "codddvgt1ep57qpdkhe2j4pe1ehlpi5iitcrludtb8ves1aaqjl453onvfphqg83vukl7bbrj49itceqfob2b3alf47u4vves5s7pog") + CallStack (from HasCallStack): + error, called at src/Unison/Codebase/SqliteCodebase.hs:1072:17 in unison-parser-typechecker-0.0.0-6U6boimwb8GAC5qrhLfs8h:Unison.Codebase.SqliteCodebase + -} + ( \repo -> + [i| ```ucm .> alias.type ##Nat builtin.Nat2 .> alias.type ##Int builtin.Int2 .> push.create git(${repo}).foo.bar ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) pulled .> view pulled.foo.bar.builtin.Nat2 .> view pulled.foo.bar.builtin.Int2 ``` |] - ), - pushPullTest - "fix2068_b_" - fmt - -- this triggers - {- - - gitsync22.sc.fix2068(b) EXCEPTION!!!: I couldn't find the hash ndn6fa85ggqtbgffqhd4d3bca2d08pgp3im36oa8k6p257aid90ovjq75htmh7lmg7akaqneva80ml1o21iscjmp9n1uc3lmqgg9rgg that I just synced to the cached copy of /private/var/folders/6m/p3szds2j67d8vwmxr51yrf5c0000gn/T/git-simple-1047398c149d3d5c/repo.git in "/Users/pchiusano/.cache/unisonlanguage/gitfiles/$x2F$private$x2F$var$x2F$folders$x2F$6m$x2F$p3szds2j67d8vwmxr51yrf5c0000gn$x2F$T$x2F$git-simple-1047398c149d3d5c$x2F$repo$dot$git". - CallStack (from HasCallStack): - error, called at src/Unison/Codebase/SqliteCodebase.hs:1046:13 in unison-parser-typechecker-0.0.0-6U6boimwb8GAC5qrhLfs8h:Unison.Codebase.SqliteCodebase - -} - ( \repo -> - [i| + ), + pushPullTest + "fix2068_b_" + fmt + -- this triggers + {- + - gitsync22.sc.fix2068(b) EXCEPTION!!!: I couldn't find the hash ndn6fa85ggqtbgffqhd4d3bca2d08pgp3im36oa8k6p257aid90ovjq75htmh7lmg7akaqneva80ml1o21iscjmp9n1uc3lmqgg9rgg that I just synced to the cached copy of /private/var/folders/6m/p3szds2j67d8vwmxr51yrf5c0000gn/T/git-simple-1047398c149d3d5c/repo.git in "/Users/pchiusano/.cache/unisonlanguage/gitfiles/$x2F$private$x2F$var$x2F$folders$x2F$6m$x2F$p3szds2j67d8vwmxr51yrf5c0000gn$x2F$T$x2F$git-simple-1047398c149d3d5c$x2F$repo$dot$git". + CallStack (from HasCallStack): + error, called at src/Unison/Codebase/SqliteCodebase.hs:1046:13 in unison-parser-typechecker-0.0.0-6U6boimwb8GAC5qrhLfs8h:Unison.Codebase.SqliteCodebase + -} + ( \repo -> + [i| ```ucm .> alias.type ##Nat builtin.Nat2 .> alias.type ##Int builtin.Int2 @@ -565,17 +565,17 @@ test = .> push.create git(${repo}).foo.bar ``` |] - ) - ( \repo -> - [i| + ) + ( \repo -> + [i| ```ucm .> pull git(${repo}) pulled .> view pulled.foo.bar.builtin.Nat2 .> view pulled.foo.bar.builtin.Int2 ``` |] - ) - ] + ) + ] pushPullTest :: String -> CodebaseFormat -> (FilePath -> Transcript) -> (FilePath -> Transcript) -> Test () pushPullTest name fmt authorScript userScript = scope name do diff --git a/unison-cli/unison/ArgParse.hs b/unison-cli/unison/ArgParse.hs index a619b124f..bc24034f2 100644 --- a/unison-cli/unison/ArgParse.hs +++ b/unison-cli/unison/ArgParse.hs @@ -179,7 +179,9 @@ initCommand = command "init" (info initParser (progDesc initHelp)) runDesc :: String -> String -> String runDesc cmd location = - "Execute a definition from " <> location <> ", passing on the provided arguments. " + "Execute a definition from " + <> location + <> ", passing on the provided arguments. " <> " To pass flags to your program, use `" <> cmd <> " -- --my-flag`" @@ -369,7 +371,8 @@ runSymbolParser = runFileParser :: Parser Command runFileParser = Run - <$> ( RunFromFile <$> fileArgument "path/to/file" + <$> ( RunFromFile + <$> fileArgument "path/to/file" <*> strArgument (metavar "SYMBOL") ) <*> runArgumentParser @@ -403,9 +406,11 @@ saveCodebaseToFlag = do long "save-codebase-to" <> short 'S' <> help "Where the codebase should be created. Implies --save-codebase" - pure (case path of - Just _ -> SaveCodebase path - _ -> DontSaveCodebase) + pure + ( case path of + Just _ -> SaveCodebase path + _ -> DontSaveCodebase + ) downloadBaseFlag :: Parser ShouldDownloadBase downloadBaseFlag = @@ -472,10 +477,12 @@ transcriptParser = do shouldSaveCodebase <- saveCodebaseFlag mrtsStatsFp <- rtsStatsOption files <- liftA2 (NE.:|) (fileArgument "FILE") (many (fileArgument "FILES...")) - pure (let saveCodebase = case shouldSaveCodebaseTo of - DontSaveCodebase -> shouldSaveCodebase - _ -> shouldSaveCodebaseTo - in Transcript DontFork saveCodebase mrtsStatsFp files) + pure + ( let saveCodebase = case shouldSaveCodebaseTo of + DontSaveCodebase -> shouldSaveCodebase + _ -> shouldSaveCodebaseTo + in Transcript DontFork saveCodebase mrtsStatsFp files + ) transcriptForkParser :: Parser Command transcriptForkParser = do @@ -484,10 +491,12 @@ transcriptForkParser = do shouldSaveCodebase <- saveCodebaseFlag mrtsStatsFp <- rtsStatsOption files <- liftA2 (NE.:|) (fileArgument "FILE") (many (fileArgument "FILES...")) - pure (let saveCodebase = case shouldSaveCodebaseTo of - DontSaveCodebase -> shouldSaveCodebase - _ -> shouldSaveCodebaseTo - in Transcript UseFork saveCodebase mrtsStatsFp files) + pure + ( let saveCodebase = case shouldSaveCodebaseTo of + DontSaveCodebase -> shouldSaveCodebase + _ -> shouldSaveCodebaseTo + in Transcript UseFork saveCodebase mrtsStatsFp files + ) unisonHelp :: String -> String -> P.Doc unisonHelp (P.text -> executable) (P.text -> version) = diff --git a/unison-cli/unison/System/Path.hs b/unison-cli/unison/System/Path.hs index 09049046d..4afaed558 100644 --- a/unison-cli/unison/System/Path.hs +++ b/unison-cli/unison/System/Path.hs @@ -40,7 +40,7 @@ filterUseless :: [FilePath] -> [FilePath] filterUseless = (\\ [".", ".."]) -- | Returns a list of nodes in a tree via a depth-first walk. -mtreeList :: Monad m => (a -> m [a]) -> a -> m [a] +mtreeList :: (Monad m) => (a -> m [a]) -> a -> m [a] mtreeList children root = do xs <- children root subChildren <- mapM (mtreeList children) xs diff --git a/unison-core/src/Unison/ABT.hs b/unison-core/src/Unison/ABT.hs index 0805b2978..087a98482 100644 --- a/unison-core/src/Unison/ABT.hs +++ b/unison-core/src/Unison/ABT.hs @@ -115,8 +115,8 @@ import U.Core.ABT unabs, visit, visit', - visit_, visitPure, + visit_, vmap, pattern AbsN', pattern Tm', @@ -135,14 +135,15 @@ abt_ = lens out setter -- a.k.a. baseFunctor_ :: Traversal' (Term f v a) (f _) baseFunctor_ :: - Applicative m => + (Applicative m) => (f (Term f v a) -> m (f (Term f v a))) -> Term f v a -> m (Term f v a) baseFunctor_ f t = - t & abt_ %%~ \case - Tm fx -> Tm <$> f (fx) - x -> pure x + t + & abt_ %%~ \case + Tm fx -> Tm <$> f (fx) + x -> pure x -- deriving instance (Data a, Data v, Typeable f, Data (f (Term f v a)), Ord v) => Data (Term f v a) @@ -152,7 +153,7 @@ unvar :: V v -> v unvar (Free v) = v unvar (Bound v) = v -instance Var v => Var (V v) where +instance (Var v) => Var (V v) where freshIn s v = freshIn (Set.map unvar s) <$> v wrap :: (Functor f, Foldable f, Var v) => v -> Term f (V v) a -> (V v, Term f (V v) a) @@ -182,7 +183,7 @@ annotateBound = go Set.empty Tm body -> tm' a (go bound <$> body) -- | `True` if `v` is a member of the set of free variables of `t` -isFreeIn :: Ord v => v -> Term f v a -> Bool +isFreeIn :: (Ord v) => v -> Term f v a -> Bool isFreeIn v t = Set.member v (freeVars t) -- | Replace the annotation with the given argument. @@ -206,10 +207,10 @@ amap' f t@(Term _ a out) = case out of Cycle r -> cycle' (f t a) (amap' f r) Abs v body -> abs' (f t a) v (amap' f body) -extraMap :: Functor g => (forall k. f k -> g k) -> Term f v a -> Term g v a +extraMap :: (Functor g) => (forall k. f k -> g k) -> Term f v a -> Term g v a extraMap p (Term fvs a sub) = Term fvs a (go p sub) where - go :: Functor g => (forall k. f k -> g k) -> ABT f v (Term f v a) -> ABT g v (Term g v a) + go :: (Functor g) => (forall k. f k -> g k) -> ABT f v (Term f v a) -> ABT g v (Term g v a) go p = \case Var v -> Var v Cycle r -> Cycle (extraMap p r) @@ -244,10 +245,10 @@ var = annotatedVar () annotatedVar :: a -> v -> Term f v a annotatedVar = U.Core.ABT.var -abs :: Ord v => v -> Term f v () -> Term f v () +abs :: (Ord v) => v -> Term f v () -> Term f v () abs = abs' () -abs' :: Ord v => a -> v -> Term f v a -> Term f v a +abs' :: (Ord v) => a -> v -> Term f v a -> Term f v a abs' = U.Core.ABT.abs absr :: (Functor f, Foldable f, Var v) => v -> Term f (V v) () -> Term f (V v) () @@ -257,10 +258,10 @@ absr = absr' () absr' :: (Functor f, Foldable f, Var v) => a -> v -> Term f (V v) a -> Term f (V v) a absr' a v body = wrap' v body $ \v body -> abs' a v body -absChain :: Ord v => [v] -> Term f v () -> Term f v () +absChain :: (Ord v) => [v] -> Term f v () -> Term f v () absChain vs t = foldr abs t vs -absChain' :: Ord v => [(a, v)] -> Term f v a -> Term f v a +absChain' :: (Ord v) => [(a, v)] -> Term f v a -> Term f v a absChain' vs t = foldr (\(a, v) t -> abs' a v t) t vs tm :: (Foldable f, Ord v) => f (Term f v ()) -> Term f v () @@ -328,10 +329,10 @@ changeVars m t = case out t of Just v -> annotatedVar (annotation t) v Tm v -> tm' (annotation t) (changeVars m <$> v) -fresh :: Var v => Term f v a -> v -> v +fresh :: (Var v) => Term f v a -> v -> v fresh t = freshIn (freeVars t) -allVars :: Foldable f => Term f v a -> [v] +allVars :: (Foldable f) => Term f v a -> [v] allVars t = case out t of Var v -> [v] Cycle body -> allVars body @@ -443,7 +444,7 @@ rewriteDown_ f t = do Tm body -> tm' (annotation t') <$> (traverse (rewriteDown_ f) body) data Subst f v a = Subst - { freshen :: forall m v'. Monad m => (v -> m v') -> m v', + { freshen :: forall m v'. (Monad m) => (v -> m v') -> m v', bind :: Term f v a -> Term f v a, bindInheritAnnotation :: forall b. Term f v b -> Term f v a, variable :: v @@ -508,21 +509,21 @@ find' :: [Term f v a] find' p = Unison.ABT.find (\t -> if p t then Found t else Continue) -components :: Var v => [(v, Term f v a)] -> [[(v, Term f v a)]] +components :: (Var v) => [(v, Term f v a)] -> [[(v, Term f v a)]] components = Components.components freeVars -- Converts to strongly connected components while preserving the -- order of definitions. Satisfies `join (orderedComponents bs) == bs`. -orderedComponents' :: Var v => [(v, Term f v a)] -> [[(v, Term f v a)]] +orderedComponents' :: (Var v) => [(v, Term f v a)] -> [[(v, Term f v a)]] orderedComponents' tms = go [] Set.empty tms where go [] _ [] = [] go [] deps (hd : rem) = go [hd] (deps <> freeVars (snd hd)) rem go cur deps rem = case findIndex isDep rem of Nothing -> - reverse cur : - let (hd, tl) = splitAt 1 rem - in go hd (depsFor hd) tl + reverse cur + : let (hd, tl) = splitAt 1 rem + in go hd (depsFor hd) tl Just i -> go (reverse newMembers ++ cur) deps' (drop (i + 1) rem) where deps' = deps <> depsFor newMembers @@ -538,10 +539,10 @@ orderedComponents' tms = go [] Set.empty tms -- Example: given `[[x],[ping,r,s,pong]]`, where `ping` and `pong` -- are mutually recursive but `r` and `s` are uninvolved, this produces: -- `[[x], [ping,pong], [r], [s]]`. -orderedComponents :: Var v => [(v, Term f v a)] -> [[(v, Term f v a)]] +orderedComponents :: (Var v) => [(v, Term f v a)] -> [[(v, Term f v a)]] orderedComponents bs0 = tweak =<< orderedComponents' bs0 where - tweak :: Var v => [(v, Term f v a)] -> [[(v, Term f v a)]] + tweak :: (Var v) => [(v, Term f v a)] -> [[(v, Term f v a)]] tweak bs@(_ : _ : _) = case takeWhile isCyclic (components bs) of [] -> [bs] cycles -> cycles <> orderedComponents rest diff --git a/unison-core/src/Unison/ABT/Normalized.hs b/unison-core/src/Unison/ABT/Normalized.hs index c620e20f5..ba2b98f4a 100644 --- a/unison-core/src/Unison/ABT/Normalized.hs +++ b/unison-core/src/Unison/ABT/Normalized.hs @@ -44,25 +44,26 @@ data Term f v = Term } instance - (forall a b. Show a => Show b => Show (f a b), Show v) => + (forall a b. (Show a) => (Show b) => Show (f a b), Show v) => Show (ABT f v) where showsPrec p a = showParen (p >= 9) $ case a of Abs v tm -> - showString "Abs " . showsPrec 10 v + showString "Abs " + . showsPrec 10 v . showString " " . showsPrec 10 tm Tm e -> showString "Tm " . showsPrec 10 e instance - (forall a b. Show a => Show b => Show (f a b), Show v) => + (forall a b. (Show a) => (Show b) => Show (f a b), Show v) => Show (Term f v) where showsPrec p (Term _ e) = showParen (p >= 9) $ showString "Term " . showsPrec 10 e instance - (forall a b. Eq a => Eq b => Eq (f a b), Bifunctor f, Bifoldable f, Var v) => + (forall a b. (Eq a) => (Eq b) => Eq (f a b), Bifunctor f, Bifoldable f, Var v) => Eq (ABT f v) where Abs v1 e1 == Abs v2 e2 @@ -72,12 +73,12 @@ instance _ == _ = False instance - (forall a b. Eq a => Eq b => Eq (f a b), Bifunctor f, Bifoldable f, Var v) => + (forall a b. (Eq a) => (Eq b) => Eq (f a b), Bifunctor f, Bifoldable f, Var v) => Eq (Term f v) where Term _ abt1 == Term _ abt2 = abt1 == abt2 -pattern TAbs :: Var v => v -> Term f v -> Term f v +pattern TAbs :: (Var v) => v -> Term f v -> Term f v pattern TAbs u bd <- Term _ (Abs u bd) where @@ -93,7 +94,7 @@ pattern TTm bd <- class (Bifoldable f, Bifunctor f) => Align f where align :: - Applicative g => + (Applicative g) => (vl -> vr -> g vs) -> (el -> er -> g es) -> f vl el -> @@ -101,7 +102,7 @@ class (Bifoldable f, Bifunctor f) => Align f where Maybe (g (f vs es)) alphaErr :: - Align f => Var v => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) a + (Align f) => (Var v) => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) a alphaErr un tml tmr = Left (tml, renames count un tmr) where count = Map.fromListWith (+) . flip zip [1, 1 ..] $ toList un @@ -109,7 +110,7 @@ alphaErr un tml tmr = Left (tml, renames count un tmr) -- Checks if two terms are equal up to a given variable renaming. The -- renaming should map variables in the right hand term to the -- equivalent variable in the left hand term. -alpha :: Align f => Var v => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) () +alpha :: (Align f) => (Var v) => Map v v -> Term f v -> Term f v -> Either (Term f v, Term f v) () alpha un (TAbs u tml) (TAbs v tmr) = alpha (Map.insert v u (Map.filter (/= u) un)) tml tmr alpha un tml@(TTm bdl) tmr@(TTm bdr) @@ -120,11 +121,11 @@ alpha un tml@(TTm bdl) tmr@(TTm bdr) | otherwise = alphaErr un tml tmr alpha un tml tmr = alphaErr un tml tmr -unabss :: Var v => Term f v -> ([v], Term f v) +unabss :: (Var v) => Term f v -> ([v], Term f v) unabss (TAbs v (unabss -> (vs, bd))) = (v : vs, bd) unabss bd = ([], bd) -pattern TAbss :: Var v => [v] -> Term f v -> Term f v +pattern TAbss :: (Var v) => [v] -> Term f v -> Term f v pattern TAbss vs bd <- (unabss -> (vs, bd)) where diff --git a/unison-core/src/Unison/DataDeclaration.hs b/unison-core/src/Unison/DataDeclaration.hs index 30398158a..b7e3c2dd9 100644 --- a/unison-core/src/Unison/DataDeclaration.hs +++ b/unison-core/src/Unison/DataDeclaration.hs @@ -70,10 +70,10 @@ data DeclOrBuiltin v a asDataDecl :: Decl v a -> DataDeclaration v a asDataDecl = either toDataDecl id -declDependencies :: Ord v => Decl v a -> Set Reference +declDependencies :: (Ord v) => Decl v a -> Set Reference declDependencies = either (dependencies . toDataDecl) dependencies -labeledDeclDependencies :: Ord v => Decl v a -> Set LD.LabeledDependency +labeledDeclDependencies :: (Ord v) => Decl v a -> Set LD.LabeledDependency labeledDeclDependencies = Set.map LD.TypeReference . declDependencies constructorType :: Decl v a -> CT.ConstructorType @@ -107,7 +107,7 @@ asDataDecl_ :: Iso' (EffectDeclaration v a) (DataDeclaration v a) asDataDecl_ = iso toDataDecl EffectDeclaration withEffectDeclM :: - Functor f => + (Functor f) => (DataDeclaration v a -> f (DataDeclaration v' a')) -> EffectDeclaration v a -> f (EffectDeclaration v' a') @@ -200,7 +200,7 @@ constructorTypes :: DataDeclaration v a -> [Type v a] constructorTypes = (snd <$>) . constructors -- what is declFields? —AI -declFields :: Var v => Decl v a -> Either [Int] [Int] +declFields :: (Var v) => Decl v a -> Either [Int] [Int] declFields = bimap cf cf . first toDataDecl where cf = fmap fields . constructorTypes @@ -217,7 +217,7 @@ constructors (DataDeclaration _ _ _ ctors) = [(v, t) | (_, v, t) <- ctors] constructorVars :: DataDeclaration v a -> [v] constructorVars dd = fst <$> constructors dd -constructorNames :: Var v => DataDeclaration v a -> [Text] +constructorNames :: (Var v) => DataDeclaration v a -> [Text] constructorNames dd = Var.name <$> constructorVars dd -- This function is unsound, since the `rid` and the `decl` have to match. @@ -234,18 +234,18 @@ constructorIds dd = [0 .. fromIntegral $ length (constructors dd) - 1] -- | All variables mentioned in the given data declaration. -- Includes both term and type variables, both free and bound. -allVars :: Ord v => DataDeclaration v a -> Set v +allVars :: (Ord v) => DataDeclaration v a -> Set v allVars (DataDeclaration _ _ bound ctors) = Set.unions $ Set.fromList bound : [Set.insert v (Set.fromList $ ABT.allVars tp) | (_, v, tp) <- ctors] -- | All variables mentioned in the given declaration. -- Includes both term and type variables, both free and bound. -allVars' :: Ord v => Decl v a -> Set v +allVars' :: (Ord v) => Decl v a -> Set v allVars' = allVars . either toDataDecl id bindReferences :: - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Map Name.Name Reference -> @@ -256,11 +256,11 @@ bindReferences unsafeVarToName keepFree names (DataDeclaration m a bound constru (a,v,) <$> Type.bindReferences unsafeVarToName keepFree names ty pure $ DataDeclaration m a bound constructors -dependencies :: Ord v => DataDeclaration v a -> Set Reference +dependencies :: (Ord v) => DataDeclaration v a -> Set Reference dependencies dd = Set.unions (Type.dependencies <$> constructorTypes dd) -labeledDependencies :: Ord v => DataDeclaration v a -> Set LD.LabeledDependency +labeledDependencies :: (Ord v) => DataDeclaration v a -> Set LD.LabeledDependency labeledDependencies = Set.map LD.TypeReference . dependencies mkEffectDecl' :: @@ -278,7 +278,7 @@ data F a | Modified Modifier a deriving (Functor, Foldable, Show) -updateDependencies :: Ord v => Map Reference Reference -> Decl v a -> Decl v a +updateDependencies :: (Ord v) => Map Reference Reference -> Decl v a -> Decl v a updateDependencies typeUpdates decl = back $ dataDecl @@ -297,7 +297,7 @@ updateDependencies typeUpdates decl = -- have been replaced with the corresponding output `v`s in the output `Decl`s, -- which are fresh with respect to all input Decls. unhashComponent :: - forall v a. Var v => Map Reference.Id (Decl v a) -> Map Reference.Id (v, Decl v a) + forall v a. (Var v) => Map Reference.Id (Decl v a) -> Map Reference.Id (v, Decl v a) unhashComponent m = let usedVars :: Set v usedVars = foldMap allVars' m diff --git a/unison-core/src/Unison/DataDeclaration/Names.hs b/unison-core/src/Unison/DataDeclaration/Names.hs index 2564f7948..900aa48a2 100644 --- a/unison-core/src/Unison/DataDeclaration/Names.hs +++ b/unison-core/src/Unison/DataDeclaration/Names.hs @@ -18,7 +18,7 @@ import Unison.Var (Var) import Prelude hiding (cycle) -- implementation of dataDeclToNames and effectDeclToNames -toNames :: Var v => (v -> Name.Name) -> CT.ConstructorType -> v -> Reference.Id -> DataDeclaration v a -> Names +toNames :: (Var v) => (v -> Name.Name) -> CT.ConstructorType -> v -> Reference.Id -> DataDeclaration v a -> Names toNames varToName ct typeSymbol (Reference.DerivedId -> r) dd = -- constructor names foldMap names (DD.constructorVars dd `zip` [0 ..]) @@ -28,20 +28,20 @@ toNames varToName ct typeSymbol (Reference.DerivedId -> r) dd = names (ctor, i) = Names (Rel.singleton (varToName ctor) (Referent.Con (ConstructorReference r i) ct)) mempty -dataDeclToNames :: Var v => (v -> Name.Name) -> v -> Reference.Id -> DataDeclaration v a -> Names +dataDeclToNames :: (Var v) => (v -> Name.Name) -> v -> Reference.Id -> DataDeclaration v a -> Names dataDeclToNames varToName = toNames varToName CT.Data -effectDeclToNames :: Var v => (v -> Name.Name) -> v -> Reference.Id -> EffectDeclaration v a -> Names +effectDeclToNames :: (Var v) => (v -> Name.Name) -> v -> Reference.Id -> EffectDeclaration v a -> Names effectDeclToNames varToName typeSymbol r ed = toNames varToName CT.Effect typeSymbol r $ DD.toDataDecl ed -dataDeclToNames' :: Var v => (v -> Name.Name) -> (v, (Reference.Id, DataDeclaration v a)) -> Names +dataDeclToNames' :: (Var v) => (v -> Name.Name) -> (v, (Reference.Id, DataDeclaration v a)) -> Names dataDeclToNames' varToName (v, (r, d)) = dataDeclToNames varToName v r d -effectDeclToNames' :: Var v => (v -> Name.Name) -> (v, (Reference.Id, EffectDeclaration v a)) -> Names +effectDeclToNames' :: (Var v) => (v -> Name.Name) -> (v, (Reference.Id, EffectDeclaration v a)) -> Names effectDeclToNames' varToName (v, (r, d)) = effectDeclToNames varToName v r d bindNames :: - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Names -> diff --git a/unison-core/src/Unison/HashQualified'.hs b/unison-core/src/Unison/HashQualified'.hs index a6afd4bec..ac6579730 100644 --- a/unison-core/src/Unison/HashQualified'.hs +++ b/unison-core/src/Unison/HashQualified'.hs @@ -78,12 +78,12 @@ fromNamedReference n r = HashQualified n (Reference.toShortHash r) fromName :: n -> HashQualified n fromName = NameOnly -matchesNamedReferent :: Eq n => n -> Referent -> HashQualified n -> Bool +matchesNamedReferent :: (Eq n) => n -> Referent -> HashQualified n -> Bool matchesNamedReferent n r = \case NameOnly n' -> n' == n HashQualified n' sh -> n' == n && sh `SH.isPrefixOf` Referent.toShortHash r -matchesNamedReference :: Eq n => n -> Reference -> HashQualified n -> Bool +matchesNamedReference :: (Eq n) => n -> Reference -> HashQualified n -> Bool matchesNamedReference n r = \case NameOnly n' -> n' == n HashQualified n' sh -> n' == n && sh `SH.isPrefixOf` Reference.toShortHash r @@ -101,14 +101,14 @@ sortByLength = NameOnly name -> (length (Name.reverseSegments name), Nothing, Name.isAbsolute name) HashQualified name hash -> (length (Name.reverseSegments name), Just hash, Name.isAbsolute name) -instance Name.Alphabetical n => Name.Alphabetical (HashQualified n) where +instance (Name.Alphabetical n) => Name.Alphabetical (HashQualified n) where compareAlphabetical (NameOnly n) (NameOnly n2) = Name.compareAlphabetical n n2 -- NameOnly comes first compareAlphabetical NameOnly {} HashQualified {} = LT compareAlphabetical HashQualified {} NameOnly {} = GT compareAlphabetical (HashQualified n sh) (HashQualified n2 sh2) = Name.compareAlphabetical n n2 <> compare sh sh2 -instance Convert n n2 => Parse (HashQualified n) n2 where +instance (Convert n n2) => Parse (HashQualified n) n2 where parse = \case NameOnly n -> Just (Name.convert n) _ -> Nothing diff --git a/unison-core/src/Unison/HashQualified.hs b/unison-core/src/Unison/HashQualified.hs index d5d927990..88276b9fd 100644 --- a/unison-core/src/Unison/HashQualified.hs +++ b/unison-core/src/Unison/HashQualified.hs @@ -126,7 +126,7 @@ requalify hq r = case hq of HashQualified n _ -> fromNamedReferent n r HashOnly _ -> fromReferent r -instance Name.Alphabetical n => Name.Alphabetical (HashQualified n) where +instance (Name.Alphabetical n) => Name.Alphabetical (HashQualified n) where -- Ordered alphabetically, based on the name. Hashes come last. compareAlphabetical a b = case (toName a, toName b) of @@ -140,7 +140,7 @@ instance Name.Alphabetical n => Name.Alphabetical (HashQualified n) where (Just _, Nothing) -> GT (Just sh, Just sh2) -> compare sh sh2 -instance Convert n n2 => Convert (HashQualified n) (HashQualified n2) where +instance (Convert n n2) => Convert (HashQualified n) (HashQualified n2) where convert = fmap Name.convert instance Convert n (HashQualified n) where diff --git a/unison-core/src/Unison/Hashable.hs b/unison-core/src/Unison/Hashable.hs index 82c5da56b..a51109f79 100644 --- a/unison-core/src/Unison/Hashable.hs +++ b/unison-core/src/Unison/Hashable.hs @@ -45,9 +45,9 @@ hash = accumulate' -- useful in algorithms, the runtime, etc. -- Consider carefully which class you want in each use-case. class Hashable t where - tokens :: Accumulate h => t -> [Token h] + tokens :: (Accumulate h) => t -> [Token h] -instance Hashable a => Hashable [a] where +instance (Hashable a) => Hashable [a] where tokens = map accumulateToken instance (Hashable a, Hashable b) => Hashable (a, b) where @@ -109,7 +109,7 @@ instance Accumulate Hash where let tbytes = encodeUtf8 txt in [encodeLength (B.length tbytes), tbytes] toBS (Hashed h) = [Hash.toByteString h] - encodeLength :: Integral n => n -> B.ByteString + encodeLength :: (Integral n) => n -> B.ByteString encodeLength = BL.toStrict . toLazyByteString . word64BE . fromIntegral fromBytes = Hash.fromByteString toBytes = Hash.toByteString diff --git a/unison-core/src/Unison/LabeledDependency.hs b/unison-core/src/Unison/LabeledDependency.hs index 1ab378101..13ebe0369 100644 --- a/unison-core/src/Unison/LabeledDependency.hs +++ b/unison-core/src/Unison/LabeledDependency.hs @@ -62,14 +62,14 @@ dataConstructor r = ConReference r Data effectConstructor :: ConstructorReference -> LabeledDependency effectConstructor r = ConReference r Effect -referents :: Foldable f => f Referent -> Set LabeledDependency +referents :: (Foldable f) => f Referent -> Set LabeledDependency referents rs = Set.fromList (map referent $ toList rs) fold :: (Reference -> a) -> (Referent -> a) -> LabeledDependency -> a fold f _ (TypeReference r) = f r fold _ g (TermReferent r) = g r -partition :: Foldable t => t LabeledDependency -> ([Reference], [Referent]) +partition :: (Foldable t) => t LabeledDependency -> ([Reference], [Referent]) partition = foldMap \case TypeReference ref -> ([ref], []) diff --git a/unison-core/src/Unison/Name.hs b/unison-core/src/Unison/Name.hs index e90686e6a..bd93b87cc 100644 --- a/unison-core/src/Unison/Name.hs +++ b/unison-core/src/Unison/Name.hs @@ -102,7 +102,7 @@ compareSuffix (Name _ ss0) = -- /Precondition/: the name is relative -- -- /O(n)/, where /n/ is the number of segments. -cons :: HasCallStack => NameSegment -> Name -> Name +cons :: (HasCallStack) => NameSegment -> Name -> Name cons x name = case name of Name Absolute _ -> @@ -187,7 +187,7 @@ isPrefixOf :: Name -> Name -> Bool isPrefixOf (Name p0 ss0) (Name p1 ss1) = p0 == p1 && List.isPrefixOf (reverse (toList ss0)) (reverse (toList ss1)) -joinDot :: HasCallStack => Name -> Name -> Name +joinDot :: (HasCallStack) => Name -> Name -> Name joinDot n1@(Name p0 ss0) n2@(Name p1 ss1) = case p1 of Relative -> Name p0 (ss1 <> ss0) @@ -344,7 +344,7 @@ sortNames toText = -- @ -- -- /Precondition/: the name is relative. -splits :: HasCallStack => Name -> [([NameSegment], Name)] +splits :: (HasCallStack) => Name -> [([NameSegment], Name)] splits (Name p ss0) = ss0 & List.NonEmpty.toList @@ -356,7 +356,7 @@ splits (Name p ss0) = -- ([], a.b.c) : over (mapped . _1) (a.) (splits b.c) -- ([], a.b.c) : over (mapped . _1) (a.) (([], b.c) : over (mapped . _1) (b.) (splits c)) -- [([], a.b.c), ([a], b.c), ([a.b], c)] - splits0 :: HasCallStack => [a] -> [([a], NonEmpty a)] + splits0 :: (HasCallStack) => [a] -> [([a], NonEmpty a)] splits0 = \case [] -> [] [x] -> [([], x :| [])] @@ -417,7 +417,7 @@ suffixFrom (Name p0 ss0) (Name _ ss1) = do -- that match. -- -- align [a,b] [x,a,b,y] = Just [x,a,b] - align :: forall a. Eq a => [a] -> [a] -> Maybe [a] + align :: forall a. (Eq a) => [a] -> [a] -> Maybe [a] align xs = go id where @@ -447,7 +447,7 @@ unqualified (Name _ (s :| _)) = -- -- NB: Only works if the `Ord` instance for `Name` orders based on -- `Name.reverseSegments`. -shortestUniqueSuffix :: forall r. Ord r => Name -> r -> R.Relation Name r -> Name +shortestUniqueSuffix :: forall r. (Ord r) => Name -> r -> R.Relation Name r -> Name shortestUniqueSuffix fqn r rel = fromMaybe fqn (List.find isOk (suffixes' fqn)) where diff --git a/unison-core/src/Unison/Names.hs b/unison-core/src/Unison/Names.hs index 7bc3e27e8..ebb41b0dc 100644 --- a/unison-core/src/Unison/Names.hs +++ b/unison-core/src/Unison/Names.hs @@ -495,7 +495,7 @@ hashQualifyTermsRelation = hashQualifyRelation HQ.fromNamedReferent hashQualifyTypesRelation :: R.Relation Name TypeReference -> R.Relation (HQ.HashQualified Name) TypeReference hashQualifyTypesRelation = hashQualifyRelation HQ.fromNamedReference -hashQualifyRelation :: Ord r => (Name -> r -> HQ.HashQualified Name) -> R.Relation Name r -> R.Relation (HQ.HashQualified Name) r +hashQualifyRelation :: (Ord r) => (Name -> r -> HQ.HashQualified Name) -> R.Relation Name r -> R.Relation (HQ.HashQualified Name) r hashQualifyRelation fromNamedRef rel = R.map go rel where go (n, r) = diff --git a/unison-core/src/Unison/NamesWithHistory.hs b/unison-core/src/Unison/NamesWithHistory.hs index 86fb1fb59..96749b028 100644 --- a/unison-core/src/Unison/NamesWithHistory.hs +++ b/unison-core/src/Unison/NamesWithHistory.hs @@ -183,7 +183,7 @@ lookupHQTerm' = -- See 'lookupHQTerm', 'lookupHQType' for monomorphic versions. lookupHQRef :: forall r. - Ord r => + (Ord r) => -- | A projection of types or terms from a Names. (Names -> Relation Name r) -> -- | isPrefixOf, for references or referents diff --git a/unison-core/src/Unison/Pattern.hs b/unison-core/src/Unison/Pattern.hs index 72bd2a480..d0446434e 100644 --- a/unison-core/src/Unison/Pattern.hs +++ b/unison-core/src/Unison/Pattern.hs @@ -132,7 +132,7 @@ instance Eq (Pattern loc) where SequenceOp _ ph op pt == SequenceOp _ ph2 op2 pt2 = ph == ph2 && op == op2 && pt == pt2 _ == _ = False -foldMap' :: Monoid m => (Pattern loc -> m) -> Pattern loc -> m +foldMap' :: (Monoid m) => (Pattern loc -> m) -> Pattern loc -> m foldMap' f p = case p of Unbound _ -> f p Var _ -> f p @@ -150,7 +150,7 @@ foldMap' f p = case p of SequenceOp _ p1 _ p2 -> f p <> foldMap' f p1 <> foldMap' f p2 generalizedDependencies :: - Ord r => + (Ord r) => (Reference -> r) -> (Reference -> ConstructorId -> r) -> (Reference -> r) -> diff --git a/unison-core/src/Unison/Term.hs b/unison-core/src/Unison/Term.hs index f28c8ad19..1656d3380 100644 --- a/unison-core/src/Unison/Term.hs +++ b/unison-core/src/Unison/Term.hs @@ -144,7 +144,7 @@ type Term0' vt v = Term' vt v () bindNames :: forall v a. - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Names -> @@ -183,7 +183,7 @@ bindNames unsafeVarToName keepFreeTerms ns0 e = do -- lookup. Any terms not found in the `Names` are kept free. bindSomeNames :: forall v a. - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Names -> @@ -213,7 +213,7 @@ bindSomeNames unsafeVarToName avoid ns e = bindNames unsafeVarToName (avoid <> v -- Prepare a term for type-directed name resolution by replacing -- any remaining free variables with blanks to be resolved by TDNR -prepareTDNR :: Var v => ABT.Term (F vt b ap) v b -> ABT.Term (F vt b ap) v b +prepareTDNR :: (Var v) => ABT.Term (F vt b ap) v b -> ABT.Term (F vt b ap) v b prepareTDNR t = fmap fst . ABT.visitPure f $ ABT.annotateBound t where f (ABT.Term _ (a, bound) (ABT.Var v)) @@ -221,7 +221,7 @@ prepareTDNR t = fmap fst . ABT.visitPure f $ ABT.annotateBound t Just $ resolve (a, bound) a (Text.unpack $ Var.name v) f _ = Nothing -amap :: Ord v => (a -> a2) -> Term v a -> Term v a2 +amap :: (Ord v) => (a -> a2) -> Term v a -> Term v a2 amap f = fmap f . patternMap (fmap f) . typeMap (fmap f) patternMap :: (Pattern ap -> Pattern ap2) -> Term2 vt at ap v a -> Term2 vt at ap2 v a @@ -241,14 +241,14 @@ patternMap f = go -- Safe since `Match` is only ctor that has embedded `Pattern ap` arg ABT.Tm ts -> unsafeCoerce $ ABT.Tm (fmap go ts) -vmap :: Ord v2 => (v -> v2) -> Term v a -> Term v2 a +vmap :: (Ord v2) => (v -> v2) -> Term v a -> Term v2 a vmap f = ABT.vmap f . typeMap (ABT.vmap f) -vtmap :: Ord vt2 => (vt -> vt2) -> Term' vt v a -> Term' vt2 v a +vtmap :: (Ord vt2) => (vt -> vt2) -> Term' vt v a -> Term' vt2 v a vtmap f = typeMap (ABT.vmap f) typeMap :: - Ord vt2 => + (Ord vt2) => (Type vt at -> Type vt2 at2) -> Term2 vt at ap v a -> Term2 vt2 at2 ap v a @@ -308,7 +308,7 @@ matchCaseExtraMap :: (loc -> loc') -> MatchCase loc a -> MatchCase loc' a matchCaseExtraMap f (MatchCase p x y) = MatchCase (fmap f p) x y unannotate :: - forall vt at ap v a. Ord v => Term2 vt at ap v a -> Term0' vt v + forall vt at ap v a. (Ord v) => Term2 vt at ap v a -> Term0' vt v unannotate = go where go :: Term2 vt at ap v a -> Term0' vt v @@ -323,12 +323,12 @@ unannotate = go f' -> ABT.tm (unsafeCoerce f') go _ = error "unpossible" -wrapV :: Ord v => Term v a -> Term (ABT.V v) a +wrapV :: (Ord v) => Term v a -> Term (ABT.V v) a wrapV = vmap ABT.Bound -- | All variables mentioned in the given term. -- Includes both term and type variables, both free and bound. -allVars :: Ord v => Term v a -> Set v +allVars :: (Ord v) => Term v a -> Set v allVars tm = Set.fromList $ ABT.allVars tm ++ [v | tp <- allTypes tm, v <- ABT.allVars tp] @@ -340,10 +340,10 @@ allVars tm = freeVars :: Term' vt v a -> Set v freeVars = ABT.freeVars -freeTypeVars :: Ord vt => Term' vt v a -> Set vt +freeTypeVars :: (Ord vt) => Term' vt v a -> Set vt freeTypeVars t = Map.keysSet $ freeTypeVarAnnotations t -freeTypeVarAnnotations :: Ord vt => Term' vt v a -> Map vt [a] +freeTypeVarAnnotations :: (Ord vt) => Term' vt v a -> Map vt [a] freeTypeVarAnnotations e = multimap $ go Set.empty e where go bound tm = case tm of @@ -619,15 +619,15 @@ pattern List' :: pattern List' xs <- (ABT.out -> ABT.Tm (List xs)) pattern Lam' :: - ABT.Var v => + (ABT.Var v) => ABT.Subst (F typeVar typeAnn patternAnn) v a -> ABT.Term (F typeVar typeAnn patternAnn) v a pattern Lam' subst <- ABT.Tm' (Lam (ABT.Abs' subst)) -pattern Delay' :: Ord v => Term2 vt at ap v a -> Term2 vt at ap v a +pattern Delay' :: (Ord v) => Term2 vt at ap v a -> Term2 vt at ap v a pattern Delay' body <- (unDelay -> Just body) -unDelay :: Ord v => Term2 vt at ap v a -> Maybe (Term2 vt at ap v a) +unDelay :: (Ord v) => Term2 vt at ap v a -> Maybe (Term2 vt at ap v a) unDelay tm = case ABT.out tm of ABT.Tm (Lam (ABT.Term _ _ (ABT.Abs v body))) | Set.notMember v (ABT.freeVars body) -> @@ -650,21 +650,21 @@ pattern LamsNamedPred' :: [v] -> Term2 vt at ap v a -> (Term2 vt at ap v a, v -> pattern LamsNamedPred' vs body <- (unLamsPred' -> Just (vs, body)) pattern LamsNamedOrDelay' :: - Var v => + (Var v) => [v] -> Term2 vt at ap v a -> Term2 vt at ap v a pattern LamsNamedOrDelay' vs body <- (unLamsUntilDelay' -> Just (vs, body)) pattern Let1' :: - Var v => + (Var v) => Term' vt v a -> ABT.Subst (F vt a a) v a -> Term' vt v a pattern Let1' b subst <- (unLet1 -> Just (_, b, subst)) pattern Let1Top' :: - Var v => + (Var v) => IsTop -> Term' vt v a -> ABT.Subst (F vt a a) v a -> @@ -732,7 +732,7 @@ pattern LetRecNamedAnnotatedTop' :: pattern LetRecNamedAnnotatedTop' top ann bs e <- (unLetRecNamedAnnotated -> Just (top, ann, bs, e)) -fresh :: Var v => Term0 v -> v -> v +fresh :: (Var v) => Term0 v -> v -> v fresh = ABT.fresh -- some smart constructors @@ -740,10 +740,10 @@ fresh = ABT.fresh var :: a -> v -> Term2 vt at ap v a var = ABT.annotatedVar -var' :: Var v => Text -> Term0' vt v +var' :: (Var v) => Text -> Term0' vt v var' = var () . Var.named -ref :: Ord v => a -> Reference -> Term2 vt at ap v a +ref :: (Ord v) => a -> Reference -> Term2 vt at ap v a ref a r = ABT.tm' a (Ref r) pattern Referent' :: Referent -> Term2 vt at ap v a @@ -755,34 +755,34 @@ unReferent (Constructor' r) = Just $ Referent.Con r CT.Data unReferent (Request' r) = Just $ Referent.Con r CT.Effect unReferent _ = Nothing -refId :: Ord v => a -> Reference.Id -> Term2 vt at ap v a +refId :: (Ord v) => a -> Reference.Id -> Term2 vt at ap v a refId a = ref a . Reference.DerivedId -termLink :: Ord v => a -> Referent -> Term2 vt at ap v a +termLink :: (Ord v) => a -> Referent -> Term2 vt at ap v a termLink a r = ABT.tm' a (TermLink r) -typeLink :: Ord v => a -> Reference -> Term2 vt at ap v a +typeLink :: (Ord v) => a -> Reference -> Term2 vt at ap v a typeLink a r = ABT.tm' a (TypeLink r) -builtin :: Ord v => a -> Text -> Term2 vt at ap v a +builtin :: (Ord v) => a -> Text -> Term2 vt at ap v a builtin a n = ref a (Reference.Builtin n) -float :: Ord v => a -> Double -> Term2 vt at ap v a +float :: (Ord v) => a -> Double -> Term2 vt at ap v a float a d = ABT.tm' a (Float d) -boolean :: Ord v => a -> Bool -> Term2 vt at ap v a +boolean :: (Ord v) => a -> Bool -> Term2 vt at ap v a boolean a b = ABT.tm' a (Boolean b) -int :: Ord v => a -> Int64 -> Term2 vt at ap v a +int :: (Ord v) => a -> Int64 -> Term2 vt at ap v a int a d = ABT.tm' a (Int d) -nat :: Ord v => a -> Word64 -> Term2 vt at ap v a +nat :: (Ord v) => a -> Word64 -> Term2 vt at ap v a nat a d = ABT.tm' a (Nat d) -text :: Ord v => a -> Text -> Term2 vt at ap v a +text :: (Ord v) => a -> Text -> Term2 vt at ap v a text a = ABT.tm' a . Text -char :: Ord v => a -> Char -> Term2 vt at ap v a +char :: (Ord v) => a -> Char -> Term2 vt at ap v a char a = ABT.tm' a . Char watch :: (Var v, Semigroup a) => a -> String -> Term v a -> Term v a @@ -793,48 +793,48 @@ watchMaybe :: (Var v, Semigroup a) => Maybe String -> Term v a -> Term v a watchMaybe Nothing e = e watchMaybe (Just note) e = watch (ABT.annotation e) note e -blank :: Ord v => a -> Term2 vt at ap v a +blank :: (Ord v) => a -> Term2 vt at ap v a blank a = ABT.tm' a (Blank B.Blank) -placeholder :: Ord v => a -> String -> Term2 vt a ap v a +placeholder :: (Ord v) => a -> String -> Term2 vt a ap v a placeholder a s = ABT.tm' a . Blank $ B.Recorded (B.Placeholder a s) -resolve :: Ord v => at -> ab -> String -> Term2 vt ab ap v at +resolve :: (Ord v) => at -> ab -> String -> Term2 vt ab ap v at resolve at ab s = ABT.tm' at . Blank $ B.Recorded (B.Resolve ab s) -constructor :: Ord v => a -> ConstructorReference -> Term2 vt at ap v a +constructor :: (Ord v) => a -> ConstructorReference -> Term2 vt at ap v a constructor a ref = ABT.tm' a (Constructor ref) -request :: Ord v => a -> ConstructorReference -> Term2 vt at ap v a +request :: (Ord v) => a -> ConstructorReference -> Term2 vt at ap v a request a ref = ABT.tm' a (Request ref) -- todo: delete and rename app' to app -app_ :: Ord v => Term0' vt v -> Term0' vt v -> Term0' vt v +app_ :: (Ord v) => Term0' vt v -> Term0' vt v -> Term0' vt v app_ f arg = ABT.tm (App f arg) -app :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a +app :: (Ord v) => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a app a f arg = ABT.tm' a (App f arg) -match :: Ord v => a -> Term2 vt at a v a -> [MatchCase a (Term2 vt at a v a)] -> Term2 vt at a v a +match :: (Ord v) => a -> Term2 vt at a v a -> [MatchCase a (Term2 vt at a v a)] -> Term2 vt at a v a match a scrutinee branches = ABT.tm' a (Match scrutinee branches) -handle :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a +handle :: (Ord v) => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a handle a h block = ABT.tm' a (Handle h block) -and :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a +and :: (Ord v) => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a and a x y = ABT.tm' a (And x y) -or :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a +or :: (Ord v) => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a or a x y = ABT.tm' a (Or x y) -list :: Ord v => a -> [Term2 vt at ap v a] -> Term2 vt at ap v a +list :: (Ord v) => a -> [Term2 vt at ap v a] -> Term2 vt at ap v a list a es = list' a (Sequence.fromList es) -list' :: Ord v => a -> Seq (Term2 vt at ap v a) -> Term2 vt at ap v a +list' :: (Ord v) => a -> Seq (Term2 vt at ap v a) -> Term2 vt at ap v a list' a es = ABT.tm' a (List es) apps :: - Ord v => + (Ord v) => Term2 vt at ap v a -> [(a, Term2 vt at ap v a)] -> Term2 vt at ap v a @@ -847,14 +847,14 @@ apps' :: Term2 vt at ap v a apps' = foldl' (\f t -> app (ABT.annotation f <> ABT.annotation t) f t) -iff :: Ord v => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a +iff :: (Ord v) => a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a -> Term2 vt at ap v a iff a cond t f = ABT.tm' a (If cond t f) -ann_ :: Ord v => Term0' vt v -> Type vt () -> Term0' vt v +ann_ :: (Ord v) => Term0' vt v -> Type vt () -> Term0' vt v ann_ e t = ABT.tm (Ann e t) ann :: - Ord v => + (Ord v) => a -> Term2 vt at ap v a -> Type vt at -> @@ -862,17 +862,17 @@ ann :: ann a e t = ABT.tm' a (Ann e t) -- arya: are we sure we want the two annotations to be the same? -lam :: Ord v => a -> v -> Term2 vt at ap v a -> Term2 vt at ap v a +lam :: (Ord v) => a -> v -> Term2 vt at ap v a -> Term2 vt at ap v a lam a v body = ABT.tm' a (Lam (ABT.abs' a v body)) -delay :: Var v => a -> Term2 vt at ap v a -> Term2 vt at ap v a +delay :: (Var v) => a -> Term2 vt at ap v a -> Term2 vt at ap v a delay a body = ABT.tm' a (Lam (ABT.abs' a (ABT.freshIn (ABT.freeVars body) (Var.named "_")) body)) -lam' :: Ord v => a -> [v] -> Term2 vt at ap v a -> Term2 vt at ap v a +lam' :: (Ord v) => a -> [v] -> Term2 vt at ap v a -> Term2 vt at ap v a lam' a vs body = foldr (lam a) body vs -lam'' :: Ord v => [(a, v)] -> Term2 vt at ap v a -> Term2 vt at ap v a +lam'' :: (Ord v) => [(a, v)] -> Term2 vt at ap v a -> Term2 vt at ap v a lam'' vs body = foldr (uncurry lam) body vs isLam :: Term2 vt at ap v a -> Bool @@ -949,7 +949,7 @@ letRec isTop blockAnn bindings e = -- | Smart constructor for let rec blocks. Each binding in the block may -- reference any other binding in the block in its body (including itself), -- and the output expression may also reference any binding in the block. -letRec_ :: Ord v => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v +letRec_ :: (Ord v) => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v letRec_ _ [] e = e letRec_ isTop bindings e = ABT.cycle (foldr (ABT.abs . fst) z bindings) where @@ -959,7 +959,7 @@ letRec_ isTop bindings e = ABT.cycle (foldr (ABT.abs . fst) z bindings) -- reference only previous bindings in the block, not including itself. -- The output expression may reference any binding in the block. -- todo: delete me -let1_ :: Ord v => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v +let1_ :: (Ord v) => IsTop -> [(v, Term0' vt v)] -> Term0' vt v -> Term0' vt v let1_ isTop bindings e = foldr f e bindings where f (v, b) body = ABT.tm (Let isTop b (ABT.abs v body)) @@ -990,7 +990,7 @@ let1' isTop bindings e = foldr f e bindings -- | Like 'let1', but for a single binding, avoiding the Semigroup constraint. singleLet :: - Ord v => + (Ord v) => IsTop -> -- Annotation spanning the whole let-binding a -> @@ -1003,7 +1003,7 @@ singleLet isTop a (v, body) e = ABT.tm' a (Let isTop body (ABT.abs' a v e)) -- let1' bs e = let1 [(ABT.v' name, b) | (name,b) <- bs ] e unLet1 :: - Var v => + (Var v) => Term' vt v a -> Maybe (IsTop, Term' vt v a, ABT.Subst (F vt a a) v a) unLet1 (ABT.Tm' (Let isTop b (ABT.Abs' subst))) = Just (isTop, b, subst) @@ -1158,7 +1158,7 @@ unLamsOpt' t = case unLams' t of -- Same as unLams', but stops at any variable named `()`, which indicates a -- delay (`'`) annotation which we want to preserve. unLamsUntilDelay' :: - Var v => + (Var v) => Term2 vt at ap v a -> Maybe ([v], Term2 vt at ap v a) unLamsUntilDelay' t = case unLamsPred' (t, (/=) $ Var.named "()") of @@ -1274,7 +1274,7 @@ labeledDependencies = LD.typeRef updateDependencies :: - Ord v => + (Ord v) => Map Referent Referent -> Map Reference Reference -> Term v a -> @@ -1303,16 +1303,16 @@ updateDependencies termUpdates typeUpdates = ABT.rebuildUp go -- | If the outermost term is a function application, -- perform substitution of the argument into the body -betaReduce :: Var v => Term0 v -> Term0 v +betaReduce :: (Var v) => Term0 v -> Term0 v betaReduce (App' (Lam' f) arg) = ABT.bind f arg betaReduce e = e -betaNormalForm :: Var v => Term0 v -> Term0 v +betaNormalForm :: (Var v) => Term0 v -> Term0 v betaNormalForm (App' f a) = betaNormalForm (betaReduce (app () (betaNormalForm f) a)) betaNormalForm e = e -- x -> f x => f -etaNormalForm :: Ord v => Term0 v -> Term0 v +etaNormalForm :: (Ord v) => Term0 v -> Term0 v etaNormalForm tm = case tm of LamNamed' v body -> step . lam (ABT.annotation tm) v $ etaNormalForm body where @@ -1322,12 +1322,13 @@ etaNormalForm tm = case tm of _ -> tm -- x -> f x => f as long as `x` is a variable of type `Var.Eta` -etaReduceEtaVars :: Var v => Term0 v -> Term0 v +etaReduceEtaVars :: (Var v) => Term0 v -> Term0 v etaReduceEtaVars tm = case tm of LamNamed' v body -> step . lam (ABT.annotation tm) v $ etaReduceEtaVars body where ok v v' f = - v == v' && Var.typeOf v == Var.Eta + v == v' + && Var.typeOf v == Var.Eta && v `Set.notMember` freeVars f step (LamNamed' v (App' f (Var' v'))) | ok v v' f = f step tm = tm @@ -1337,7 +1338,7 @@ etaReduceEtaVars tm = case tm of -- back to free variables unhashComponent :: forall v a. - Var v => + (Var v) => Map Reference.Id (Term v a) -> Map Reference.Id (v, Term v a) unhashComponent m = @@ -1356,7 +1357,7 @@ unhashComponent m = in second unhash1 <$> m' fromReferent :: - Ord v => + (Ord v) => a -> Referent -> Term2 vt at ap v a diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index a676a2b6a..19503dae3 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -42,18 +42,18 @@ _Ref = _Ctor @"Ref" -- | Types are represented as ABTs over the base functor F, with variables in `v` type Type v a = ABT.Term F v a -wrapV :: Ord v => Type v a -> Type (ABT.V v) a +wrapV :: (Ord v) => Type v a -> Type (ABT.V v) a wrapV = ABT.vmap ABT.Bound freeVars :: Type v a -> Set v freeVars = ABT.freeVars bindExternal :: - ABT.Var v => [(v, Reference)] -> Type v a -> Type v a + (ABT.Var v) => [(v, Reference)] -> Type v a -> Type v a bindExternal bs = ABT.substsInheritAnnotation [(v, ref () r) | (v, r) <- bs] bindReferences :: - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Map Name.Name Reference -> @@ -72,7 +72,7 @@ instance (Show v) => Show (Monotype v a) where show = show . getPolytype -- Smart constructor which checks if a `Type` has no `Forall` quantifiers. -monotype :: ABT.Var v => Type v a -> Maybe (Monotype v a) +monotype :: (ABT.Var v) => Type v a -> Maybe (Monotype v a) monotype t = Monotype <$> ABT.visit isMono t where isMono (Forall' _) = Just Nothing @@ -91,7 +91,7 @@ pattern Ref' r <- ABT.Tm' (Ref r) pattern Arrow' :: ABT.Term F v a -> ABT.Term F v a -> ABT.Term F v a pattern Arrow' i o <- ABT.Tm' (Arrow i o) -pattern Arrow'' :: Ord v => ABT.Term F v a -> [Type v a] -> Type v a -> ABT.Term F v a +pattern Arrow'' :: (Ord v) => ABT.Term F v a -> [Type v a] -> Type v a -> ABT.Term F v a pattern Arrow'' i es o <- Arrow' i (Effect'' es o) pattern Arrows' :: [Type v a] -> Type v a @@ -109,7 +109,7 @@ pattern App' f x <- ABT.Tm' (App f x) pattern Apps' :: Type v a -> [Type v a] -> Type v a pattern Apps' f args <- (unApps -> Just (f, args)) -pattern Pure' :: Ord v => Type v a -> Type v a +pattern Pure' :: (Ord v) => Type v a -> Type v a pattern Pure' t <- (unPure -> Just t) pattern Effects' :: [ABT.Term F v a] -> ABT.Term F v a @@ -119,20 +119,20 @@ pattern Effects' es <- ABT.Tm' (Effects es) pattern Effect1' :: ABT.Term F v a -> ABT.Term F v a -> ABT.Term F v a pattern Effect1' e t <- ABT.Tm' (Effect e t) -pattern Effect' :: Ord v => [Type v a] -> Type v a -> Type v a +pattern Effect' :: (Ord v) => [Type v a] -> Type v a -> Type v a pattern Effect' es t <- (unEffects1 -> Just (es, t)) -pattern Effect'' :: Ord v => [Type v a] -> Type v a -> Type v a +pattern Effect'' :: (Ord v) => [Type v a] -> Type v a -> Type v a pattern Effect'' es t <- (unEffect0 -> (es, t)) -- Effect0' may match zero effects -pattern Effect0' :: Ord v => [Type v a] -> Type v a -> Type v a +pattern Effect0' :: (Ord v) => [Type v a] -> Type v a -> Type v a pattern Effect0' es t <- (unEffect0 -> (es, t)) -pattern Forall' :: ABT.Var v => ABT.Subst F v a -> ABT.Term F v a +pattern Forall' :: (ABT.Var v) => ABT.Subst F v a -> ABT.Term F v a pattern Forall' subst <- ABT.Tm' (Forall (ABT.Abs' subst)) -pattern IntroOuter' :: ABT.Var v => ABT.Subst F v a -> ABT.Term F v a +pattern IntroOuter' :: (ABT.Var v) => ABT.Subst F v a -> ABT.Term F v a pattern IntroOuter' subst <- ABT.Tm' (IntroOuter (ABT.Abs' subst)) pattern IntroOuterNamed' :: v -> ABT.Term F v a -> ABT.Term F v a @@ -153,7 +153,7 @@ pattern Cycle' xs t <- ABT.Cycle' xs t pattern Abs' :: (Foldable f, Functor f, ABT.Var v) => ABT.Subst f v a -> ABT.Term f v a pattern Abs' subst <- ABT.Abs' subst -unPure :: Ord v => Type v a -> Maybe (Type v a) +unPure :: (Ord v) => Type v a -> Maybe (Type v a) unPure (Effect'' [] t) = Just t unPure (Effect'' _ _) = Nothing unPure t = Just t @@ -208,35 +208,35 @@ unForalls t = go t [] go _body [] = Nothing go body vs = Just (reverse vs, body) -unEffect0 :: Ord v => Type v a -> ([Type v a], Type v a) +unEffect0 :: (Ord v) => Type v a -> ([Type v a], Type v a) unEffect0 (Effect1' e a) = (flattenEffects e, a) unEffect0 t = ([], t) -unEffects1 :: Ord v => Type v a -> Maybe ([Type v a], Type v a) +unEffects1 :: (Ord v) => Type v a -> Maybe ([Type v a], Type v a) unEffects1 (Effect1' (Effects' es) a) = Just (es, a) unEffects1 _ = Nothing -- | True if the given type is a function, possibly quantified -isArrow :: ABT.Var v => Type v a -> Bool +isArrow :: (ABT.Var v) => Type v a -> Bool isArrow (ForallNamed' _ t) = isArrow t isArrow (Arrow' _ _) = True isArrow _ = False -- some smart constructors -ref :: Ord v => a -> Reference -> Type v a +ref :: (Ord v) => a -> Reference -> Type v a ref a = ABT.tm' a . Ref -refId :: Ord v => a -> Reference.Id -> Type v a +refId :: (Ord v) => a -> Reference.Id -> Type v a refId a = ref a . Reference.DerivedId -termLink :: Ord v => a -> Type v a +termLink :: (Ord v) => a -> Type v a termLink a = ABT.tm' a . Ref $ termLinkRef -typeLink :: Ord v => a -> Type v a +typeLink :: (Ord v) => a -> Type v a typeLink a = ABT.tm' a . Ref $ typeLinkRef -derivedBase32Hex :: Ord v => Reference -> a -> Type v a +derivedBase32Hex :: (Ord v) => Reference -> a -> Type v a derivedBase32Hex r a = ref a r intRef, natRef, floatRef, booleanRef, textRef, charRef, listRef, bytesRef, effectRef, termLinkRef, typeLinkRef :: Reference @@ -324,76 +324,76 @@ anyRef = Reference.Builtin "Any" timeSpecRef :: Reference timeSpecRef = Reference.Builtin "TimeSpec" -any :: Ord v => a -> Type v a +any :: (Ord v) => a -> Type v a any a = ref a anyRef -builtin :: Ord v => a -> Text -> Type v a +builtin :: (Ord v) => a -> Text -> Type v a builtin a = ref a . Reference.Builtin -int :: Ord v => a -> Type v a +int :: (Ord v) => a -> Type v a int a = ref a intRef -nat :: Ord v => a -> Type v a +nat :: (Ord v) => a -> Type v a nat a = ref a natRef -float :: Ord v => a -> Type v a +float :: (Ord v) => a -> Type v a float a = ref a floatRef -boolean :: Ord v => a -> Type v a +boolean :: (Ord v) => a -> Type v a boolean a = ref a booleanRef -text :: Ord v => a -> Type v a +text :: (Ord v) => a -> Type v a text a = ref a textRef -char :: Ord v => a -> Type v a +char :: (Ord v) => a -> Type v a char a = ref a charRef -fileHandle :: Ord v => a -> Type v a +fileHandle :: (Ord v) => a -> Type v a fileHandle a = ref a fileHandleRef -processHandle :: Ord v => a -> Type v a +processHandle :: (Ord v) => a -> Type v a processHandle a = ref a processHandleRef -threadId :: Ord v => a -> Type v a +threadId :: (Ord v) => a -> Type v a threadId a = ref a threadIdRef -builtinIO :: Ord v => a -> Type v a +builtinIO :: (Ord v) => a -> Type v a builtinIO a = ref a builtinIORef -scopeType :: Ord v => a -> Type v a +scopeType :: (Ord v) => a -> Type v a scopeType a = ref a scopeRef -refType :: Ord v => a -> Type v a +refType :: (Ord v) => a -> Type v a refType a = ref a refRef -iarrayType, marrayType, ibytearrayType, mbytearrayType :: Ord v => a -> Type v a +iarrayType, marrayType, ibytearrayType, mbytearrayType :: (Ord v) => a -> Type v a iarrayType a = ref a iarrayRef marrayType a = ref a marrayRef ibytearrayType a = ref a ibytearrayRef mbytearrayType a = ref a mbytearrayRef -socket :: Ord v => a -> Type v a +socket :: (Ord v) => a -> Type v a socket a = ref a socketRef -list :: Ord v => a -> Type v a +list :: (Ord v) => a -> Type v a list a = ref a listRef -bytes :: Ord v => a -> Type v a +bytes :: (Ord v) => a -> Type v a bytes a = ref a bytesRef -effectType :: Ord v => a -> Type v a +effectType :: (Ord v) => a -> Type v a effectType a = ref a $ effectRef -code, value :: Ord v => a -> Type v a +code, value :: (Ord v) => a -> Type v a code a = ref a codeRef value a = ref a valueRef -app :: Ord v => a -> Type v a -> Type v a -> Type v a +app :: (Ord v) => a -> Type v a -> Type v a -> Type v a app a f arg = ABT.tm' a (App f arg) -- `f x y z` means `((f x) y) z` and the annotation paired with `y` is the one -- meant for `app (f x) y` -apps :: Ord v => Type v a -> [(a, Type v a)] -> Type v a +apps :: (Ord v) => Type v a -> [(a, Type v a)] -> Type v a apps = foldl' go where go f (a, t) = app a f t app' :: (Ord v, Semigroup a) => Type v a -> Type v a -> Type v a @@ -402,87 +402,87 @@ app' f arg = app (ABT.annotation f <> ABT.annotation arg) f arg apps' :: (Semigroup a, Ord v) => Type v a -> [Type v a] -> Type v a apps' = foldl app' -arrow :: Ord v => a -> Type v a -> Type v a -> Type v a +arrow :: (Ord v) => a -> Type v a -> Type v a -> Type v a arrow a i o = ABT.tm' a (Arrow i o) arrow' :: (Semigroup a, Ord v) => Type v a -> Type v a -> Type v a arrow' i o = arrow (ABT.annotation i <> ABT.annotation o) i o -ann :: Ord v => a -> Type v a -> K.Kind -> Type v a +ann :: (Ord v) => a -> Type v a -> K.Kind -> Type v a ann a e t = ABT.tm' a (Ann e t) -forall :: Ord v => a -> v -> Type v a -> Type v a +forall :: (Ord v) => a -> v -> Type v a -> Type v a forall a v body = ABT.tm' a (Forall (ABT.abs' a v body)) -introOuter :: Ord v => a -> v -> Type v a -> Type v a +introOuter :: (Ord v) => a -> v -> Type v a -> Type v a introOuter a v body = ABT.tm' a (IntroOuter (ABT.abs' a v body)) -iff :: Var v => Type v () +iff :: (Var v) => Type v () iff = forall () aa $ arrows (f <$> [boolean (), a, a]) a where aa = Var.named "a" a = var () aa f x = ((), x) -iff' :: Var v => a -> Type v a +iff' :: (Var v) => a -> Type v a iff' loc = forall loc aa $ arrows (f <$> [boolean loc, a, a]) a where aa = Var.named "a" a = var loc aa f x = (loc, x) -iff2 :: Var v => a -> Type v a +iff2 :: (Var v) => a -> Type v a iff2 loc = forall loc aa $ arrows (f <$> [a, a]) a where aa = Var.named "a" a = var loc aa f x = (loc, x) -andor :: Ord v => Type v () +andor :: (Ord v) => Type v () andor = arrows (f <$> [boolean (), boolean ()]) $ boolean () where f x = ((), x) -andor' :: Ord v => a -> Type v a +andor' :: (Ord v) => a -> Type v a andor' a = arrows (f <$> [boolean a, boolean a]) $ boolean a where f x = (a, x) -var :: Ord v => a -> v -> Type v a +var :: (Ord v) => a -> v -> Type v a var = ABT.annotatedVar -v' :: Var v => Text -> Type v () +v' :: (Var v) => Text -> Type v () v' s = ABT.var (Var.named s) -- Like `v'`, but creates an annotated variable given an annotation -av' :: Var v => a -> Text -> Type v a +av' :: (Var v) => a -> Text -> Type v a av' a s = ABT.annotatedVar a (Var.named s) -forall' :: Var v => a -> [Text] -> Type v a -> Type v a +forall' :: (Var v) => a -> [Text] -> Type v a -> Type v a forall' a vs body = foldr (forall a) body (Var.named <$> vs) -foralls :: Ord v => a -> [v] -> Type v a -> Type v a +foralls :: (Ord v) => a -> [v] -> Type v a -> Type v a foralls a vs body = foldr (forall a) body vs -- Note: `a -> b -> c` parses as `a -> (b -> c)` -- the annotation associated with `b` will be the annotation for the `b -> c` -- node -arrows :: Ord v => [(a, Type v a)] -> Type v a -> Type v a +arrows :: (Ord v) => [(a, Type v a)] -> Type v a -> Type v a arrows ts result = foldr go result ts where go = uncurry arrow -- The types of effectful computations -effect :: Ord v => a -> [Type v a] -> Type v a -> Type v a +effect :: (Ord v) => a -> [Type v a] -> Type v a -> Type v a effect a es (Effect1' fs t) = let es' = (es >>= flattenEffects) ++ flattenEffects fs in ABT.tm' a (Effect (ABT.tm' a (Effects es')) t) effect a es t = ABT.tm' a (Effect (ABT.tm' a (Effects es)) t) -effects :: Ord v => a -> [Type v a] -> Type v a +effects :: (Ord v) => a -> [Type v a] -> Type v a effects a es = ABT.tm' a (Effects $ es >>= flattenEffects) -effect1 :: Ord v => a -> Type v a -> Type v a -> Type v a +effect1 :: (Ord v) => a -> Type v a -> Type v a -> Type v a effect1 a es (Effect1' fs t) = let es' = flattenEffects es ++ flattenEffects fs in ABT.tm' a (Effect (ABT.tm' a (Effects es')) t) @@ -494,28 +494,28 @@ flattenEffects es = [es] -- The types of first-class effect values -- which get deconstructed in effect handlers. -effectV :: Ord v => a -> (a, Type v a) -> (a, Type v a) -> Type v a +effectV :: (Ord v) => a -> (a, Type v a) -> (a, Type v a) -> Type v a effectV builtinA e t = apps (builtin builtinA "Effect") [e, t] -- Strips effects from a type. E.g. `{e} a` becomes `a`. -stripEffect :: Ord v => Type v a -> ([Type v a], Type v a) +stripEffect :: (Ord v) => Type v a -> ([Type v a], Type v a) stripEffect (Effect' e t) = case stripEffect t of (ei, t) -> (e ++ ei, t) stripEffect t = ([], t) -- The type of the flipped function application operator: -- `(a -> (a -> b) -> b)` -flipApply :: Var v => Type v () -> Type v () +flipApply :: (Var v) => Type v () -> Type v () flipApply t = forall () b $ arrow () (arrow () t (var () b)) (var () b) where b = ABT.fresh t (Var.named "b") -generalize' :: Var v => Var.Type -> Type v a -> Type v a +generalize' :: (Var v) => Var.Type -> Type v a -> Type v a generalize' k t = generalize vsk t where vsk = [v | v <- Set.toList (freeVars t), Var.typeOf v == k] -- | Bind the given variables with an outer `forall`, if they are used in `t`. -generalize :: Ord v => [v] -> Type v a -> Type v a +generalize :: (Ord v) => [v] -> Type v a -> Type v a generalize vs t = foldr f t vs where f v t = @@ -529,22 +529,22 @@ unforall' :: Type v a -> ([v], Type v a) unforall' (ForallsNamed' vs t) = (vs, t) unforall' t = ([], t) -dependencies :: Ord v => Type v a -> Set Reference +dependencies :: (Ord v) => Type v a -> Set Reference dependencies t = Set.fromList . Writer.execWriter $ ABT.visit' f t where f t@(Ref r) = Writer.tell [r] $> t f t = pure t -labeledDependencies :: Ord v => Type v a -> Set LD.LabeledDependency +labeledDependencies :: (Ord v) => Type v a -> Set LD.LabeledDependency labeledDependencies = Set.map LD.TypeReference . dependencies -updateDependencies :: Ord v => Map Reference Reference -> Type v a -> Type v a +updateDependencies :: (Ord v) => Map Reference Reference -> Type v a -> Type v a updateDependencies typeUpdates = ABT.rebuildUp go where go (Ref r) = Ref (Map.findWithDefault r r typeUpdates) go f = f -usesEffects :: Ord v => Type v a -> Bool +usesEffects :: (Ord v) => Type v a -> Bool usesEffects t = getAny . getConst $ ABT.visit go t where go (Effect1' _ _) = Just (Const (Any True)) @@ -556,7 +556,7 @@ usesEffects t = getAny . getConst $ ABT.visit go t -- -- This function would return the set {e, e2}, but not `e3` since `e3` -- is bound by the enclosing forall. -freeEffectVars :: Ord v => Type v a -> Set v +freeEffectVars :: (Ord v) => Type v a -> Set v freeEffectVars t = Set.fromList . join . runIdentity $ ABT.foreachSubterm go (snd <$> ABT.annotateBound t) @@ -609,7 +609,7 @@ purifyArrows = ABT.visitPure go go _ = Nothing -- Remove free effect variables from the type that are in the set -removeEffectVars :: ABT.Var v => Set v -> Type v a -> Type v a +removeEffectVars :: (ABT.Var v) => Set v -> Type v a -> Type v a removeEffectVars removals t = let z = effects () [] t' = ABT.substsInheritAnnotation ((,z) <$> Set.toList removals) t @@ -628,7 +628,7 @@ removeEffectVars removals t = -- Used for type-based search, we apply this transformation to both the -- indexed type and the query type, so the user can supply `a -> b` that will -- match `a ->{e} b` (but not `a ->{IO} b`). -removeAllEffectVars :: ABT.Var v => Type v a -> Type v a +removeAllEffectVars :: (ABT.Var v) => Type v a -> Type v a removeAllEffectVars t = let allEffectVars = foldMap go (ABT.subterms t) go (Effects' vs) = Set.fromList [v | Var' v <- vs] @@ -637,7 +637,7 @@ removeAllEffectVars t = (vs, tu) = unforall' t in generalize vs (removeEffectVars allEffectVars tu) -removePureEffects :: ABT.Var v => Type v a -> Type v a +removePureEffects :: (ABT.Var v) => Type v a -> Type v a removePureEffects t | not Settings.removePureEffects = t | otherwise = @@ -667,7 +667,7 @@ removePureEffects t editFunctionResult :: forall v a. - Ord v => + (Ord v) => (Type v a -> Type v a) -> Type v a -> Type v a @@ -696,14 +696,14 @@ functionResult = go False -- `B -> B` becomes `B -> B` (not changed) -- `.foo -> .foo` becomes `.foo -> .foo` (not changed) -- `.foo.bar -> blarrg.woot` becomes `.foo.bar -> blarrg.woot` (unchanged) -generalizeLowercase :: Var v => Set v -> Type v a -> Type v a +generalizeLowercase :: (Var v) => Set v -> Type v a -> Type v a generalizeLowercase except t = foldr (forall (ABT.annotation t)) t vars where vars = [v | v <- Set.toList (ABT.freeVars t `Set.difference` except), Var.universallyQuantifyIfFree v] -- Convert all free variables in `allowed` to variables bound by an `introOuter`. -freeVarsToOuters :: Ord v => Set v -> Type v a -> Type v a +freeVarsToOuters :: (Ord v) => Set v -> Type v a -> Type v a freeVarsToOuters allowed t = foldr (introOuter (ABT.annotation t)) t vars where vars = Set.toList $ ABT.freeVars t `Set.intersection` allowed @@ -711,7 +711,7 @@ freeVarsToOuters allowed t = foldr (introOuter (ABT.annotation t)) t vars -- | This function removes all variable shadowing from the types and reduces -- fresh ids to the minimum possible to avoid ambiguity. Useful when showing -- two different types. -cleanupVars :: Var v => [Type v a] -> [Type v a] +cleanupVars :: (Var v) => [Type v a] -> [Type v a] cleanupVars ts | not Settings.cleanupTypes = ts cleanupVars ts = let changedVars = cleanupVarsMap ts @@ -720,7 +720,7 @@ cleanupVars ts = -- Compute a variable replacement map from a collection of types, which -- can be passed to `cleanupVars1'`. This is used to cleanup variable ids -- for multiple related types, like when reporting a type error. -cleanupVarsMap :: Var v => [Type v a] -> Map.Map v v +cleanupVarsMap :: (Var v) => [Type v a] -> Map.Map v v cleanupVarsMap ts = let varsByName = foldl' step Map.empty (ts >>= ABT.allVars) step m v = Map.insertWith (++) (Var.name $ Var.reset v) [v] m @@ -732,12 +732,12 @@ cleanupVarsMap ts = ] in changedVars -cleanupVars1' :: Var v => Map.Map v v -> Type v a -> Type v a +cleanupVars1' :: (Var v) => Map.Map v v -> Type v a -> Type v a cleanupVars1' = ABT.changeVars -- | This function removes all variable shadowing from the type and reduces -- fresh ids to the minimum possible to avoid ambiguity. -cleanupVars1 :: Var v => Type v a -> Type v a +cleanupVars1 :: (Var v) => Type v a -> Type v a cleanupVars1 t | not Settings.cleanupTypes = t cleanupVars1 t = case cleanupVars [t] of @@ -745,7 +745,7 @@ cleanupVars1 t = _ -> error "cleanupVars1: expected exactly one result" -- This removes duplicates and normalizes the order of ability lists -cleanupAbilityLists :: Var v => Type v a -> Type v a +cleanupAbilityLists :: (Var v) => Type v a -> Type v a cleanupAbilityLists = ABT.visitPure go where -- leave explicitly empty `{}` alone @@ -757,17 +757,17 @@ cleanupAbilityLists = ABT.visitPure go _ -> Just (effect (ABT.annotation t) es $ ABT.visitPure go v) go _ = Nothing -cleanups :: Var v => [Type v a] -> [Type v a] +cleanups :: (Var v) => [Type v a] -> [Type v a] cleanups ts = cleanupVars $ map cleanupAbilityLists ts -cleanup :: Var v => Type v a -> Type v a +cleanup :: (Var v) => Type v a -> Type v a cleanup t | not Settings.cleanupTypes = t cleanup t = cleanupVars1 . cleanupAbilityLists $ t builtinAbilities :: Set Reference builtinAbilities = Set.fromList [builtinIORef, stmRef] -instance Show a => Show (F a) where +instance (Show a) => Show (F a) where showsPrec = go where go _ (Ref r) = shows r @@ -782,7 +782,8 @@ instance Show a => Show (F a) where s "{" <> shows es <> s "}" go p (Effect e t) = showParen (p > 0) $ - showParen True $ shows e <> s " " <> showsPrec p t + showParen True $ + shows e <> s " " <> showsPrec p t go p (Forall body) = case p of 0 -> showsPrec p body _ -> showParen True $ s "∀ " <> shows body diff --git a/unison-core/src/Unison/Type/Names.hs b/unison-core/src/Unison/Type/Names.hs index cc5ef09a0..7949874b1 100644 --- a/unison-core/src/Unison/Type/Names.hs +++ b/unison-core/src/Unison/Type/Names.hs @@ -13,7 +13,7 @@ import qualified Unison.Util.List as List import Unison.Var (Var) bindNames :: - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Names.Names -> diff --git a/unison-core/src/Unison/Util/Components.hs b/unison-core/src/Unison/Util/Components.hs index 88a79fb4c..927aea21d 100644 --- a/unison-core/src/Unison/Util/Components.hs +++ b/unison-core/src/Unison/Util/Components.hs @@ -31,7 +31,7 @@ import Unison.Prelude -- -- Uses Tarjan's algorithm: -- https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm -components :: Ord v => (t -> Set v) -> [(v, t)] -> [[(v, t)]] +components :: (Ord v) => (t -> Set v) -> [(v, t)] -> [[(v, t)]] components freeVars bs = let varIds = Map.fromList (map fst bs `zip` reverse [(1 :: Int) .. length bs]) diff --git a/unison-core/src/Unison/Util/List.hs b/unison-core/src/Unison/Util/List.hs index 018c2432f..acd565a20 100644 --- a/unison-core/src/Unison/Util/List.hs +++ b/unison-core/src/Unison/Util/List.hs @@ -6,7 +6,7 @@ import qualified Data.Map as Map import qualified Data.Set as Set import Unison.Prelude -multimap :: Foldable f => Ord k => f (k, v) -> Map k [v] +multimap :: (Foldable f) => (Ord k) => f (k, v) -> Map k [v] multimap kvs = -- preserve the order of the values from the original list reverse <$> foldl' step Map.empty kvs @@ -49,7 +49,7 @@ nubOrdOn = uniqueBy uniqueBy' :: (Foldable f, Ord b) => (a -> b) -> f a -> [a] uniqueBy' f = reverse . uniqueBy f . reverse . toList -safeHead :: Foldable f => f a -> Maybe a +safeHead :: (Foldable f) => f a -> Maybe a safeHead = headMay . toList validate :: (Semigroup e, Foldable f) => (a -> Either e b) -> f a -> Either e [b] @@ -72,7 +72,7 @@ intercalateMapWith sep f xs = result -- Take runs of consecutive occurrences of r within a list, -- and in each run, overwrite all but the first occurrence of r with w. -quenchRuns :: Eq a => a -> a -> [a] -> [a] +quenchRuns :: (Eq a) => a -> a -> [a] -> [a] quenchRuns r w = reverse . go False r w [] where go inRun r w acc = \case diff --git a/unison-core/src/Unison/Var.hs b/unison-core/src/Unison/Var.hs index 0ff8d3336..25cbf3757 100644 --- a/unison-core/src/Unison/Var.hs +++ b/unison-core/src/Unison/Var.hs @@ -53,10 +53,10 @@ class (Show v, ABT.Var v) => Var v where freshId :: v -> Word64 freshenId :: Word64 -> v -> v -freshIn :: ABT.Var v => Set v -> v -> v +freshIn :: (ABT.Var v) => Set v -> v -> v freshIn = ABT.freshIn -named :: Var v => Text -> v +named :: (Var v) => Text -> v named n = typed (User n) rawName :: Type -> Text @@ -82,26 +82,26 @@ rawName typ = case typ of UnnamedReference ref -> Reference.idToText ref UnnamedWatch k guid -> fromString k <> "." <> guid -name :: Var v => v -> Text +name :: (Var v) => v -> Text name v = rawName (typeOf v) <> showid v where showid (freshId -> 0) = "" showid (freshId -> n) = pack (show n) -- | Currently, actions in blocks are encoded as bindings --- with names of the form _123 (an underscore, followed by +-- with names of the form _123 (an underscore, followed by -- 1 or more digits). This function returns `True` if the -- input variable has this form. --- +-- -- Various places check for this (the pretty-printer, to -- determine how to print the binding), and the typechecker -- (to decide if it should ensure the binding has type `()`). -isAction :: Var v => v -> Bool +isAction :: (Var v) => v -> Bool isAction v = case Text.unpack (name v) of ('_' : rest) | Just _ <- (readMaybe rest :: Maybe Int) -> True _ -> False -uncapitalize :: Var v => v -> v +uncapitalize :: (Var v) => v -> v uncapitalize v = nameds $ go (nameStr v) where go (c : rest) = toLower c : rest @@ -119,7 +119,7 @@ missingResult, inferTypeConstructor, inferTypeConstructorArg, inferOther :: - Var v => v + (Var v) => v missingResult = typed MissingResult blank = typed Blank inferInput = typed (Inference Input) @@ -133,10 +133,10 @@ inferTypeConstructor = typed (Inference TypeConstructor) inferTypeConstructorArg = typed (Inference TypeConstructorArg) inferOther = typed (Inference Other) -unnamedRef :: Var v => Reference.Id -> v +unnamedRef :: (Var v) => Reference.Id -> v unnamedRef ref = typed (UnnamedReference ref) -unnamedTest :: Var v => Text -> v +unnamedTest :: (Var v) => Text -> v unnamedTest guid = typed (UnnamedWatch TestWatch guid) data Type @@ -183,33 +183,33 @@ data InferenceType | Other deriving (Eq, Ord, Show) -reset :: Var v => v -> v +reset :: (Var v) => v -> v reset v = typed (typeOf v) -unqualifiedName :: Var v => v -> Text +unqualifiedName :: (Var v) => v -> Text unqualifiedName = fromMaybe "" . lastMay . Name.segments' . name -unqualified :: Var v => v -> v +unqualified :: (Var v) => v -> v unqualified v = case typeOf v of User _ -> named . unqualifiedName $ v _ -> v -namespaced :: Var v => [v] -> v +namespaced :: (Var v) => [v] -> v namespaced vs = named $ intercalateMap "." name vs -nameStr :: Var v => v -> String +nameStr :: (Var v) => v -> String nameStr = Text.unpack . name -nameds :: Var v => String -> v +nameds :: (Var v) => String -> v nameds s = named (Text.pack s) -joinDot :: Var v => v -> v -> v +joinDot :: (Var v) => v -> v -> v joinDot prefix v2 = if name prefix == "." then named (name prefix `mappend` name v2) else named (name prefix `mappend` "." `mappend` name v2) -universallyQuantifyIfFree :: forall v. Var v => v -> Bool +universallyQuantifyIfFree :: forall v. (Var v) => v -> Bool universallyQuantifyIfFree v = ok (name $ reset v) && unqualified v == v where diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs b/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs index 4d93cbde3..6f3bbd599 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/ABT.hs @@ -105,7 +105,8 @@ hash' env = \case hashInt i = Hashable.accumulate [Hashable.Nat $ fromIntegral i] die = error $ - "unknown var in environment: " ++ show v + "unknown var in environment: " + ++ show v ++ " environment = " ++ show env Cycle' vs t -> hash1 (hashCycle vs env) undefined t diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs b/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs index 0fed39823..c8d08ec79 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/DataDeclaration.hs @@ -49,7 +49,7 @@ constructorTypes = (snd <$>) . constructors constructors :: DataDeclaration v a -> [(v, Type v a)] constructors (DataDeclaration _ _ _ ctors) = [(v, t) | (_, v, t) <- ctors] -toABT :: ABT.Var v => DataDeclaration v () -> ABT.Term F v () +toABT :: (ABT.Var v) => DataDeclaration v () -> ABT.Term F v () toABT dd = ABT.tm $ Modified (modifier dd) dd' where dd' = ABT.absChain (bound dd) (ABT.tm (Constructors (ABT.transform Type <$> constructorTypes dd))) @@ -92,7 +92,7 @@ hashDecls unsafeVarToName decls = do pure [(v, r, dd) | (v, r) <- varToRef, Just dd <- [Map.lookup v decls']] bindReferences :: - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Map Name.Name Reference -> diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs index b8ed3de25..f258b053f 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Term.hs @@ -83,15 +83,15 @@ type Term v a = Term2 v a a v a type Term2 vt at ap v a = ABT.Term (TermF vt at ap) v a -- some smart constructors -ref :: Ord v => a -> Reference -> Term2 vt at ap v a +ref :: (Ord v) => a -> Reference -> Term2 vt at ap v a ref a r = ABT.tm' a (TermRef r) -refId :: Ord v => a -> ReferenceId -> Term2 vt at ap v a +refId :: (Ord v) => a -> ReferenceId -> Term2 vt at ap v a refId a = ref a . ReferenceDerivedId hashTermComponents :: forall v a. - Var v => + (Var v) => Map v (Term v a, Type v a) -> Map v (ReferenceId, Term v a, Type v a) hashTermComponents terms = @@ -116,16 +116,16 @@ hashTermComponents terms = -- What if there's a top-level Annotation but it doesn't match -- the type that was provided? -hashTermComponentsWithoutTypes :: Var v => Map v (Term v a) -> Map v (ReferenceId, Term v a) +hashTermComponentsWithoutTypes :: (Var v) => Map v (Term v a) -> Map v (ReferenceId, Term v a) hashTermComponentsWithoutTypes = ReferenceUtil.hashComponents $ refId () -hashClosedTerm :: Var v => Term v a -> ReferenceId +hashClosedTerm :: (Var v) => Term v a -> ReferenceId hashClosedTerm tm = ReferenceId (ABT.hash tm) 0 -instance Var v => Hashable1 (TermF v a p) where +instance (Var v) => Hashable1 (TermF v a p) where hash1 :: forall x. ([x] -> ([Hash], x -> Hash)) -> (x -> Hash) -> (TermF v a p) x -> Hash hash1 hashCycle hash e = - let varint :: Integral i => i -> Hashable.Token + let varint :: (Integral i) => i -> Hashable.Token varint = Hashable.Nat . fromIntegral tag = Hashable.Tag hashed = Hashable.Hashed @@ -147,54 +147,54 @@ instance Var v => Hashable1 (TermF v a p) where -- See `Hashable1 Type.F` _ -> Hashable.accumulate $ - tag 1 : - case e of - TermNat i -> [tag 64, accumulateToken i] - TermInt i -> [tag 65, accumulateToken i] - TermFloat n -> [tag 66, Hashable.Double n] - TermBoolean b -> [tag 67, accumulateToken b] - TermText t -> [tag 68, accumulateToken t] - TermChar c -> [tag 69, accumulateToken c] - TermBlank b -> - tag 1 : case b of - B.Blank -> [tag 0] - B.Recorded (B.Placeholder _ s) -> - [tag 1, Hashable.Text (Text.pack s)] - B.Recorded (B.Resolve _ s) -> - [tag 2, Hashable.Text (Text.pack s)] - TermRef (ReferenceBuiltin name) -> [tag 2, accumulateToken name] - TermRef ReferenceDerived {} -> - error "handled above, but GHC can't figure this out" - TermApp a a2 -> [tag 3, hashed (hash a), hashed (hash a2)] - TermAnn a t -> [tag 4, hashed (hash a), hashed (ABT.hash t)] - TermList as -> - tag 5 : - varint (Sequence.length as) : - map - (hashed . hash) - (toList as) - TermLam a -> [tag 6, hashed (hash a)] - -- note: we use `hashCycle` to ensure result is independent of - -- let binding order - TermLetRec as a -> case hashCycle as of - (hs, hash) -> tag 7 : hashed (hash a) : map hashed hs - -- here, order is significant, so don't use hashCycle - TermLet b a -> [tag 8, hashed $ hash b, hashed $ hash a] - TermIf b t f -> - [tag 9, hashed $ hash b, hashed $ hash t, hashed $ hash f] - TermRequest r n -> [tag 10, accumulateToken r, varint n] - TermConstructor r n -> [tag 12, accumulateToken r, varint n] - TermMatch e branches -> - tag 13 : hashed (hash e) : concatMap h branches - where - h (MatchCase pat guard branch) = - concat - [ [accumulateToken pat], - toList (hashed . hash <$> guard), - [hashed (hash branch)] - ] - TermHandle h b -> [tag 15, hashed $ hash h, hashed $ hash b] - TermAnd x y -> [tag 16, hashed $ hash x, hashed $ hash y] - TermOr x y -> [tag 17, hashed $ hash x, hashed $ hash y] - TermTermLink r -> [tag 18, accumulateToken r] - TermTypeLink r -> [tag 19, accumulateToken r] + tag 1 + : case e of + TermNat i -> [tag 64, accumulateToken i] + TermInt i -> [tag 65, accumulateToken i] + TermFloat n -> [tag 66, Hashable.Double n] + TermBoolean b -> [tag 67, accumulateToken b] + TermText t -> [tag 68, accumulateToken t] + TermChar c -> [tag 69, accumulateToken c] + TermBlank b -> + tag 1 : case b of + B.Blank -> [tag 0] + B.Recorded (B.Placeholder _ s) -> + [tag 1, Hashable.Text (Text.pack s)] + B.Recorded (B.Resolve _ s) -> + [tag 2, Hashable.Text (Text.pack s)] + TermRef (ReferenceBuiltin name) -> [tag 2, accumulateToken name] + TermRef ReferenceDerived {} -> + error "handled above, but GHC can't figure this out" + TermApp a a2 -> [tag 3, hashed (hash a), hashed (hash a2)] + TermAnn a t -> [tag 4, hashed (hash a), hashed (ABT.hash t)] + TermList as -> + tag 5 + : varint (Sequence.length as) + : map + (hashed . hash) + (toList as) + TermLam a -> [tag 6, hashed (hash a)] + -- note: we use `hashCycle` to ensure result is independent of + -- let binding order + TermLetRec as a -> case hashCycle as of + (hs, hash) -> tag 7 : hashed (hash a) : map hashed hs + -- here, order is significant, so don't use hashCycle + TermLet b a -> [tag 8, hashed $ hash b, hashed $ hash a] + TermIf b t f -> + [tag 9, hashed $ hash b, hashed $ hash t, hashed $ hash f] + TermRequest r n -> [tag 10, accumulateToken r, varint n] + TermConstructor r n -> [tag 12, accumulateToken r, varint n] + TermMatch e branches -> + tag 13 : hashed (hash e) : concatMap h branches + where + h (MatchCase pat guard branch) = + concat + [ [accumulateToken pat], + toList (hashed . hash <$> guard), + [hashed (hash branch)] + ] + TermHandle h b -> [tag 15, hashed $ hash h, hashed $ hash b] + TermAnd x y -> [tag 16, hashed $ hash x, hashed $ hash y] + TermOr x y -> [tag 17, hashed $ hash x, hashed $ hash y] + TermTermLink r -> [tag 18, accumulateToken r] + TermTypeLink r -> [tag 19, accumulateToken r] diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs index fa29660b2..83d74e308 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Tokenizable.hs @@ -46,11 +46,11 @@ data Token | Hashed !Hash | Nat !Word64 -accumulateToken :: Tokenizable t => t -> Token +accumulateToken :: (Tokenizable t) => t -> Token accumulateToken = Hashed . hashTokenizable -- | Tokenize then accumulate a type into a Hash. -hashTokenizable :: Tokenizable t => t -> Hash +hashTokenizable :: (Tokenizable t) => t -> Hash hashTokenizable = accumulate . tokens -- | Tokenizable converts a value into a set of hashing tokens which will later be accumulated @@ -71,7 +71,7 @@ hashTokenizable = accumulate . tokens class Tokenizable t where tokens :: t -> [Token] -instance Tokenizable a => Tokenizable [a] where +instance (Tokenizable a) => Tokenizable [a] where tokens = map accumulateToken instance (Tokenizable a, Tokenizable b) => Tokenizable (a, b) where @@ -133,7 +133,7 @@ accumulate = Hash.fromByteString . BA.convert . CH.hashFinalize . go CH.hashInit let tbytes = encodeUtf8 txt in [encodeLength (B.length tbytes), tbytes] toBS (Hashed h) = [Hash.toByteString h] - encodeLength :: Integral n => n -> B.ByteString + encodeLength :: (Integral n) => n -> B.ByteString encodeLength = BL.toStrict . toLazyByteString . word64BE . fromIntegral class Hashable1 f where diff --git a/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs b/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs index 56039871f..ee5ea8757 100644 --- a/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs +++ b/unison-hashing-v2/src/Unison/Hashing/V2/Type.hs @@ -55,11 +55,11 @@ freeVars :: Type v a -> Set v freeVars = ABT.freeVars bindExternal :: - ABT.Var v => [(v, Reference)] -> Type v a -> Type v a + (ABT.Var v) => [(v, Reference)] -> Type v a -> Type v a bindExternal bs = ABT.substsInheritAnnotation [(v, ref () r) | (v, r) <- bs] bindReferences :: - Var v => + (Var v) => (v -> Name.Name) -> Set v -> Map Name.Name Reference -> @@ -90,7 +90,7 @@ unForalls t = go t [] go body vs = Just (reverse vs, body) -- some smart constructors -ref :: Ord v => a -> Reference -> Type v a +ref :: (Ord v) => a -> Reference -> Type v a ref a = ABT.tm' a . TypeRef intRef, natRef, floatRef, booleanRef, textRef, charRef, listRef, effectRef :: Reference @@ -103,11 +103,11 @@ charRef = ReferenceBuiltin "Char" listRef = ReferenceBuiltin "Sequence" effectRef = ReferenceBuiltin "Effect" -forall :: Ord v => a -> v -> Type v a -> Type v a +forall :: (Ord v) => a -> v -> Type v a -> Type v a forall a v body = ABT.tm' a (TypeForall (ABT.abs' a v body)) -- | Bind the given variables with an outer `forall`, if they are used in `t`. -generalize :: Ord v => [v] -> Type v a -> Type v a +generalize :: (Ord v) => [v] -> Type v a -> Type v a generalize vs t = foldr f t vs where f v t = diff --git a/unison-share-api/src/Unison/Server/Backend.hs b/unison-share-api/src/Unison/Server/Backend.hs index 2f386744a..504d5db9b 100644 --- a/unison-share-api/src/Unison/Server/Backend.hs +++ b/unison-share-api/src/Unison/Server/Backend.hs @@ -213,7 +213,7 @@ parseNamesForBranch root = namesForBranch root <&> \(n, _, _) -> n prettyNamesForBranch :: Branch m -> NameScoping -> Names prettyNamesForBranch root = namesForBranch root <&> \(_, n, _) -> n -shallowPPE :: MonadIO m => Codebase m v a -> V2Branch.Branch m -> m PPE.PrettyPrintEnv +shallowPPE :: (MonadIO m) => Codebase m v a -> V2Branch.Branch m -> m PPE.PrettyPrintEnv shallowPPE codebase b = do hashLength <- Codebase.runTransaction codebase Codebase.hashLength names <- shallowNames codebase b @@ -224,7 +224,7 @@ shallowPPE codebase b = do -- I.e. names in nested children are omitted. -- This should probably live elsewhere, but the package dependency graph makes it hard to find -- a good place. -shallowNames :: forall m v a. Monad m => Codebase m v a -> V2Branch.Branch m -> m Names +shallowNames :: forall m v a. (Monad m) => Codebase m v a -> V2Branch.Branch m -> m Names shallowNames codebase b = do newTerms <- V2Branch.terms b @@ -336,7 +336,7 @@ fuzzyFind printNames query = -- List the immediate children of a namespace lsAtPath :: - MonadIO m => + (MonadIO m) => Codebase m Symbol Ann -> -- The root to follow the path from. Maybe (V2Branch.Branch Sqlite.Transaction) -> @@ -406,7 +406,7 @@ resultListType :: (Ord v, Monoid a) => Type v a resultListType = Type.app mempty (Type.list mempty) (Type.ref mempty Decls.testResultRef) termListEntry :: - MonadIO m => + (MonadIO m) => Codebase m Symbol Ann -> V2Branch.Branch n -> ExactName NameSegment V2Referent.Referent -> @@ -462,7 +462,7 @@ getTermTag codebase r sig = do | otherwise -> Plain getTypeTag :: - Var v => + (Var v) => Codebase m v Ann -> Reference -> Sqlite.Transaction TypeTag @@ -476,7 +476,7 @@ getTypeTag codebase r = do _ -> pure (if Set.member r Type.builtinAbilities then Ability else Data) typeListEntry :: - Var v => + (Var v) => Codebase m v Ann -> V2Branch.Branch n -> ExactName NameSegment Reference -> @@ -502,7 +502,7 @@ typeListEntry codebase b (ExactName nameSegment ref) = do typeDeclHeader :: forall v m. - Var v => + (Var v) => Codebase m v Ann -> PPE.PrettyPrintEnv -> Reference -> @@ -531,7 +531,7 @@ formatTypeName' ppe r = $ PPE.typeName ppe r termEntryToNamedTerm :: - Var v => PPE.PrettyPrintEnv -> Maybe Width -> TermEntry v a -> NamedTerm + (Var v) => PPE.PrettyPrintEnv -> Maybe Width -> TermEntry v a -> NamedTerm termEntryToNamedTerm ppe typeWidth te@TermEntry {termEntryType = mayType, termEntryTag = tag, termEntryHash} = NamedTerm { termName = termEntryHQName te, @@ -550,7 +550,7 @@ typeEntryToNamedType te@TypeEntry {typeEntryTag, typeEntryHash} = -- | Find all definitions and children reachable from the given 'V2Branch.Branch', lsBranch :: - MonadIO m => + (MonadIO m) => Codebase m Symbol Ann -> V2Branch.Branch n -> m [ShallowListEntry Symbol Ann] @@ -701,7 +701,7 @@ makeNameSearch hashLength names = } -- | Interpret a 'Search' as a function from name to search results. -applySearch :: Show r => Search r -> HQ'.HashQualified Name -> [SR.SearchResult] +applySearch :: (Show r) => Search r -> HQ'.HashQualified Name -> [SR.SearchResult] applySearch Search {lookupNames, lookupRelativeHQRefs', makeResult, matchesNamedRef} query = do -- a bunch of references will match a HQ ref. toList (lookupRelativeHQRefs' query) <&> \ref -> @@ -805,15 +805,15 @@ getShallowCausalAtPathFromRootHash mayRootHash path = do Just h -> Codebase.expectCausalBranchByCausalHash h Codebase.getShallowCausalAtPath path (Just shallowRoot) -formatType' :: Var v => PPE.PrettyPrintEnv -> Width -> Type v a -> SyntaxText +formatType' :: (Var v) => PPE.PrettyPrintEnv -> Width -> Type v a -> SyntaxText formatType' ppe w = Pretty.render w . TypePrinter.prettySyntax ppe -formatType :: Var v => PPE.PrettyPrintEnv -> Width -> Type v a -> Syntax.SyntaxText +formatType :: (Var v) => PPE.PrettyPrintEnv -> Width -> Type v a -> Syntax.SyntaxText formatType ppe w = mungeSyntaxText . formatType' ppe w formatSuffixedType :: - Var v => + (Var v) => PPED.PrettyPrintEnvDecl -> Width -> Type v Ann -> @@ -821,7 +821,7 @@ formatSuffixedType :: formatSuffixedType ppe = formatType (PPED.suffixifiedPPE ppe) mungeSyntaxText :: - Functor g => g (UST.Element Reference) -> g Syntax.Element + (Functor g) => g (UST.Element Reference) -> g Syntax.Element mungeSyntaxText = fmap Syntax.convertElement -- | Renders a definition for the given name or hash alongside its documentation. @@ -1089,7 +1089,7 @@ docsInBranchToHtmlFiles runtime codebase root currentPath directory = do writeFile fullPath (Text.unpack fileContents) bestNameForTerm :: - forall v. Var v => PPE.PrettyPrintEnv -> Width -> Referent -> Text + forall v. (Var v) => PPE.PrettyPrintEnv -> Width -> Referent -> Text bestNameForTerm ppe width = Text.pack . Pretty.render width @@ -1099,7 +1099,7 @@ bestNameForTerm ppe width = . Term.fromReferent mempty bestNameForType :: - forall v. Var v => PPE.PrettyPrintEnv -> Width -> Reference -> Text + forall v. (Var v) => PPE.PrettyPrintEnv -> Width -> Reference -> Text bestNameForType ppe width = Text.pack . Pretty.render width @@ -1116,7 +1116,7 @@ bestNameForType ppe width = -- The 'suffixified' component of this ppe will search for the shortest unambiguous suffix within the scope in which the name is found (local, falling back to global) scopedNamesForBranchHash :: forall m n v a. - MonadIO m => + (MonadIO m) => Codebase m v a -> Maybe (V2Branch.CausalBranch n) -> Path -> @@ -1159,7 +1159,7 @@ scopedNamesForBranchHash codebase mbh path = do pure (ScopedNames.parseNames scopedNames, ScopedNames.namesAtPath scopedNames) resolveCausalHash :: - Monad m => Maybe CausalHash -> Codebase m v a -> Backend m (Branch m) + (Monad m) => Maybe CausalHash -> Codebase m v a -> Backend m (Branch m) resolveCausalHash h codebase = case h of Nothing -> lift (Codebase.getRootBranch codebase) Just bhash -> do @@ -1172,7 +1172,7 @@ resolveCausalHashV2 h = case h of Just ch -> Codebase.expectCausalBranchByCausalHash ch resolveRootBranchHash :: - MonadIO m => Maybe ShortCausalHash -> Codebase m v a -> Backend m (Branch m) + (MonadIO m) => Maybe ShortCausalHash -> Codebase m v a -> Backend m (Branch m) resolveRootBranchHash mayRoot codebase = case mayRoot of Nothing -> lift (Codebase.getRootBranch codebase) @@ -1257,8 +1257,8 @@ displayType codebase = \case pure (UserObject decl) termsToSyntax :: - Var v => - Ord a => + (Var v) => + (Ord a) => Suffixify -> Width -> PPED.PrettyPrintEnvDecl -> @@ -1287,8 +1287,8 @@ termsToSyntax suff width ppe0 terms = $ TermPrinter.prettyBinding (ppeBody r) n tm typesToSyntax :: - Var v => - Ord a => + (Var v) => + (Ord a) => Suffixify -> Width -> PPED.PrettyPrintEnvDecl -> diff --git a/unison-share-api/src/Unison/Server/CodebaseServer.hs b/unison-share-api/src/Unison/Server/CodebaseServer.hs index 4344903e6..f64d52eda 100644 --- a/unison-share-api/src/Unison/Server/CodebaseServer.hs +++ b/unison-share-api/src/Unison/Server/CodebaseServer.hs @@ -347,7 +347,7 @@ serveDocs _ respond = respond $ responseLBS ok200 [plain] docsBS serveOpenAPI :: Handler OpenApi serveOpenAPI = pure openAPI -hoistWithAuth :: forall api. HasServer api '[] => Proxy api -> ByteString -> ServerT api Handler -> ServerT (Authed api) Handler +hoistWithAuth :: forall api. (HasServer api '[]) => Proxy api -> ByteString -> ServerT api Handler -> ServerT (Authed api) Handler hoistWithAuth api expectedToken server token = hoistServer @api @Handler @Handler api (\h -> handleAuth expectedToken token *> h) server serveUnison :: diff --git a/unison-share-api/src/Unison/Server/Doc.hs b/unison-share-api/src/Unison/Server/Doc.hs index 78a412a00..d0b2db216 100644 --- a/unison-share-api/src/Unison/Server/Doc.hs +++ b/unison-share-api/src/Unison/Server/Doc.hs @@ -95,7 +95,7 @@ data DocG specialForm deriving stock (Eq, Show, Generic, Functor, Foldable, Traversable) deriving anyclass (ToJSON) -deriving instance ToSchema specialForm => ToSchema (DocG specialForm) +deriving instance (ToSchema specialForm) => ToSchema (DocG specialForm) type UnisonHash = Text @@ -103,7 +103,7 @@ data Ref a = Term a | Type a deriving stock (Eq, Show, Generic, Functor, Foldable, Traversable) deriving anyclass (ToJSON) -instance ToSchema a => ToSchema (Ref a) +instance (ToSchema a) => ToSchema (Ref a) data MediaSource = MediaSource {mediaSourceUrl :: Text, mediaSourceMimeType :: Maybe Text} deriving stock (Eq, Show, Generic) @@ -172,7 +172,7 @@ evalAndRenderDoc pped terms typeOf eval types tm = -- | Renders the given doc, which must have been evaluated using 'evalDoc' renderDoc :: forall v. - Var v => + (Var v) => PPE.PrettyPrintEnvDecl -> EvaluatedDoc v -> Doc @@ -241,7 +241,8 @@ renderDoc pped doc = renderSpecial <$> doc MissingDecl r -> [(Type (Reference.toText r, DO.MissingObject (SH.unsafeFromText $ Reference.toText r)))] BuiltinDecl r -> let name = - formatPretty . NP.styleHashQualified (NP.fmt (S.TypeReference r)) + formatPretty + . NP.styleHashQualified (NP.fmt (S.TypeReference r)) . PPE.typeName suffixifiedPPE $ r in [Type (Reference.toText r, DO.BuiltinObject name)] @@ -447,7 +448,7 @@ data RenderError trm deriving stock (Eq, Show, Generic) deriving anyclass (ToJSON) -deriving anyclass instance ToSchema trm => ToSchema (RenderError trm) +deriving anyclass instance (ToSchema trm) => ToSchema (RenderError trm) data EvaluatedSrc v = EvaluatedSrcDecl (EvaluatedDecl v) @@ -468,11 +469,11 @@ data EvaluatedTerm v deriving stock (Show, Eq, Generic) -- Determines all dependencies which will be required to render a doc. -dependencies :: Ord v => EvaluatedDoc v -> Set LD.LabeledDependency +dependencies :: (Ord v) => EvaluatedDoc v -> Set LD.LabeledDependency dependencies = foldMap dependenciesSpecial -- | Determines all dependencies of a special form -dependenciesSpecial :: forall v. Ord v => EvaluatedSpecialForm v -> Set LD.LabeledDependency +dependenciesSpecial :: forall v. (Ord v) => EvaluatedSpecialForm v -> Set LD.LabeledDependency dependenciesSpecial = \case ESource srcs -> srcDeps srcs EFoldedSource srcs -> srcDeps srcs diff --git a/unison-share-api/src/Unison/Server/Endpoints/DefinitionSummary.hs b/unison-share-api/src/Unison/Server/Endpoints/DefinitionSummary.hs index 1aa7f60bc..b6523703a 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/DefinitionSummary.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/DefinitionSummary.hs @@ -50,7 +50,11 @@ import Unison.Symbol (Symbol) import Unison.Util.Pretty (Width) type TermSummaryAPI = - "definitions" :> "terms" :> "by-hash" :> Capture "hash" Referent :> "summary" + "definitions" + :> "terms" + :> "by-hash" + :> Capture "hash" Referent + :> "summary" -- Optional name to include in summary. -- It's propagated through to the response as-is. -- If missing, the short hash will be used instead. @@ -113,7 +117,11 @@ serveTermSummary codebase referent mayName mayRoot relativeTo mayWidth = do else UserObject termSig type TypeSummaryAPI = - "definitions" :> "types" :> "by-hash" :> Capture "hash" Reference :> "summary" + "definitions" + :> "types" + :> "by-hash" + :> Capture "hash" Reference + :> "summary" -- Optional name to include in summary. -- It's propagated through to the response as-is. -- If missing, the short hash will be used instead. diff --git a/unison-share-api/src/Unison/Server/Endpoints/FuzzyFind.hs b/unison-share-api/src/Unison/Server/Endpoints/FuzzyFind.hs index a041bd3fd..e8c03a28c 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/FuzzyFind.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/FuzzyFind.hs @@ -52,7 +52,8 @@ import Unison.Symbol (Symbol) import Unison.Util.Pretty (Width) type FuzzyFindAPI = - "find" :> QueryParam "rootBranch" SCH.ShortCausalHash + "find" + :> QueryParam "rootBranch" SCH.ShortCausalHash :> QueryParam "relativeTo" Path.Path :> QueryParam "limit" Int :> QueryParam "renderWidth" Width @@ -128,7 +129,7 @@ instance ToSample FoundResult where serveFuzzyFind :: forall m. - MonadIO m => + (MonadIO m) => Codebase m Symbol Ann -> Maybe SCH.ShortCausalHash -> Maybe Path.Path -> diff --git a/unison-share-api/src/Unison/Server/Endpoints/GetDefinitions.hs b/unison-share-api/src/Unison/Server/Endpoints/GetDefinitions.hs index 243dc1949..dee7f8375 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/GetDefinitions.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/GetDefinitions.hs @@ -41,7 +41,8 @@ import Unison.Util.Monoid (foldMapM) import Unison.Util.Pretty (Width) type DefinitionsAPI = - "getDefinition" :> QueryParam "rootBranch" ShortCausalHash + "getDefinition" + :> QueryParam "rootBranch" ShortCausalHash :> QueryParam "relativeTo" Path.Path :> QueryParams "names" (HQ.HashQualified Name) :> QueryParam "renderWidth" Width diff --git a/unison-share-api/src/Unison/Server/Endpoints/NamespaceDetails.hs b/unison-share-api/src/Unison/Server/Endpoints/NamespaceDetails.hs index 5d27be939..b5ec7b189 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/NamespaceDetails.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/NamespaceDetails.hs @@ -36,7 +36,8 @@ import Unison.Symbol (Symbol) import Unison.Util.Pretty (Width) type NamespaceDetailsAPI = - "namespaces" :> Capture "namespace" Path.Path + "namespaces" + :> Capture "namespace" Path.Path :> QueryParam "rootBranch" ShortCausalHash :> QueryParam "renderWidth" Width :> APIGet NamespaceDetails @@ -80,7 +81,7 @@ namespaceDetails :: namespaceDetails runtime codebase namespacePath maySCH mayWidth = let width = mayDefaultWidth mayWidth in do - (rootCausal, namespaceCausal, shallowBranch) <- + (rootCausal, namespaceCausal, shallowBranch) <- Backend.hoistBackend (Codebase.runTransaction codebase) do rootCausal <- Backend.resolveRootBranchHashV2 maySCH namespaceCausal <- lift $ Codebase.getShallowCausalAtPath namespacePath (Just rootCausal) diff --git a/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs b/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs index 7e53b65db..19d07cedb 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/NamespaceListing.hs @@ -47,7 +47,8 @@ import Unison.Util.Pretty (Width) import Unison.Var (Var) type NamespaceListingAPI = - "list" :> QueryParam "rootBranch" ShortCausalHash + "list" + :> QueryParam "rootBranch" ShortCausalHash :> QueryParam "relativeTo" Path.Path :> QueryParam "namespace" Path.Path :> APIGet NamespaceListing @@ -134,7 +135,7 @@ instance ToJSON KindExpression where toEncoding = genericToEncoding defaultOptions backendListEntryToNamespaceObject :: - Var v => + (Var v) => PPE.PrettyPrintEnv -> Maybe Width -> Backend.ShallowListEntry v a -> diff --git a/unison-share-api/src/Unison/Server/Endpoints/Projects.hs b/unison-share-api/src/Unison/Server/Endpoints/Projects.hs index 56ef56571..1755e54a7 100644 --- a/unison-share-api/src/Unison/Server/Endpoints/Projects.hs +++ b/unison-share-api/src/Unison/Server/Endpoints/Projects.hs @@ -38,7 +38,8 @@ import Unison.Symbol (Symbol) import Unison.Util.Monoid (foldMapM) type ProjectsAPI = - "projects" :> QueryParam "rootBranch" ShortCausalHash + "projects" + :> QueryParam "rootBranch" ShortCausalHash :> QueryParam "owner" ProjectOwner :> APIGet [ProjectListing] @@ -118,7 +119,7 @@ entryToOwner = \case serve :: forall m. - MonadIO m => + (MonadIO m) => Codebase m Symbol Ann -> Maybe ShortCausalHash -> Maybe ProjectOwner -> diff --git a/unison-share-api/src/Unison/Server/Orphans.hs b/unison-share-api/src/Unison/Server/Orphans.hs index 066b0528a..d731007ab 100644 --- a/unison-share-api/src/Unison/Server/Orphans.hs +++ b/unison-share-api/src/Unison/Server/Orphans.hs @@ -353,6 +353,6 @@ instance ToHttpApiData Name where deriving newtype instance ToSchema NameSegment -deriving anyclass instance ToSchema n => ToSchema (HQ.HashQualified n) +deriving anyclass instance (ToSchema n) => ToSchema (HQ.HashQualified n) -deriving anyclass instance ToSchema n => ToSchema (HQ'.HashQualified n) +deriving anyclass instance (ToSchema n) => ToSchema (HQ'.HashQualified n) diff --git a/unison-share-api/src/Unison/Server/SearchResult'.hs b/unison-share-api/src/Unison/Server/SearchResult'.hs index 58b845288..886435be4 100644 --- a/unison-share-api/src/Unison/Server/SearchResult'.hs +++ b/unison-share-api/src/Unison/Server/SearchResult'.hs @@ -39,18 +39,20 @@ data TypeResult' v a (Set (HQ'.HashQualified Name)) deriving (Eq, Show) -pattern Tm :: HQ.HashQualified Name - -> Maybe (Type v a) - -> Referent - -> Set (HQ'.HashQualified Name) - -> SearchResult' v a +pattern Tm :: + HQ.HashQualified Name -> + Maybe (Type v a) -> + Referent -> + Set (HQ'.HashQualified Name) -> + SearchResult' v a pattern Tm n t r as = Tm' (TermResult' n t r as) -pattern Tp :: HQ.HashQualified Name - -> DisplayObject () (Decl v a) - -> Reference - -> Set (HQ'.HashQualified Name) - -> SearchResult' v a +pattern Tp :: + HQ.HashQualified Name -> + DisplayObject () (Decl v a) -> + Reference -> + Set (HQ'.HashQualified Name) -> + SearchResult' v a pattern Tp n t r as = Tp' (TypeResult' n t r as) tmReferent :: SearchResult' v a -> Maybe Referent @@ -67,7 +69,7 @@ foldResult' f g = \case -- todo: comment me out, is this actually useful, given what we saw in ShowDefinitionI? -- namely, that it doesn't include the Term's deps, just the Decl's and the -- result Term/Type names. -labeledDependencies :: Ord v => SearchResult' v a -> Set LabeledDependency +labeledDependencies :: (Ord v) => SearchResult' v a -> Set LabeledDependency labeledDependencies = \case Tm' (TermResult' _ t r _) -> Set.insert (LD.referent r) $ maybe mempty (Set.map LD.typeRef . Type.dependencies) t diff --git a/unison-share-api/src/Unison/Server/Syntax.hs b/unison-share-api/src/Unison/Server/Syntax.hs index 5fb62d9eb..705a4c904 100644 --- a/unison-share-api/src/Unison/Server/Syntax.hs +++ b/unison-share-api/src/Unison/Server/Syntax.hs @@ -47,11 +47,11 @@ instance FromJSON Element deriving instance ToSchema Element -instance ToJSON a => ToJSON (Segment a) +instance (ToJSON a) => ToJSON (Segment a) -instance FromJSON a => FromJSON (Segment a) +instance (FromJSON a) => FromJSON (Segment a) -deriving instance ToSchema a => ToSchema (Segment a) +deriving instance (ToSchema a) => ToSchema (Segment a) instance ToJSON SeqOp @@ -65,7 +65,7 @@ instance FromJSON SyntaxText deriving anyclass instance ToSchema SyntaxText -instance ToSchema r => ToSchema (Seq r) where +instance (ToSchema r) => ToSchema (Seq r) where declareNamedSchema _ = declareNamedSchema (Proxy @[r]) convertElement :: SyntaxText.Element Reference -> Element diff --git a/unison-share-api/src/Unison/Server/Types.hs b/unison-share-api/src/Unison/Server/Types.hs index a017fd738..80af376e6 100644 --- a/unison-share-api/src/Unison/Server/Types.hs +++ b/unison-share-api/src/Unison/Server/Types.hs @@ -290,7 +290,7 @@ deriving instance ToSchema TypeTag munge :: Text -> LZ.ByteString munge = Text.encodeUtf8 . Text.Lazy.fromStrict -mungeShow :: Show s => s -> LZ.ByteString +mungeShow :: (Show s) => s -> LZ.ByteString mungeShow = mungeString . show mungeString :: String -> LZ.ByteString @@ -299,7 +299,7 @@ mungeString = Text.encodeUtf8 . Text.Lazy.pack defaultWidth :: Width defaultWidth = 80 -discard :: Applicative m => a -> m () +discard :: (Applicative m) => a -> m () discard = const $ pure () mayDefaultWidth :: Maybe Width -> Width diff --git a/unison-share-api/src/Unison/Sync/Types.hs b/unison-share-api/src/Unison/Sync/Types.hs index c307f47e1..77598c835 100644 --- a/unison-share-api/src/Unison/Sync/Types.hs +++ b/unison-share-api/src/Unison/Sync/Types.hs @@ -251,7 +251,7 @@ instance (ToJSON text, ToJSON noSyncHash, ToJSON hash) => ToJSON (Entity text no ND ns -> go NamespaceDiffType ns C causal -> go CausalType causal where - go :: ToJSON a => EntityType -> a -> Aeson.Value + go :: (ToJSON a) => EntityType -> a -> Aeson.Value go typ obj = object ["type" .= typ, "object" .= obj] instance (FromJSON text, FromJSON noSyncHash, FromJSON hash, Ord hash) => FromJSON (Entity text noSyncHash hash) where @@ -278,7 +278,7 @@ entityHashes_ f = \case -- | Get the direct dependencies of an entity (which are actually sync'd). -- -- FIXME use generic-lens here? (typed @hash) -entityDependencies :: Ord hash => Entity text noSyncHash hash -> Set hash +entityDependencies :: (Ord hash) => Entity text noSyncHash hash -> Set hash entityDependencies = \case TC (TermComponent terms) -> flip foldMap terms \(LocalIds {hashes}, _term) -> Set.fromList hashes DC (DeclComponent decls) -> flip foldMap decls \(LocalIds {hashes}, _decl) -> Set.fromList hashes @@ -325,7 +325,7 @@ instance (FromJSON text, FromJSON hash) => FromJSON (TermComponent text hash) wh pure (TermComponent terms) bitraverseComponents :: - Applicative f => + (Applicative f) => (a -> f a') -> (b -> f b') -> [(LocalIds a b, ByteString)] -> @@ -427,7 +427,7 @@ instance (FromJSON text, FromJSON oldHash, FromJSON newHash) => FromJSON (Patch Base64Bytes bytes <- obj .: "bytes" pure Patch {..} -patchHashes_ :: Applicative m => (hash -> m hash') -> Patch text noSyncHash hash -> m (Patch text noSyncHash hash') +patchHashes_ :: (Applicative m) => (hash -> m hash') -> Patch text noSyncHash hash -> m (Patch text noSyncHash hash') patchHashes_ f (Patch {..}) = do newHashLookup <- traverse f newHashLookup pure (Patch {..}) @@ -460,7 +460,7 @@ instance (FromJSON text, FromJSON oldHash, FromJSON hash) => FromJSON (PatchDiff Base64Bytes bytes <- obj .: "bytes" pure PatchDiff {..} -patchDiffHashes_ :: Applicative m => (hash -> m hash') -> PatchDiff text noSyncHash hash -> m (PatchDiff text noSyncHash hash') +patchDiffHashes_ :: (Applicative m) => (hash -> m hash') -> PatchDiff text noSyncHash hash -> m (PatchDiff text noSyncHash hash') patchDiffHashes_ f (PatchDiff {..}) = do parent <- f parent newHashLookup <- traverse f newHashLookup @@ -540,7 +540,7 @@ instance (FromJSON text, FromJSON hash) => FromJSON (NamespaceDiff text hash) wh Base64Bytes bytes <- obj .: "bytes" pure NamespaceDiff {..} -namespaceDiffHashes_ :: Applicative m => (hash -> m hash') -> NamespaceDiff text hash -> m (NamespaceDiff text hash') +namespaceDiffHashes_ :: (Applicative m) => (hash -> m hash') -> NamespaceDiff text hash -> m (NamespaceDiff text hash') namespaceDiffHashes_ f (NamespaceDiff {..}) = do parent <- f parent defnLookup <- traverse f defnLookup @@ -929,7 +929,7 @@ data NeedDependencies hash = NeedDependencies } deriving stock (Show, Eq, Ord) -instance ToJSON hash => ToJSON (NeedDependencies hash) where +instance (ToJSON hash) => ToJSON (NeedDependencies hash) where toJSON (NeedDependencies missingDependencies) = object ["missing_dependencies" .= missingDependencies] @@ -941,10 +941,10 @@ instance (FromJSON hash, Ord hash) => FromJSON (NeedDependencies hash) where ------------------------------------------------------------------------------------------------------------------------ -- Misc. helpers -failText :: MonadFail m => Text -> m a +failText :: (MonadFail m) => Text -> m a failText = fail . Text.unpack -jsonUnion :: ToJSON a => Text -> a -> Value +jsonUnion :: (ToJSON a) => Text -> a -> Value jsonUnion typeName val = Aeson.object [ "type" .= String typeName, diff --git a/unison-share-api/src/Unison/Util/Find.hs b/unison-share-api/src/Unison/Util/Find.hs index 4e3395a60..f2fb30a7e 100644 --- a/unison-share-api/src/Unison/Util/Find.hs +++ b/unison-share-api/src/Unison/Util/Find.hs @@ -149,7 +149,7 @@ prefixFindInBranch b hq = -- only search before the # before the # and after the # after the # fuzzyFindInBranch :: - HasCallStack => + (HasCallStack) => Names -> HQ'.HashQualified Name -> [(SearchResult, P.Pretty P.ColorText)] diff --git a/unison-src/parser-tests/GenerateErrors.hs b/unison-src/parser-tests/GenerateErrors.hs index 16426017c..b4e257288 100644 --- a/unison-src/parser-tests/GenerateErrors.hs +++ b/unison-src/parser-tests/GenerateErrors.hs @@ -25,12 +25,12 @@ unisonFilesInCurrDir = getCurrentDirectory >>= unisonFilesInDir errorFileName :: String -> String errorFileName n = dropExtension n ++ ".message.txt" -emitAsPlainTextTo :: Var v => String -> Err v -> FilePath -> IO () +emitAsPlainTextTo :: (Var v) => String -> Err v -> FilePath -> IO () emitAsPlainTextTo src e f = writeUtf8 f plainErr where plainErr = Color.toPlain $ prettyParseError src e -printError :: Var v => String -> Err v -> IO () +printError :: (Var v) => String -> Err v -> IO () printError src e = putStrLn $ B.showParseError src e processFile :: FilePath -> IO () diff --git a/unison-syntax/src/Unison/Syntax/HashQualified'.hs b/unison-syntax/src/Unison/Syntax/HashQualified'.hs index 00a97c567..20b6cd996 100644 --- a/unison-syntax/src/Unison/Syntax/HashQualified'.hs +++ b/unison-syntax/src/Unison/Syntax/HashQualified'.hs @@ -34,7 +34,7 @@ fromText t = case Text.breakOn "#" t of (name, "") -> Just $ HQ'.NameOnly (Name.unsafeFromText name) -- safe bc breakOn # (name, hash) -> HQ'.HashQualified (Name.unsafeFromText name) <$> SH.fromText hash -unsafeFromText :: HasCallStack => Text -> HQ'.HashQualified Name +unsafeFromText :: (HasCallStack) => Text -> HQ'.HashQualified Name unsafeFromText txt = fromMaybe msg (fromText txt) where msg = error ("HashQualified.unsafeFromText " <> show txt) diff --git a/unison-syntax/src/Unison/Syntax/HashQualified.hs b/unison-syntax/src/Unison/Syntax/HashQualified.hs index 4ae865dd9..c312d3636 100644 --- a/unison-syntax/src/Unison/Syntax/HashQualified.hs +++ b/unison-syntax/src/Unison/Syntax/HashQualified.hs @@ -52,7 +52,7 @@ unsafeFromText txt = fromMaybe msg . fromText $ txt where msg = error $ "HashQualified.unsafeFromText " <> show txt -unsafeFromVar :: Var v => v -> HashQualified Name +unsafeFromVar :: (Var v) => v -> HashQualified Name unsafeFromVar = unsafeFromText . Var.name toString :: HashQualified Name -> String @@ -63,6 +63,6 @@ toText :: HashQualified Name -> Text toText = HashQualified.toTextWith Name.toText -toVar :: Var v => HashQualified Name -> v +toVar :: (Var v) => HashQualified Name -> v toVar = Var.named . toText diff --git a/unison-syntax/src/Unison/Syntax/Lexer.hs b/unison-syntax/src/Unison/Syntax/Lexer.hs index 670665f57..110fe52b4 100644 --- a/unison-syntax/src/Unison/Syntax/Lexer.hs +++ b/unison-syntax/src/Unison/Syntax/Lexer.hs @@ -248,10 +248,11 @@ token'' tok p = do topHasClosePair ((name, _) : _) = name `elem` ["{", "(", "[", "handle", "match", "if", "then"] -showErrorFancy :: P.ShowErrorComponent e => P.ErrorFancy e -> String +showErrorFancy :: (P.ShowErrorComponent e) => P.ErrorFancy e -> String showErrorFancy (P.ErrorFail msg) = msg showErrorFancy (P.ErrorIndentation ord ref actual) = - "incorrect indentation (got " <> show (P.unPos actual) + "incorrect indentation (got " + <> show (P.unPos actual) <> ", should be " <> p <> show (P.unPos ref) @@ -300,19 +301,19 @@ lexer0' scope rem = tweak (h@(payload -> Reserved _) : t) = h : tweak t tweak (t1 : t2@(payload -> Numeric num) : rem) | notLayout t1 && touches t1 t2 && isSigned num = - t1 : - Token - (SymbolyId (take 1 num) Nothing) - (start t2) - (inc $ start t2) : - Token (Numeric (drop 1 num)) (inc $ start t2) (end t2) : - tweak rem + t1 + : Token + (SymbolyId (take 1 num) Nothing) + (start t2) + (inc $ start t2) + : Token (Numeric (drop 1 num)) (inc $ start t2) (end t2) + : tweak rem tweak (h : t) = h : tweak t isSigned num = all (\ch -> ch == '-' || ch == '+') $ take 1 num infixl 2 <+> -(<+>) :: Monoid a => P a -> P a -> P a +(<+>) :: (Monoid a) => P a -> P a -> P a p1 <+> p2 = do a1 <- p1; a2 <- p2; pure (a1 <> a2) lexemes :: P [Token Lexeme] @@ -349,7 +350,11 @@ lexemes' eof = pure $ hd <> tl where toks = - doc2 <|> doc <|> token numeric <|> token character <|> reserved + doc2 + <|> doc + <|> token numeric + <|> token character + <|> reserved <|> token symbolyId <|> token blank <|> token wordyId @@ -418,7 +423,10 @@ lexemes' eof = leafy closing = groupy closing gs where gs = - link <|> externalLink <|> exampleInline <|> expr + link + <|> externalLink + <|> exampleInline + <|> expr <|> boldOrItalicOrStrikethrough closing <|> verbatim <|> atDoc @@ -528,7 +536,8 @@ lexemes' eof = link = P.label "link (examples: {type List}, {Nat.+})" $ wrap "syntax.docLink" $ - P.try $ lit "{" *> (typeLink <|> termLink) <* lit "}" + P.try $ + lit "{" *> (typeLink <|> termLink) <* lit "}" expr = P.label "transclusion (examples: {{ doc2 }}, {{ sepBy s [doc1, doc2] }})" $ @@ -587,7 +596,8 @@ lexemes' eof = boldOrItalicOrStrikethrough closing = do let start = - some (P.satisfy (== '*')) <|> some (P.satisfy (== '_')) + some (P.satisfy (== '*')) + <|> some (P.satisfy (== '_')) <|> some (P.satisfy (== '~')) name s = @@ -925,14 +935,21 @@ lexemes' eof = layoutKeywords :: P [Token Lexeme] layoutKeywords = - ifElse <|> withKw <|> openKw "match" <|> openKw "handle" <|> typ <|> arr <|> eq + ifElse + <|> withKw + <|> openKw "match" + <|> openKw "handle" + <|> typ + <|> arr + <|> eq <|> openKw "cases" <|> openKw "where" <|> openKw "let" <|> openKw "do" where ifElse = - openKw "if" <|> closeKw' (Just "then") ["if"] (lit "then") + openKw "if" + <|> closeKw' (Just "then") ["if"] (lit "then") <|> closeKw' (Just "else") ["then"] (lit "else") modKw = typeModifiersAlt (openKw1 wordySep) typeOrAbilityKw = typeOrAbilityAlt openTypeKw1 @@ -1114,10 +1131,11 @@ headToken :: T a -> a headToken (T a _ _) = a headToken (L a) = a -instance Show a => Show (T a) where +instance (Show a) => Show (T a) where show (L a) = show a show (T open mid close) = - show open ++ "\n" + show open + ++ "\n" ++ indent " " (intercalateMap "\n" show mid) ++ "\n" ++ intercalateMap "" show close @@ -1294,14 +1312,14 @@ keywords = typeOrAbility :: Set String typeOrAbility = Set.fromList ["type", "ability"] -typeOrAbilityAlt :: Alternative f => (String -> f a) -> f a +typeOrAbilityAlt :: (Alternative f) => (String -> f a) -> f a typeOrAbilityAlt f = asum $ map f (toList typeOrAbility) typeModifiers :: Set String typeModifiers = Set.fromList ["structural", "unique"] -typeModifiersAlt :: Alternative f => (String -> f a) -> f a +typeModifiersAlt :: (Alternative f) => (String -> f a) -> f a typeModifiersAlt f = asum $ map f (toList typeModifiers) @@ -1329,7 +1347,10 @@ debugLex'' [Token (Err (Opaque msg)) start end] = where msg1 = "Error on line " <> show (line start) <> ", column " <> show (column start) msg2 = - "Error on line " <> show (line start) <> ", column " <> show (column start) + "Error on line " + <> show (line start) + <> ", column " + <> show (column start) <> " - line " <> show (line end) <> ", column " diff --git a/unison-syntax/src/Unison/Syntax/Name.hs b/unison-syntax/src/Unison/Syntax/Name.hs index 56f154696..052b34f92 100644 --- a/unison-syntax/src/Unison/Syntax/Name.hs +++ b/unison-syntax/src/Unison/Syntax/Name.hs @@ -55,7 +55,7 @@ toText (Name pos (x0 :| xs)) = Relative -> "" -- | Convert a name to a string representation, then parse that as a var. -toVar :: Var v => Name -> v +toVar :: (Var v) => Name -> v toVar = Var.named . toText @@ -102,12 +102,12 @@ unsafeFromString = -- -- Performs very minor validation (a name can't be empty, nor contain a '#' character [at least currently?]) but makes -- no attempt at rejecting bogus names like "foo...bar...baz". -unsafeFromText :: HasCallStack => Text -> Name +unsafeFromText :: (HasCallStack) => Text -> Name unsafeFromText = either (error . Text.unpack) id . fromTextEither -- | Unsafely parse a name from a var, by first rendering the var as a string. -- -- See 'unsafeFromText'. -unsafeFromVar :: Var v => v -> Name +unsafeFromVar :: (Var v) => v -> Name unsafeFromVar = unsafeFromText . Var.name diff --git a/unison-syntax/src/Unison/Syntax/Parser.hs b/unison-syntax/src/Unison/Syntax/Parser.hs index 76a98054e..ae5efe95f 100644 --- a/unison-syntax/src/Unison/Syntax/Parser.hs +++ b/unison-syntax/src/Unison/Syntax/Parser.hs @@ -73,7 +73,7 @@ instance Semigroup UniqueName where instance Monoid UniqueName where mempty = UniqueName (\_ _ -> Nothing) -uniqueBase32Namegen :: forall gen. Random.DRG gen => gen -> UniqueName +uniqueBase32Namegen :: forall gen. (Random.DRG gen) => gen -> UniqueName uniqueBase32Namegen rng = UniqueName $ \pos lenInBase32Hex -> go pos lenInBase32Hex rng where @@ -91,7 +91,7 @@ uniqueBase32Namegen rng = then go pos lenInBase32Hex rng else Just . Text.take lenInBase32Hex $ b58 -uniqueName :: Var v => Int -> P v Text +uniqueName :: (Var v) => Int -> P v Text uniqueName lenInBase32Hex = do UniqueName mkName <- asks uniqueNames pos <- L.start <$> P.lookAhead anyToken @@ -144,13 +144,13 @@ instance Annotated Ann where instance Annotated (L.Token a) where ann (L.Token _ s e) = Ann s e -instance Annotated a => Annotated (ABT.Term f v a) where +instance (Annotated a) => Annotated (ABT.Term f v a) where ann = ann . ABT.annotation -instance Annotated a => Annotated (Pattern a) where +instance (Annotated a) => Annotated (Pattern a) where ann = ann . Pattern.loc -instance Annotated a => Annotated [a] where +instance (Annotated a) => Annotated [a] where ann [] = mempty ann (h : t) = foldl' (\acc a -> acc <> ann a) (ann h) t @@ -162,7 +162,7 @@ label = P.label -- label = P.dbg -traceRemainingTokens :: Ord v => String -> P v () +traceRemainingTokens :: (Ord v) => String -> P v () traceRemainingTokens label = do remainingTokens <- lookAhead $ many anyToken let _ = @@ -175,16 +175,16 @@ mkAnn x y = ann x <> ann y tok :: (Ann -> a -> b) -> L.Token a -> b tok f (L.Token a start end) = f (Ann start end) a -peekAny :: Ord v => P v (L.Token L.Lexeme) +peekAny :: (Ord v) => P v (L.Token L.Lexeme) peekAny = P.lookAhead P.anySingle -lookAhead :: Ord v => P v a -> P v a +lookAhead :: (Ord v) => P v a -> P v a lookAhead = P.lookAhead -anyToken :: Ord v => P v (L.Token L.Lexeme) +anyToken :: (Ord v) => P v (L.Token L.Lexeme) anyToken = P.anySingle -failCommitted :: Ord v => Error v -> P v x +failCommitted :: (Ord v) => Error v -> P v x failCommitted e = do void anyToken <|> void P.eof P.customFailure e @@ -192,13 +192,13 @@ failCommitted e = do proxy :: Proxy Input proxy = Proxy -root :: Ord v => P v a -> P v a +root :: (Ord v) => P v a -> P v a root p = (openBlock *> p) <* closeBlock <* P.eof -rootFile :: Ord v => P v a -> P v a +rootFile :: (Ord v) => P v a -> P v a rootFile p = p <* P.eof -run' :: Ord v => P v a -> String -> String -> ParsingEnv -> Either (Err v) a +run' :: (Ord v) => P v a -> String -> String -> ParsingEnv -> Either (Err v) a run' p s name env = let lex = if debug @@ -209,101 +209,101 @@ run' p s name env = Left err -> Left (Nel.head (P.bundleErrors err)) Right x -> Right x -run :: Ord v => P v a -> String -> ParsingEnv -> Either (Err v) a +run :: (Ord v) => P v a -> String -> ParsingEnv -> Either (Err v) a run p s = run' p s "" -- Virtual pattern match on a lexeme. -queryToken :: Ord v => (L.Lexeme -> Maybe a) -> P v (L.Token a) +queryToken :: (Ord v) => (L.Lexeme -> Maybe a) -> P v (L.Token a) queryToken f = P.token (traverse f) Set.empty -- Consume a block opening and return the string that opens the block. -openBlock :: Ord v => P v (L.Token String) +openBlock :: (Ord v) => P v (L.Token String) openBlock = queryToken getOpen where getOpen (L.Open s) = Just s getOpen _ = Nothing -openBlockWith :: Ord v => String -> P v (L.Token ()) +openBlockWith :: (Ord v) => String -> P v (L.Token ()) openBlockWith s = void <$> P.satisfy ((L.Open s ==) . L.payload) -- Match a particular lexeme exactly, and consume it. -matchToken :: Ord v => L.Lexeme -> P v (L.Token L.Lexeme) +matchToken :: (Ord v) => L.Lexeme -> P v (L.Token L.Lexeme) matchToken x = P.satisfy ((==) x . L.payload) -- The package name that refers to the root, literally just `.` -importDotId :: Ord v => P v (L.Token Name) +importDotId :: (Ord v) => P v (L.Token Name) importDotId = queryToken go where go (L.SymbolyId "." Nothing) = Just (Name.unsafeFromString ".") go _ = Nothing -- Consume a virtual semicolon -semi :: Ord v => P v (L.Token ()) +semi :: (Ord v) => P v (L.Token ()) semi = label "newline or semicolon" $ queryToken go where go (L.Semi _) = Just () go _ = Nothing -- Consume the end of a block -closeBlock :: Ord v => P v (L.Token ()) +closeBlock :: (Ord v) => P v (L.Token ()) closeBlock = void <$> matchToken L.Close -wordyPatternName :: Var v => P v (L.Token v) +wordyPatternName :: (Var v) => P v (L.Token v) wordyPatternName = queryToken $ \case L.WordyId s Nothing -> Just $ Var.nameds s _ -> Nothing -- Parse an prefix identifier e.g. Foo or (+), discarding any hash -prefixDefinitionName :: Var v => P v (L.Token v) +prefixDefinitionName :: (Var v) => P v (L.Token v) prefixDefinitionName = wordyDefinitionName <|> parenthesize symbolyDefinitionName -- Parse a wordy identifier e.g. Foo, discarding any hash -wordyDefinitionName :: Var v => P v (L.Token v) +wordyDefinitionName :: (Var v) => P v (L.Token v) wordyDefinitionName = queryToken $ \case L.WordyId s _ -> Just $ Var.nameds s L.Blank s -> Just $ Var.nameds ("_" <> s) _ -> Nothing -- Parse a wordyId as a String, rejecting any hash -wordyIdString :: Ord v => P v (L.Token String) +wordyIdString :: (Ord v) => P v (L.Token String) wordyIdString = queryToken $ \case L.WordyId s Nothing -> Just s _ -> Nothing -- Parse a wordyId as a Name, rejecting any hash -importWordyId :: Ord v => P v (L.Token Name) +importWordyId :: (Ord v) => P v (L.Token Name) importWordyId = (fmap . fmap) Name.unsafeFromString wordyIdString -- The `+` in: use Foo.bar + as a Name -importSymbolyId :: Ord v => P v (L.Token Name) +importSymbolyId :: (Ord v) => P v (L.Token Name) importSymbolyId = (fmap . fmap) Name.unsafeFromString symbolyIdString -- Parse a symbolyId as a String, rejecting any hash -symbolyIdString :: Ord v => P v (L.Token String) +symbolyIdString :: (Ord v) => P v (L.Token String) symbolyIdString = queryToken $ \case L.SymbolyId s Nothing -> Just s _ -> Nothing -- Parse an infix id e.g. + or Docs.++, discarding any hash -infixDefinitionName :: Var v => P v (L.Token v) +infixDefinitionName :: (Var v) => P v (L.Token v) infixDefinitionName = symbolyDefinitionName -- Parse a symboly ID like >>= or &&, discarding any hash -symbolyDefinitionName :: Var v => P v (L.Token v) +symbolyDefinitionName :: (Var v) => P v (L.Token v) symbolyDefinitionName = queryToken $ \case L.SymbolyId s _ -> Just $ Var.nameds s _ -> Nothing -parenthesize :: Ord v => P v a -> P v a +parenthesize :: (Ord v) => P v a -> P v a parenthesize p = P.try (openBlockWith "(" *> p) <* closeBlock -hqPrefixId, hqInfixId :: Ord v => P v (L.Token (HQ.HashQualified Name)) +hqPrefixId, hqInfixId :: (Ord v) => P v (L.Token (HQ.HashQualified Name)) hqPrefixId = hqWordyId_ <|> parenthesize hqSymbolyId_ hqInfixId = hqSymbolyId_ -- Parse a hash-qualified alphanumeric identifier -hqWordyId_ :: Ord v => P v (L.Token (HQ.HashQualified Name)) +hqWordyId_ :: (Ord v) => P v (L.Token (HQ.HashQualified Name)) hqWordyId_ = queryToken $ \case L.WordyId "" (Just h) -> Just $ HQ.HashOnly h L.WordyId s (Just h) -> Just $ HQ.HashQualified (Name.unsafeFromString s) h @@ -313,7 +313,7 @@ hqWordyId_ = queryToken $ \case _ -> Nothing -- Parse a hash-qualified symboly ID like >>=#foo or && -hqSymbolyId_ :: Ord v => P v (L.Token (HQ.HashQualified Name)) +hqSymbolyId_ :: (Ord v) => P v (L.Token (HQ.HashQualified Name)) hqSymbolyId_ = queryToken $ \case L.SymbolyId "" (Just h) -> Just $ HQ.HashOnly h L.SymbolyId s (Just h) -> Just $ HQ.HashQualified (Name.unsafeFromString s) h @@ -321,62 +321,62 @@ hqSymbolyId_ = queryToken $ \case _ -> Nothing -- Parse a reserved word -reserved :: Ord v => String -> P v (L.Token String) +reserved :: (Ord v) => String -> P v (L.Token String) reserved w = label w $ queryToken getReserved where getReserved (L.Reserved w') | w == w' = Just w getReserved _ = Nothing -- Parse a placeholder or typed hole -blank :: Ord v => P v (L.Token String) +blank :: (Ord v) => P v (L.Token String) blank = label "blank" $ queryToken getBlank where getBlank (L.Blank s) = Just ('_' : s) getBlank _ = Nothing -numeric :: Ord v => P v (L.Token String) +numeric :: (Ord v) => P v (L.Token String) numeric = queryToken getNumeric where getNumeric (L.Numeric s) = Just s getNumeric _ = Nothing -bytesToken :: Ord v => P v (L.Token Bytes) +bytesToken :: (Ord v) => P v (L.Token Bytes) bytesToken = queryToken getBytes where getBytes (L.Bytes bs) = Just bs getBytes _ = Nothing -sepBy :: Ord v => P v a -> P v b -> P v [b] +sepBy :: (Ord v) => P v a -> P v b -> P v [b] sepBy sep pb = P.sepBy pb sep -sepBy1 :: Ord v => P v a -> P v b -> P v [b] +sepBy1 :: (Ord v) => P v a -> P v b -> P v [b] sepBy1 sep pb = P.sepBy1 pb sep -sepEndBy :: Ord v => P v a -> P v b -> P v [b] +sepEndBy :: (Ord v) => P v a -> P v b -> P v [b] sepEndBy sep pb = P.sepEndBy pb sep -character :: Ord v => P v (L.Token Char) +character :: (Ord v) => P v (L.Token Char) character = queryToken getChar where getChar (L.Character c) = Just c getChar _ = Nothing -string :: Ord v => P v (L.Token Text) +string :: (Ord v) => P v (L.Token Text) string = queryToken getString where getString (L.Textual s) = Just (Text.pack s) getString _ = Nothing -tupleOrParenthesized :: Ord v => P v a -> (Ann -> a) -> (a -> a -> a) -> P v a +tupleOrParenthesized :: (Ord v) => P v a -> (Ann -> a) -> (a -> a -> a) -> P v a tupleOrParenthesized p unit pair = seq' "(" go p where go _ [t] = t go a xs = foldr pair (unit a) xs -seq :: Ord v => (Ann -> [a] -> a) -> P v a -> P v a +seq :: (Ord v) => (Ann -> [a] -> a) -> P v a -> P v a seq = seq' "[" -seq' :: Ord v => String -> (Ann -> [a] -> a) -> P v a -> P v a +seq' :: (Ord v) => String -> (Ann -> [a] -> a) -> P v a -> P v a seq' openStr f p = do open <- openBlockWith openStr <* redundant es <- sepEndBy (P.try $ optional semi *> reserved "," <* redundant) p @@ -386,19 +386,19 @@ seq' openStr f p = do go open elems close = f (ann open <> ann close) elems redundant = P.skipMany (P.eitherP (reserved ",") semi) -chainr1 :: Ord v => P v a -> P v (a -> a -> a) -> P v a +chainr1 :: (Ord v) => P v a -> P v (a -> a -> a) -> P v a chainr1 p op = go1 where go1 = p >>= go2 go2 hd = do { op <- op; op hd <$> go1 } <|> pure hd -- Parse `p` 1+ times, combining with `op` -chainl1 :: Ord v => P v a -> P v (a -> a -> a) -> P v a +chainl1 :: (Ord v) => P v a -> P v (a -> a -> a) -> P v a chainl1 p op = foldl (flip ($)) <$> p <*> P.many (flip <$> op <*> p) -- If `p` would succeed, this fails uncommitted. -- Otherwise, `failIfOk` used to produce the output -failureIf :: Ord v => P v (P v b) -> P v a -> P v b +failureIf :: (Ord v) => P v (P v b) -> P v a -> P v b failureIf failIfOk p = do dontwant <- P.try . P.lookAhead $ failIfOk p <- P.try $ P.lookAhead (optional p) diff --git a/yaks/easytest/src/EasyTest.hs b/yaks/easytest/src/EasyTest.hs index da89129f8..c277ac178 100644 --- a/yaks/easytest/src/EasyTest.hs +++ b/yaks/easytest/src/EasyTest.hs @@ -54,11 +54,11 @@ atomicLogger = do let dummy = foldl' (\_ ch -> ch == 'a') True msg in dummy `seq` bracket (takeMVar lock) (\_ -> putMVar lock ()) (\_ -> putStrLn msg) -expect' :: HasCallStack => Bool -> Test () +expect' :: (HasCallStack) => Bool -> Test () expect' False = crash "unexpected" expect' True = pure () -expect :: HasCallStack => Bool -> Test () +expect :: (HasCallStack) => Bool -> Test () expect False = crash "unexpected" expect True = ok @@ -80,15 +80,15 @@ expectNotEqual forbidden actual = then ok else crash $ unlines ["", show actual, "** did equal the forbidden value **", show forbidden] -expectJust :: HasCallStack => Maybe a -> Test a +expectJust :: (HasCallStack) => Maybe a -> Test a expectJust Nothing = crash "expected Just, got Nothing" expectJust (Just a) = ok >> pure a -expectRight :: HasCallStack => Either e a -> Test a +expectRight :: (HasCallStack) => Either e a -> Test a expectRight (Left _) = crash "expected Right, got Left" expectRight (Right a) = ok >> pure a -expectLeft :: HasCallStack => Either e a -> Test e +expectLeft :: (HasCallStack) => Either e a -> Test e expectLeft (Left e) = ok >> pure e expectLeft (Right _) = crash "expected Left, got Right" @@ -197,11 +197,11 @@ note msg = do pure () -- | Log a showable value -note' :: Show s => s -> Test () +note' :: (Show s) => s -> Test () note' = note . show -- | Generate a random value -random :: Random a => Test a +random :: (Random a) => Test a random = do rng <- asks rng liftIO . atomically $ do @@ -211,7 +211,7 @@ random = do pure a -- | Generate a bounded random value. Inclusive on both sides. -random' :: Random a => a -> a -> Test a +random' :: (Random a) => a -> a -> Test a random' lower upper = do rng <- asks rng liftIO . atomically $ do @@ -318,11 +318,11 @@ tuple4 = (,,,) <$> random <*> random <*> random <*> random -- | Generate a `Data.Map k v` of the given size. -mapOf :: Ord k => Int -> Test k -> Test v -> Test (Map k v) +mapOf :: (Ord k) => Int -> Test k -> Test v -> Test (Map k v) mapOf n k v = Map.fromList <$> listOf n (pair k v) -- | Generate a `[Data.Map k v]` of the given sizes. -mapsOf :: Ord k => [Int] -> Test k -> Test v -> Test [Map k v] +mapsOf :: (Ord k) => [Int] -> Test k -> Test v -> Test [Map k v] mapsOf sizes k v = sizes `forM` \n -> mapOf n k v -- | Catch all exceptions that could occur in the given `Test` @@ -374,14 +374,14 @@ skip :: Test () skip = Test (Nothing <$ putResult Skipped) -- | Record a failure at the current scope -crash :: HasCallStack => String -> Test a +crash :: (HasCallStack) => String -> Test a crash msg = do let trace = callStack msg' = msg ++ " " ++ prettyCallStack trace Test (Just <$> putResult Failed) >> noteScoped ("FAILURE " ++ msg') >> Test (pure Nothing) -- | Overwrites the env so that note_ (the logger) is a no op -nologging :: HasCallStack => Test a -> Test a +nologging :: (HasCallStack) => Test a -> Test a nologging (Test t) = Test $ do env <- ask liftIO $ runWrap (env {note_ = \_ -> pure ()}) t @@ -396,7 +396,7 @@ attempt (Test t) = nologging $ do -- | Placeholder wrapper for a failing test. The test being wrapped is expected/known to fail. -- Will produce a failure if the test being wrapped suddenly becomes a success. -pending :: HasCallStack => Test a -> Test a +pending :: (HasCallStack) => Test a -> Test a pending test = do m <- attempt test case m of From 6cbdf6833f0a4e664ff2db37002c868678c890e7 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Mon, 13 Feb 2023 13:08:22 -0600 Subject: [PATCH 319/467] Add note about formatting existing in-flight PRs --- development.markdown | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/development.markdown b/development.markdown index 64dc24c32..3b45c47d5 100644 --- a/development.markdown +++ b/development.markdown @@ -16,7 +16,7 @@ To get cracking with Unison: On startup, Unison prints a url for the codebase UI. If you did step 3 above, then visiting that URL in a browser will give you a nice interface to your codebase. -## Add a pre-commit hook for autoformatting with Ormolu +## Autoformatting your code with Ormolu We use 0.5.3.0 of Ormolu and CI will fail if your code isn't properly formatted. You can add the following to `.git/hooks/pre-commit` to make sure all your commits get formatted (this assumes you've got [`rg`](https://github.com/BurntSushi/ripgrep) installed and on your path): @@ -31,7 +31,13 @@ if [[ -z "${SKIP_FORMATTING}" ]]; then fi ``` -Note that you can always wrap a comment around some code you don't want Ormolu to touch, using: +If you've got an existing PR that somehow hasn't been formatted correctly, you can install the correct version of Ormolu locally, then do: + +``` +ormolu --mode inplace $(find . -name '*.hs') +``` + +Also note that you can always wrap a comment around some code you don't want Ormolu to touch, using: ``` {- ORMOLU_DISABLE -} From 97ce5bf7a175a8c3462b4e6440bee496a685a3e4 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Mon, 13 Feb 2023 13:34:07 -0600 Subject: [PATCH 320/467] Only run check on ubuntu --- .github/workflows/ci.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bf11ccdc0..5f3e0faaf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,18 @@ on: - release/* jobs: + checkout: + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + path: unison + + ormolu: + runs-on: ubuntu-20.04 + steps: + - uses: mrkkrp/ormolu-action@v10 + build: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -34,10 +46,8 @@ jobs: - macOS-11.0 - windows-2019 steps: - - uses: actions/checkout@v2 - with: - path: unison - - uses: mrkkrp/ormolu-action@v10 + - needs: checkout + - needs: ormolu # The number towards the beginning of the cache keys allow you to manually avoid using a previous cache. # GitHub will automatically delete caches that haven't been accessed in 7 days, but there is no way to From 0c702229f6156cce3046f46bce7a8a35e940466f Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Mon, 13 Feb 2023 13:39:09 -0600 Subject: [PATCH 321/467] fix yaml syntax --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5f3e0faaf..3e3ab7db0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,6 +32,8 @@ jobs: build: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} + needs: checkout + needs: ormolu defaults: run: working-directory: unison @@ -46,8 +48,6 @@ jobs: - macOS-11.0 - windows-2019 steps: - - needs: checkout - - needs: ormolu # The number towards the beginning of the cache keys allow you to manually avoid using a previous cache. # GitHub will automatically delete caches that haven't been accessed in 7 days, but there is no way to From 53c529978a4327f43b28ffc224e519fbbd42a69d Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Mon, 13 Feb 2023 13:41:38 -0600 Subject: [PATCH 322/467] needs syntax fix --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3e3ab7db0..e098ef925 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,8 +32,7 @@ jobs: build: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} - needs: checkout - needs: ormolu + needs: [checkout, ormolu] defaults: run: working-directory: unison From 4bd4eff18460836d00e5ee88358e619810aad0ca Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Mon, 13 Feb 2023 13:44:27 -0600 Subject: [PATCH 323/467] I am not programming by YAML file. What have I become? --- .github/workflows/ci.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e098ef925..7ebe6cdce 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,22 +17,19 @@ on: - release/* jobs: - checkout: - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - with: - path: unison ormolu: runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 + with: + path: unison - uses: mrkkrp/ormolu-action@v10 build: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} - needs: [checkout, ormolu] + needs: ormolu defaults: run: working-directory: unison @@ -47,6 +44,9 @@ jobs: - macOS-11.0 - windows-2019 steps: + - uses: actions/checkout@v2 + with: + path: unison # The number towards the beginning of the cache keys allow you to manually avoid using a previous cache. # GitHub will automatically delete caches that haven't been accessed in 7 days, but there is no way to From 23f4754663d088138bce283b025fc0f6b4c51a4d Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 13 Feb 2023 19:03:27 -0500 Subject: [PATCH 324/467] Make compile.native use racket --- .../src/Unison/Codebase/Editor/HandleInput.hs | 99 +++++++++++++------ 1 file changed, 68 insertions(+), 31 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index b06e167fa..414bb9739 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -36,8 +36,14 @@ import System.Directory getXdgDirectory, ) import System.Environment (withArgs) +import System.Exit (ExitCode (..)) import System.FilePath (()) -import System.Process (callProcess, readCreateProcess, shell) +import System.Process + ( callProcess, + readCreateProcess, + readCreateProcessWithExitCode, + shell, + ) import qualified Text.Megaparsec as P import qualified U.Codebase.Branch.Diff as V2Branch import qualified U.Codebase.Causal as V2Causal @@ -2739,37 +2745,51 @@ typecheckAndEval ppe tm = do a = External rendered = P.toPlainUnbroken $ TP.pretty ppe tm -ensureSchemeExists :: Cli () -ensureSchemeExists = +ensureSchemeExists :: SchemeBackend -> Cli () +ensureSchemeExists bk = liftIO callScheme >>= \case True -> pure () False -> Cli.returnEarly (PrintMessage msg) where - msg = - P.lines - [ "I can't seem to call scheme. See", - "", - P.indentN - 2 - "https://github.com/cisco/ChezScheme/blob/main/BUILDING", - "", - "for how to install Chez Scheme." - ] + msg = case bk of + Racket -> + P.lines + [ "I can't seem to call racket. See", + "", + P.indentN + 2 + "https://download.racket-lang.org/", + "", + "for how to install Racket." + ] + Chez -> + P.lines + [ "I can't seem to call scheme. See", + "", + P.indentN + 2 + "https://github.com/cisco/ChezScheme/blob/main/BUILDING", + "", + "for how to install Chez Scheme." + ] + cmd = case bk of + Racket -> "racket -l- raco help" + Chez -> "scheme -q" callScheme = - catch - (True <$ readCreateProcess (shell "scheme -q") "") - (\(_ :: IOException) -> pure False) + readCreateProcessWithExitCode (shell cmd) "" >>= \case + (ExitSuccess, _, _) -> pure True + (ExitFailure _, _, _) -> pure False -racketOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] -racketOpts gendir statdir file args = libs ++ [file] ++ args +racketOpts :: FilePath -> FilePath -> [String] -> [String] +racketOpts gendir statdir args = libs ++ args where includes = [gendir, statdir "common", statdir "racket"] - libs = concatMap (\dir -> ["-S",dir]) includes + libs = concatMap (\dir -> ["-S", dir]) includes -chezOpts :: FilePath -> FilePath -> FilePath -> [String] -> [String] -chezOpts gendir statdir file args = - "-q" : opt ++ libs ++ ["--script", file] ++ args +chezOpts :: FilePath -> FilePath -> [String] -> [String] +chezOpts gendir statdir args = + "-q" : opt ++ libs ++ ["--script"] ++ args where includes = [gendir, statdir "common", statdir "chez"] libs = ["--libdirs", List.intercalate ":" includes] @@ -2778,14 +2798,14 @@ chezOpts gendir statdir file args = data SchemeBackend = Racket | Chez runScheme :: SchemeBackend -> String -> [String] -> Cli () -runScheme bk file args0 = do - ensureSchemeExists +runScheme bk file args = do + ensureSchemeExists bk gendir <- getSchemeGenLibDir statdir <- getSchemeStaticLibDir - let cmd = case bk of Racket -> "racket" ; Chez -> "scheme" + let cmd = case bk of Racket -> "racket"; Chez -> "scheme" opts = case bk of - Racket -> racketOpts gendir statdir file args0 - Chez -> chezOpts gendir statdir file args0 + Racket -> racketOpts gendir statdir (file : args) + Chez -> chezOpts gendir statdir (file : args) success <- liftIO $ (True <$ callProcess cmd opts) @@ -2793,11 +2813,28 @@ runScheme bk file args0 = do unless success $ Cli.returnEarly (PrintMessage "Scheme evaluation failed.") -buildChez :: String -> String -> Cli () -buildChez main file = do - ensureSchemeExists +buildScheme :: SchemeBackend -> String -> String -> Cli () +buildScheme bk main file = do + ensureSchemeExists bk statDir <- getSchemeStaticLibDir genDir <- getSchemeGenLibDir + build genDir statDir main file + where + build + | Racket <- bk = buildRacket + | Chez <- bk = buildChez + +buildRacket :: String -> String -> String -> String -> Cli () +buildRacket genDir statDir main file = + let args = ["-l", "raco", "--", "exe", "-o", main, file] + opts = racketOpts genDir statDir args + in void . liftIO $ + catch + (True <$ callProcess "racket" opts) + (\(_ :: IOException) -> pure False) + +buildChez :: String -> String -> String -> String -> Cli () +buildChez genDir statDir main file = do let cmd = shell "scheme -q --optimize-level 3" void . liftIO $ readCreateProcess cmd (build statDir genDir) where @@ -2826,7 +2863,7 @@ doRunAsScheme main args = do doCompileScheme :: String -> HQ.HashQualified Name -> Cli () doCompileScheme out main = - generateSchemeFile False out main >>= buildChez out + generateSchemeFile True out main >>= buildScheme Racket out generateSchemeFile :: Bool -> String -> HQ.HashQualified Name -> Cli String generateSchemeFile exec out main = do From 0109f004757aa0827ec136fda830a7fbe2936588 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Tue, 14 Feb 2023 09:56:02 -0600 Subject: [PATCH 325/467] Update .github/workflows/ci.yaml Co-authored-by: Arya Irani <538571+aryairani@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7ebe6cdce..18b7cfc05 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v2 with: path: unison - - uses: mrkkrp/ormolu-action@v10 + - uses: mrkkrp/ormolu-action@v10 # v10 uses ormolu 0.5.3.0 build: name: ${{ matrix.os }} From 96d42d213c87cc9c8e9865a46a0053bf69abd60b Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Tue, 14 Feb 2023 09:59:26 -0600 Subject: [PATCH 326/467] reformat --- parser-typechecker/src/Unison/Runtime/Foreign.hs | 8 ++++---- parser-typechecker/src/Unison/Util/Text/Pattern.hs | 10 +++++----- unison-core/src/Unison/Type.hs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Foreign.hs b/parser-typechecker/src/Unison/Runtime/Foreign.hs index c29e7ee5c..dc4eb94ba 100644 --- a/parser-typechecker/src/Unison/Runtime/Foreign.hs +++ b/parser-typechecker/src/Unison/Runtime/Foreign.hs @@ -240,7 +240,7 @@ instance BuiltinForeign TimeSpec where foreignRef = Tagged Ty.timeSpecRef data HashAlgorithm where -- Reference is a reference to the hash algorithm - HashAlgorithm :: Hash.HashAlgorithm a => Reference -> a -> HashAlgorithm + HashAlgorithm :: (Hash.HashAlgorithm a) => Reference -> a -> HashAlgorithm newtype Tls = Tls TLS.Context @@ -254,15 +254,15 @@ instance BuiltinForeign CPattern where instance BuiltinForeign CharPattern where foreignRef = Tagged Ty.charClassRef -wrapBuiltin :: forall f. BuiltinForeign f => f -> Foreign +wrapBuiltin :: forall f. (BuiltinForeign f) => f -> Foreign wrapBuiltin x = Wrap r x where Tagged r = foreignRef :: Tagged f Reference -unwrapBuiltin :: BuiltinForeign f => Foreign -> f +unwrapBuiltin :: (BuiltinForeign f) => Foreign -> f unwrapBuiltin (Wrap _ x) = unsafeCoerce x -maybeUnwrapBuiltin :: forall f. BuiltinForeign f => Foreign -> Maybe f +maybeUnwrapBuiltin :: forall f. (BuiltinForeign f) => Foreign -> Maybe f maybeUnwrapBuiltin (Wrap r x) | r == r0 = Just (unsafeCoerce x) | otherwise = Nothing diff --git a/parser-typechecker/src/Unison/Util/Text/Pattern.hs b/parser-typechecker/src/Unison/Util/Text/Pattern.hs index 0b2b3d2e4..14abd413e 100644 --- a/parser-typechecker/src/Unison/Util/Text/Pattern.hs +++ b/parser-typechecker/src/Unison/Util/Text/Pattern.hs @@ -163,11 +163,11 @@ compile (Many p) !_ !success = case p of rem | DT.null rem -> go acc t | otherwise -> - -- moving the remainder to the root of the tree is much more efficient - -- since the next uncons will be O(1) rather than O(log n) - -- this can't unbalance the tree too badly since these promoted chunks - -- are being consumed and will get removed by a subsequent uncons - success acc (Text.appendUnbalanced (Text.fromText rem) t) + -- moving the remainder to the root of the tree is much more efficient + -- since the next uncons will be O(1) rather than O(log n) + -- this can't unbalance the tree too badly since these promoted chunks + -- are being consumed and will get removed by a subsequent uncons + success acc (Text.appendUnbalanced (Text.fromText rem) t) {-# INLINE walker #-} compile (Replicate m n p) !err !success = case p of Char Any -> \acc t -> diff --git a/unison-core/src/Unison/Type.hs b/unison-core/src/Unison/Type.hs index 045836331..81801b723 100644 --- a/unison-core/src/Unison/Type.hs +++ b/unison-core/src/Unison/Type.hs @@ -644,7 +644,7 @@ removePureEffects :: (ABT.Var v) => Type v a -> Type v a removePureEffects t | not Settings.removePureEffects = t | otherwise = - generalize vs $ removeEffectVars fvs tu + generalize vs $ removeEffectVars fvs tu where (vs, tu) = unforall' t vss = Set.fromList vs From 63ef9953cada4fb107fa2d3d58075bc819c24244 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 14 Feb 2023 23:00:21 +0000 Subject: [PATCH 327/467] Consolidate into single test suite --- unison-src/builtin-tests/concurrency-tests.u | 2 +- unison-src/builtin-tests/interpreter-tests.md | 15 +++++---------- .../builtin-tests/interpreter-tests.output.md | 6 ------ unison-src/builtin-tests/jit-tests.md | 14 +++++--------- unison-src/builtin-tests/jit-tests.output.md | 4 ---- unison-src/builtin-tests/tests.u | 4 +++- 6 files changed, 14 insertions(+), 31 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index b18ffb765..c573bd191 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,4 +1,4 @@ -concurrency.tests = Tests.main do +concurrency.tests = do !simpleRefTest !simpleRefTestScope !ticketTest diff --git a/unison-src/builtin-tests/interpreter-tests.md b/unison-src/builtin-tests/interpreter-tests.md index 7f94009be..206efae6e 100644 --- a/unison-src/builtin-tests/interpreter-tests.md +++ b/unison-src/builtin-tests/interpreter-tests.md @@ -10,6 +10,11 @@ If you want to define more complex tests somewhere other than `tests.u`, just `l then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls to `Tests.check` and `Tests.checkEqual`). +```ucm:hide +.> load unison-src/builtin-tests/concurrency-tests.u +.> add +``` + ```ucm:hide .> load unison-src/builtin-tests/tests.u .> add @@ -18,13 +23,3 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run tests ``` - -```ucm:hide -.> load unison-src/builtin-tests/concurrency-tests.u -.> add -``` - -```ucm -.> run concurrency.tests -``` - diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index 311b77b6d..947c5941a 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -11,9 +11,3 @@ to `Tests.check` and `Tests.checkEqual`). () ``` -```ucm -.> run concurrency.tests - - () - -``` diff --git a/unison-src/builtin-tests/jit-tests.md b/unison-src/builtin-tests/jit-tests.md index b44da5dc0..3cb95d893 100644 --- a/unison-src/builtin-tests/jit-tests.md +++ b/unison-src/builtin-tests/jit-tests.md @@ -12,6 +12,11 @@ If you want to define more complex tests somewhere other than `tests.u`, just `l then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls to `Tests.check` and `Tests.checkEqual`). +```ucm:hide +.> load unison-src/builtin-tests/concurrency-tests.u +.> add +``` + ```ucm:hide .> load unison-src/builtin-tests/tests.u .> add @@ -20,12 +25,3 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native tests ``` - -```ucm:hide -.> load unison-src/builtin-tests/concurrency-tests.u -.> add -``` - -```ucm -.> run.native concurrency.tests -``` diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 19ddeec19..016ea7e65 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -9,7 +9,3 @@ to `Tests.check` and `Tests.checkEqual`). .> run.native tests ``` -```ucm -.> run.native concurrency.tests - -``` diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 550585352..aa76faa73 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -23,4 +23,6 @@ tests = Tests.main do check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") === 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") === 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 - check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 \ No newline at end of file + check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 + + !concurrency.tests From f4fe9c6a5040a3c997fb209ad0d1c2823fe9c8d2 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 15 Feb 2023 00:11:47 +0000 Subject: [PATCH 328/467] Ignore libb2 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6ef1f5047..73249e2da 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ dist-newstyle # GHC *.hie *.prof +/libb2.dylib From 949f677afced7aeb66d63977c4c6605cd6891214 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 15 Feb 2023 00:19:29 +0000 Subject: [PATCH 329/467] Add stub for tryEval --- scheme-libs/common/unison/primops.ss | 2 ++ unison-src/builtin-tests/concurrency-tests.u | 10 +++++-- unison-src/builtin-tests/jit-tests.output.md | 30 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 98b32c886..d6156587e 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -73,6 +73,7 @@ unison-FOp-IO.delay.impl.v3 unison-POp-FORK unison-FOp-IO.kill.impl.v3 + unison-POp-TFRC unison-POp-ADDN unison-POp-ANDN @@ -327,6 +328,7 @@ (define (unison-FOp-Scope.array n) (make-vector n)) (define (unison-POp-FORK thunk) (fork thunk)) + (define (unison-POp-TFRC thunk) (display "stub")) (define (unison-FOp-IO.delay.impl.v3 micros) (sleep micros)) (define (unison-FOp-IO.kill.impl.v3 threadId) (kill threadId)) (define (unison-FOp-Scope.ref a) (ref-new a)) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index c573bd191..57ae05df5 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -6,7 +6,7 @@ concurrency.tests = do !promiseSequentialTest !promiseConcurrentTest !forkKillTest - -- !tryEvalForkTest + !tryEvalForkTest !fullTest simpleRefTest = do @@ -84,7 +84,13 @@ forkKillTest = do v = Ref.read ref checkEqual "Thread was killed" v "initial" -tryEvalForkTest = bug "Depends on the Exception ability being implemented" +tryEvalForkTest = do + t = fork do + match catchAll do sleep_ (500 * millis) with + Left _ -> unsafeRun! do IO.console.printLine "interrupted" + Right _ -> unsafeRun! do IO.console.printLine "finished" + sleep_ (300 * millis) + kill_ t atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () atomicUpdate ref f = diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 016ea7e65..596fc74aa 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -8,4 +8,34 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native tests + 💔💥 + + The program halted with an unhandled exception: + + Failure + (typeLink ANFDecodeError) "unrecognized POp tag" (Any 118) + + + Stack trace: + ##raise + ``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + 💔💥 + + The program halted with an unhandled exception: + + Failure + (typeLink ANFDecodeError) "unrecognized POp tag" (Any 118) + + + Stack trace: + ##raise + From a0d36fdc516aad68818020f84243fa39918ac009 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 15 Feb 2023 06:40:21 +0000 Subject: [PATCH 330/467] Point ucm at fork of internal compiler lib --- .../src/Unison/Codebase/Editor/HandleInput.hs | 2 +- unison-src/builtin-tests/jit-tests.output.md | 31 +++---------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index b06e167fa..94d1c74b7 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2659,7 +2659,7 @@ doFetchCompiler = { server = RemoteRepo.DefaultCodeserver, repo = ShareUserHandle "unison", path = - Path.fromList $ NameSegment <$> ["public", "internal", "trunk"] + Path.fromList $ NameSegment <$> ["public", "internal", "primops"] } repo = Just $ ReadRemoteNamespaceShare ns diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 596fc74aa..d767bdcea 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -1,41 +1,18 @@ Note: This should be forked off of the codebase created by base.md -If you want to define more complex tests somewhere other than `tests.u`, just `load my-tests.u` then `add`, -then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls -to `Tests.check` and `Tests.checkEqual`). - ```ucm -.> run.native tests - - 💔💥 - - The program halted with an unhandled exception: - - Failure - (typeLink ANFDecodeError) "unrecognized POp tag" (Any 118) - - - Stack trace: - ##raise - +.> compile.native.fetch.> compile.native.genlibs.> load unison-src/builtin-tests/testlib.u.> add ``` - 🛑 The transcript failed due to an error in the stanza above. The error is: - 💔💥 + ❗️ - The program halted with an unhandled exception: - - Failure - (typeLink ANFDecodeError) "unrecognized POp tag" (Any 118) - - - Stack trace: - ##raise + The server didn't find anything at + unison.public.internal.primop-tags From 3f28697e258bebfa5a09caced8227d40525ccb8b Mon Sep 17 00:00:00 2001 From: Cody Allen Date: Wed, 15 Feb 2023 10:01:36 -0500 Subject: [PATCH 331/467] Improve error message for unhandled ability In certain cases this will change the failure message from something like `resolve: unhandled ability request: 1561` to `resolve: unhandled ability request: #ifg08` where `#ifg08` is the has of the ability that was unhandled. At this stage we don't have convenient access to the actual constructor within the ability that was not handled. I haven't added tests because I don't really know how to set them up. But it's not really a big deal if there's a regression in this error message, so I'm not sure whether they'd be worth the trouble. --- parser-typechecker/src/Unison/Runtime/Machine.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index 3ea45194c..bdd860943 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -1772,9 +1772,14 @@ resolve env _ _ (Env n i) = Just r -> pure $ PAp (CIx r n i) unull bnull Nothing -> die $ "resolve: missing reference for comb: " ++ show n resolve _ _ bstk (Stk i) = peekOff bstk i -resolve _ denv _ (Dyn i) = case EC.lookup i denv of +resolve env denv _ (Dyn i) = case EC.lookup i denv of Just clo -> pure clo - _ -> die $ "resolve: unhandled ability request: " ++ show i + Nothing -> readTVarIO (tagRefs env) >>= err + where + unhandled rs = case EC.lookup i rs of + Just r -> show r + Nothing -> show i + err rs = die $ "resolve: unhandled ability request: " ++ unhandled rs combSection :: (HasCallStack) => CCache -> CombIx -> IO Comb combSection env (CIx _ n i) = From 0c15c313cdc0d5f8e0eb0d9871646cfb326a6ceb Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 15 Feb 2023 09:30:29 -0600 Subject: [PATCH 332/467] Ormolu --- unison-cli/src/Unison/Auth/Tokens.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unison-cli/src/Unison/Auth/Tokens.hs b/unison-cli/src/Unison/Auth/Tokens.hs index b3ea8c8bc..9d0a1202b 100644 --- a/unison-cli/src/Unison/Auth/Tokens.hs +++ b/unison-cli/src/Unison/Auth/Tokens.hs @@ -20,7 +20,7 @@ import Web.JWT import qualified Web.JWT as JWT -- | Checks whether a JWT access token is expired. -isExpired :: MonadIO m => AccessToken -> m Bool +isExpired :: (MonadIO m) => AccessToken -> m Bool isExpired accessToken = liftIO do jwt <- JWT.decode accessToken `whenNothing` (throwIO $ InvalidJWT "Failed to decode JWT") now <- getPOSIXTime @@ -50,7 +50,7 @@ newTokenProvider manager host = UnliftIO.try @_ @CredentialFailure $ do -- | Don't yet support automatically refreshing tokens. -- -- Specification: https://datatracker.ietf.org/doc/html/rfc6749#section-6 -performTokenRefresh :: MonadIO m => DiscoveryDoc -> Tokens -> m (Either CredentialFailure Tokens) +performTokenRefresh :: (MonadIO m) => DiscoveryDoc -> Tokens -> m (Either CredentialFailure Tokens) performTokenRefresh DiscoveryDoc {tokenEndpoint} (Tokens {refreshToken = currentRefreshToken}) = runExceptT $ case currentRefreshToken of Nothing -> From c4f981ef58324d4e98e086888a818dfb67f17a43 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 15 Feb 2023 09:31:46 -0600 Subject: [PATCH 333/467] Ormolu --- unison-cli/src/Unison/Auth/UserInfo.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-cli/src/Unison/Auth/UserInfo.hs b/unison-cli/src/Unison/Auth/UserInfo.hs index 51de0bbaa..36ef184a6 100644 --- a/unison-cli/src/Unison/Auth/UserInfo.hs +++ b/unison-cli/src/Unison/Auth/UserInfo.hs @@ -11,7 +11,7 @@ import Unison.Auth.Types import Unison.Prelude -- | Get user info for an authenticated user. -getUserInfo :: MonadIO m => DiscoveryDoc -> AccessToken -> m (Either CredentialFailure UserInfo) +getUserInfo :: (MonadIO m) => DiscoveryDoc -> AccessToken -> m (Either CredentialFailure UserInfo) getUserInfo (DiscoveryDoc {userInfoEndpoint}) accessToken = liftIO $ do unauthenticatedHttpClient <- HTTP.getGlobalManager req <- HTTP.requestFromURI userInfoEndpoint <&> HTTP.applyBearerAuth (Text.encodeUtf8 accessToken) From 82bd02faea960dd248ccf425c256e5a977825b1b Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Wed, 15 Feb 2023 17:29:23 -0500 Subject: [PATCH 334/467] Some type references were being ignored when compiling code - The existing code was assuming that only references involved in `Pack` instructions were relevant, but this only preserves data type and request information. We need to remember types used in handlers, or else we will think that remote requests are coming from distinct abilities than the ones we are handling. --- parser-typechecker/src/Unison/Runtime/MCode.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parser-typechecker/src/Unison/Runtime/MCode.hs b/parser-typechecker/src/Unison/Runtime/MCode.hs index 811e4a0e1..62c1ad360 100644 --- a/parser-typechecker/src/Unison/Runtime/MCode.hs +++ b/parser-typechecker/src/Unison/Runtime/MCode.hs @@ -1436,6 +1436,9 @@ sectionTypes _ = [] instrTypes :: Instr -> [Word64] instrTypes (Pack _ w _) = [w `shiftR` 16] +instrTypes (Reset ws) = setToList ws +instrTypes (Capture w) = [w] +instrTypes (SetDyn w _) = [w] instrTypes _ = [] branchDeps :: Branch -> [Word64] From ec6c8ef9ead5b100a5e6f0b233281b1dc60d7d11 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 15 Feb 2023 22:49:43 +0000 Subject: [PATCH 335/467] Finally managed to get the internal fork to work --- unison-src/builtin-tests/base.output.md | 6 +++--- unison-src/builtin-tests/jit-tests.output.md | 19 ++++++------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/unison-src/builtin-tests/base.output.md b/unison-src/builtin-tests/base.output.md index ea906338b..f47cea815 100644 --- a/unison-src/builtin-tests/base.output.md +++ b/unison-src/builtin-tests/base.output.md @@ -4,13 +4,13 @@ ✅ - ✅ Successfully pulled into newly created namespace base. + Successfully pulled into newly created namespace base. .> compile.native.fetch ✅ - ✅ Successfully updated .unison.internal from - dolio.public.internal.trunk. + Successfully updated .unison.internal from + unison.public.internal.primops. ``` diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index d767bdcea..016ea7e65 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -1,18 +1,11 @@ Note: This should be forked off of the codebase created by base.md +If you want to define more complex tests somewhere other than `tests.u`, just `load my-tests.u` then `add`, +then reference those tests (which should be of type `'{IO,Exception,Tests} ()`, written using calls +to `Tests.check` and `Tests.checkEqual`). + ```ucm -.> compile.native.fetch.> compile.native.genlibs.> load unison-src/builtin-tests/testlib.u.> add +.> run.native tests + ``` - - -🛑 - -The transcript failed due to an error in the stanza above. The error is: - - - ❗️ - - The server didn't find anything at - unison.public.internal.primop-tags - From ab03c43c5ecd370771c1f5fc68b6d795bb7347be Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 15 Feb 2023 23:35:04 +0000 Subject: [PATCH 336/467] Add structure for try-eval --- scheme-libs/chez/unison/concurrent.ss | 7 ++++--- scheme-libs/common/unison/primops.ss | 2 +- scheme-libs/racket/unison/concurrent.ss | 10 ++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scheme-libs/chez/unison/concurrent.ss b/scheme-libs/chez/unison/concurrent.ss index e49a0c27d..0e7ecf1b8 100644 --- a/scheme-libs/chez/unison/concurrent.ss +++ b/scheme-libs/chez/unison/concurrent.ss @@ -10,13 +10,13 @@ promise-try-read fork kill - sleep) + sleep + try-eval) (define err "This operation is not supported on the pure Chez Scheme backend, use the Racket over Chez Scheme backend") - ;; TODO feels like there is a macro waiting to happen here (define (ref-new a) (error err)) (define (ref-read ref) (error err)) (define (ref-write ref a) (error err)) @@ -25,5 +25,6 @@ backend, use the Racket over Chez Scheme backend") (define (promise-read promise) (error err)) (define (promise-try-read promise) (error err)) (define (fork thread-thunk) (error err)) - (define (kill thread-id) (error err))) + (define (kill thread-id) (error err)) + (define (try-eval thunk) (error err))) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index d6156587e..da8437834 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -328,7 +328,7 @@ (define (unison-FOp-Scope.array n) (make-vector n)) (define (unison-POp-FORK thunk) (fork thunk)) - (define (unison-POp-TFRC thunk) (display "stub")) + (define (unison-POp-TFRC thunk) (try-eval thunk)) (define (unison-FOp-IO.delay.impl.v3 micros) (sleep micros)) (define (unison-FOp-IO.kill.impl.v3 threadId) (kill threadId)) (define (unison-FOp-Scope.ref a) (ref-new a)) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 3c79ae533..698b70c3c 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -12,7 +12,8 @@ promise-try-read fork kill - sleep) + sleep + try-eval) (import (rnrs) (rnrs records syntactic) @@ -86,4 +87,9 @@ (define (kill threadId) (break-thread threadId) - (right unit))) + (right unit)) + + (define (try-eval thunk) + (with-handlers ([exn:break? (lambda (x) ())]) + (display "semi-stub") + (thunk)))) From bd3a3a587e5a504c65e5266103e4625963e49390 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 15 Feb 2023 23:48:12 +0000 Subject: [PATCH 337/467] Test tryEval on both completions and thread kills --- unison-src/builtin-tests/concurrency-tests.u | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 57ae05df5..cd8eba6b2 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -7,6 +7,7 @@ concurrency.tests = do !promiseConcurrentTest !forkKillTest !tryEvalForkTest + !tryEvalKillTest !fullTest simpleRefTest = do @@ -85,6 +86,13 @@ forkKillTest = do checkEqual "Thread was killed" v "initial" tryEvalForkTest = do + t = fork do + match catchAll do sleep_ (500 * millis) with + Left _ -> unsafeRun! do IO.console.printLine "interrupted" + Right _ -> unsafeRun! do IO.console.printLine "finished" + sleep_ (600 * millis) + +tryEvalKillTest = do t = fork do match catchAll do sleep_ (500 * millis) with Left _ -> unsafeRun! do IO.console.printLine "interrupted" From 6ad8fe9c88171009489cd0d130c5ef21eb097928 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 15 Feb 2023 23:55:43 +0000 Subject: [PATCH 338/467] Add assertions for tryEval tests --- unison-src/builtin-tests/concurrency-tests.u | 23 +++++++++++++------- unison-src/builtin-tests/jit-tests.output.md | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index cd8eba6b2..2268d092f 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -86,19 +86,26 @@ forkKillTest = do checkEqual "Thread was killed" v "initial" tryEvalForkTest = do + ref = IO.ref "initial" t = fork do - match catchAll do sleep_ (500 * millis) with - Left _ -> unsafeRun! do IO.console.printLine "interrupted" - Right _ -> unsafeRun! do IO.console.printLine "finished" - sleep_ (600 * millis) + match catchAll do sleep_ (400 * millis) with + Left _ -> unsafeRun! do Ref.write ref "interrupted" + Right _ -> unsafeRun! do Ref.write ref "finished" + sleep_ (500 * millis) + v = Ref.read ref + checkEqual "tryEval is a no-op on success" v "finished" tryEvalKillTest = do + ref = IO.ref "initial" t = fork do - match catchAll do sleep_ (500 * millis) with - Left _ -> unsafeRun! do IO.console.printLine "interrupted" - Right _ -> unsafeRun! do IO.console.printLine "finished" - sleep_ (300 * millis) + match catchAll do sleep_ (400 * millis) with + Left _ -> unsafeRun! do Ref.write ref "interrupted" + Right _ -> unsafeRun! do Ref.write ref "finished" + sleep_ (200 * millis) kill_ t + sleep_ (300 * millis) + v = Ref.read ref + checkEqual "Thread was killed" v "interrupted" atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () atomicUpdate ref f = diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 016ea7e65..f4277ee45 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -8,4 +8,6 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native tests + Scheme evaluation failed. + ``` From 67ab95bc200d0360e053d6cc56ff3fedab94227f Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 16 Feb 2023 00:02:38 +0000 Subject: [PATCH 339/467] tryEval is a no-op on success --- scheme-libs/racket/unison/concurrent.ss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 698b70c3c..e1860694e 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -91,5 +91,4 @@ (define (try-eval thunk) (with-handlers ([exn:break? (lambda (x) ())]) - (display "semi-stub") - (thunk)))) + (right (thunk))))) From 22402b4a0842f3ea0b4ed335f8d61c1b1ea86e9f Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 16 Feb 2023 10:48:55 +0000 Subject: [PATCH 340/467] Distinguish test cases --- unison-src/builtin-tests/concurrency-tests.u | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 2268d092f..87a059dda 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -105,7 +105,7 @@ tryEvalKillTest = do kill_ t sleep_ (300 * millis) v = Ref.read ref - checkEqual "Thread was killed" v "interrupted" + checkEqual "Thread was killed, with finalisers" v "interrupted" atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () atomicUpdate ref f = From cdef5f7a1cff96f98cbe445580ae3a4599c0c7a2 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 16 Feb 2023 11:25:56 +0000 Subject: [PATCH 341/467] Broken: define failure data --- scheme-libs/common/unison/data.ss | 12 ++++++++++-- scheme-libs/racket/unison/concurrent.ss | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index d4848c111..40a03efa1 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -16,7 +16,8 @@ either-get unit false - true) + true + failure) (import (rnrs)) @@ -60,4 +61,11 @@ (define (left? either) (eq? 0 (car either))) ; Either a b -> a | b - (define (either-get either) (car (cdr either)))) + (define (either-get either) (car (cdr either))) + + ; a -> Any + (define (any a) `(0 ,a)) + + ; Type -> Text -> a -> Failure + (define (failure typeLink msg a) + `(0 ,typeLink ,msg ,(any a)))) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index e1860694e..42cf4356d 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -90,5 +90,6 @@ (right unit)) (define (try-eval thunk) - (with-handlers ([exn:break? (lambda (x) ())]) + (with-handlers + ([exn:break? (lambda (x) (left (failure "reference" "thread killed" ())))]) (right (thunk))))) From c0f935dfcdc8eb483c8adfeb7e2e16559aff0b08 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 16 Feb 2023 14:05:11 +0000 Subject: [PATCH 342/467] Encode failure shape (typelink still not done properly) --- scheme-libs/common/unison/data.ss | 14 +- scheme-libs/racket/unison/concurrent.ss | 2 +- unison-src/builtin-tests/concurrency-tests.u | 226 +++++++++---------- unison-src/builtin-tests/jit-tests.output.md | 2 - unison-src/builtin-tests/tests.u | 42 ++-- 5 files changed, 145 insertions(+), 141 deletions(-) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index 40a03efa1..24c950473 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -17,7 +17,9 @@ unit false true - failure) + any + failure + exception) (import (rnrs)) @@ -66,6 +68,10 @@ ; a -> Any (define (any a) `(0 ,a)) - ; Type -> Text -> a -> Failure - (define (failure typeLink msg a) - `(0 ,typeLink ,msg ,(any a)))) + ; Type -> Text -> Any -> Failure + (define (failure typeLink msg any) + `(0 ,typeLink ,msg ,any)) + + ; Type -> Text -> a ->{Exception} b + (define (exception typeLink msg a) + (failure typeLink msg (any a)))) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 42cf4356d..089f2486b 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -91,5 +91,5 @@ (define (try-eval thunk) (with-handlers - ([exn:break? (lambda (x) (left (failure "reference" "thread killed" ())))]) + ([exn:break? (lambda (x) (exception "referenceId" "thread killed" ()))]) (right (thunk))))) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 87a059dda..1c712f4de 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,99 +1,99 @@ concurrency.tests = do - !simpleRefTest - !simpleRefTestScope - !ticketTest - !casTest - !promiseSequentialTest - !promiseConcurrentTest - !forkKillTest - !tryEvalForkTest + -- !simpleRefTest + -- !simpleRefTestScope + -- !ticketTest + -- !casTest + -- !promiseSequentialTest + -- !promiseConcurrentTest + -- !forkKillTest + -- !tryEvalForkTest !tryEvalKillTest - !fullTest + -- !fullTest -simpleRefTest = do - r = IO.ref 0 - Ref.write r 1 - i = Ref.read r - Ref.write r 2 - j = Ref.read r - Ref.write r 5 - checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) +-- simpleRefTest = do +-- r = IO.ref 0 +-- Ref.write r 1 +-- i = Ref.read r +-- Ref.write r 2 +-- j = Ref.read r +-- Ref.write r 5 +-- checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) -simpleRefTestScope = do - Scope.run do - r = Scope.ref 0 - Ref.write r 1 - i = Ref.read r - Ref.write r 2 - j = Ref.read r - Ref.write r 5 - checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) +-- simpleRefTestScope = do +-- Scope.run do +-- r = Scope.ref 0 +-- Ref.write r 1 +-- i = Ref.read r +-- Ref.write r 2 +-- j = Ref.read r +-- Ref.write r 5 +-- checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) -ticketTest = do - r = IO.ref 3 - t = Ref.readForCas r - v = Ticket.read t - checkEqual "Ticket contains the Ref value" v 3 +-- ticketTest = do +-- r = IO.ref 3 +-- t = Ref.readForCas r +-- v = Ticket.read t +-- checkEqual "Ticket contains the Ref value" v 3 -casTest = do - ref = IO.ref 0 - ticket = Ref.readForCas ref - v1 = Ref.cas ref ticket 5 - check "CAS is successful is there were no conflicting writes" 'v1 - Ref.write ref 10 - v2 = Ref.cas ref ticket 15 - check "CAS fails when there was an intervening write" '(not v2) +-- casTest = do +-- ref = IO.ref 0 +-- ticket = Ref.readForCas ref +-- v1 = Ref.cas ref ticket 5 +-- check "CAS is successful is there were no conflicting writes" 'v1 +-- Ref.write ref 10 +-- v2 = Ref.cas ref ticket 15 +-- check "CAS fails when there was an intervening write" '(not v2) -promiseSequentialTest = do - use Nat eq - use Promise read write - p = !Promise.new - v0 = Promise.tryRead p - checkEqual "Promise should be empty when created" v0 None - Promise.write_ p 0 - v1 = read p - checkEqual "Promise should read a value that's been written" v1 0 - Promise.write_ p 1 - v2 = read p - checkEqual "Promise can only be written to once" v2 v1 - v3 = Promise.tryRead p - checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) +-- promiseSequentialTest = do +-- use Nat eq +-- use Promise read write +-- p = !Promise.new +-- v0 = Promise.tryRead p +-- checkEqual "Promise should be empty when created" v0 None +-- Promise.write_ p 0 +-- v1 = read p +-- checkEqual "Promise should read a value that's been written" v1 0 +-- Promise.write_ p 1 +-- v2 = read p +-- checkEqual "Promise can only be written to once" v2 v1 +-- v3 = Promise.tryRead p +-- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) millis = 1000 sleep_ n = unsafeRun! do sleep n -promiseConcurrentTest = do - use Nat eq - use concurrent fork - p = !Promise.new - _ = fork do - sleep_ (200 * millis) - Promise.write p 5 - v = Promise.read p - checkEqual "Reads awaits for completion of the Promise" v 5 +-- promiseConcurrentTest = do +-- use Nat eq +-- use concurrent fork +-- p = !Promise.new +-- _ = fork do +-- sleep_ (200 * millis) +-- Promise.write p 5 +-- v = Promise.read p +-- checkEqual "Reads awaits for completion of the Promise" v 5 kill_ t = unsafeRun! do concurrent.kill t -forkKillTest = do - ref = IO.ref "initial" - thread = fork do - sleep_ (400 * millis) - Ref.write ref "done" - sleep_ (200 * millis) - kill_ thread - sleep_ (300 * millis) - v = Ref.read ref - checkEqual "Thread was killed" v "initial" +-- forkKillTest = do +-- ref = IO.ref "initial" +-- thread = fork do +-- sleep_ (400 * millis) +-- Ref.write ref "done" +-- sleep_ (200 * millis) +-- kill_ thread +-- sleep_ (300 * millis) +-- v = Ref.read ref +-- checkEqual "Thread was killed" v "initial" -tryEvalForkTest = do - ref = IO.ref "initial" - t = fork do - match catchAll do sleep_ (400 * millis) with - Left _ -> unsafeRun! do Ref.write ref "interrupted" - Right _ -> unsafeRun! do Ref.write ref "finished" - sleep_ (500 * millis) - v = Ref.read ref - checkEqual "tryEval is a no-op on success" v "finished" +-- tryEvalForkTest = do +-- ref = IO.ref "initial" +-- t = fork do +-- match catchAll do sleep_ (400 * millis) with +-- Left _ -> unsafeRun! do Ref.write ref "interrupted" +-- Right _ -> unsafeRun! do Ref.write ref "finished" +-- sleep_ (500 * millis) +-- v = Ref.read ref +-- checkEqual "tryEval is a no-op on success" v "finished" tryEvalKillTest = do ref = IO.ref "initial" @@ -107,42 +107,42 @@ tryEvalKillTest = do v = Ref.read ref checkEqual "Thread was killed, with finalisers" v "interrupted" -atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () -atomicUpdate ref f = - ticket = Ref.readForCas ref - value = f (Ticket.read ticket) - if Ref.cas ref ticket value then () else atomicUpdate ref f +-- atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () +-- atomicUpdate ref f = +-- ticket = Ref.readForCas ref +-- value = f (Ticket.read ticket) +-- if Ref.cas ref ticket value then () else atomicUpdate ref f -spawnN : Nat -> '{IO} a ->{IO} [a] -spawnN n fa = - use Nat eq - - use concurrent fork +-- spawnN : Nat -> '{IO} a ->{IO} [a] +-- spawnN n fa = +-- use Nat eq - +-- use concurrent fork - go i acc = - if eq i 0 - then acc - else - value = !Promise.new - _ = fork do Promise.write value !fa - go (i - 1) (acc :+ value) +-- go i acc = +-- if eq i 0 +-- then acc +-- else +-- value = !Promise.new +-- _ = fork do Promise.write value !fa +-- go (i - 1) (acc :+ value) - map Promise.read (go n []) +-- map Promise.read (go n []) -fullTest = do - use Nat * + eq - +-- fullTest = do +-- use Nat * + eq - - numThreads = 100 - iterations = 100 - expected = numThreads * iterations +-- numThreads = 100 +-- iterations = 100 +-- expected = numThreads * iterations - state = IO.ref 0 - thread n = - if eq n 0 - then () - else - atomicUpdate state (v -> v + 1) - thread (n - 1) - ignore (spawnN numThreads '(thread iterations)) - result = Ref.read state - checkEqual "The state of the counter is consistent " result expected +-- state = IO.ref 0 +-- thread n = +-- if eq n 0 +-- then () +-- else +-- atomicUpdate state (v -> v + 1) +-- thread (n - 1) +-- ignore (spawnN numThreads '(thread iterations)) +-- result = Ref.read state +-- checkEqual "The state of the counter is consistent " result expected diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index f4277ee45..016ea7e65 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -8,6 +8,4 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native tests - Scheme evaluation failed. - ``` diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index aa76faa73..10f6abe41 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -1,28 +1,28 @@ tests : '{IO,Exception} () tests = Tests.main do - check "Nat.+" do 1 + 1 == 2 - check "Nat.*" do 10 * 100 == 1000 - check "Nat./" do 100 / 10 == 10 + -- check "Nat.+" do 1 + 1 == 2 + -- check "Nat.*" do 10 * 100 == 1000 + -- check "Nat./" do 100 / 10 == 10 - -- cryptographic hashing - check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") === 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 - check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") === 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") === 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e - check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") === 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a - check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") === 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 - check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") === 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 - check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") === 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 - check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") === 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce + -- -- cryptographic hashing + -- check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") === 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 + -- check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") === 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + -- check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") === 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e + -- check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") === 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a + -- check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") === 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 + -- check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") === 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 + -- check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") === 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 + -- check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") === 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce - -- hmacs - check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") === 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f - check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") === 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 - check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") === 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e - check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") === 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 - check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") === 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 - check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") === 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be - check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 - check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 + -- -- hmacs + -- check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") === 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f + -- check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") === 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 + -- check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") === 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e + -- check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") === 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 + -- check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") === 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 + -- check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") === 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be + -- check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 + -- check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 !concurrency.tests From 601ba2fc93406348e2a6579c111ded8f2450180a Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 16 Feb 2023 14:36:13 +0000 Subject: [PATCH 343/467] Enable all tests --- unison-src/builtin-tests/concurrency-tests.u | 226 +++++++++---------- unison-src/builtin-tests/tests.u | 42 ++-- 2 files changed, 134 insertions(+), 134 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 1c712f4de..87a059dda 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -1,99 +1,99 @@ concurrency.tests = do - -- !simpleRefTest - -- !simpleRefTestScope - -- !ticketTest - -- !casTest - -- !promiseSequentialTest - -- !promiseConcurrentTest - -- !forkKillTest - -- !tryEvalForkTest + !simpleRefTest + !simpleRefTestScope + !ticketTest + !casTest + !promiseSequentialTest + !promiseConcurrentTest + !forkKillTest + !tryEvalForkTest !tryEvalKillTest - -- !fullTest + !fullTest --- simpleRefTest = do --- r = IO.ref 0 --- Ref.write r 1 --- i = Ref.read r --- Ref.write r 2 --- j = Ref.read r --- Ref.write r 5 --- checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) +simpleRefTest = do + r = IO.ref 0 + Ref.write r 1 + i = Ref.read r + Ref.write r 2 + j = Ref.read r + Ref.write r 5 + checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) --- simpleRefTestScope = do --- Scope.run do --- r = Scope.ref 0 --- Ref.write r 1 --- i = Ref.read r --- Ref.write r 2 --- j = Ref.read r --- Ref.write r 5 --- checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) +simpleRefTestScope = do + Scope.run do + r = Scope.ref 0 + Ref.write r 1 + i = Ref.read r + Ref.write r 2 + j = Ref.read r + Ref.write r 5 + checkEqual "Ref read-write" (i, j, Ref.read r) (1, 2, 5) --- ticketTest = do --- r = IO.ref 3 --- t = Ref.readForCas r --- v = Ticket.read t --- checkEqual "Ticket contains the Ref value" v 3 +ticketTest = do + r = IO.ref 3 + t = Ref.readForCas r + v = Ticket.read t + checkEqual "Ticket contains the Ref value" v 3 --- casTest = do --- ref = IO.ref 0 --- ticket = Ref.readForCas ref --- v1 = Ref.cas ref ticket 5 --- check "CAS is successful is there were no conflicting writes" 'v1 --- Ref.write ref 10 --- v2 = Ref.cas ref ticket 15 --- check "CAS fails when there was an intervening write" '(not v2) +casTest = do + ref = IO.ref 0 + ticket = Ref.readForCas ref + v1 = Ref.cas ref ticket 5 + check "CAS is successful is there were no conflicting writes" 'v1 + Ref.write ref 10 + v2 = Ref.cas ref ticket 15 + check "CAS fails when there was an intervening write" '(not v2) --- promiseSequentialTest = do --- use Nat eq --- use Promise read write --- p = !Promise.new --- v0 = Promise.tryRead p --- checkEqual "Promise should be empty when created" v0 None --- Promise.write_ p 0 --- v1 = read p --- checkEqual "Promise should read a value that's been written" v1 0 --- Promise.write_ p 1 --- v2 = read p --- checkEqual "Promise can only be written to once" v2 v1 --- v3 = Promise.tryRead p --- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) +promiseSequentialTest = do + use Nat eq + use Promise read write + p = !Promise.new + v0 = Promise.tryRead p + checkEqual "Promise should be empty when created" v0 None + Promise.write_ p 0 + v1 = read p + checkEqual "Promise should read a value that's been written" v1 0 + Promise.write_ p 1 + v2 = read p + checkEqual "Promise can only be written to once" v2 v1 + v3 = Promise.tryRead p + checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2) millis = 1000 sleep_ n = unsafeRun! do sleep n --- promiseConcurrentTest = do --- use Nat eq --- use concurrent fork --- p = !Promise.new --- _ = fork do --- sleep_ (200 * millis) --- Promise.write p 5 --- v = Promise.read p --- checkEqual "Reads awaits for completion of the Promise" v 5 +promiseConcurrentTest = do + use Nat eq + use concurrent fork + p = !Promise.new + _ = fork do + sleep_ (200 * millis) + Promise.write p 5 + v = Promise.read p + checkEqual "Reads awaits for completion of the Promise" v 5 kill_ t = unsafeRun! do concurrent.kill t --- forkKillTest = do --- ref = IO.ref "initial" --- thread = fork do --- sleep_ (400 * millis) --- Ref.write ref "done" --- sleep_ (200 * millis) --- kill_ thread --- sleep_ (300 * millis) --- v = Ref.read ref --- checkEqual "Thread was killed" v "initial" +forkKillTest = do + ref = IO.ref "initial" + thread = fork do + sleep_ (400 * millis) + Ref.write ref "done" + sleep_ (200 * millis) + kill_ thread + sleep_ (300 * millis) + v = Ref.read ref + checkEqual "Thread was killed" v "initial" --- tryEvalForkTest = do --- ref = IO.ref "initial" --- t = fork do --- match catchAll do sleep_ (400 * millis) with --- Left _ -> unsafeRun! do Ref.write ref "interrupted" --- Right _ -> unsafeRun! do Ref.write ref "finished" --- sleep_ (500 * millis) --- v = Ref.read ref --- checkEqual "tryEval is a no-op on success" v "finished" +tryEvalForkTest = do + ref = IO.ref "initial" + t = fork do + match catchAll do sleep_ (400 * millis) with + Left _ -> unsafeRun! do Ref.write ref "interrupted" + Right _ -> unsafeRun! do Ref.write ref "finished" + sleep_ (500 * millis) + v = Ref.read ref + checkEqual "tryEval is a no-op on success" v "finished" tryEvalKillTest = do ref = IO.ref "initial" @@ -107,42 +107,42 @@ tryEvalKillTest = do v = Ref.read ref checkEqual "Thread was killed, with finalisers" v "interrupted" --- atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () --- atomicUpdate ref f = --- ticket = Ref.readForCas ref --- value = f (Ticket.read ticket) --- if Ref.cas ref ticket value then () else atomicUpdate ref f +atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () +atomicUpdate ref f = + ticket = Ref.readForCas ref + value = f (Ticket.read ticket) + if Ref.cas ref ticket value then () else atomicUpdate ref f --- spawnN : Nat -> '{IO} a ->{IO} [a] --- spawnN n fa = --- use Nat eq - --- use concurrent fork +spawnN : Nat -> '{IO} a ->{IO} [a] +spawnN n fa = + use Nat eq - + use concurrent fork --- go i acc = --- if eq i 0 --- then acc --- else --- value = !Promise.new --- _ = fork do Promise.write value !fa --- go (i - 1) (acc :+ value) + go i acc = + if eq i 0 + then acc + else + value = !Promise.new + _ = fork do Promise.write value !fa + go (i - 1) (acc :+ value) --- map Promise.read (go n []) + map Promise.read (go n []) --- fullTest = do --- use Nat * + eq - +fullTest = do + use Nat * + eq - --- numThreads = 100 --- iterations = 100 --- expected = numThreads * iterations + numThreads = 100 + iterations = 100 + expected = numThreads * iterations --- state = IO.ref 0 --- thread n = --- if eq n 0 --- then () --- else --- atomicUpdate state (v -> v + 1) --- thread (n - 1) --- ignore (spawnN numThreads '(thread iterations)) --- result = Ref.read state --- checkEqual "The state of the counter is consistent " result expected + state = IO.ref 0 + thread n = + if eq n 0 + then () + else + atomicUpdate state (v -> v + 1) + thread (n - 1) + ignore (spawnN numThreads '(thread iterations)) + result = Ref.read state + checkEqual "The state of the counter is consistent " result expected diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 10f6abe41..2308b36b1 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -1,28 +1,28 @@ tests : '{IO,Exception} () tests = Tests.main do - -- check "Nat.+" do 1 + 1 == 2 - -- check "Nat.*" do 10 * 100 == 1000 - -- check "Nat./" do 100 / 10 == 10 + check "Nat.+" do 1 + 1 == 2 + check "Nat.*" do 10 * 100 == 1000 + check "Nat./" do 100 / 10 == 10 - -- -- cryptographic hashing - -- check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") === 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 - -- check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") === 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - -- check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") === 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e - -- check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") === 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a - -- check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") === 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 - -- check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") === 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 - -- check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") === 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 - -- check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") === 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce + -- cryptographic hashing + check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") === 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 + check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") === 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") === 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e + check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") === 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a + check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") === 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 + check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") === 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 + check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") === 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 + check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") === 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce - -- -- hmacs - -- check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") === 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f - -- check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") === 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 - -- check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") === 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e - -- check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") === 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 - -- check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") === 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 - -- check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") === 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be - -- check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 - -- check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 + -- hmacs + check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") === 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f + check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") === 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 + check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") === 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e + check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") === 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 + check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") === 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 + check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") === 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be + check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 + check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 !concurrency.tests From 2502776a8fe7f3ea0d6615f523306f8a32bd95fe Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Thu, 16 Feb 2023 14:46:02 +0000 Subject: [PATCH 344/467] Assert on message from thread killed exception --- unison-src/builtin-tests/concurrency-tests.u | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unison-src/builtin-tests/concurrency-tests.u b/unison-src/builtin-tests/concurrency-tests.u index 87a059dda..50b197fc1 100644 --- a/unison-src/builtin-tests/concurrency-tests.u +++ b/unison-src/builtin-tests/concurrency-tests.u @@ -89,7 +89,7 @@ tryEvalForkTest = do ref = IO.ref "initial" t = fork do match catchAll do sleep_ (400 * millis) with - Left _ -> unsafeRun! do Ref.write ref "interrupted" + Left _ -> () Right _ -> unsafeRun! do Ref.write ref "finished" sleep_ (500 * millis) v = Ref.read ref @@ -99,13 +99,13 @@ tryEvalKillTest = do ref = IO.ref "initial" t = fork do match catchAll do sleep_ (400 * millis) with - Left _ -> unsafeRun! do Ref.write ref "interrupted" + Left (Failure typ msg a) -> unsafeRun! do Ref.write ref msg Right _ -> unsafeRun! do Ref.write ref "finished" sleep_ (200 * millis) kill_ t sleep_ (300 * millis) v = Ref.read ref - checkEqual "Thread was killed, with finalisers" v "interrupted" + checkEqual "Thread was killed, with finalisers" v "thread killed" atomicUpdate : Ref {IO} a -> (a -> a) ->{IO} () atomicUpdate ref f = From 75e58b4bf6579926cff0ecc6deef2022a91a8510 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 12:09:09 +0000 Subject: [PATCH 345/467] Point ucm back at trunk of internal compiler lib --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index 94d1c74b7..b06e167fa 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2659,7 +2659,7 @@ doFetchCompiler = { server = RemoteRepo.DefaultCodeserver, repo = ShareUserHandle "unison", path = - Path.fromList $ NameSegment <$> ["public", "internal", "primops"] + Path.fromList $ NameSegment <$> ["public", "internal", "trunk"] } repo = Just $ ReadRemoteNamespaceShare ns From d4c7c4009e796e35643216996400e8a379d5f2c4 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 12:16:05 +0000 Subject: [PATCH 346/467] Better modelling of thread killed exceptions --- scheme-libs/racket/unison/concurrent.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 089f2486b..90267d223 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -91,5 +91,5 @@ (define (try-eval thunk) (with-handlers - ([exn:break? (lambda (x) (exception "referenceId" "thread killed" ()))]) + ([exn:break? (lambda (x) (exception "ThreadKilled" "thread killed" x))]) (right (thunk))))) From 9a979153ea057a6867812c06b8f1031c5161f17b Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 12:22:42 +0000 Subject: [PATCH 347/467] Add TODO about type links --- scheme-libs/racket/unison/concurrent.ss | 1 + 1 file changed, 1 insertion(+) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 90267d223..399b6f02d 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -89,6 +89,7 @@ (break-thread threadId) (right unit)) + ;; TODO Add proper type links to the various exception types once we have them (define (try-eval thunk) (with-handlers ([exn:break? (lambda (x) (exception "ThreadKilled" "thread killed" x))]) From fe79b7c7bf8a88ae3bc55ab80551d74ebccd5b1c Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 12:43:06 +0000 Subject: [PATCH 348/467] Categorise failures --- scheme-libs/racket/unison/concurrent.ss | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 399b6f02d..10c668fbf 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -33,14 +33,18 @@ parameterize-break sleep printf + with-handlers exn:break? - with-handlers) + exn:fail:read? + exn:fail:filesystem? + exn:fail:network? + exn:fail?) (box ref-new) (unbox ref-read) (set-box! ref-write) (sleep sleep-secs)) - (only (racket unsafe ops) unsafe-struct*-cas!) - (unison data)) + (only (racket exn) exn->string) + (only (racket unsafe ops) unsafe-struct*-cas!)) (define-record-type promise (fields semaphore event (mutable value))) @@ -89,8 +93,15 @@ (break-thread threadId) (right unit)) + (define (exn:io? e) + (or (exn:fail:read? e) + (exn:fail:filesystem? e) + (exn:fail:network? e))) + ;; TODO Add proper type links to the various exception types once we have them (define (try-eval thunk) (with-handlers - ([exn:break? (lambda (x) (exception "ThreadKilled" "thread killed" x))]) + ([exn:break? (lambda (e) (exception "ThreadKilled" "thread killed" ()))] + [exn:io? (lambda (e) (exception "IOException" (exn->string e) ()))] + [exn:fail? (lambda (e) (exception "MiscFailure" (exn->string e) ()))]) (right (thunk))))) From 40fef4d8ce5485c5a64e8be887bff80c766b07ad Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 12:53:27 +0000 Subject: [PATCH 349/467] Catch all other stray exceptions --- scheme-libs/racket/unison/concurrent.ss | 3 ++- unison-src/builtin-tests/tests.u | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 10c668fbf..4f64e77dc 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -103,5 +103,6 @@ (with-handlers ([exn:break? (lambda (e) (exception "ThreadKilled" "thread killed" ()))] [exn:io? (lambda (e) (exception "IOException" (exn->string e) ()))] - [exn:fail? (lambda (e) (exception "MiscFailure" (exn->string e) ()))]) + [exn:fail? (lambda (e) (exception "MiscFailure" (exn->string e) ()))] + [(lambda (x) #t) (lambda (e) (exception "MiscFailure" "unknown exception" e))]) (right (thunk))))) diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 2308b36b1..1a3891fe0 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -26,3 +26,12 @@ tests = Tests.main do check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 !concurrency.tests + !foo + + +foo = do + match catchAll do bug "nooo!" with + Left (Failure typ msg a) -> + IO.console.printLine msg + IO.console.printLine "caught there" + Right _ -> () From 88122d36e2763d3ec092abe9d68e554039bf99a2 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 13:35:49 +0000 Subject: [PATCH 350/467] Better assertion for testing `bug` --- unison-src/builtin-tests/tests.u | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 1a3891fe0..363bf6da3 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -25,13 +25,5 @@ tests = Tests.main do check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 + check "bug is caught" do isLeft (catchAll do bug ()) !concurrency.tests - !foo - - -foo = do - match catchAll do bug "nooo!" with - Left (Failure typ msg a) -> - IO.console.printLine msg - IO.console.printLine "caught there" - Right _ -> () From 704648a7e0113ed573c64894e9ef5dae40fbb9fc Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 13:46:37 +0000 Subject: [PATCH 351/467] More precise categorisation of exceptions --- scheme-libs/racket/unison/concurrent.ss | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scheme-libs/racket/unison/concurrent.ss b/scheme-libs/racket/unison/concurrent.ss index 4f64e77dc..5bd613fd8 100644 --- a/scheme-libs/racket/unison/concurrent.ss +++ b/scheme-libs/racket/unison/concurrent.ss @@ -35,10 +35,12 @@ printf with-handlers exn:break? + exn:fail? exn:fail:read? exn:fail:filesystem? exn:fail:network? - exn:fail?) + exn:fail:contract:divide-by-zero? + exn:fail:contract:non-fixnum-result?) (box ref-new) (unbox ref-read) (set-box! ref-write) @@ -98,11 +100,16 @@ (exn:fail:filesystem? e) (exn:fail:network? e))) - ;; TODO Add proper type links to the various exception types once we have them + (define (exn:arith? e) + (or (exn:fail:contract:divide-by-zero? e) + (exn:fail:contract:non-fixnum-result? e))) + + ;; TODO Replace strings with proper type links once we have them (define (try-eval thunk) (with-handlers - ([exn:break? (lambda (e) (exception "ThreadKilled" "thread killed" ()))] - [exn:io? (lambda (e) (exception "IOException" (exn->string e) ()))] - [exn:fail? (lambda (e) (exception "MiscFailure" (exn->string e) ()))] + ([exn:break? (lambda (e) (exception "ThreadKilledFailure" "thread killed" ()))] + [exn:io? (lambda (e) (exception "IOFailure" (exn->string e) ()))] + [exn:arith? (lambda (e) (exception "ArithmeticFailure" (exn->string e) ()))] + [exn:fail? (lambda (e) (exception "RuntimeFailure" (exn->string e) ()))] [(lambda (x) #t) (lambda (e) (exception "MiscFailure" "unknown exception" e))]) (right (thunk))))) From b71393e7579b4d50673504e8b7de322393f11542 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 14:19:09 +0000 Subject: [PATCH 352/467] Slight refactor of test suite --- unison-src/builtin-tests/tests.u | 56 ++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 363bf6da3..57ab19abe 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -1,29 +1,35 @@ tests : '{IO,Exception} () tests = Tests.main do - check "Nat.+" do 1 + 1 == 2 - check "Nat.*" do 10 * 100 == 1000 - check "Nat./" do 100 / 10 == 10 - - -- cryptographic hashing - check "Sha1 hashBytes" do hashBytes Sha1 (toUtf8 "") === 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709 - check "Sha2_256 hashBytes" do hashBytes Sha2_256 (toUtf8 "") === 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - check "Sha2_512 hashBytes" do hashBytes Sha2_512 (toUtf8 "") === 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e - check "Sha3_256 hashBytes" do hashBytes Sha3_256 (toUtf8 "") === 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a - check "Sha3_512 hashBytes" do hashBytes Sha3_512 (toUtf8 "") === 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26 - check "Blake2s_256 hashBytes" do hashBytes Blake2s_256 (toUtf8 "") === 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9 - check "Blake2b_256 hashBytes" do hashBytes Blake2b_256 (toUtf8 "") === 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8 - check "Blake2b_512 hashBytes" do hashBytes Blake2b_512 (toUtf8 "") === 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce - - -- hmacs - check "Sha1 hmacBytes" do hmacBytes Sha1 (toUtf8 "key") (toUtf8 "") === 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f - check "Sha2_256 hmacBytes" do hmacBytes Sha2_256 (toUtf8 "key") (toUtf8 "") === 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0 - check "Sha2_512 hmacBytes" do hmacBytes Sha2_512 (toUtf8 "key") (toUtf8 "") === 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e - check "Sha3_256 hmacBytes" do hmacBytes Sha3_256 (toUtf8 "key") (toUtf8 "") === 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75 - check "Sha3_512 hmacBytes" do hmacBytes Sha3_512 (toUtf8 "key") (toUtf8 "") === 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282 - check "Blake2s_256 hmacBytes" do hmacBytes Blake2s_256 (toUtf8 "key") (toUtf8 "") === 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be - check "Blake2b_256 hmacBytes" do hmacBytes Blake2b_256 (toUtf8 "key") (toUtf8 "") === 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4 - check "Blake2b_512 hmacBytes" do hmacBytes Blake2b_512 (toUtf8 "key") (toUtf8 "") === 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3 - - check "bug is caught" do isLeft (catchAll do bug ()) + !crypto.hash.tests + !hmac.tests !concurrency.tests + check "bug is caught" do isLeft (catchAll do bug ()) + +crypto.hash.tests = do + hash alg = hashBytes alg (toUtf8 "") + tag name = name ++ " hashBytes" + [ + ("Sha1", Sha1, 0xsda39a3ee5e6b4b0d3255bfef95601890afd80709), + ("Sha2_256", Sha2_256, 0xse3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855), + ("Sha2_512", Sha2_512, 0xscf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e), + ("Sha3_256", Sha3_256, 0xsa7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a), + ("Sha3_512", Sha3_512, 0xsa69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26), + ("Blake2s_256", Blake2s_256, 0xs69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9), + ("Blake2b_256", Blake2b_256, 0xs0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8), + ("Blake2b_512", Blake2b_512, 0xs786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce) + ] |> List.foreach_ cases (name, alg, res) -> checkEqual (tag name) (hash alg) res + +hmac.tests = do + hmac alg = hmacBytes alg (toUtf8 "key") (toUtf8 "") + tag name = name ++ " hmacBytes" + [ + ("Sha1", Sha1, 0xsf42bb0eeb018ebbd4597ae7213711ec60760843f), + ("Sha2_256", Sha2_256, 0xs5d5d139563c95b5967b9bd9a8c9b233a9dedb45072794cd232dc1b74832607d0), + ("Sha2_512", Sha2_512, 0xs84fa5aa0279bbc473267d05a53ea03310a987cecc4c1535ff29b6d76b8f1444a728df3aadb89d4a9a6709e1998f373566e8f824a8ca93b1821f0b69bc2a2f65e), + ("Sha3_256", Sha3_256, 0xs74f3c030ecc36a1835d04a333ebb7fce2688c0c78fb0bcf9592213331c884c75), + ("Sha3_512", Sha3_512, 0xs7539119b6367aa902bdc6f558d20c906d6acbd4aba3fd344eb08b0200144a1fa453ff6e7919962358be53f6db2a320d1852c52a3dea3e907070775f7a91f1282), + ("Blake2s_256", Blake2s_256, 0xs67148074efc0f6741b474ef81c4d98d266e880d372fe723d2569b1d414d234be), + ("Blake2b_256", Blake2b_256, 0xs4224e1297e51239a642e21f756bde2785716f872298178180d7f3d1d36a5e4e4), + ("Blake2b_512", Blake2b_512, 0xs019fe04bf010b8d72772e6b46897ecf74b4878c394ff2c4d5cfa0b7cc9bbefcb28c36de23cef03089db9c3d900468c89804f135e9fdef7ec9b3c7abe50ed33d3) + ] |> List.foreach_ cases (name, alg, res) -> checkEqual (tag name) (hmac alg) res From 2ee1f5a118fc78ff2694676ed1192451597c4a19 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Fri, 17 Feb 2023 14:32:50 +0000 Subject: [PATCH 353/467] Correct output --- unison-src/builtin-tests/base.output.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/builtin-tests/base.output.md b/unison-src/builtin-tests/base.output.md index f47cea815..e51894c11 100644 --- a/unison-src/builtin-tests/base.output.md +++ b/unison-src/builtin-tests/base.output.md @@ -11,6 +11,6 @@ ✅ Successfully updated .unison.internal from - unison.public.internal.primops. + unison.public.internal.trunk. ``` From aa9e3aae357d81749ca03ddd6f9953c9d23b1112 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Fri, 17 Feb 2023 22:34:30 -0600 Subject: [PATCH 354/467] Fix `request` for the case of unhandled abilities Previously it would give an untraceable scheme error, "expected mpair, found #f". This now just raises the ability request as an exception. --- scheme-libs/common/unison/boot.ss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 43ec4022a..2e693ab81 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -153,7 +153,10 @@ (define-syntax request (syntax-rules () [(request r t . args) - ((cdr (ref-mark (quote r))) (list (quote r) t . args))])) + (let ((ref-mark-result (ref-mark (quote r)))) + (if (equal? #f ref-mark-result) + (raise (list . args)) + ((cdr ref-mark-result) (list (quote r) t . args))))])) ; See the explanation of `handle` for a more thorough understanding ; of why this is doing two control operations. From 89d562bae9ffcfe3b65e24aec2375fbbc2d730af Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Tue, 21 Feb 2023 13:55:04 -0800 Subject: [PATCH 355/467] ormulu --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 1 - unison-cli/src/Unison/CommandLine/OutputMessages.hs | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index e5e46cf3c..d8877300f 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -466,7 +466,6 @@ loop e = do headb <- getBranch headRepo mergedb <- liftIO (Branch.merge'' (Codebase.lca codebase) Branch.RegularMerge baseb headb) squashedb <- liftIO (Branch.merge'' (Codebase.lca codebase) Branch.SquashMerge headb baseb) - -- Perform all child updates in a single step. Cli.updateAt description destAbs $ Branch.step \destBranch0 -> destBranch0 & Branch.children diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 4a90a6953..55812dca8 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -49,6 +49,16 @@ import qualified Unison.Builtin.Decls as DD import Unison.Codebase.Editor.DisplayObject (DisplayObject (BuiltinObject, MissingObject, UserObject)) import qualified Unison.Codebase.Editor.Input as Input import Unison.Codebase.Editor.Output + ( DisplayDefinitionsOutput(..), + NumberedArgs, + NumberedOutput(..), + Output(..), + ShareError(ShareErrorTransport, ShareErrorCheckAndSetPush, + ShareErrorFastForwardPush, ShareErrorPull, + ShareErrorGetCausalHashByPath), + TestReportStats(NewlyComputed, CachedTests), + UndoFailureReason(CantUndoPastMerge, CantUndoPastStart), + WhichBranchEmpty(..) ) import qualified Unison.Codebase.Editor.Output as E import qualified Unison.Codebase.Editor.Output.BranchDiff as OBD import qualified Unison.Codebase.Editor.Output.PushPull as PushPull From 3c5800e14e6fa9a31f3d0007f107c6c7143f9935 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Tue, 21 Feb 2023 14:09:22 -0800 Subject: [PATCH 356/467] moar ormulu --- .../src/Unison/Codebase/Editor/HandleInput.hs | 44 +++++++++++-------- .../src/Unison/CommandLine/OutputMessages.hs | 23 ++++++---- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index d8877300f..a6e4a05e6 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2975,26 +2975,32 @@ checkDeletes typesTermsTuples doutput inputs = do let allTermsToDelete :: Set LabeledDependency allTermsToDelete = Set.unions (fmap Names.labeledReferences toDelete) -- get the endangered dependencies for each entity to delete - endangered <- Cli.runTransaction $ traverse (\targetToDelete -> - getEndangeredDependents targetToDelete (allTermsToDelete) rootNames) toDelete + endangered <- + Cli.runTransaction $ + traverse ( \targetToDelete -> + getEndangeredDependents targetToDelete (allTermsToDelete) rootNames + ) + toDelete -- If the overall dependency map is not completely empty, abort deletion let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b ) False m ) endangered - if null endangeredDeletions then do - let deleteTypesTerms = - splitsNames >>= (\(split, _, types, terms) -> - (map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) ++ - (map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms ) - ) - before <- Cli.getRootBranch0 - description <- inputDescription inputs - Cli.stepManyAt description deleteTypesTerms - case doutput of - DeleteOutput'Diff -> do - after <- Cli.getRootBranch0 - (ppe, diff) <- diffHelper before after - Cli.respondNumbered (ShowDiffAfterDeleteDefinitions ppe diff) - DeleteOutput'NoDiff -> do - Cli.respond Success + if null endangeredDeletions + then do + let deleteTypesTerms = + splitsNames + >>= ( \(split, _, types, terms) -> + (map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) + ++ (map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms ) + ) + before <- Cli.getRootBranch0 + description <- inputDescription inputs + Cli.stepManyAt description deleteTypesTerms + case doutput of + DeleteOutput'Diff -> do + after <- Cli.getRootBranch0 + (ppe, diff) <- diffHelper before after + Cli.respondNumbered (ShowDiffAfterDeleteDefinitions ppe diff) + DeleteOutput'NoDiff -> do + Cli.respond Success else do ppeDecl <- currentPrettyPrintEnvDecl Backend.Within let combineRefs = List.foldl (Map.unionWith NESet.union) Map.empty endangeredDeletions @@ -3024,7 +3030,7 @@ getEndangeredDependents targetToDelete otherDesiredDeletions rootNames = do refsToDelete = Names.labeledReferences targetToDelete -- refs left over after deleting target let remainingRefs :: Set LabeledDependency - remainingRefs = Names.labeledReferences remainingNames + remainingRefs = Names.labeledReferences remainingNames -- remove the other targets for deletion from the remaining terms let remainingRefsWithoutOtherTargets :: Set LabeledDependency remainingRefsWithoutOtherTargets = Set.difference remainingRefs otherDesiredDeletions diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 55812dca8..24147e535 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -51,14 +51,19 @@ import qualified Unison.Codebase.Editor.Input as Input import Unison.Codebase.Editor.Output ( DisplayDefinitionsOutput(..), NumberedArgs, - NumberedOutput(..), - Output(..), - ShareError(ShareErrorTransport, ShareErrorCheckAndSetPush, - ShareErrorFastForwardPush, ShareErrorPull, - ShareErrorGetCausalHashByPath), - TestReportStats(NewlyComputed, CachedTests), - UndoFailureReason(CantUndoPastMerge, CantUndoPastStart), - WhichBranchEmpty(..) ) + NumberedOutput (..), + Output (..), + ShareError + ( ShareErrorTransport, + ShareErrorCheckAndSetPush, + ShareErrorFastForwardPush, + ShareErrorPull, + ShareErrorGetCausalHashByPath + ), + TestReportStats (NewlyComputed, CachedTests), + UndoFailureReason (CantUndoPastMerge, CantUndoPastStart), + WhichBranchEmpty (..), + ) import qualified Unison.Codebase.Editor.Output as E import qualified Unison.Codebase.Editor.Output.BranchDiff as OBD import qualified Unison.Codebase.Editor.Output.PushPull as PushPull @@ -796,7 +801,7 @@ notifyUser dir o = case o of pure $ P.warnCallout "The following names were not found in the codebase. Check your spelling." <> P.newline - <> (P.syntaxToColor $ P.indent " " (P.lines (fmap prettyName hqs) )) + <> (P.syntaxToColor $ P.indent " " (P.lines (fmap prettyName hqs))) TermNotFound _ -> pure . P.warnCallout $ "I don't know about that term." TypeNotFound _ -> From c771611873ccbce73191595d302bbf6db6cb5524 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Tue, 21 Feb 2023 14:19:22 -0800 Subject: [PATCH 357/467] trying with built in vs code formatter --- .../src/Unison/Codebase/Editor/HandleInput.hs | 72 ++++++----- .../src/Unison/CommandLine/OutputMessages.hs | 121 +++++++++--------- 2 files changed, 99 insertions(+), 94 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index a6e4a05e6..b62285d6c 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1,4 +1,5 @@ {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} + {-# HLINT ignore "Use tuple-section" #-} module Unison.Codebase.Editor.HandleInput ( loop, @@ -119,6 +120,7 @@ import qualified Unison.Codebase.Metadata as Metadata import Unison.Codebase.Patch (Patch (..)) import qualified Unison.Codebase.Patch as Patch import Unison.Codebase.Path (Path, Path' (..)) +import qualified Unison.Codebase.Path as HQSplit' import qualified Unison.Codebase.Path as Path import qualified Unison.Codebase.Path.Parse as Path import Unison.Codebase.PushBehavior (PushBehavior) @@ -147,6 +149,7 @@ import Unison.Hash32 (Hash32) import qualified Unison.Hash32 as Hash32 import qualified Unison.HashQualified as HQ import qualified Unison.HashQualified' as HQ' +import qualified Unison.HashQualified' as HashQualified import qualified Unison.Hashing.V2.Convert as Hashing import Unison.LabeledDependency (LabeledDependency) import qualified Unison.LabeledDependency as LD @@ -219,8 +222,6 @@ import qualified Unison.Var as Var import qualified Unison.WatchKind as WK import qualified UnliftIO.STM as STM import Web.Browser (openBrowser) -import qualified Unison.Codebase.Path as HQSplit' -import qualified Unison.HashQualified' as HashQualified ------------------------------------------------------------------------------------------------------------------------ -- Main loop @@ -1446,13 +1447,13 @@ inputDescription input = pure ("delete.verbose " <> Text.intercalate " " thing) DeleteTarget'Term DeleteOutput'NoDiff things0 -> do thing <- traverse hqs' things0 - pure ("delete.term " <> Text.intercalate " "thing) + pure ("delete.term " <> Text.intercalate " " thing) DeleteTarget'Term DeleteOutput'Diff things0 -> do thing <- traverse hqs' things0 pure ("delete.term.verbose " <> Text.intercalate " " thing) DeleteTarget'Type DeleteOutput'NoDiff thing0 -> do thing <- traverse hqs' thing0 - pure ("delete.type " <> Text.intercalate " "thing) + pure ("delete.type " <> Text.intercalate " " thing) DeleteTarget'Type DeleteOutput'Diff thing0 -> do thing <- traverse hqs' thing0 pure ("delete.type.verbose " <> Text.intercalate " " thing) @@ -2547,10 +2548,10 @@ searchBranchScored names0 score queries = pair qn HQ.HashQualified qn h | h `SH.isPrefixOf` Referent.toShortHash ref -> - pair qn + pair qn HQ.HashOnly h | h `SH.isPrefixOf` Referent.toShortHash ref -> - Just (Nothing, result) + Just (Nothing, result) _ -> Nothing where result = SR.termSearchResult names0 name ref @@ -2566,10 +2567,10 @@ searchBranchScored names0 score queries = pair qn HQ.HashQualified qn h | h `SH.isPrefixOf` Reference.toShortHash ref -> - pair qn + pair qn HQ.HashOnly h | h `SH.isPrefixOf` Reference.toShortHash ref -> - Just (Nothing, result) + Just (Nothing, result) _ -> Nothing where result = SR.typeSearchResult names0 name ref @@ -2703,9 +2704,9 @@ typecheckAndEval ppe tm = do -- Type checking succeeded Result.Result _ (Just ty) | Typechecker.fitsScheme ty mty -> - () <$ evalUnisonTerm False ppe False tm + () <$ evalUnisonTerm False ppe False tm | otherwise -> - Cli.returnEarly $ BadMainFunction "run" rendered ty ppe [mty] + Cli.returnEarly $ BadMainFunction "run" rendered ty ppe [mty] Result.Result notes Nothing -> do currentPath <- Cli.getCurrentPath let tes = [err | Result.TypeError err <- toList notes] @@ -2939,22 +2940,25 @@ delete :: Cli () delete input doutput getTerms getTypes hqs' = do -- persists the original hash qualified entity for error reporting - typesTermsTuple <- traverse (\hq -> do - absolute <- Cli.resolveSplit' hq - types <- getTypes absolute - terms <- getTerms absolute - return (hq, types, terms) - ) hqs' + typesTermsTuple <- + traverse + ( \hq -> do + absolute <- Cli.resolveSplit' hq + types <- getTypes absolute + terms <- getTerms absolute + return (hq, types, terms) + ) + hqs' let notFounds = List.filter (\(_, types, terms) -> Set.null terms && Set.null types) typesTermsTuple -- if there are any entities which cannot be deleted because they don't exist, short circuit. - if not $ null notFounds then do - let toName :: [(Path.HQSplit', Set Reference, Set referent)] -> [Name] - toName notFounds = - mapMaybe (\(split,_,_) -> Path.toName' $ HashQualified.toName (HQSplit'.unsplitHQ' split)) notFounds - Cli.returnEarly $ NamesNotFound (toName notFounds) - else do - checkDeletes typesTermsTuple doutput input - + if not $ null notFounds + then do + let toName :: [(Path.HQSplit', Set Reference, Set referent)] -> [Name] + toName notFounds = + mapMaybe (\(split, _, _) -> Path.toName' $ HashQualified.toName (HQSplit'.unsplitHQ' split)) notFounds + Cli.returnEarly $ NamesNotFound (toName notFounds) + else do + checkDeletes typesTermsTuple doutput input checkDeletes :: [(Path.HQSplit', Set Reference, Set Referent)] -> DeleteOutput -> Input -> Cli () checkDeletes typesTermsTuples doutput inputs = do @@ -2962,8 +2966,8 @@ checkDeletes typesTermsTuples doutput inputs = do (Path.HQSplit', Set Reference, Set Referent) -> Cli (Path.Split, Name, Set Reference, Set Referent) toSplitName hq = do - resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> hq^._1) - return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), hq^._2, hq^._3) + resolvedPath <- Path.convert <$> Cli.resolveSplit' (HQ'.toName <$> hq ^. _1) + return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), hq ^. _2, hq ^. _3) -- get the splits and names with terms and types splitsNames <- traverse toSplitName typesTermsTuples let toRel :: Ord ref => Set ref -> Name -> R.Relation Name ref @@ -2977,19 +2981,20 @@ checkDeletes typesTermsTuples doutput inputs = do -- get the endangered dependencies for each entity to delete endangered <- Cli.runTransaction $ - traverse ( \targetToDelete -> - getEndangeredDependents targetToDelete (allTermsToDelete) rootNames - ) - toDelete + traverse + ( \targetToDelete -> + getEndangeredDependents targetToDelete (allTermsToDelete) rootNames + ) + toDelete -- If the overall dependency map is not completely empty, abort deletion - let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b ) False m ) endangered + let endangeredDeletions = List.filter (\m -> not $ null m || Map.foldr (\s b -> null s || b) False m) endangered if null endangeredDeletions then do let deleteTypesTerms = splitsNames >>= ( \(split, _, types, terms) -> (map (BranchUtil.makeDeleteTypeName split) . Set.toList $ types) - ++ (map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms ) + ++ (map (BranchUtil.makeDeleteTermName split) . Set.toList $ terms) ) before <- Cli.getRootBranch0 description <- inputDescription inputs @@ -3001,7 +3006,7 @@ checkDeletes typesTermsTuples doutput inputs = do Cli.respondNumbered (ShowDiffAfterDeleteDefinitions ppe diff) DeleteOutput'NoDiff -> do Cli.respond Success - else do + else do ppeDecl <- currentPrettyPrintEnvDecl Backend.Within let combineRefs = List.foldl (Map.unionWith NESet.union) Map.empty endangeredDeletions Cli.respondNumbered (CantDeleteDefinitions ppeDecl combineRefs) @@ -3538,4 +3543,3 @@ stripUnisonFileReferences unisonFile term = | Just var <- (\k -> Map.lookup k refMap) =<< Reference.toId ref -> ABT.var var x -> ABT.tm x in ABT.cata alg term - diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index 24147e535..b0f59b832 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -49,21 +49,21 @@ import qualified Unison.Builtin.Decls as DD import Unison.Codebase.Editor.DisplayObject (DisplayObject (BuiltinObject, MissingObject, UserObject)) import qualified Unison.Codebase.Editor.Input as Input import Unison.Codebase.Editor.Output - ( DisplayDefinitionsOutput(..), - NumberedArgs, - NumberedOutput (..), - Output (..), - ShareError - ( ShareErrorTransport, - ShareErrorCheckAndSetPush, - ShareErrorFastForwardPush, - ShareErrorPull, - ShareErrorGetCausalHashByPath - ), - TestReportStats (NewlyComputed, CachedTests), - UndoFailureReason (CantUndoPastMerge, CantUndoPastStart), - WhichBranchEmpty (..), - ) + ( DisplayDefinitionsOutput (..), + NumberedArgs, + NumberedOutput (..), + Output (..), + ShareError + ( ShareErrorCheckAndSetPush, + ShareErrorFastForwardPush, + ShareErrorGetCausalHashByPath, + ShareErrorPull, + ShareErrorTransport + ), + TestReportStats (CachedTests, NewlyComputed), + UndoFailureReason (CantUndoPastMerge, CantUndoPastStart), + WhichBranchEmpty (..), + ) import qualified Unison.Codebase.Editor.Output as E import qualified Unison.Codebase.Editor.Output.BranchDiff as OBD import qualified Unison.Codebase.Editor.Output.PushPull as PushPull @@ -692,8 +692,8 @@ notifyUser dir o = case o of CachedTests 0 _ -> pure . P.callout "😶" $ "No tests to run." CachedTests n n' | n == n' -> - pure $ - P.lines [cache, "", displayTestResults True ppe oks fails] + pure $ + P.lines [cache, "", displayTestResults True ppe oks fails] CachedTests _n m -> pure $ if m == 0 @@ -1082,11 +1082,11 @@ notifyUser dir o = case o of let prettyBindings = P.bracket . P.lines $ - P.wrap "The watch expression(s) reference these definitions:" - : "" - : [ P.syntaxToColor $ TermPrinter.prettyBinding ppe (HQ.unsafeFromVar v) b - | (v, b) <- bindings - ] + P.wrap "The watch expression(s) reference these definitions:" : + "" : + [ P.syntaxToColor $ TermPrinter.prettyBinding ppe (HQ.unsafeFromVar v) b + | (v, b) <- bindings + ] prettyWatches = P.sep "\n\n" @@ -1334,13 +1334,13 @@ notifyUser dir o = case o of case (new, old) of ([], []) -> error "BustedBuiltins busted, as there were no busted builtins." ([], old) -> - P.wrap ("This codebase includes some builtins that are considered deprecated. Use the " <> makeExample' IP.updateBuiltins <> " command when you're ready to work on eliminating them from your codebase:") - : "" - : fmap (P.text . Reference.toText) old + P.wrap ("This codebase includes some builtins that are considered deprecated. Use the " <> makeExample' IP.updateBuiltins <> " command when you're ready to work on eliminating them from your codebase:") : + "" : + fmap (P.text . Reference.toText) old (new, []) -> - P.wrap ("This version of Unison provides builtins that are not part of your codebase. Use " <> makeExample' IP.updateBuiltins <> " to add them:") - : "" - : fmap (P.text . Reference.toText) new + P.wrap ("This version of Unison provides builtins that are not part of your codebase. Use " <> makeExample' IP.updateBuiltins <> " to add them:") : + "" : + fmap (P.text . Reference.toText) new (new@(_ : _), old@(_ : _)) -> [ P.wrap ( "Sorry and/or good news! This version of Unison supports a different set of builtins than this codebase uses. You can use " @@ -1663,11 +1663,11 @@ notifyUser dir o = case o of num n = P.hiBlack $ P.shown n <> "." header = (P.hiBlack "Reference", P.hiBlack "Name") pairs = - header - : ( fmap (first c . second c) $ - [(p $ Reference.toShortHash r, prettyName n) | (n, r) <- names] - ++ [(p $ Reference.toShortHash r, "(no name available)") | r <- toList missing] - ) + header : + ( fmap (first c . second c) $ + [(p $ Reference.toShortHash r, prettyName n) | (n, r) <- names] + ++ [(p $ Reference.toShortHash r, "(no name available)") | r <- toList missing] + ) p = prettyShortHash . SH.take hqLength c = P.syntaxToColor ListNamespaceDependencies _ppe _path Empty -> pure $ "This namespace has no external dependencies." @@ -2307,10 +2307,10 @@ prettyTypeResultHeaderFull' (SR'.TypeResult' name dt r aliases) = P.lines stuff <> P.newline where stuff = - (P.hiBlack "-- " <> greyHash (HQ.fromReference r)) - : fmap - (\name -> prettyDeclTriple (name, r, dt)) - (name : map HQ'.toHQ (toList aliases)) + (P.hiBlack "-- " <> greyHash (HQ.fromReference r)) : + fmap + (\name -> prettyDeclTriple (name, r, dt)) + (name : map HQ'.toHQ (toList aliases)) where greyHash = styleHashQualified' id P.hiBlack @@ -2595,7 +2595,7 @@ showDiffNamespace :: (Pretty, NumberedArgs) showDiffNamespace _ _ _ _ diffOutput | OBD.isEmpty diffOutput = - ("The namespaces are identical.", mempty) + ("The namespaces are identical.", mempty) showDiffNamespace sn ppe oldPath newPath OBD.BranchDiffOutput {..} = (P.sepNonEmpty "\n\n" p, toList args) where @@ -3042,23 +3042,24 @@ listOfDefinitions' fscope ppe detailed results = else P.lines . P.nonEmpty - $ prettyNumberedResults - : [ formatMissingStuff termsWithMissingTypes missingTypes, - Monoid.unlessM (null missingBuiltins) - . bigproblem - $ P.wrap - "I encountered an inconsistency in the codebase; these definitions refer to built-ins that this version of unison doesn't know about:" - `P.hang` P.column2 - ( (P.bold "Name", P.bold "Built-in") - -- : ("-", "-") - : fmap - ( bimap - (P.syntaxToColor . prettyHashQualified) - (P.text . Referent.toText) - ) - missingBuiltins + $ prettyNumberedResults : + [ formatMissingStuff termsWithMissingTypes missingTypes, + Monoid.unlessM (null missingBuiltins) + . bigproblem + $ P.wrap + "I encountered an inconsistency in the codebase; these definitions refer to built-ins that this version of unison doesn't know about:" + `P.hang` P.column2 + ( (P.bold "Name", P.bold "Built-in") + -- : ("-", "-") + : + fmap + ( bimap + (P.syntaxToColor . prettyHashQualified) + (P.text . Referent.toText) ) - ] + missingBuiltins + ) + ] where prettyNumberedResults = P.numberedList prettyResults -- todo: group this by namespace @@ -3225,8 +3226,8 @@ prettyDiff diff = "", P.indentN 2 $ P.column2 $ - (P.hiBlack "Original name", P.hiBlack "New name") - : [(prettyName n, prettyName n2) | (n, n2) <- moved] + (P.hiBlack "Original name", P.hiBlack "New name") : + [(prettyName n, prettyName n2) | (n, n2) <- moved] ] else mempty, if not $ null copied @@ -3236,10 +3237,10 @@ prettyDiff diff = "", P.indentN 2 $ P.column2 $ - (P.hiBlack "Original name", P.hiBlack "New name(s)") - : [ (prettyName n, P.sep " " (prettyName <$> ns)) - | (n, ns) <- copied - ] + (P.hiBlack "Original name", P.hiBlack "New name(s)") : + [ (prettyName n, P.sep " " (prettyName <$> ns)) + | (n, ns) <- copied + ] ] else mempty ] From 02ac7cd31165716848d5c2243fdb7274f942f5b5 Mon Sep 17 00:00:00 2001 From: Rebecca Mark Date: Tue, 21 Feb 2023 14:45:15 -0800 Subject: [PATCH 358/467] using up-to-date version of ormolu --- .../src/Unison/Codebase/Editor/HandleInput.hs | 14 +-- .../src/Unison/CommandLine/OutputMessages.hs | 91 +++++++++---------- 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index b62285d6c..ec53e0fcb 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -2548,10 +2548,10 @@ searchBranchScored names0 score queries = pair qn HQ.HashQualified qn h | h `SH.isPrefixOf` Referent.toShortHash ref -> - pair qn + pair qn HQ.HashOnly h | h `SH.isPrefixOf` Referent.toShortHash ref -> - Just (Nothing, result) + Just (Nothing, result) _ -> Nothing where result = SR.termSearchResult names0 name ref @@ -2567,10 +2567,10 @@ searchBranchScored names0 score queries = pair qn HQ.HashQualified qn h | h `SH.isPrefixOf` Reference.toShortHash ref -> - pair qn + pair qn HQ.HashOnly h | h `SH.isPrefixOf` Reference.toShortHash ref -> - Just (Nothing, result) + Just (Nothing, result) _ -> Nothing where result = SR.typeSearchResult names0 name ref @@ -2704,9 +2704,9 @@ typecheckAndEval ppe tm = do -- Type checking succeeded Result.Result _ (Just ty) | Typechecker.fitsScheme ty mty -> - () <$ evalUnisonTerm False ppe False tm + () <$ evalUnisonTerm False ppe False tm | otherwise -> - Cli.returnEarly $ BadMainFunction "run" rendered ty ppe [mty] + Cli.returnEarly $ BadMainFunction "run" rendered ty ppe [mty] Result.Result notes Nothing -> do currentPath <- Cli.getCurrentPath let tes = [err | Result.TypeError err <- toList notes] @@ -2970,7 +2970,7 @@ checkDeletes typesTermsTuples doutput inputs = do return (resolvedPath, Path.unsafeToName (Path.unsplit resolvedPath), hq ^. _2, hq ^. _3) -- get the splits and names with terms and types splitsNames <- traverse toSplitName typesTermsTuples - let toRel :: Ord ref => Set ref -> Name -> R.Relation Name ref + let toRel :: (Ord ref) => Set ref -> Name -> R.Relation Name ref toRel setRef name = R.fromList (fmap (name,) (toList setRef)) let toDelete = fmap (\(_, names, types, terms) -> Names (toRel terms names) (toRel types names)) splitsNames -- make sure endangered is compeletely contained in paths diff --git a/unison-cli/src/Unison/CommandLine/OutputMessages.hs b/unison-cli/src/Unison/CommandLine/OutputMessages.hs index b0f59b832..c64e6c75a 100644 --- a/unison-cli/src/Unison/CommandLine/OutputMessages.hs +++ b/unison-cli/src/Unison/CommandLine/OutputMessages.hs @@ -692,8 +692,8 @@ notifyUser dir o = case o of CachedTests 0 _ -> pure . P.callout "😶" $ "No tests to run." CachedTests n n' | n == n' -> - pure $ - P.lines [cache, "", displayTestResults True ppe oks fails] + pure $ + P.lines [cache, "", displayTestResults True ppe oks fails] CachedTests _n m -> pure $ if m == 0 @@ -1082,11 +1082,11 @@ notifyUser dir o = case o of let prettyBindings = P.bracket . P.lines $ - P.wrap "The watch expression(s) reference these definitions:" : - "" : - [ P.syntaxToColor $ TermPrinter.prettyBinding ppe (HQ.unsafeFromVar v) b - | (v, b) <- bindings - ] + P.wrap "The watch expression(s) reference these definitions:" + : "" + : [ P.syntaxToColor $ TermPrinter.prettyBinding ppe (HQ.unsafeFromVar v) b + | (v, b) <- bindings + ] prettyWatches = P.sep "\n\n" @@ -1334,13 +1334,13 @@ notifyUser dir o = case o of case (new, old) of ([], []) -> error "BustedBuiltins busted, as there were no busted builtins." ([], old) -> - P.wrap ("This codebase includes some builtins that are considered deprecated. Use the " <> makeExample' IP.updateBuiltins <> " command when you're ready to work on eliminating them from your codebase:") : - "" : - fmap (P.text . Reference.toText) old + P.wrap ("This codebase includes some builtins that are considered deprecated. Use the " <> makeExample' IP.updateBuiltins <> " command when you're ready to work on eliminating them from your codebase:") + : "" + : fmap (P.text . Reference.toText) old (new, []) -> - P.wrap ("This version of Unison provides builtins that are not part of your codebase. Use " <> makeExample' IP.updateBuiltins <> " to add them:") : - "" : - fmap (P.text . Reference.toText) new + P.wrap ("This version of Unison provides builtins that are not part of your codebase. Use " <> makeExample' IP.updateBuiltins <> " to add them:") + : "" + : fmap (P.text . Reference.toText) new (new@(_ : _), old@(_ : _)) -> [ P.wrap ( "Sorry and/or good news! This version of Unison supports a different set of builtins than this codebase uses. You can use " @@ -1663,11 +1663,11 @@ notifyUser dir o = case o of num n = P.hiBlack $ P.shown n <> "." header = (P.hiBlack "Reference", P.hiBlack "Name") pairs = - header : - ( fmap (first c . second c) $ - [(p $ Reference.toShortHash r, prettyName n) | (n, r) <- names] - ++ [(p $ Reference.toShortHash r, "(no name available)") | r <- toList missing] - ) + header + : ( fmap (first c . second c) $ + [(p $ Reference.toShortHash r, prettyName n) | (n, r) <- names] + ++ [(p $ Reference.toShortHash r, "(no name available)") | r <- toList missing] + ) p = prettyShortHash . SH.take hqLength c = P.syntaxToColor ListNamespaceDependencies _ppe _path Empty -> pure $ "This namespace has no external dependencies." @@ -2307,10 +2307,10 @@ prettyTypeResultHeaderFull' (SR'.TypeResult' name dt r aliases) = P.lines stuff <> P.newline where stuff = - (P.hiBlack "-- " <> greyHash (HQ.fromReference r)) : - fmap - (\name -> prettyDeclTriple (name, r, dt)) - (name : map HQ'.toHQ (toList aliases)) + (P.hiBlack "-- " <> greyHash (HQ.fromReference r)) + : fmap + (\name -> prettyDeclTriple (name, r, dt)) + (name : map HQ'.toHQ (toList aliases)) where greyHash = styleHashQualified' id P.hiBlack @@ -2595,7 +2595,7 @@ showDiffNamespace :: (Pretty, NumberedArgs) showDiffNamespace _ _ _ _ diffOutput | OBD.isEmpty diffOutput = - ("The namespaces are identical.", mempty) + ("The namespaces are identical.", mempty) showDiffNamespace sn ppe oldPath newPath OBD.BranchDiffOutput {..} = (P.sepNonEmpty "\n\n" p, toList args) where @@ -3042,24 +3042,23 @@ listOfDefinitions' fscope ppe detailed results = else P.lines . P.nonEmpty - $ prettyNumberedResults : - [ formatMissingStuff termsWithMissingTypes missingTypes, - Monoid.unlessM (null missingBuiltins) - . bigproblem - $ P.wrap - "I encountered an inconsistency in the codebase; these definitions refer to built-ins that this version of unison doesn't know about:" - `P.hang` P.column2 - ( (P.bold "Name", P.bold "Built-in") - -- : ("-", "-") - : - fmap - ( bimap - (P.syntaxToColor . prettyHashQualified) - (P.text . Referent.toText) + $ prettyNumberedResults + : [ formatMissingStuff termsWithMissingTypes missingTypes, + Monoid.unlessM (null missingBuiltins) + . bigproblem + $ P.wrap + "I encountered an inconsistency in the codebase; these definitions refer to built-ins that this version of unison doesn't know about:" + `P.hang` P.column2 + ( (P.bold "Name", P.bold "Built-in") + -- : ("-", "-") + : fmap + ( bimap + (P.syntaxToColor . prettyHashQualified) + (P.text . Referent.toText) + ) + missingBuiltins ) - missingBuiltins - ) - ] + ] where prettyNumberedResults = P.numberedList prettyResults -- todo: group this by namespace @@ -3226,8 +3225,8 @@ prettyDiff diff = "", P.indentN 2 $ P.column2 $ - (P.hiBlack "Original name", P.hiBlack "New name") : - [(prettyName n, prettyName n2) | (n, n2) <- moved] + (P.hiBlack "Original name", P.hiBlack "New name") + : [(prettyName n, prettyName n2) | (n, n2) <- moved] ] else mempty, if not $ null copied @@ -3237,10 +3236,10 @@ prettyDiff diff = "", P.indentN 2 $ P.column2 $ - (P.hiBlack "Original name", P.hiBlack "New name(s)") : - [ (prettyName n, P.sep " " (prettyName <$> ns)) - | (n, ns) <- copied - ] + (P.hiBlack "Original name", P.hiBlack "New name(s)") + : [ (prettyName n, P.sep " " (prettyName <$> ns)) + | (n, ns) <- copied + ] ] else mempty ] From 5e9c1e23e7d71b7097d00a49d7a3988a6a30676f Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 21 Feb 2023 11:41:55 +0000 Subject: [PATCH 359/467] Add tests for ThreadKilled typeLink --- unison-src/builtin-tests/interpreter-tests.md | 10 ++++++++++ .../builtin-tests/interpreter-tests.output.md | 6 ++++++ .../builtin-tests/thread-killed-typeLink-test.u | 14 ++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 unison-src/builtin-tests/thread-killed-typeLink-test.u diff --git a/unison-src/builtin-tests/interpreter-tests.md b/unison-src/builtin-tests/interpreter-tests.md index 206efae6e..f6a145491 100644 --- a/unison-src/builtin-tests/interpreter-tests.md +++ b/unison-src/builtin-tests/interpreter-tests.md @@ -23,3 +23,13 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run tests ``` + + +```ucm:hide +.> load unison-src/builtin-tests/thread-killed-typeLink-test.u +.> add +``` + +```ucm +.> run threadKilledTypeLinkTest +``` diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index 947c5941a..751dbdb67 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -11,3 +11,9 @@ to `Tests.check` and `Tests.checkEqual`). () ``` +```ucm +.> run threadKilledTypeLinkTest + + () + +``` diff --git a/unison-src/builtin-tests/thread-killed-typeLink-test.u b/unison-src/builtin-tests/thread-killed-typeLink-test.u new file mode 100644 index 000000000..03d3abd52 --- /dev/null +++ b/unison-src/builtin-tests/thread-killed-typeLink-test.u @@ -0,0 +1,14 @@ +-- TODO Move this to concurrency-tests once the JIT supports typeLinks +threadKilledTypeLinkTest = Tests.main do + ref = IO.ref "initial" + typ = typeLink MiscFailure + t = fork do + match catchAll do sleep_ (400 * millis) with + Left (Failure f _ _) | f === typ -> unsafeRun! do Ref.write ref "caught" + _ -> () + sleep_ (200 * millis) + kill_ t + sleep_ (300 * millis) + v = Ref.read ref + checkEqual "Thread was killed, with finalisers" v "caught" + From 78153f6f457f7e595b13a4220106c2f69c786192 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 21 Feb 2023 12:34:17 +0000 Subject: [PATCH 360/467] Intercept async exceptions --- parser-typechecker/src/Unison/Runtime/Machine.hs | 3 +++ unison-src/builtin-tests/thread-killed-typeLink-test.u | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index bdd860943..181782b2c 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -521,6 +521,9 @@ encodeExn ustk bstk (Left exn) = do (Rf.stmFailureRef, disp be, unitValue) | Just (be :: BlockedIndefinitelyOnMVar) <- fromException exn = (Rf.ioFailureRef, disp be, unitValue) + -- TODO arithmeticFailureRef is a placeholder for the upcoming threadKilledRef + | Just (ie :: AsyncException) <- fromException exn = + (Rf.arithmeticFailureRef, disp ie, unitValue) | otherwise = (Rf.miscFailureRef, disp exn, unitValue) eval :: diff --git a/unison-src/builtin-tests/thread-killed-typeLink-test.u b/unison-src/builtin-tests/thread-killed-typeLink-test.u index 03d3abd52..b256999bb 100644 --- a/unison-src/builtin-tests/thread-killed-typeLink-test.u +++ b/unison-src/builtin-tests/thread-killed-typeLink-test.u @@ -1,7 +1,7 @@ -- TODO Move this to concurrency-tests once the JIT supports typeLinks threadKilledTypeLinkTest = Tests.main do ref = IO.ref "initial" - typ = typeLink MiscFailure + typ = typeLink ArithmeticFailure t = fork do match catchAll do sleep_ (400 * millis) with Left (Failure f _ _) | f === typ -> unsafeRun! do Ref.write ref "caught" From 8bb93a4edec27897b9c1fd6b75f64e64f822f494 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 21 Feb 2023 13:42:04 +0000 Subject: [PATCH 361/467] Add reference for threadKilledFailure --- parser-typechecker/src/Unison/Builtin/Decls.hs | 13 +++++++++++-- parser-typechecker/src/Unison/Runtime/Machine.hs | 3 +-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/parser-typechecker/src/Unison/Builtin/Decls.hs b/parser-typechecker/src/Unison/Builtin/Decls.hs index 607ad7632..af8f39aac 100644 --- a/parser-typechecker/src/Unison/Builtin/Decls.hs +++ b/parser-typechecker/src/Unison/Builtin/Decls.hs @@ -78,11 +78,12 @@ tlsSignedCertRef = lookupDeclRef "io2.Tls.SignedCert" tlsPrivateKeyRef = lookupDeclRef "io2.Tls.PrivateKey" -runtimeFailureRef, arithmeticFailureRef, miscFailureRef, stmFailureRef :: Reference +runtimeFailureRef, arithmeticFailureRef, miscFailureRef, stmFailureRef, threadKilledFailureRef :: Reference runtimeFailureRef = lookupDeclRef "io2.RuntimeFailure" arithmeticFailureRef = lookupDeclRef "io2.ArithmeticFailure" miscFailureRef = lookupDeclRef "io2.MiscFailure" stmFailureRef = lookupDeclRef "io2.STMFailure" +threadKilledFailureRef = lookupDeclRef "io2.ThreadKilledFailure" fileModeRef, filePathRef, bufferModeRef, seekModeRef, seqViewRef :: Reference fileModeRef = lookupDeclRef "io2.FileMode" @@ -184,7 +185,8 @@ builtinDataDecls = rs1 ++ rs (v "io2.RuntimeFailure", runtimeFailure), (v "io2.ArithmeticFailure", arithmeticFailure), (v "io2.MiscFailure", miscFailure), - (v "io2.STMFailure", stmFailure) + (v "io2.STMFailure", stmFailure), + (v "io2.ThreadKilledFailure", threadKilledFailure) ] of Right a -> a Left e -> error $ "builtinDataDecls: " <> show e @@ -363,6 +365,13 @@ builtinDataDecls = rs1 ++ rs [] [] + threadKilledFailure = + DataDeclaration + (Unique "replace-this-with-proper-id") + () + [] + [] + stdhnd = DataDeclaration (Unique "67bf7a8e517cbb1e9f42bc078e35498212d3be3c") diff --git a/parser-typechecker/src/Unison/Runtime/Machine.hs b/parser-typechecker/src/Unison/Runtime/Machine.hs index 181782b2c..e54e5aa03 100644 --- a/parser-typechecker/src/Unison/Runtime/Machine.hs +++ b/parser-typechecker/src/Unison/Runtime/Machine.hs @@ -521,9 +521,8 @@ encodeExn ustk bstk (Left exn) = do (Rf.stmFailureRef, disp be, unitValue) | Just (be :: BlockedIndefinitelyOnMVar) <- fromException exn = (Rf.ioFailureRef, disp be, unitValue) - -- TODO arithmeticFailureRef is a placeholder for the upcoming threadKilledRef | Just (ie :: AsyncException) <- fromException exn = - (Rf.arithmeticFailureRef, disp ie, unitValue) + (Rf.threadKilledFailureRef, disp ie, unitValue) | otherwise = (Rf.miscFailureRef, disp exn, unitValue) eval :: From 1467e91e1c994c00d64ae25c0873f14f82751b03 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 21 Feb 2023 13:44:19 +0000 Subject: [PATCH 362/467] Better structure for threadKilled test --- .../builtin-tests/interpreter-tests.output.md | 32 ++++++++++++++++++- .../thread-killed-typeLink-test.u | 9 +++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index 751dbdb67..f55914606 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -14,6 +14,36 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run threadKilledTypeLinkTest - () + 💔💥 + + I've encountered a call to builtin.bug with the following + value: + + "test suite failed" + + + Stack trace: + bug + #37j95plas6 ``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + 💔💥 + + I've encountered a call to builtin.bug with the following + value: + + "test suite failed" + + + Stack trace: + bug + #37j95plas6 + diff --git a/unison-src/builtin-tests/thread-killed-typeLink-test.u b/unison-src/builtin-tests/thread-killed-typeLink-test.u index b256999bb..adf313b9e 100644 --- a/unison-src/builtin-tests/thread-killed-typeLink-test.u +++ b/unison-src/builtin-tests/thread-killed-typeLink-test.u @@ -1,14 +1,15 @@ -- TODO Move this to concurrency-tests once the JIT supports typeLinks threadKilledTypeLinkTest = Tests.main do - ref = IO.ref "initial" - typ = typeLink ArithmeticFailure + ref = IO.ref None t = fork do match catchAll do sleep_ (400 * millis) with - Left (Failure f _ _) | f === typ -> unsafeRun! do Ref.write ref "caught" + Left (Failure f _ _) -> unsafeRun! do Ref.write ref (Some f) _ -> () sleep_ (200 * millis) kill_ t sleep_ (300 * millis) v = Ref.read ref - checkEqual "Thread was killed, with finalisers" v "caught" + expected = Some (typeLink ArithmeticFailure) + checkEqual "Thread was killed, with finalisers" v expected + From 3564ed78c5c2c05334e55dcdc56a4907e9fbc7d7 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 21 Feb 2023 13:59:04 +0000 Subject: [PATCH 363/467] Thread killed typeLink test passing --- unison-src/builtin-tests/interpreter-tests.md | 1 + .../builtin-tests/interpreter-tests.output.md | 32 +------------------ .../thread-killed-typeLink-test.u | 4 +-- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/unison-src/builtin-tests/interpreter-tests.md b/unison-src/builtin-tests/interpreter-tests.md index f6a145491..ffa081717 100644 --- a/unison-src/builtin-tests/interpreter-tests.md +++ b/unison-src/builtin-tests/interpreter-tests.md @@ -26,6 +26,7 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm:hide +.> builtins.merge .> load unison-src/builtin-tests/thread-killed-typeLink-test.u .> add ``` diff --git a/unison-src/builtin-tests/interpreter-tests.output.md b/unison-src/builtin-tests/interpreter-tests.output.md index f55914606..751dbdb67 100644 --- a/unison-src/builtin-tests/interpreter-tests.output.md +++ b/unison-src/builtin-tests/interpreter-tests.output.md @@ -14,36 +14,6 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run threadKilledTypeLinkTest - 💔💥 - - I've encountered a call to builtin.bug with the following - value: - - "test suite failed" - - - Stack trace: - bug - #37j95plas6 + () ``` - - - -🛑 - -The transcript failed due to an error in the stanza above. The error is: - - - 💔💥 - - I've encountered a call to builtin.bug with the following - value: - - "test suite failed" - - - Stack trace: - bug - #37j95plas6 - diff --git a/unison-src/builtin-tests/thread-killed-typeLink-test.u b/unison-src/builtin-tests/thread-killed-typeLink-test.u index adf313b9e..2af89952d 100644 --- a/unison-src/builtin-tests/thread-killed-typeLink-test.u +++ b/unison-src/builtin-tests/thread-killed-typeLink-test.u @@ -9,7 +9,7 @@ threadKilledTypeLinkTest = Tests.main do kill_ t sleep_ (300 * millis) v = Ref.read ref - expected = Some (typeLink ArithmeticFailure) - checkEqual "Thread was killed, with finalisers" v expected + expected = Some (typeLink ThreadKilledFailure) + checkEqual "Thread killed, finalisers with typeLink" v expected From 26d251e977ac57ff1082d7518ecab5999cfea264 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 21 Feb 2023 16:58:12 +0000 Subject: [PATCH 364/467] Add id for ThreadKilledFailure --- parser-typechecker/src/Unison/Builtin/Decls.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Builtin/Decls.hs b/parser-typechecker/src/Unison/Builtin/Decls.hs index af8f39aac..f7fae7f48 100644 --- a/parser-typechecker/src/Unison/Builtin/Decls.hs +++ b/parser-typechecker/src/Unison/Builtin/Decls.hs @@ -367,7 +367,7 @@ builtinDataDecls = rs1 ++ rs threadKilledFailure = DataDeclaration - (Unique "replace-this-with-proper-id") + (Unique "e7e479ebb757edcd5acff958b00aa228ac75b0c53638d44cf9d62fca045c33cf") () [] [] From ffb07e1d824b604626322a17db2322d6077f4134 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Tue, 21 Feb 2023 17:50:31 +0000 Subject: [PATCH 365/467] Delete chez stub for concurrent library --- scheme-libs/chez/unison/concurrent.ss | 30 --------------------------- 1 file changed, 30 deletions(-) delete mode 100644 scheme-libs/chez/unison/concurrent.ss diff --git a/scheme-libs/chez/unison/concurrent.ss b/scheme-libs/chez/unison/concurrent.ss deleted file mode 100644 index 0e7ecf1b8..000000000 --- a/scheme-libs/chez/unison/concurrent.ss +++ /dev/null @@ -1,30 +0,0 @@ -(library (unison concurrent) - (export - ref-new - ref-read - ref-write - ref-cas - promise-new - promise-read - promise-write - promise-try-read - fork - kill - sleep - try-eval) - - - (define err "This operation is not supported on the pure Chez Scheme -backend, use the Racket over Chez Scheme backend") - - (define (ref-new a) (error err)) - (define (ref-read ref) (error err)) - (define (ref-write ref a) (error err)) - (define (ref-cas ref old-value new-value) (error err)) - (define (promise-new) (error err)) - (define (promise-read promise) (error err)) - (define (promise-try-read promise) (error err)) - (define (fork thread-thunk) (error err)) - (define (kill thread-id) (error err)) - (define (try-eval thunk) (error err))) - From a8f1fb6fe18578a15230c35b35c8e2a8940dbf87 Mon Sep 17 00:00:00 2001 From: Fabio Labella Date: Wed, 22 Feb 2023 16:06:30 +0000 Subject: [PATCH 366/467] Generate transcripts --- .../all-base-hashes.output.md | 757 +++++++-------- unison-src/transcripts/alias-many.output.md | 383 ++++---- .../transcripts/builtins-merge.output.md | 2 +- .../transcripts/emptyCodebase.output.md | 4 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 28 +- .../transcripts/name-selection.output.md | 903 +++++++++--------- unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 +- 9 files changed, 1062 insertions(+), 1057 deletions(-) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index ce3b7bc36..61393a036 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -1495,267 +1495,270 @@ This transcript is intended to make visible accidental changes to the hashing al 432. -- ##ThreadId builtin type builtin.io2.ThreadId - 433. -- ##Tls + 433. -- #ggh649864d9bfnk90n7kgtj7dflddc4kn8osu7u7mub8p7l8biid8dgtungj4u005h7karbgupfpum9jp94spks3ma1sgh39bhirv38 + unique type builtin.io2.ThreadKilledFailure + + 434. -- ##Tls builtin type builtin.io2.Tls - 434. -- ##Tls.Cipher + 435. -- ##Tls.Cipher builtin type builtin.io2.Tls.Cipher - 435. -- ##Tls.ClientConfig + 436. -- ##Tls.ClientConfig builtin type builtin.io2.Tls.ClientConfig - 436. -- ##Tls.ClientConfig.certificates.set + 437. -- ##Tls.ClientConfig.certificates.set builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 437. -- ##TLS.ClientConfig.ciphers.set + 438. -- ##TLS.ClientConfig.ciphers.set builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 438. -- ##Tls.ClientConfig.default + 439. -- ##Tls.ClientConfig.default builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 439. -- ##Tls.ClientConfig.versions.set + 440. -- ##Tls.ClientConfig.versions.set builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 440. -- ##Tls.decodeCert.impl.v3 + 441. -- ##Tls.decodeCert.impl.v3 builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 441. -- ##Tls.decodePrivateKey + 442. -- ##Tls.decodePrivateKey builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 442. -- ##Tls.encodeCert + 443. -- ##Tls.encodeCert builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 443. -- ##Tls.encodePrivateKey + 444. -- ##Tls.encodePrivateKey builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 444. -- ##Tls.handshake.impl.v3 + 445. -- ##Tls.handshake.impl.v3 builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 445. -- ##Tls.newClient.impl.v3 + 446. -- ##Tls.newClient.impl.v3 builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 446. -- ##Tls.newServer.impl.v3 + 447. -- ##Tls.newServer.impl.v3 builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 447. -- ##Tls.PrivateKey + 448. -- ##Tls.PrivateKey builtin type builtin.io2.Tls.PrivateKey - 448. -- ##Tls.receive.impl.v3 + 449. -- ##Tls.receive.impl.v3 builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 449. -- ##Tls.send.impl.v3 + 450. -- ##Tls.send.impl.v3 builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 450. -- ##Tls.ServerConfig + 451. -- ##Tls.ServerConfig builtin type builtin.io2.Tls.ServerConfig - 451. -- ##Tls.ServerConfig.certificates.set + 452. -- ##Tls.ServerConfig.certificates.set builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 452. -- ##Tls.ServerConfig.ciphers.set + 453. -- ##Tls.ServerConfig.ciphers.set builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 453. -- ##Tls.ServerConfig.default + 454. -- ##Tls.ServerConfig.default builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 454. -- ##Tls.ServerConfig.versions.set + 455. -- ##Tls.ServerConfig.versions.set builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 455. -- ##Tls.SignedCert + 456. -- ##Tls.SignedCert builtin type builtin.io2.Tls.SignedCert - 456. -- ##Tls.terminate.impl.v3 + 457. -- ##Tls.terminate.impl.v3 builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 457. -- ##Tls.Version + 458. -- ##Tls.Version builtin type builtin.io2.Tls.Version - 458. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + 459. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 unique type builtin.io2.TlsFailure - 459. -- ##TVar + 460. -- ##TVar builtin type builtin.io2.TVar - 460. -- ##TVar.new + 461. -- ##TVar.new builtin.io2.TVar.new : a ->{STM} TVar a - 461. -- ##TVar.newIO + 462. -- ##TVar.newIO builtin.io2.TVar.newIO : a ->{IO} TVar a - 462. -- ##TVar.read + 463. -- ##TVar.read builtin.io2.TVar.read : TVar a ->{STM} a - 463. -- ##TVar.readIO + 464. -- ##TVar.readIO builtin.io2.TVar.readIO : TVar a ->{IO} a - 464. -- ##TVar.swap + 465. -- ##TVar.swap builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 465. -- ##TVar.write + 466. -- ##TVar.write builtin.io2.TVar.write : TVar a -> a ->{STM} () - 466. -- ##validateSandboxed + 467. -- ##validateSandboxed builtin.io2.validateSandboxed : [Link.Term] -> a -> Boolean - 467. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + 468. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 unique type builtin.IsPropagated - 468. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + 469. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 builtin.IsPropagated.IsPropagated : IsPropagated - 469. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + 470. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 unique type builtin.IsTest - 470. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + 471. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 builtin.IsTest.IsTest : IsTest - 471. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + 472. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g unique type builtin.License - 472. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + 473. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 builtin.License.copyrightHolders : License -> [CopyrightHolder] - 473. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + 474. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo builtin.License.copyrightHolders.modify : ([CopyrightHolder] ->{g} [CopyrightHolder]) -> License ->{g} License - 474. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + 475. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro builtin.License.copyrightHolders.set : [CopyrightHolder] -> License -> License - 475. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + 476. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 builtin.License.License : [CopyrightHolder] -> [Year] -> LicenseType -> License - 476. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + 477. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g builtin.License.licenseType : License -> LicenseType - 477. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + 478. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo builtin.License.licenseType.modify : (LicenseType ->{g} LicenseType) -> License ->{g} License - 478. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + 479. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o builtin.License.licenseType.set : LicenseType -> License -> License - 479. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + 480. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig builtin.License.years : License -> [Year] - 480. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + 481. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 builtin.License.years.modify : ([Year] ->{g} [Year]) -> License ->{g} License - 481. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + 482. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo builtin.License.years.set : [Year] -> License -> License - 482. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + 483. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 unique type builtin.LicenseType - 483. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + 484. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 builtin.LicenseType.LicenseType : Doc -> LicenseType - 484. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + 485. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 unique type builtin.Link - 485. -- ##Link.Term + 486. -- ##Link.Term builtin type builtin.Link.Term - 486. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + 487. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 builtin.Link.Term : Link.Term -> Link - 487. -- ##Link.Term.toText + 488. -- ##Link.Term.toText builtin.Link.Term.toText : Link.Term -> Text - 488. -- ##Link.Type + 489. -- ##Link.Type builtin type builtin.Link.Type - 489. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + 490. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 builtin.Link.Type : Type -> Link - 490. -- ##Sequence + 491. -- ##Sequence builtin type builtin.List - 491. -- ##List.++ + 492. -- ##List.++ builtin.List.++ : [a] -> [a] -> [a] - 492. -- ##List.cons + 493. -- ##List.cons builtin.List.+:, builtin.List.cons : a -> [a] -> [a] - 493. -- ##List.snoc + 494. -- ##List.snoc builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] - 494. -- ##List.at + 495. -- ##List.at builtin.List.at : Nat -> [a] -> Optional a - 495. -- ##List.cons + 496. -- ##List.cons builtin.List.cons, builtin.List.+: : a -> [a] -> [a] - 496. -- ##List.drop + 497. -- ##List.drop builtin.List.drop : Nat -> [a] -> [a] - 497. -- ##List.empty + 498. -- ##List.empty builtin.List.empty : [a] - 498. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + 499. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] - 499. -- ##List.size + 500. -- ##List.size builtin.List.size : [a] -> Nat - 500. -- ##List.snoc + 501. -- ##List.snoc builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] - 501. -- ##List.take + 502. -- ##List.take builtin.List.take : Nat -> [a] -> [a] - 502. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + 503. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g builtin.metadata.isPropagated : IsPropagated - 503. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + 504. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko builtin.metadata.isTest : IsTest - 504. -- ##MutableArray + 505. -- ##MutableArray builtin type builtin.MutableArray - 505. -- ##MutableArray.copyTo! + 506. -- ##MutableArray.copyTo! builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a @@ -1763,34 +1766,34 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 506. -- ##MutableArray.freeze + 507. -- ##MutableArray.freeze builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 507. -- ##MutableArray.freeze! + 508. -- ##MutableArray.freeze! builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 508. -- ##MutableArray.read + 509. -- ##MutableArray.read builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 509. -- ##MutableArray.size + 510. -- ##MutableArray.size builtin.MutableArray.size : MutableArray g a -> Nat - 510. -- ##MutableArray.write + 511. -- ##MutableArray.write builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 511. -- ##MutableByteArray + 512. -- ##MutableByteArray builtin type builtin.MutableByteArray - 512. -- ##MutableByteArray.copyTo! + 513. -- ##MutableByteArray.copyTo! builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g @@ -1798,688 +1801,688 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 513. -- ##MutableByteArray.freeze + 514. -- ##MutableByteArray.freeze builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 514. -- ##MutableByteArray.freeze! + 515. -- ##MutableByteArray.freeze! builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 515. -- ##MutableByteArray.read16be + 516. -- ##MutableByteArray.read16be builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 516. -- ##MutableByteArray.read24be + 517. -- ##MutableByteArray.read24be builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 517. -- ##MutableByteArray.read32be + 518. -- ##MutableByteArray.read32be builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 518. -- ##MutableByteArray.read40be + 519. -- ##MutableByteArray.read40be builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 519. -- ##MutableByteArray.read64be + 520. -- ##MutableByteArray.read64be builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 520. -- ##MutableByteArray.read8 + 521. -- ##MutableByteArray.read8 builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 521. -- ##MutableByteArray.size + 522. -- ##MutableByteArray.size builtin.MutableByteArray.size : MutableByteArray g -> Nat - 522. -- ##MutableByteArray.write16be + 523. -- ##MutableByteArray.write16be builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 523. -- ##MutableByteArray.write32be + 524. -- ##MutableByteArray.write32be builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 524. -- ##MutableByteArray.write64be + 525. -- ##MutableByteArray.write64be builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 525. -- ##MutableByteArray.write8 + 526. -- ##MutableByteArray.write8 builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 526. -- ##Nat + 527. -- ##Nat builtin type builtin.Nat - 527. -- ##Nat.* + 528. -- ##Nat.* builtin.Nat.* : Nat -> Nat -> Nat - 528. -- ##Nat.+ + 529. -- ##Nat.+ builtin.Nat.+ : Nat -> Nat -> Nat - 529. -- ##Nat./ + 530. -- ##Nat./ builtin.Nat./ : Nat -> Nat -> Nat - 530. -- ##Nat.and + 531. -- ##Nat.and builtin.Nat.and : Nat -> Nat -> Nat - 531. -- ##Nat.complement + 532. -- ##Nat.complement builtin.Nat.complement : Nat -> Nat - 532. -- ##Nat.drop + 533. -- ##Nat.drop builtin.Nat.drop : Nat -> Nat -> Nat - 533. -- ##Nat.== + 534. -- ##Nat.== builtin.Nat.eq : Nat -> Nat -> Boolean - 534. -- ##Nat.fromText + 535. -- ##Nat.fromText builtin.Nat.fromText : Text -> Optional Nat - 535. -- ##Nat.> + 536. -- ##Nat.> builtin.Nat.gt : Nat -> Nat -> Boolean - 536. -- ##Nat.>= + 537. -- ##Nat.>= builtin.Nat.gteq : Nat -> Nat -> Boolean - 537. -- ##Nat.increment + 538. -- ##Nat.increment builtin.Nat.increment : Nat -> Nat - 538. -- ##Nat.isEven + 539. -- ##Nat.isEven builtin.Nat.isEven : Nat -> Boolean - 539. -- ##Nat.isOdd + 540. -- ##Nat.isOdd builtin.Nat.isOdd : Nat -> Boolean - 540. -- ##Nat.leadingZeros + 541. -- ##Nat.leadingZeros builtin.Nat.leadingZeros : Nat -> Nat - 541. -- ##Nat.< + 542. -- ##Nat.< builtin.Nat.lt : Nat -> Nat -> Boolean - 542. -- ##Nat.<= + 543. -- ##Nat.<= builtin.Nat.lteq : Nat -> Nat -> Boolean - 543. -- ##Nat.mod + 544. -- ##Nat.mod builtin.Nat.mod : Nat -> Nat -> Nat - 544. -- ##Nat.or + 545. -- ##Nat.or builtin.Nat.or : Nat -> Nat -> Nat - 545. -- ##Nat.popCount + 546. -- ##Nat.popCount builtin.Nat.popCount : Nat -> Nat - 546. -- ##Nat.pow + 547. -- ##Nat.pow builtin.Nat.pow : Nat -> Nat -> Nat - 547. -- ##Nat.shiftLeft + 548. -- ##Nat.shiftLeft builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 548. -- ##Nat.shiftRight + 549. -- ##Nat.shiftRight builtin.Nat.shiftRight : Nat -> Nat -> Nat - 549. -- ##Nat.sub + 550. -- ##Nat.sub builtin.Nat.sub : Nat -> Nat -> Int - 550. -- ##Nat.toFloat + 551. -- ##Nat.toFloat builtin.Nat.toFloat : Nat -> Float - 551. -- ##Nat.toInt + 552. -- ##Nat.toInt builtin.Nat.toInt : Nat -> Int - 552. -- ##Nat.toText + 553. -- ##Nat.toText builtin.Nat.toText : Nat -> Text - 553. -- ##Nat.trailingZeros + 554. -- ##Nat.trailingZeros builtin.Nat.trailingZeros : Nat -> Nat - 554. -- ##Nat.xor + 555. -- ##Nat.xor builtin.Nat.xor : Nat -> Nat -> Nat - 555. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + 556. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg structural type builtin.Optional a - 556. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + 557. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 builtin.Optional.None : Optional a - 557. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + 558. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 builtin.Optional.Some : a -> Optional a - 558. -- ##Pattern + 559. -- ##Pattern builtin type builtin.Pattern - 559. -- ##Pattern.capture + 560. -- ##Pattern.capture builtin.Pattern.capture : Pattern a -> Pattern a - 560. -- ##Pattern.isMatch + 561. -- ##Pattern.isMatch builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 561. -- ##Pattern.join + 562. -- ##Pattern.join builtin.Pattern.join : [Pattern a] -> Pattern a - 562. -- ##Pattern.many + 563. -- ##Pattern.many builtin.Pattern.many : Pattern a -> Pattern a - 563. -- ##Pattern.or + 564. -- ##Pattern.or builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 564. -- ##Pattern.replicate + 565. -- ##Pattern.replicate builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 565. -- ##Pattern.run + 566. -- ##Pattern.run builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) - 566. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + 567. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg structural type builtin.Pretty txt - 567. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + 568. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 unique type builtin.Pretty.Annotated w txt - 568. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + 569. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 builtin.Pretty.Annotated.Append : w -> [Annotated w txt] -> Annotated w txt - 569. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + 570. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 builtin.Pretty.Annotated.Empty : Annotated w txt - 570. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + 571. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 builtin.Pretty.Annotated.Group : w -> Annotated w txt -> Annotated w txt - 571. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + 572. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 builtin.Pretty.Annotated.Indent : w -> Annotated w txt -> Annotated w txt -> Annotated w txt -> Annotated w txt - 572. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + 573. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 builtin.Pretty.Annotated.Lit : w -> txt -> Annotated w txt - 573. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + 574. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 builtin.Pretty.Annotated.OrElse : w -> Annotated w txt -> Annotated w txt -> Annotated w txt - 574. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + 575. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 builtin.Pretty.Annotated.Table : w -> [[Annotated w txt]] -> Annotated w txt - 575. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + 576. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 builtin.Pretty.Annotated.Wrap : w -> Annotated w txt -> Annotated w txt - 576. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + 577. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg builtin.Pretty.append : Pretty txt -> Pretty txt -> Pretty txt - 577. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + 578. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 builtin.Pretty.empty : Pretty txt - 578. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + 579. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo builtin.Pretty.get : Pretty txt -> Annotated () txt - 579. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + 580. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 builtin.Pretty.group : Pretty txt -> Pretty txt - 580. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + 581. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno builtin.Pretty.indent : Pretty txt -> Pretty txt -> Pretty txt - 581. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + 582. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug builtin.Pretty.indent' : Pretty txt -> Pretty txt -> Pretty txt -> Pretty txt - 582. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + 583. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo builtin.Pretty.join : [Pretty txt] -> Pretty txt - 583. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + 584. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 584. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + 585. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 - 585. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + 586. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 builtin.Pretty.orElse : Pretty txt -> Pretty txt -> Pretty txt - 586. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + 587. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 builtin.Pretty.Pretty : Annotated () txt -> Pretty txt - 587. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + 588. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g builtin.Pretty.sepBy : Pretty txt -> [Pretty txt] -> Pretty txt - 588. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + 589. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro builtin.Pretty.table : [[Pretty txt]] -> Pretty txt - 589. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + 590. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 builtin.Pretty.wrap : Pretty txt -> Pretty txt - 590. -- ##Ref + 591. -- ##Ref builtin type builtin.Ref - 591. -- ##Ref.read + 592. -- ##Ref.read builtin.Ref.read : Ref g a ->{g} a - 592. -- ##Ref.write + 593. -- ##Ref.write builtin.Ref.write : Ref g a -> a ->{g} () - 593. -- ##Effect + 594. -- ##Effect builtin type builtin.Request - 594. -- ##Scope + 595. -- ##Scope builtin type builtin.Scope - 595. -- ##Scope.array + 596. -- ##Scope.array builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 596. -- ##Scope.arrayOf + 597. -- ##Scope.arrayOf builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 597. -- ##Scope.bytearray + 598. -- ##Scope.bytearray builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 598. -- ##Scope.bytearrayOf + 599. -- ##Scope.bytearrayOf builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 599. -- ##Scope.ref + 600. -- ##Scope.ref builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 600. -- ##Scope.run + 601. -- ##Scope.run builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 601. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + 602. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 structural type builtin.SeqView a b - 602. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + 603. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 builtin.SeqView.VElem : a -> b -> SeqView a b - 603. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + 604. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 builtin.SeqView.VEmpty : SeqView a b - 604. -- ##Socket.toText + 605. -- ##Socket.toText builtin.Socket.toText : Socket -> Text - 605. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + 606. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo builtin.syntax.docAside : Doc2 -> Doc2 - 606. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + 607. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 builtin.syntax.docBlockquote : Doc2 -> Doc2 - 607. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + 608. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 builtin.syntax.docBold : Doc2 -> Doc2 - 608. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + 609. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg builtin.syntax.docBulletedList : [Doc2] -> Doc2 - 609. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + 610. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 - 610. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + 611. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo builtin.syntax.docCode : Doc2 -> Doc2 - 611. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + 612. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 builtin.syntax.docCodeBlock : Text -> Text -> Doc2 - 612. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + 613. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 builtin.syntax.docColumn : [Doc2] -> Doc2 - 613. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + 614. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term - 614. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + 615. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg builtin.syntax.docEmbedAnnotations : tms -> tms - 615. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + 616. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 builtin.syntax.docEmbedSignatureLink : '{g} t -> Doc2.Term - 616. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + 617. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao builtin.syntax.docEmbedTermLink : '{g} t -> Either a Doc2.Term - 617. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + 618. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 builtin.syntax.docEmbedTypeLink : typ -> Either typ b - 618. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + 619. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg builtin.syntax.docEval : 'a -> Doc2 - 619. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + 620. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g builtin.syntax.docEvalInline : 'a -> Doc2 - 620. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + 621. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 builtin.syntax.docExample : Nat -> '{g} t -> Doc2 - 621. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + 622. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 - 622. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + 623. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 623. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + 624. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) - 624. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + 625. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 builtin.syntax.docGroup : Doc2 -> Doc2 - 625. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + 626. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 builtin.syntax.docItalic : Doc2 -> Doc2 - 626. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + 627. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 builtin.syntax.docJoin : [Doc2] -> Doc2 - 627. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + 628. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 - 628. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + 629. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 - 629. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + 630. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 - 630. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + 631. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 builtin.syntax.docParagraph : [Doc2] -> Doc2 - 631. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + 632. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 - 632. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + 633. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 builtin.syntax.docSignature : [Doc2.Term] -> Doc2 - 633. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + 634. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 - 634. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + 635. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 builtin.syntax.docSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 635. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + 636. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 builtin.syntax.docSourceElement : link -> annotations -> (link, annotations) - 636. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + 637. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag builtin.syntax.docStrikethrough : Doc2 -> Doc2 - 637. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + 638. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g builtin.syntax.docTable : [[Doc2]] -> Doc2 - 638. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + 639. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 - 639. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + 640. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 builtin.syntax.docTransclude : d -> d - 640. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + 641. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 builtin.syntax.docUntitledSection : [Doc2] -> Doc2 - 641. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + 642. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo builtin.syntax.docVerbatim : Doc2 -> Doc2 - 642. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + 643. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 builtin.syntax.docWord : Text -> Doc2 - 643. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + 644. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 unique type builtin.Test.Result - 644. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + 645. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 builtin.Test.Result.Fail : Text -> Result - 645. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + 646. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 builtin.Test.Result.Ok : Text -> Result - 646. -- ##Text + 647. -- ##Text builtin type builtin.Text - 647. -- ##Text.!= + 648. -- ##Text.!= builtin.Text.!= : Text -> Text -> Boolean - 648. -- ##Text.++ + 649. -- ##Text.++ builtin.Text.++ : Text -> Text -> Text - 649. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + 650. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text - 650. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + 651. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg builtin.Text.alignRightWith : Nat -> Char -> Text -> Text - 651. -- ##Text.drop + 652. -- ##Text.drop builtin.Text.drop : Nat -> Text -> Text - 652. -- ##Text.empty + 653. -- ##Text.empty builtin.Text.empty : Text - 653. -- ##Text.== + 654. -- ##Text.== builtin.Text.eq : Text -> Text -> Boolean - 654. -- ##Text.fromCharList + 655. -- ##Text.fromCharList builtin.Text.fromCharList : [Char] -> Text - 655. -- ##Text.fromUtf8.impl.v3 + 656. -- ##Text.fromUtf8.impl.v3 builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 656. -- ##Text.> + 657. -- ##Text.> builtin.Text.gt : Text -> Text -> Boolean - 657. -- ##Text.>= + 658. -- ##Text.>= builtin.Text.gteq : Text -> Text -> Boolean - 658. -- ##Text.< + 659. -- ##Text.< builtin.Text.lt : Text -> Text -> Boolean - 659. -- ##Text.<= + 660. -- ##Text.<= builtin.Text.lteq : Text -> Text -> Boolean - 660. -- ##Text.patterns.anyChar + 661. -- ##Text.patterns.anyChar builtin.Text.patterns.anyChar : Pattern Text - 661. -- ##Text.patterns.char + 662. -- ##Text.patterns.char builtin.Text.patterns.char : Class -> Pattern Text - 662. -- ##Text.patterns.charIn + 663. -- ##Text.patterns.charIn builtin.Text.patterns.charIn : [Char] -> Pattern Text - 663. -- ##Text.patterns.charRange + 664. -- ##Text.patterns.charRange builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 664. -- ##Text.patterns.digit + 665. -- ##Text.patterns.digit builtin.Text.patterns.digit : Pattern Text - 665. -- ##Text.patterns.eof + 666. -- ##Text.patterns.eof builtin.Text.patterns.eof : Pattern Text - 666. -- ##Text.patterns.letter + 667. -- ##Text.patterns.letter builtin.Text.patterns.letter : Pattern Text - 667. -- ##Text.patterns.literal + 668. -- ##Text.patterns.literal builtin.Text.patterns.literal : Text -> Pattern Text - 668. -- ##Text.patterns.notCharIn + 669. -- ##Text.patterns.notCharIn builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 669. -- ##Text.patterns.notCharRange + 670. -- ##Text.patterns.notCharRange builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 670. -- ##Text.patterns.punctuation + 671. -- ##Text.patterns.punctuation builtin.Text.patterns.punctuation : Pattern Text - 671. -- ##Text.patterns.space + 672. -- ##Text.patterns.space builtin.Text.patterns.space : Pattern Text - 672. -- ##Text.repeat + 673. -- ##Text.repeat builtin.Text.repeat : Nat -> Text -> Text - 673. -- ##Text.reverse + 674. -- ##Text.reverse builtin.Text.reverse : Text -> Text - 674. -- ##Text.size + 675. -- ##Text.size builtin.Text.size : Text -> Nat - 675. -- ##Text.take + 676. -- ##Text.take builtin.Text.take : Nat -> Text -> Text - 676. -- ##Text.toCharList + 677. -- ##Text.toCharList builtin.Text.toCharList : Text -> [Char] - 677. -- ##Text.toLowercase + 678. -- ##Text.toLowercase builtin.Text.toLowercase : Text -> Text - 678. -- ##Text.toUppercase + 679. -- ##Text.toUppercase builtin.Text.toUppercase : Text -> Text - 679. -- ##Text.toUtf8 + 680. -- ##Text.toUtf8 builtin.Text.toUtf8 : Text -> Bytes - 680. -- ##Text.uncons + 681. -- ##Text.uncons builtin.Text.uncons : Text -> Optional (Char, Text) - 681. -- ##Text.unsnoc + 682. -- ##Text.unsnoc builtin.Text.unsnoc : Text -> Optional (Text, Char) - 682. -- ##ThreadId.toText + 683. -- ##ThreadId.toText builtin.ThreadId.toText : ThreadId -> Text - 683. -- ##todo + 684. -- ##todo builtin.todo : a -> b - 684. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + 685. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 structural type builtin.Tuple a b - 685. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + 686. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 builtin.Tuple.Cons : a -> b -> Tuple a b - 686. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + 687. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g structural type builtin.Unit - 687. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + 688. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 builtin.Unit.Unit : () - 688. -- ##Universal.< + 689. -- ##Universal.< builtin.Universal.< : a -> a -> Boolean - 689. -- ##Universal.<= + 690. -- ##Universal.<= builtin.Universal.<= : a -> a -> Boolean - 690. -- ##Universal.== + 691. -- ##Universal.== builtin.Universal.== : a -> a -> Boolean - 691. -- ##Universal.> + 692. -- ##Universal.> builtin.Universal.> : a -> a -> Boolean - 692. -- ##Universal.>= + 693. -- ##Universal.>= builtin.Universal.>= : a -> a -> Boolean - 693. -- ##Universal.compare + 694. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 694. -- ##Universal.murmurHash + 695. -- ##Universal.murmurHash builtin.Universal.murmurHash : a -> Nat - 695. -- ##unsafe.coerceAbilities + 696. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 696. -- ##Value + 697. -- ##Value builtin type builtin.Value - 697. -- ##Value.dependencies + 698. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 698. -- ##Value.deserialize + 699. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 699. -- ##Value.load + 700. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 700. -- ##Value.serialize + 701. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 701. -- ##Value.value + 702. -- ##Value.value builtin.Value.value : a -> Value - 702. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 703. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 703. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 704. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 704. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 705. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 705. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 706. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 706. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 707. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 707. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 708. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 708. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 709. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 709. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 710. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 710. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 711. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 711. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 712. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 712. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 713. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2487,7 +2490,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 713. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 714. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2496,318 +2499,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 714. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 715. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 715. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 716. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 716. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 717. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 717. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 718. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 718. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 719. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 719. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 720. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 720. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 721. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 721. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 722. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 722. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 723. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 723. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 724. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 724. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 725. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 725. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 726. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 726. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 727. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 727. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 728. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 728. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 729. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 729. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 730. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 730. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 731. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 731. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 732. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 732. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 733. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 733. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 734. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 734. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 735. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 735. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 736. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 736. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 737. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 737. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 738. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 738. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 739. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 739. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 740. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 740. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 741. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 741. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 742. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 742. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 743. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 743. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 744. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 744. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 745. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 745. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 746. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 746. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 747. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 747. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 748. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 748. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 749. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 749. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 750. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 750. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 751. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 751. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 752. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 752. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 753. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 753. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 754. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 754. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 755. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 755. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 756. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 756. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 757. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 757. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 758. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 758. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 759. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 759. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 760. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 760. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 761. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 761. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 762. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 762. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 763. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 763. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 764. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 764. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 765. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 765. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 766. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 766. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 767. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 767. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 768. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 768. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 769. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 769. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 770. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 770. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 771. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 771. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 772. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 772. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 773. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 773. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 774. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 774. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 775. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 775. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 776. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 776. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 777. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 777. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 778. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 778. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 779. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o saveSelfContained : a -> Text ->{IO, Exception} () - 779. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 780. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 780. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 781. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 781. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 782. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 782. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 783. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 783. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 784. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 784. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 785. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 785. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 786. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 786. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 787. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 787. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 788. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 788. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 789. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 789. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 790. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 790. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 791. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 791. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 792. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 792. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 793. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 793. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 794. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 794. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 795. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 795. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 796. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 796. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 797. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 797. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 798. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 798. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 799. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 799. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 800. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 800. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 801. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 801. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 802. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 802. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 803. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 803. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 804. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 804. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 805. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 805. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 806. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 806. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 807. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 807. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 808. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 808. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 809. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 809. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 810. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index e33cc9565..45cb2259b 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -422,271 +422,272 @@ Let's try it! 312. io2.STM.retry : '{STM} a 313. unique type io2.STMFailure 314. builtin type io2.ThreadId - 315. builtin type io2.Tls - 316. builtin type io2.Tls.Cipher - 317. builtin type io2.Tls.ClientConfig - 318. io2.Tls.ClientConfig.certificates.set : [SignedCert] + 315. unique type io2.ThreadKilledFailure + 316. builtin type io2.Tls + 317. builtin type io2.Tls.Cipher + 318. builtin type io2.Tls.ClientConfig + 319. io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 319. io2.TLS.ClientConfig.ciphers.set : [Cipher] + 320. io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 320. io2.Tls.ClientConfig.default : Text + 321. io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 321. io2.Tls.ClientConfig.versions.set : [Version] + 322. io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 322. io2.Tls.decodeCert.impl : Bytes + 323. io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 323. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 324. io2.Tls.encodeCert : SignedCert -> Bytes - 325. io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 326. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 327. io2.Tls.newClient.impl : ClientConfig + 324. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] + 325. io2.Tls.encodeCert : SignedCert -> Bytes + 326. io2.Tls.encodePrivateKey : PrivateKey -> Bytes + 327. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () + 328. io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 328. io2.Tls.newServer.impl : ServerConfig + 329. io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 329. builtin type io2.Tls.PrivateKey - 330. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 331. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 332. builtin type io2.Tls.ServerConfig - 333. io2.Tls.ServerConfig.certificates.set : [SignedCert] + 330. builtin type io2.Tls.PrivateKey + 331. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes + 332. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () + 333. builtin type io2.Tls.ServerConfig + 334. io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 334. io2.Tls.ServerConfig.ciphers.set : [Cipher] + 335. io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 335. io2.Tls.ServerConfig.default : [SignedCert] + 336. io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 336. io2.Tls.ServerConfig.versions.set : [Version] + 337. io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 337. builtin type io2.Tls.SignedCert - 338. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 339. builtin type io2.Tls.Version - 340. unique type io2.TlsFailure - 341. builtin type io2.TVar - 342. io2.TVar.new : a ->{STM} TVar a - 343. io2.TVar.newIO : a ->{IO} TVar a - 344. io2.TVar.read : TVar a ->{STM} a - 345. io2.TVar.readIO : TVar a ->{IO} a - 346. io2.TVar.swap : TVar a -> a ->{STM} a - 347. io2.TVar.write : TVar a -> a ->{STM} () - 348. io2.validateSandboxed : [Term] -> a -> Boolean - 349. unique type IsPropagated - 350. IsPropagated.IsPropagated : IsPropagated - 351. unique type IsTest - 352. IsTest.IsTest : IsTest - 353. unique type Link - 354. builtin type Link.Term - 355. Link.Term : Term -> Link - 356. Link.Term.toText : Term -> Text - 357. builtin type Link.Type - 358. Link.Type : Type -> Link - 359. builtin type List - 360. List.++ : [a] -> [a] -> [a] - 361. List.+: : a -> [a] -> [a] - 362. List.:+ : [a] -> a -> [a] - 363. List.at : Nat -> [a] -> Optional a - 364. List.cons : a -> [a] -> [a] - 365. List.drop : Nat -> [a] -> [a] - 366. List.empty : [a] - 367. List.size : [a] -> Nat - 368. List.snoc : [a] -> a -> [a] - 369. List.take : Nat -> [a] -> [a] - 370. metadata.isPropagated : IsPropagated - 371. metadata.isTest : IsTest - 372. builtin type MutableArray - 373. MutableArray.copyTo! : MutableArray g a + 338. builtin type io2.Tls.SignedCert + 339. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () + 340. builtin type io2.Tls.Version + 341. unique type io2.TlsFailure + 342. builtin type io2.TVar + 343. io2.TVar.new : a ->{STM} TVar a + 344. io2.TVar.newIO : a ->{IO} TVar a + 345. io2.TVar.read : TVar a ->{STM} a + 346. io2.TVar.readIO : TVar a ->{IO} a + 347. io2.TVar.swap : TVar a -> a ->{STM} a + 348. io2.TVar.write : TVar a -> a ->{STM} () + 349. io2.validateSandboxed : [Term] -> a -> Boolean + 350. unique type IsPropagated + 351. IsPropagated.IsPropagated : IsPropagated + 352. unique type IsTest + 353. IsTest.IsTest : IsTest + 354. unique type Link + 355. builtin type Link.Term + 356. Link.Term : Term -> Link + 357. Link.Term.toText : Term -> Text + 358. builtin type Link.Type + 359. Link.Type : Type -> Link + 360. builtin type List + 361. List.++ : [a] -> [a] -> [a] + 362. List.+: : a -> [a] -> [a] + 363. List.:+ : [a] -> a -> [a] + 364. List.at : Nat -> [a] -> Optional a + 365. List.cons : a -> [a] -> [a] + 366. List.drop : Nat -> [a] -> [a] + 367. List.empty : [a] + 368. List.size : [a] -> Nat + 369. List.snoc : [a] -> a -> [a] + 370. List.take : Nat -> [a] -> [a] + 371. metadata.isPropagated : IsPropagated + 372. metadata.isTest : IsTest + 373. builtin type MutableArray + 374. MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a -> Nat -> Nat ->{g, Exception} () - 374. MutableArray.freeze : MutableArray g a + 375. MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 375. MutableArray.freeze! : MutableArray g a + 376. MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 376. MutableArray.read : MutableArray g a + 377. MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 377. MutableArray.size : MutableArray g a -> Nat - 378. MutableArray.write : MutableArray g a + 378. MutableArray.size : MutableArray g a -> Nat + 379. MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 379. builtin type MutableByteArray - 380. MutableByteArray.copyTo! : MutableByteArray g + 380. builtin type MutableByteArray + 381. MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 381. MutableByteArray.freeze : MutableByteArray g + 382. MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 382. MutableByteArray.freeze! : MutableByteArray g + 383. MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 383. MutableByteArray.read16be : MutableByteArray g + 384. MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 384. MutableByteArray.read24be : MutableByteArray g + 385. MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 385. MutableByteArray.read32be : MutableByteArray g + 386. MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 386. MutableByteArray.read40be : MutableByteArray g + 387. MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 387. MutableByteArray.read64be : MutableByteArray g + 388. MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 388. MutableByteArray.read8 : MutableByteArray g + 389. MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 389. MutableByteArray.size : MutableByteArray g -> Nat - 390. MutableByteArray.write16be : MutableByteArray g + 390. MutableByteArray.size : MutableByteArray g -> Nat + 391. MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 391. MutableByteArray.write32be : MutableByteArray g + 392. MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 392. MutableByteArray.write64be : MutableByteArray g + 393. MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 393. MutableByteArray.write8 : MutableByteArray g + 394. MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 394. builtin type Nat - 395. Nat.* : Nat -> Nat -> Nat - 396. Nat.+ : Nat -> Nat -> Nat - 397. Nat./ : Nat -> Nat -> Nat - 398. Nat.and : Nat -> Nat -> Nat - 399. Nat.complement : Nat -> Nat - 400. Nat.drop : Nat -> Nat -> Nat - 401. Nat.eq : Nat -> Nat -> Boolean - 402. Nat.fromText : Text -> Optional Nat - 403. Nat.gt : Nat -> Nat -> Boolean - 404. Nat.gteq : Nat -> Nat -> Boolean - 405. Nat.increment : Nat -> Nat - 406. Nat.isEven : Nat -> Boolean - 407. Nat.isOdd : Nat -> Boolean - 408. Nat.leadingZeros : Nat -> Nat - 409. Nat.lt : Nat -> Nat -> Boolean - 410. Nat.lteq : Nat -> Nat -> Boolean - 411. Nat.mod : Nat -> Nat -> Nat - 412. Nat.or : Nat -> Nat -> Nat - 413. Nat.popCount : Nat -> Nat - 414. Nat.pow : Nat -> Nat -> Nat - 415. Nat.shiftLeft : Nat -> Nat -> Nat - 416. Nat.shiftRight : Nat -> Nat -> Nat - 417. Nat.sub : Nat -> Nat -> Int - 418. Nat.toFloat : Nat -> Float - 419. Nat.toInt : Nat -> Int - 420. Nat.toText : Nat -> Text - 421. Nat.trailingZeros : Nat -> Nat - 422. Nat.xor : Nat -> Nat -> Nat - 423. structural type Optional a - 424. Optional.None : Optional a - 425. Optional.Some : a -> Optional a - 426. builtin type Pattern - 427. Pattern.capture : Pattern a -> Pattern a - 428. Pattern.isMatch : Pattern a -> a -> Boolean - 429. Pattern.join : [Pattern a] -> Pattern a - 430. Pattern.many : Pattern a -> Pattern a - 431. Pattern.or : Pattern a -> Pattern a -> Pattern a - 432. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 433. Pattern.run : Pattern a -> a -> Optional ([a], a) - 434. builtin type Ref - 435. Ref.read : Ref g a ->{g} a - 436. Ref.write : Ref g a -> a ->{g} () - 437. builtin type Request - 438. builtin type Scope - 439. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 440. Scope.arrayOf : a + 395. builtin type Nat + 396. Nat.* : Nat -> Nat -> Nat + 397. Nat.+ : Nat -> Nat -> Nat + 398. Nat./ : Nat -> Nat -> Nat + 399. Nat.and : Nat -> Nat -> Nat + 400. Nat.complement : Nat -> Nat + 401. Nat.drop : Nat -> Nat -> Nat + 402. Nat.eq : Nat -> Nat -> Boolean + 403. Nat.fromText : Text -> Optional Nat + 404. Nat.gt : Nat -> Nat -> Boolean + 405. Nat.gteq : Nat -> Nat -> Boolean + 406. Nat.increment : Nat -> Nat + 407. Nat.isEven : Nat -> Boolean + 408. Nat.isOdd : Nat -> Boolean + 409. Nat.leadingZeros : Nat -> Nat + 410. Nat.lt : Nat -> Nat -> Boolean + 411. Nat.lteq : Nat -> Nat -> Boolean + 412. Nat.mod : Nat -> Nat -> Nat + 413. Nat.or : Nat -> Nat -> Nat + 414. Nat.popCount : Nat -> Nat + 415. Nat.pow : Nat -> Nat -> Nat + 416. Nat.shiftLeft : Nat -> Nat -> Nat + 417. Nat.shiftRight : Nat -> Nat -> Nat + 418. Nat.sub : Nat -> Nat -> Int + 419. Nat.toFloat : Nat -> Float + 420. Nat.toInt : Nat -> Int + 421. Nat.toText : Nat -> Text + 422. Nat.trailingZeros : Nat -> Nat + 423. Nat.xor : Nat -> Nat -> Nat + 424. structural type Optional a + 425. Optional.None : Optional a + 426. Optional.Some : a -> Optional a + 427. builtin type Pattern + 428. Pattern.capture : Pattern a -> Pattern a + 429. Pattern.isMatch : Pattern a -> a -> Boolean + 430. Pattern.join : [Pattern a] -> Pattern a + 431. Pattern.many : Pattern a -> Pattern a + 432. Pattern.or : Pattern a -> Pattern a -> Pattern a + 433. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a + 434. Pattern.run : Pattern a -> a -> Optional ([a], a) + 435. builtin type Ref + 436. Ref.read : Ref g a ->{g} a + 437. Ref.write : Ref g a -> a ->{g} () + 438. builtin type Request + 439. builtin type Scope + 440. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a + 441. Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 441. Scope.bytearray : Nat + 442. Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 442. Scope.bytearrayOf : Nat + 443. Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 443. Scope.ref : a ->{Scope s} Ref {Scope s} a - 444. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 445. structural type SeqView a b - 446. SeqView.VElem : a -> b -> SeqView a b - 447. SeqView.VEmpty : SeqView a b - 448. Socket.toText : Socket -> Text - 449. unique type Test.Result - 450. Test.Result.Fail : Text -> Result - 451. Test.Result.Ok : Text -> Result - 452. builtin type Text - 453. Text.!= : Text -> Text -> Boolean - 454. Text.++ : Text -> Text -> Text - 455. Text.drop : Nat -> Text -> Text - 456. Text.empty : Text - 457. Text.eq : Text -> Text -> Boolean - 458. Text.fromCharList : [Char] -> Text - 459. Text.fromUtf8.impl : Bytes -> Either Failure Text - 460. Text.gt : Text -> Text -> Boolean - 461. Text.gteq : Text -> Text -> Boolean - 462. Text.lt : Text -> Text -> Boolean - 463. Text.lteq : Text -> Text -> Boolean - 464. Text.patterns.anyChar : Pattern Text - 465. Text.patterns.char : Class -> Pattern Text - 466. Text.patterns.charIn : [Char] -> Pattern Text - 467. Text.patterns.charRange : Char -> Char -> Pattern Text - 468. Text.patterns.digit : Pattern Text - 469. Text.patterns.eof : Pattern Text - 470. Text.patterns.letter : Pattern Text - 471. Text.patterns.literal : Text -> Pattern Text - 472. Text.patterns.notCharIn : [Char] -> Pattern Text - 473. Text.patterns.notCharRange : Char -> Char -> Pattern Text - 474. Text.patterns.punctuation : Pattern Text - 475. Text.patterns.space : Pattern Text - 476. Text.repeat : Nat -> Text -> Text - 477. Text.reverse : Text -> Text - 478. Text.size : Text -> Nat - 479. Text.take : Nat -> Text -> Text - 480. Text.toCharList : Text -> [Char] - 481. Text.toLowercase : Text -> Text - 482. Text.toUppercase : Text -> Text - 483. Text.toUtf8 : Text -> Bytes - 484. Text.uncons : Text -> Optional (Char, Text) - 485. Text.unsnoc : Text -> Optional (Text, Char) - 486. ThreadId.toText : ThreadId -> Text - 487. todo : a -> b - 488. structural type Tuple a b - 489. Tuple.Cons : a -> b -> Tuple a b - 490. structural type Unit - 491. Unit.Unit : () - 492. Universal.< : a -> a -> Boolean - 493. Universal.<= : a -> a -> Boolean - 494. Universal.== : a -> a -> Boolean - 495. Universal.> : a -> a -> Boolean - 496. Universal.>= : a -> a -> Boolean - 497. Universal.compare : a -> a -> Int - 498. Universal.murmurHash : a -> Nat - 499. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 500. builtin type Value - 501. Value.dependencies : Value -> [Term] - 502. Value.deserialize : Bytes -> Either Text Value - 503. Value.load : Value ->{IO} Either [Term] a - 504. Value.serialize : Value -> Bytes - 505. Value.value : a -> Value + 444. Scope.ref : a ->{Scope s} Ref {Scope s} a + 445. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r + 446. structural type SeqView a b + 447. SeqView.VElem : a -> b -> SeqView a b + 448. SeqView.VEmpty : SeqView a b + 449. Socket.toText : Socket -> Text + 450. unique type Test.Result + 451. Test.Result.Fail : Text -> Result + 452. Test.Result.Ok : Text -> Result + 453. builtin type Text + 454. Text.!= : Text -> Text -> Boolean + 455. Text.++ : Text -> Text -> Text + 456. Text.drop : Nat -> Text -> Text + 457. Text.empty : Text + 458. Text.eq : Text -> Text -> Boolean + 459. Text.fromCharList : [Char] -> Text + 460. Text.fromUtf8.impl : Bytes -> Either Failure Text + 461. Text.gt : Text -> Text -> Boolean + 462. Text.gteq : Text -> Text -> Boolean + 463. Text.lt : Text -> Text -> Boolean + 464. Text.lteq : Text -> Text -> Boolean + 465. Text.patterns.anyChar : Pattern Text + 466. Text.patterns.char : Class -> Pattern Text + 467. Text.patterns.charIn : [Char] -> Pattern Text + 468. Text.patterns.charRange : Char -> Char -> Pattern Text + 469. Text.patterns.digit : Pattern Text + 470. Text.patterns.eof : Pattern Text + 471. Text.patterns.letter : Pattern Text + 472. Text.patterns.literal : Text -> Pattern Text + 473. Text.patterns.notCharIn : [Char] -> Pattern Text + 474. Text.patterns.notCharRange : Char -> Char -> Pattern Text + 475. Text.patterns.punctuation : Pattern Text + 476. Text.patterns.space : Pattern Text + 477. Text.repeat : Nat -> Text -> Text + 478. Text.reverse : Text -> Text + 479. Text.size : Text -> Nat + 480. Text.take : Nat -> Text -> Text + 481. Text.toCharList : Text -> [Char] + 482. Text.toLowercase : Text -> Text + 483. Text.toUppercase : Text -> Text + 484. Text.toUtf8 : Text -> Bytes + 485. Text.uncons : Text -> Optional (Char, Text) + 486. Text.unsnoc : Text -> Optional (Text, Char) + 487. ThreadId.toText : ThreadId -> Text + 488. todo : a -> b + 489. structural type Tuple a b + 490. Tuple.Cons : a -> b -> Tuple a b + 491. structural type Unit + 492. Unit.Unit : () + 493. Universal.< : a -> a -> Boolean + 494. Universal.<= : a -> a -> Boolean + 495. Universal.== : a -> a -> Boolean + 496. Universal.> : a -> a -> Boolean + 497. Universal.>= : a -> a -> Boolean + 498. Universal.compare : a -> a -> Int + 499. Universal.murmurHash : a -> Nat + 500. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b + 501. builtin type Value + 502. Value.dependencies : Value -> [Term] + 503. Value.deserialize : Bytes -> Either Text Value + 504. Value.load : Value ->{IO} Either [Term] a + 505. Value.serialize : Value -> Bytes + 506. Value.value : a -> Value .builtin> alias.many 94-104 .mylib diff --git a/unison-src/transcripts/builtins-merge.output.md b/unison-src/transcripts/builtins-merge.output.md index bad9e8cc0..3369e258b 100644 --- a/unison-src/transcripts/builtins-merge.output.md +++ b/unison-src/transcripts/builtins-merge.output.md @@ -74,7 +74,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 63. Value/ (5 terms) 64. bug (a -> b) 65. crypto/ (12 terms, 1 type) - 66. io2/ (131 terms, 31 types) + 66. io2/ (131 terms, 32 types) 67. metadata/ (2 terms) 68. todo (a -> b) 69. unsafe/ (1 term) diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index 52a58a68c..9db858af9 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge` .foo> ls - 1. builtin/ (440 terms, 65 types) + 1. builtin/ (440 terms, 66 types) ``` And for a limited time, you can get even more builtin goodies: @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (612 terms, 83 types) + 1. builtin/ (612 terms, 84 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index 05f6267ff..d65e99380 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -113,13 +113,13 @@ it's still in the `history` of the parent namespace and can be resurrected at an Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #pfspc3m714 + ⊙ 1. #9k2k834edc - Deletes: feature1.y - ⊙ 2. #t9gdv3652e + ⊙ 2. #d9u1nnu62h + Adds / updates: @@ -130,26 +130,26 @@ it's still in the `history` of the parent namespace and can be resurrected at an Original name New name(s) feature1.y master.y - ⊙ 3. #fnah4umom7 + ⊙ 3. #8ir51a10kg + Adds / updates: feature1.y - ⊙ 4. #fsd9t403lp + ⊙ 4. #v03np1853n > Moves: Original name New name x master.x - ⊙ 5. #64tba28sdf + ⊙ 5. #1fnkqqd2ae + Adds / updates: x - □ 6. #uql7vkh78v (start of history) + □ 6. #b3jsb4pjcl (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 0b5fd12c2..030e44616 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -269,7 +269,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (617 terms, 84 types) + 1. root/ (617 terms, 85 types) .> history @@ -278,13 +278,13 @@ I should be able to move the root into a sub-namespace - □ 1. #g5nn5l3b03 (start of history) + □ 1. #hu6p22qbe4 (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (612 terms, 83 types) + 1. builtin/ (612 terms, 84 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -294,7 +294,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #vt3jsa8k80 + ⊙ 1. #8rae339vn9 - Deletes: @@ -305,7 +305,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #b2h3s5rv29 + ⊙ 2. #r697qei02b + Adds / updates: @@ -317,26 +317,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #7v6bvecsm0 + ⊙ 3. #ca0k6ug92t + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #1uf0leagkk + ⊙ 4. #7nnrjj85km > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #a3uao3fp6q + ⊙ 5. #01cflse46b - Deletes: history.b.termInB - ⊙ 6. #umd1mp6mku + ⊙ 6. #cna2qqmgcq + Adds / updates: @@ -347,13 +347,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #dqfd14almm + ⊙ 7. #qoce7dt2h1 + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #ljk3oa07ld + ⊙ 8. #g8m2g6bd1g > Moves: @@ -363,7 +363,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #hhun973gp5 + ⊙ 9. #ngl33npfah + Adds / updates: @@ -373,7 +373,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #8ri4h5gjvo + ⊙ 10. #1rnd8dpisq + Adds / updates: @@ -385,7 +385,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #ahcsbbqt21 + ⊙ 11. #7s9j9tscke ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index f6c248b2d..45438248d 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -148,298 +148,299 @@ d = c + 10 60. builtin type builtin.Link.Term 61. builtin type builtin.Text 62. builtin type builtin.io2.ThreadId - 63. builtin type builtin.io2.Ref.Ticket - 64. builtin type builtin.io2.Clock.internals.TimeSpec - 65. builtin type builtin.io2.Tls - 66. unique type builtin.io2.TlsFailure - 67. structural type builtin.Tuple a b - 68. builtin type builtin.Link.Type - 69. structural type builtin.Unit - 70. builtin type builtin.Value - 71. builtin type builtin.io2.Tls.Version - 72. builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 73. builtin.io2.IOError.AlreadyExists : IOError - 74. builtin.io2.FileMode.Append : FileMode - 75. builtin.Doc.Blob : Text + 63. unique type builtin.io2.ThreadKilledFailure + 64. builtin type builtin.io2.Ref.Ticket + 65. builtin type builtin.io2.Clock.internals.TimeSpec + 66. builtin type builtin.io2.Tls + 67. unique type builtin.io2.TlsFailure + 68. structural type builtin.Tuple a b + 69. builtin type builtin.Link.Type + 70. structural type builtin.Unit + 71. builtin type builtin.Value + 72. builtin type builtin.io2.Tls.Version + 73. builtin.io2.SeekMode.AbsoluteSeek : SeekMode + 74. builtin.io2.IOError.AlreadyExists : IOError + 75. builtin.io2.FileMode.Append : FileMode + 76. builtin.Doc.Blob : Text -> Doc - 76. builtin.io2.BufferMode.BlockBuffering : BufferMode - 77. builtin.Tuple.Cons : a + 77. builtin.io2.BufferMode.BlockBuffering : BufferMode + 78. builtin.Tuple.Cons : a -> b -> Tuple a b - 78. builtin.io2.IOError.EOF : IOError - 79. builtin.Doc.Evaluate : Term + 79. builtin.io2.IOError.EOF : IOError + 80. builtin.Doc.Evaluate : Term -> Doc - 80. builtin.Test.Result.Fail : Text + 81. builtin.Test.Result.Fail : Text -> Result - 81. builtin.io2.Failure.Failure : Type + 82. builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 82. builtin.io2.IOError.IllegalOperation : IOError - 83. builtin.IsPropagated.IsPropagated : IsPropagated - 84. builtin.IsTest.IsTest : IsTest - 85. builtin.Doc.Join : [Doc] + 83. builtin.io2.IOError.IllegalOperation : IOError + 84. builtin.IsPropagated.IsPropagated : IsPropagated + 85. builtin.IsTest.IsTest : IsTest + 86. builtin.Doc.Join : [Doc] -> Doc - 86. builtin.Either.Left : a + 87. builtin.Either.Left : a -> Either a b - 87. builtin.io2.BufferMode.LineBuffering : BufferMode - 88. builtin.Doc.Link : Link + 88. builtin.io2.BufferMode.LineBuffering : BufferMode + 89. builtin.Doc.Link : Link -> Doc - 89. builtin.io2.BufferMode.NoBuffering : BufferMode - 90. builtin.io2.IOError.NoSuchThing : IOError - 91. builtin.Optional.None : Optional + 90. builtin.io2.BufferMode.NoBuffering : BufferMode + 91. builtin.io2.IOError.NoSuchThing : IOError + 92. builtin.Optional.None : Optional a - 92. builtin.Test.Result.Ok : Text + 93. builtin.Test.Result.Ok : Text -> Result - 93. builtin.io2.IOError.PermissionDenied : IOError - 94. builtin.io2.FileMode.Read : FileMode - 95. builtin.io2.FileMode.ReadWrite : FileMode - 96. builtin.io2.SeekMode.RelativeSeek : SeekMode - 97. builtin.io2.IOError.ResourceBusy : IOError - 98. builtin.io2.IOError.ResourceExhausted : IOError - 99. builtin.Either.Right : b + 94. builtin.io2.IOError.PermissionDenied : IOError + 95. builtin.io2.FileMode.Read : FileMode + 96. builtin.io2.FileMode.ReadWrite : FileMode + 97. builtin.io2.SeekMode.RelativeSeek : SeekMode + 98. builtin.io2.IOError.ResourceBusy : IOError + 99. builtin.io2.IOError.ResourceExhausted : IOError + 100. builtin.Either.Right : b -> Either a b - 100. builtin.io2.SeekMode.SeekFromEnd : SeekMode - 101. builtin.Doc.Signature : Term + 101. builtin.io2.SeekMode.SeekFromEnd : SeekMode + 102. builtin.Doc.Signature : Term -> Doc - 102. builtin.io2.BufferMode.SizedBlockBuffering : Nat + 103. builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 103. builtin.Optional.Some : a + 104. builtin.Optional.Some : a -> Optional a - 104. builtin.Doc.Source : Link + 105. builtin.Doc.Source : Link -> Doc - 105. builtin.io2.StdHandle.StdErr : StdHandle - 106. builtin.io2.StdHandle.StdIn : StdHandle - 107. builtin.io2.StdHandle.StdOut : StdHandle - 108. builtin.Link.Term : Term + 106. builtin.io2.StdHandle.StdErr : StdHandle + 107. builtin.io2.StdHandle.StdIn : StdHandle + 108. builtin.io2.StdHandle.StdOut : StdHandle + 109. builtin.Link.Term : Term -> Link - 109. builtin.Link.Type : Type + 110. builtin.Link.Type : Type -> Link - 110. builtin.Unit.Unit : () - 111. builtin.io2.IOError.UserError : IOError - 112. builtin.SeqView.VElem : a + 111. builtin.Unit.Unit : () + 112. builtin.io2.IOError.UserError : IOError + 113. builtin.SeqView.VElem : a -> b -> SeqView a b - 113. builtin.SeqView.VEmpty : SeqView + 114. builtin.SeqView.VEmpty : SeqView a b - 114. builtin.io2.FileMode.Write : FileMode - 115. builtin.Exception.raise : Failure + 115. builtin.io2.FileMode.Write : FileMode + 116. builtin.Exception.raise : Failure ->{Exception} x - 116. builtin.Text.!= : Text + 117. builtin.Text.!= : Text -> Text -> Boolean - 117. builtin.Float.* : Float + 118. builtin.Float.* : Float -> Float -> Float - 118. builtin.Int.* : Int + 119. builtin.Int.* : Int -> Int -> Int - 119. builtin.Nat.* : Nat + 120. builtin.Nat.* : Nat -> Nat -> Nat - 120. builtin.Float.+ : Float + 121. builtin.Float.+ : Float -> Float -> Float - 121. builtin.Int.+ : Int + 122. builtin.Int.+ : Int -> Int -> Int - 122. builtin.Nat.+ : Nat + 123. builtin.Nat.+ : Nat -> Nat -> Nat - 123. builtin.Bytes.++ : Bytes + 124. builtin.Bytes.++ : Bytes -> Bytes -> Bytes - 124. builtin.List.++ : [a] + 125. builtin.List.++ : [a] -> [a] -> [a] - 125. builtin.Text.++ : Text + 126. builtin.Text.++ : Text -> Text -> Text - 126. ┌ builtin.List.+: : a + 127. ┌ builtin.List.+: : a -> [a] -> [a] - 127. └ builtin.List.cons : a + 128. └ builtin.List.cons : a -> [a] -> [a] - 128. builtin.Float.- : Float + 129. builtin.Float.- : Float -> Float -> Float - 129. builtin.Int.- : Int + 130. builtin.Int.- : Int -> Int -> Int - 130. builtin.Float./ : Float + 131. builtin.Float./ : Float -> Float -> Float - 131. builtin.Int./ : Int + 132. builtin.Int./ : Int -> Int -> Int - 132. builtin.Nat./ : Nat + 133. builtin.Nat./ : Nat -> Nat -> Nat - 133. ┌ builtin.List.:+ : [a] + 134. ┌ builtin.List.:+ : [a] -> a -> [a] - 134. └ builtin.List.snoc : [a] + 135. └ builtin.List.snoc : [a] -> a -> [a] - 135. builtin.Universal.< : a + 136. builtin.Universal.< : a -> a -> Boolean - 136. builtin.Universal.<= : a + 137. builtin.Universal.<= : a -> a -> Boolean - 137. builtin.Universal.== : a + 138. builtin.Universal.== : a -> a -> Boolean - 138. builtin.Universal.> : a + 139. builtin.Universal.> : a -> a -> Boolean - 139. builtin.Universal.>= : a + 140. builtin.Universal.>= : a -> a -> Boolean - 140. builtin.Any.Any : a + 141. builtin.Any.Any : a -> Any - 141. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm - 142. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm - 143. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 144. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm - 145. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 146. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 147. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 148. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 149. builtin.Float.abs : Float + 142. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm + 143. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm + 144. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm + 145. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm + 146. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + 147. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + 148. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + 149. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + 150. builtin.Float.abs : Float -> Float - 150. builtin.Float.acos : Float + 151. builtin.Float.acos : Float -> Float - 151. builtin.Float.acosh : Float + 152. builtin.Float.acosh : Float -> Float - 152. builtin.Char.Class.alphanumeric : Class - 153. builtin.Char.Class.and : Class + 153. builtin.Char.Class.alphanumeric : Class + 154. builtin.Char.Class.and : Class -> Class -> Class - 154. builtin.Int.and : Int + 155. builtin.Int.and : Int -> Int -> Int - 155. builtin.Nat.and : Nat + 156. builtin.Nat.and : Nat -> Nat -> Nat - 156. builtin.Char.Class.any : Class - 157. builtin.Text.patterns.anyChar : Pattern + 157. builtin.Char.Class.any : Class + 158. builtin.Text.patterns.anyChar : Pattern Text - 158. builtin.Char.Class.anyOf : [Char] + 159. builtin.Char.Class.anyOf : [Char] -> Class - 159. builtin.io2.IO.array : Nat + 160. builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 160. builtin.Scope.array : Nat + 161. builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 161. builtin.io2.IO.arrayOf : a + 162. builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 162. builtin.Scope.arrayOf : a + 163. builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 163. builtin.Float.asin : Float + 164. builtin.Float.asin : Float -> Float - 164. builtin.Float.asinh : Float + 165. builtin.Float.asinh : Float -> Float - 165. builtin.Bytes.at : Nat + 166. builtin.Bytes.at : Nat -> Bytes -> Optional Nat - 166. builtin.List.at : Nat + 167. builtin.List.at : Nat -> [a] -> Optional a - 167. builtin.Float.atan : Float + 168. builtin.Float.atan : Float -> Float - 168. builtin.Float.atan2 : Float + 169. builtin.Float.atan2 : Float -> Float -> Float - 169. builtin.Float.atanh : Float + 170. builtin.Float.atanh : Float -> Float - 170. builtin.io2.STM.atomically : '{STM} a + 171. builtin.io2.STM.atomically : '{STM} a ->{IO} a - 171. builtin.bug : a -> b - 172. builtin.io2.IO.bytearray : Nat + 172. builtin.bug : a -> b + 173. builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 173. builtin.Scope.bytearray : Nat + 174. builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 174. builtin.io2.IO.bytearrayOf : Nat + 175. builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 175. builtin.Scope.bytearrayOf : Nat + 176. builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 176. ┌ c#gjmq673r1v : Nat - 177. └ long.name.but.shortest.suffixification : Nat - 178. builtin.Code.cache_ : [( Term, + 177. ┌ c#gjmq673r1v : Nat + 178. └ long.name.but.shortest.suffixification : Nat + 179. builtin.Code.cache_ : [( Term, Code)] ->{IO} [Term] - 179. builtin.io2.IO.process.call : Text + 180. builtin.io2.IO.process.call : Text -> [Text] ->{IO} Nat - 180. builtin.Pattern.capture : Pattern + 181. builtin.Pattern.capture : Pattern a -> Pattern a - 181. builtin.io2.Ref.cas : Ref + 182. builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 182. builtin.Float.ceiling : Float + 183. builtin.Float.ceiling : Float -> Int - 183. builtin.Text.patterns.char : Class + 184. builtin.Text.patterns.char : Class -> Pattern Text - 184. builtin.Text.patterns.charIn : [Char] + 185. builtin.Text.patterns.charIn : [Char] -> Pattern Text - 185. builtin.Text.patterns.charRange : Char + 186. builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 186. builtin.unsafe.coerceAbilities : (a + 187. builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 187. builtin.Universal.compare : a + 188. builtin.Universal.compare : a -> a -> Int - 188. builtin.Int.complement : Int + 189. builtin.Int.complement : Int -> Int - 189. builtin.Nat.complement : Nat + 190. builtin.Nat.complement : Nat -> Nat - 190. builtin.Bytes.gzip.compress : Bytes + 191. builtin.Bytes.gzip.compress : Bytes -> Bytes - 191. builtin.Bytes.zlib.compress : Bytes + 192. builtin.Bytes.zlib.compress : Bytes -> Bytes - 192. builtin.Char.Class.control : Class - 193. builtin.ImmutableArray.copyTo! : MutableArray + 193. builtin.Char.Class.control : Class + 194. builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray @@ -448,7 +449,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 194. builtin.ImmutableByteArray.copyTo! : MutableByteArray + 195. builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -456,7 +457,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 195. builtin.MutableArray.copyTo! : MutableArray + 196. builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray @@ -465,7 +466,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 196. builtin.MutableByteArray.copyTo! : MutableByteArray + 197. builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray @@ -474,979 +475,979 @@ d = c + 10 -> Nat ->{g, Exception} () - 197. builtin.Float.cos : Float + 198. builtin.Float.cos : Float -> Float - 198. builtin.Float.cosh : Float + 199. builtin.Float.cosh : Float -> Float - 199. builtin.Bytes.decodeNat16be : Bytes + 200. builtin.Bytes.decodeNat16be : Bytes -> Optional ( Nat, Bytes) - 200. builtin.Bytes.decodeNat16le : Bytes + 201. builtin.Bytes.decodeNat16le : Bytes -> Optional ( Nat, Bytes) - 201. builtin.Bytes.decodeNat32be : Bytes + 202. builtin.Bytes.decodeNat32be : Bytes -> Optional ( Nat, Bytes) - 202. builtin.Bytes.decodeNat32le : Bytes + 203. builtin.Bytes.decodeNat32le : Bytes -> Optional ( Nat, Bytes) - 203. builtin.Bytes.decodeNat64be : Bytes + 204. builtin.Bytes.decodeNat64be : Bytes -> Optional ( Nat, Bytes) - 204. builtin.Bytes.decodeNat64le : Bytes + 205. builtin.Bytes.decodeNat64le : Bytes -> Optional ( Nat, Bytes) - 205. builtin.io2.Tls.decodePrivateKey : Bytes + 206. builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 206. builtin.Bytes.gzip.decompress : Bytes + 207. builtin.Bytes.gzip.decompress : Bytes -> Either Text Bytes - 207. builtin.Bytes.zlib.decompress : Bytes + 208. builtin.Bytes.zlib.decompress : Bytes -> Either Text Bytes - 208. builtin.io2.Tls.ClientConfig.default : Text + 209. builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 209. builtin.io2.Tls.ServerConfig.default : [SignedCert] + 210. builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 210. builtin.Code.dependencies : Code + 211. builtin.Code.dependencies : Code -> [Term] - 211. builtin.Value.dependencies : Value + 212. builtin.Value.dependencies : Value -> [Term] - 212. builtin.Code.deserialize : Bytes + 213. builtin.Code.deserialize : Bytes -> Either Text Code - 213. builtin.Value.deserialize : Bytes + 214. builtin.Value.deserialize : Bytes -> Either Text Value - 214. builtin.Text.patterns.digit : Pattern + 215. builtin.Text.patterns.digit : Pattern Text - 215. builtin.Code.display : Text + 216. builtin.Code.display : Text -> Code -> Text - 216. builtin.Bytes.drop : Nat + 217. builtin.Bytes.drop : Nat -> Bytes -> Bytes - 217. builtin.List.drop : Nat + 218. builtin.List.drop : Nat -> [a] -> [a] - 218. builtin.Nat.drop : Nat + 219. builtin.Nat.drop : Nat -> Nat -> Nat - 219. builtin.Text.drop : Nat + 220. builtin.Text.drop : Nat -> Text -> Text - 220. builtin.Bytes.empty : Bytes - 221. builtin.List.empty : [a] - 222. builtin.Text.empty : Text - 223. builtin.io2.Tls.encodeCert : SignedCert + 221. builtin.Bytes.empty : Bytes + 222. builtin.List.empty : [a] + 223. builtin.Text.empty : Text + 224. builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 224. builtin.Bytes.encodeNat16be : Nat + 225. builtin.Bytes.encodeNat16be : Nat -> Bytes - 225. builtin.Bytes.encodeNat16le : Nat + 226. builtin.Bytes.encodeNat16le : Nat -> Bytes - 226. builtin.Bytes.encodeNat32be : Nat + 227. builtin.Bytes.encodeNat32be : Nat -> Bytes - 227. builtin.Bytes.encodeNat32le : Nat + 228. builtin.Bytes.encodeNat32le : Nat -> Bytes - 228. builtin.Bytes.encodeNat64be : Nat + 229. builtin.Bytes.encodeNat64be : Nat -> Bytes - 229. builtin.Bytes.encodeNat64le : Nat + 230. builtin.Bytes.encodeNat64le : Nat -> Bytes - 230. builtin.io2.Tls.encodePrivateKey : PrivateKey + 231. builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 231. builtin.Text.patterns.eof : Pattern + 232. builtin.Text.patterns.eof : Pattern Text - 232. builtin.Float.eq : Float + 233. builtin.Float.eq : Float -> Float -> Boolean - 233. builtin.Int.eq : Int + 234. builtin.Int.eq : Int -> Int -> Boolean - 234. builtin.Nat.eq : Nat + 235. builtin.Nat.eq : Nat -> Nat -> Boolean - 235. builtin.Text.eq : Text + 236. builtin.Text.eq : Text -> Text -> Boolean - 236. builtin.io2.IO.process.exitCode : ProcessHandle + 237. builtin.io2.IO.process.exitCode : ProcessHandle ->{IO} Optional Nat - 237. builtin.Float.exp : Float + 238. builtin.Float.exp : Float -> Float - 238. builtin.Bytes.flatten : Bytes + 239. builtin.Bytes.flatten : Bytes -> Bytes - 239. builtin.Float.floor : Float + 240. builtin.Float.floor : Float -> Int - 240. builtin.io2.IO.forkComp : '{IO} a + 241. builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 241. builtin.MutableArray.freeze : MutableArray + 242. builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 242. builtin.MutableByteArray.freeze : MutableByteArray + 243. builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 243. builtin.MutableArray.freeze! : MutableArray + 244. builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 244. builtin.MutableByteArray.freeze! : MutableByteArray + 245. builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 245. builtin.Bytes.fromBase16 : Bytes + 246. builtin.Bytes.fromBase16 : Bytes -> Either Text Bytes - 246. builtin.Bytes.fromBase32 : Bytes + 247. builtin.Bytes.fromBase32 : Bytes -> Either Text Bytes - 247. builtin.Bytes.fromBase64 : Bytes + 248. builtin.Bytes.fromBase64 : Bytes -> Either Text Bytes - 248. builtin.Bytes.fromBase64UrlUnpadded : Bytes + 249. builtin.Bytes.fromBase64UrlUnpadded : Bytes -> Either Text Bytes - 249. builtin.Text.fromCharList : [Char] + 250. builtin.Text.fromCharList : [Char] -> Text - 250. builtin.Bytes.fromList : [Nat] + 251. builtin.Bytes.fromList : [Nat] -> Bytes - 251. builtin.Char.fromNat : Nat + 252. builtin.Char.fromNat : Nat -> Char - 252. builtin.Float.fromRepresentation : Nat + 253. builtin.Float.fromRepresentation : Nat -> Float - 253. builtin.Int.fromRepresentation : Nat + 254. builtin.Int.fromRepresentation : Nat -> Int - 254. builtin.Float.fromText : Text + 255. builtin.Float.fromText : Text -> Optional Float - 255. builtin.Int.fromText : Text + 256. builtin.Int.fromText : Text -> Optional Int - 256. builtin.Nat.fromText : Text + 257. builtin.Nat.fromText : Text -> Optional Nat - 257. builtin.Float.gt : Float + 258. builtin.Float.gt : Float -> Float -> Boolean - 258. builtin.Int.gt : Int + 259. builtin.Int.gt : Int -> Int -> Boolean - 259. builtin.Nat.gt : Nat + 260. builtin.Nat.gt : Nat -> Nat -> Boolean - 260. builtin.Text.gt : Text + 261. builtin.Text.gt : Text -> Text -> Boolean - 261. builtin.Float.gteq : Float + 262. builtin.Float.gteq : Float -> Float -> Boolean - 262. builtin.Int.gteq : Int + 263. builtin.Int.gteq : Int -> Int -> Boolean - 263. builtin.Nat.gteq : Nat + 264. builtin.Nat.gteq : Nat -> Nat -> Boolean - 264. builtin.Text.gteq : Text + 265. builtin.Text.gteq : Text -> Text -> Boolean - 265. builtin.crypto.hash : HashAlgorithm + 266. builtin.crypto.hash : HashAlgorithm -> a -> Bytes - 266. builtin.crypto.hashBytes : HashAlgorithm + 267. builtin.crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 267. builtin.crypto.hmac : HashAlgorithm + 268. builtin.crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 268. builtin.crypto.hmacBytes : HashAlgorithm + 269. builtin.crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 269. builtin.io2.IO.clientSocket.impl : Text + 270. builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 270. builtin.io2.IO.closeFile.impl : Handle + 271. builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 271. builtin.io2.IO.closeSocket.impl : Socket + 272. builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 272. builtin.io2.IO.createDirectory.impl : Text + 273. builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 273. builtin.io2.IO.createTempDirectory.impl : Text + 274. builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 274. builtin.io2.Tls.decodeCert.impl : Bytes + 275. builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 275. builtin.io2.IO.delay.impl : Nat + 276. builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 276. builtin.io2.IO.directoryContents.impl : Text + 277. builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 277. builtin.io2.IO.fileExists.impl : Text + 278. builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 278. builtin.Text.fromUtf8.impl : Bytes + 279. builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 279. builtin.io2.IO.getArgs.impl : '{IO} Either + 280. builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 280. builtin.io2.IO.getBuffering.impl : Handle + 281. builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 281. builtin.io2.IO.getBytes.impl : Handle + 282. builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 282. builtin.io2.IO.getChar.impl : Handle + 283. builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 283. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either + 284. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 284. builtin.io2.IO.getEcho.impl : Handle + 285. builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 285. builtin.io2.IO.getEnv.impl : Text + 286. builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 286. builtin.io2.IO.getFileSize.impl : Text + 287. builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 287. builtin.io2.IO.getFileTimestamp.impl : Text + 288. builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 288. builtin.io2.IO.getLine.impl : Handle + 289. builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 289. builtin.io2.IO.getSomeBytes.impl : Handle + 290. builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 290. builtin.io2.IO.getTempDirectory.impl : '{IO} Either + 291. builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 291. builtin.io2.IO.handlePosition.impl : Handle + 292. builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 292. builtin.io2.Tls.handshake.impl : Tls + 293. builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 293. builtin.io2.IO.isDirectory.impl : Text + 294. builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 294. builtin.io2.IO.isFileEOF.impl : Handle + 295. builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 295. builtin.io2.IO.isFileOpen.impl : Handle + 296. builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 296. builtin.io2.IO.isSeekable.impl : Handle + 297. builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 297. builtin.io2.IO.kill.impl : ThreadId + 298. builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 298. builtin.io2.IO.listen.impl : Socket + 299. builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 299. builtin.io2.Tls.newClient.impl : ClientConfig + 300. builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 300. builtin.io2.Tls.newServer.impl : ServerConfig + 301. builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 301. builtin.io2.IO.openFile.impl : Text + 302. builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 302. builtin.io2.MVar.put.impl : MVar a + 303. builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 303. builtin.io2.IO.putBytes.impl : Handle + 304. builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 304. builtin.io2.MVar.read.impl : MVar a + 305. builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 305. builtin.io2.IO.ready.impl : Handle + 306. builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 306. builtin.io2.Tls.receive.impl : Tls + 307. builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 307. builtin.io2.IO.removeDirectory.impl : Text + 308. builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 308. builtin.io2.IO.removeFile.impl : Text + 309. builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 309. builtin.io2.IO.renameDirectory.impl : Text + 310. builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 310. builtin.io2.IO.renameFile.impl : Text + 311. builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 311. builtin.io2.IO.seekHandle.impl : Handle + 312. builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 312. builtin.io2.Tls.send.impl : Tls + 313. builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 313. builtin.io2.IO.serverSocket.impl : Optional + 314. builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 314. builtin.io2.IO.setBuffering.impl : Handle + 315. builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 315. builtin.io2.IO.setCurrentDirectory.impl : Text + 316. builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 316. builtin.io2.IO.setEcho.impl : Handle + 317. builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 317. builtin.io2.IO.socketAccept.impl : Socket + 318. builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 318. builtin.io2.IO.socketPort.impl : Socket + 319. builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 319. builtin.io2.IO.socketReceive.impl : Socket + 320. builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 320. builtin.io2.IO.socketSend.impl : Socket + 321. builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 321. builtin.io2.MVar.swap.impl : MVar a + 322. builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 322. builtin.io2.IO.systemTime.impl : '{IO} Either + 323. builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 323. builtin.io2.MVar.take.impl : MVar a + 324. builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 324. builtin.io2.Tls.terminate.impl : Tls + 325. builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 325. builtin.io2.MVar.tryPut.impl : MVar a + 326. builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 326. builtin.io2.MVar.tryRead.impl : MVar a + 327. builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 327. builtin.Int.increment : Int + 328. builtin.Int.increment : Int -> Int - 328. builtin.Nat.increment : Nat + 329. builtin.Nat.increment : Nat -> Nat - 329. builtin.Char.Class.is : Class + 330. builtin.Char.Class.is : Class -> Char -> Boolean - 330. builtin.io2.MVar.isEmpty : MVar a + 331. builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 331. builtin.Int.isEven : Int + 332. builtin.Int.isEven : Int -> Boolean - 332. builtin.Nat.isEven : Nat + 333. builtin.Nat.isEven : Nat -> Boolean - 333. builtin.Pattern.isMatch : Pattern + 334. builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 334. builtin.Code.isMissing : Term + 335. builtin.Code.isMissing : Term ->{IO} Boolean - 335. builtin.Int.isOdd : Int + 336. builtin.Int.isOdd : Int -> Boolean - 336. builtin.Nat.isOdd : Nat + 337. builtin.Nat.isOdd : Nat -> Boolean - 337. builtin.metadata.isPropagated : IsPropagated - 338. builtin.metadata.isTest : IsTest - 339. builtin.Pattern.join : [Pattern + 338. builtin.metadata.isPropagated : IsPropagated + 339. builtin.metadata.isTest : IsTest + 340. builtin.Pattern.join : [Pattern a] -> Pattern a - 340. builtin.io2.IO.process.kill : ProcessHandle + 341. builtin.io2.IO.process.kill : ProcessHandle ->{IO} () - 341. builtin.Int.leadingZeros : Int + 342. builtin.Int.leadingZeros : Int -> Nat - 342. builtin.Nat.leadingZeros : Nat + 343. builtin.Nat.leadingZeros : Nat -> Nat - 343. builtin.Char.Class.letter : Class - 344. builtin.Text.patterns.letter : Pattern + 344. builtin.Char.Class.letter : Class + 345. builtin.Text.patterns.letter : Pattern Text - 345. builtin.Text.patterns.literal : Text + 346. builtin.Text.patterns.literal : Text -> Pattern Text - 346. builtin.Value.load : Value + 347. builtin.Value.load : Value ->{IO} Either [Term] a - 347. builtin.Float.log : Float + 348. builtin.Float.log : Float -> Float - 348. builtin.Float.logBase : Float + 349. builtin.Float.logBase : Float -> Float -> Float - 349. builtin.Code.lookup : Term + 350. builtin.Code.lookup : Term ->{IO} Optional Code - 350. builtin.Char.Class.lower : Class - 351. builtin.Float.lt : Float + 351. builtin.Char.Class.lower : Class + 352. builtin.Float.lt : Float -> Float -> Boolean - 352. builtin.Int.lt : Int + 353. builtin.Int.lt : Int -> Int -> Boolean - 353. builtin.Nat.lt : Nat + 354. builtin.Nat.lt : Nat -> Nat -> Boolean - 354. builtin.Text.lt : Text + 355. builtin.Text.lt : Text -> Text -> Boolean - 355. builtin.Float.lteq : Float + 356. builtin.Float.lteq : Float -> Float -> Boolean - 356. builtin.Int.lteq : Int + 357. builtin.Int.lteq : Int -> Int -> Boolean - 357. builtin.Nat.lteq : Nat + 358. builtin.Nat.lteq : Nat -> Nat -> Boolean - 358. builtin.Text.lteq : Text + 359. builtin.Text.lteq : Text -> Text -> Boolean - 359. builtin.Pattern.many : Pattern + 360. builtin.Pattern.many : Pattern a -> Pattern a - 360. builtin.Char.Class.mark : Class - 361. builtin.Float.max : Float + 361. builtin.Char.Class.mark : Class + 362. builtin.Float.max : Float -> Float -> Float - 362. builtin.Float.min : Float + 363. builtin.Float.min : Float -> Float -> Float - 363. builtin.Int.mod : Int + 364. builtin.Int.mod : Int -> Int -> Int - 364. builtin.Nat.mod : Nat + 365. builtin.Nat.mod : Nat -> Nat -> Nat - 365. builtin.io2.Clock.internals.monotonic : '{IO} Either + 366. builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 366. builtin.Universal.murmurHash : a + 367. builtin.Universal.murmurHash : a -> Nat - 367. builtin.Int.negate : Int + 368. builtin.Int.negate : Int -> Int - 368. builtin.io2.MVar.new : a + 369. builtin.io2.MVar.new : a ->{IO} MVar a - 369. builtin.io2.Promise.new : '{IO} Promise + 370. builtin.io2.Promise.new : '{IO} Promise a - 370. builtin.io2.TVar.new : a + 371. builtin.io2.TVar.new : a ->{STM} TVar a - 371. builtin.io2.MVar.newEmpty : '{IO} MVar + 372. builtin.io2.MVar.newEmpty : '{IO} MVar a - 372. builtin.io2.TVar.newIO : a + 373. builtin.io2.TVar.newIO : a ->{IO} TVar a - 373. builtin.Boolean.not : Boolean + 374. builtin.Boolean.not : Boolean -> Boolean - 374. builtin.Char.Class.not : Class + 375. builtin.Char.Class.not : Class -> Class - 375. builtin.Text.patterns.notCharIn : [Char] + 376. builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 376. builtin.Text.patterns.notCharRange : Char + 377. builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 377. builtin.io2.Clock.internals.nsec : TimeSpec + 378. builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 378. builtin.Char.Class.number : Class - 379. builtin.Char.Class.or : Class + 379. builtin.Char.Class.number : Class + 380. builtin.Char.Class.or : Class -> Class -> Class - 380. builtin.Int.or : Int + 381. builtin.Int.or : Int -> Int -> Int - 381. builtin.Nat.or : Nat + 382. builtin.Nat.or : Nat -> Nat -> Nat - 382. builtin.Pattern.or : Pattern + 383. builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 383. builtin.Int.popCount : Int + 384. builtin.Int.popCount : Int -> Nat - 384. builtin.Nat.popCount : Nat + 385. builtin.Nat.popCount : Nat -> Nat - 385. builtin.Float.pow : Float + 386. builtin.Float.pow : Float -> Float -> Float - 386. builtin.Int.pow : Int + 387. builtin.Int.pow : Int -> Nat -> Int - 387. builtin.Nat.pow : Nat + 388. builtin.Nat.pow : Nat -> Nat -> Nat - 388. builtin.Char.Class.printable : Class - 389. builtin.io2.Clock.internals.processCPUTime : '{IO} Either + 389. builtin.Char.Class.printable : Class + 390. builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 390. builtin.Char.Class.punctuation : Class - 391. builtin.Text.patterns.punctuation : Pattern + 391. builtin.Char.Class.punctuation : Class + 392. builtin.Text.patterns.punctuation : Pattern Text - 392. builtin.Char.Class.range : Char + 393. builtin.Char.Class.range : Char -> Char -> Class - 393. builtin.ImmutableArray.read : ImmutableArray + 394. builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 394. builtin.MutableArray.read : MutableArray + 395. builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 395. builtin.io2.Promise.read : Promise + 396. builtin.io2.Promise.read : Promise a ->{IO} a - 396. builtin.Ref.read : Ref g a + 397. builtin.Ref.read : Ref g a ->{g} a - 397. builtin.io2.TVar.read : TVar a + 398. builtin.io2.TVar.read : TVar a ->{STM} a - 398. builtin.io2.Ref.Ticket.read : Ticket + 399. builtin.io2.Ref.Ticket.read : Ticket a -> a - 399. builtin.ImmutableByteArray.read16be : ImmutableByteArray + 400. builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 400. builtin.MutableByteArray.read16be : MutableByteArray + 401. builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 401. builtin.ImmutableByteArray.read24be : ImmutableByteArray + 402. builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 402. builtin.MutableByteArray.read24be : MutableByteArray + 403. builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 403. builtin.ImmutableByteArray.read32be : ImmutableByteArray + 404. builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 404. builtin.MutableByteArray.read32be : MutableByteArray + 405. builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 405. builtin.ImmutableByteArray.read40be : ImmutableByteArray + 406. builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 406. builtin.MutableByteArray.read40be : MutableByteArray + 407. builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 407. builtin.ImmutableByteArray.read64be : ImmutableByteArray + 408. builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 408. builtin.MutableByteArray.read64be : MutableByteArray + 409. builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 409. builtin.ImmutableByteArray.read8 : ImmutableByteArray + 410. builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 410. builtin.MutableByteArray.read8 : MutableByteArray + 411. builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 411. builtin.io2.Ref.readForCas : Ref + 412. builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 412. builtin.io2.TVar.readIO : TVar a + 413. builtin.io2.TVar.readIO : TVar a ->{IO} a - 413. builtin.io2.Clock.internals.realtime : '{IO} Either + 414. builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 414. builtin.io2.IO.ref : a + 415. builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 415. builtin.Scope.ref : a + 416. builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 416. builtin.Text.repeat : Nat + 417. builtin.Text.repeat : Nat -> Text -> Text - 417. builtin.Pattern.replicate : Nat + 418. builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 418. builtin.io2.STM.retry : '{STM} a - 419. builtin.Text.reverse : Text + 419. builtin.io2.STM.retry : '{STM} a + 420. builtin.Text.reverse : Text -> Text - 420. builtin.Float.round : Float + 421. builtin.Float.round : Float -> Int - 421. builtin.Pattern.run : Pattern + 422. builtin.Pattern.run : Pattern a -> a -> Optional ( [a], a) - 422. builtin.Scope.run : (∀ s. + 423. builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 423. builtin.io2.Clock.internals.sec : TimeSpec + 424. builtin.io2.Clock.internals.sec : TimeSpec -> Int - 424. builtin.Char.Class.separator : Class - 425. builtin.Code.serialize : Code + 425. builtin.Char.Class.separator : Class + 426. builtin.Code.serialize : Code -> Bytes - 426. builtin.Value.serialize : Value + 427. builtin.Value.serialize : Value -> Bytes - 427. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + 428. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 428. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + 429. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 429. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + 430. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 430. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + 431. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 431. builtin.io2.Tls.ClientConfig.versions.set : [Version] + 432. builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 432. builtin.io2.Tls.ServerConfig.versions.set : [Version] + 433. builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 433. builtin.Int.shiftLeft : Int + 434. builtin.Int.shiftLeft : Int -> Nat -> Int - 434. builtin.Nat.shiftLeft : Nat + 435. builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 435. builtin.Int.shiftRight : Int + 436. builtin.Int.shiftRight : Int -> Nat -> Int - 436. builtin.Nat.shiftRight : Nat + 437. builtin.Nat.shiftRight : Nat -> Nat -> Nat - 437. builtin.Int.signum : Int + 438. builtin.Int.signum : Int -> Int - 438. builtin.Float.sin : Float + 439. builtin.Float.sin : Float -> Float - 439. builtin.Float.sinh : Float + 440. builtin.Float.sinh : Float -> Float - 440. builtin.Bytes.size : Bytes + 441. builtin.Bytes.size : Bytes -> Nat - 441. builtin.ImmutableArray.size : ImmutableArray + 442. builtin.ImmutableArray.size : ImmutableArray a -> Nat - 442. builtin.ImmutableByteArray.size : ImmutableByteArray + 443. builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 443. builtin.List.size : [a] + 444. builtin.List.size : [a] -> Nat - 444. builtin.MutableArray.size : MutableArray + 445. builtin.MutableArray.size : MutableArray g a -> Nat - 445. builtin.MutableByteArray.size : MutableByteArray + 446. builtin.MutableByteArray.size : MutableByteArray g -> Nat - 446. builtin.Text.size : Text + 447. builtin.Text.size : Text -> Nat - 447. builtin.Text.patterns.space : Pattern + 448. builtin.Text.patterns.space : Pattern Text - 448. builtin.Float.sqrt : Float + 449. builtin.Float.sqrt : Float -> Float - 449. builtin.io2.IO.process.start : Text + 450. builtin.io2.IO.process.start : Text -> [Text] ->{IO} ( Handle, Handle, Handle, ProcessHandle) - 450. builtin.io2.IO.stdHandle : StdHandle + 451. builtin.io2.IO.stdHandle : StdHandle -> Handle - 451. builtin.Nat.sub : Nat + 452. builtin.Nat.sub : Nat -> Nat -> Int - 452. builtin.io2.TVar.swap : TVar a + 453. builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 453. builtin.Char.Class.symbol : Class - 454. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 455. builtin.Bytes.take : Nat + 454. builtin.Char.Class.symbol : Class + 455. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + 456. builtin.Bytes.take : Nat -> Bytes -> Bytes - 456. builtin.List.take : Nat + 457. builtin.List.take : Nat -> [a] -> [a] - 457. builtin.Text.take : Nat + 458. builtin.Text.take : Nat -> Text -> Text - 458. builtin.Float.tan : Float + 459. builtin.Float.tan : Float -> Float - 459. builtin.Float.tanh : Float + 460. builtin.Float.tanh : Float -> Float - 460. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + 461. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 461. builtin.Bytes.toBase16 : Bytes + 462. builtin.Bytes.toBase16 : Bytes -> Bytes - 462. builtin.Bytes.toBase32 : Bytes + 463. builtin.Bytes.toBase32 : Bytes -> Bytes - 463. builtin.Bytes.toBase64 : Bytes + 464. builtin.Bytes.toBase64 : Bytes -> Bytes - 464. builtin.Bytes.toBase64UrlUnpadded : Bytes + 465. builtin.Bytes.toBase64UrlUnpadded : Bytes -> Bytes - 465. builtin.Text.toCharList : Text + 466. builtin.Text.toCharList : Text -> [Char] - 466. builtin.Int.toFloat : Int + 467. builtin.Int.toFloat : Int -> Float - 467. builtin.Nat.toFloat : Nat + 468. builtin.Nat.toFloat : Nat -> Float - 468. builtin.Nat.toInt : Nat + 469. builtin.Nat.toInt : Nat -> Int - 469. builtin.Bytes.toList : Bytes + 470. builtin.Bytes.toList : Bytes -> [Nat] - 470. builtin.Text.toLowercase : Text + 471. builtin.Text.toLowercase : Text -> Text - 471. builtin.Char.toNat : Char + 472. builtin.Char.toNat : Char -> Nat - 472. builtin.Float.toRepresentation : Float + 473. builtin.Float.toRepresentation : Float -> Nat - 473. builtin.Int.toRepresentation : Int + 474. builtin.Int.toRepresentation : Int -> Nat - 474. builtin.Char.toText : Char + 475. builtin.Char.toText : Char -> Text - 475. builtin.Debug.toText : a + 476. builtin.Debug.toText : a -> Optional (Either Text Text) - 476. builtin.Float.toText : Float + 477. builtin.Float.toText : Float -> Text - 477. builtin.Handle.toText : Handle + 478. builtin.Handle.toText : Handle -> Text - 478. builtin.Int.toText : Int + 479. builtin.Int.toText : Int -> Text - 479. builtin.Nat.toText : Nat + 480. builtin.Nat.toText : Nat -> Text - 480. builtin.Socket.toText : Socket + 481. builtin.Socket.toText : Socket -> Text - 481. builtin.Link.Term.toText : Term + 482. builtin.Link.Term.toText : Term -> Text - 482. builtin.ThreadId.toText : ThreadId + 483. builtin.ThreadId.toText : ThreadId -> Text - 483. builtin.Text.toUppercase : Text + 484. builtin.Text.toUppercase : Text -> Text - 484. builtin.Text.toUtf8 : Text + 485. builtin.Text.toUtf8 : Text -> Bytes - 485. builtin.todo : a -> b - 486. builtin.Debug.trace : Text + 486. builtin.todo : a -> b + 487. builtin.Debug.trace : Text -> a -> () - 487. builtin.Int.trailingZeros : Int + 488. builtin.Int.trailingZeros : Int -> Nat - 488. builtin.Nat.trailingZeros : Nat + 489. builtin.Nat.trailingZeros : Nat -> Nat - 489. builtin.Float.truncate : Float + 490. builtin.Float.truncate : Float -> Int - 490. builtin.Int.truncate0 : Int + 491. builtin.Int.truncate0 : Int -> Nat - 491. builtin.io2.IO.tryEval : '{IO} a + 492. builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 492. builtin.io2.Promise.tryRead : Promise + 493. builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 493. builtin.io2.MVar.tryTake : MVar a + 494. builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 494. builtin.Text.uncons : Text + 495. builtin.Text.uncons : Text -> Optional ( Char, Text) - 495. builtin.Any.unsafeExtract : Any + 496. builtin.Any.unsafeExtract : Any -> a - 496. builtin.Text.unsnoc : Text + 497. builtin.Text.unsnoc : Text -> Optional ( Text, Char) - 497. builtin.Char.Class.upper : Class - 498. builtin.Code.validate : [( Term, + 498. builtin.Char.Class.upper : Class + 499. builtin.Code.validate : [( Term, Code)] ->{IO} Optional Failure - 499. builtin.io2.validateSandboxed : [Term] + 500. builtin.io2.validateSandboxed : [Term] -> a -> Boolean - 500. builtin.Value.value : a + 501. builtin.Value.value : a -> Value - 501. builtin.io2.IO.process.wait : ProcessHandle + 502. builtin.io2.IO.process.wait : ProcessHandle ->{IO} Nat - 502. builtin.Debug.watch : Text + 503. builtin.Debug.watch : Text -> a -> a - 503. builtin.Char.Class.whitespace : Class - 504. builtin.MutableArray.write : MutableArray + 504. builtin.Char.Class.whitespace : Class + 505. builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 505. builtin.io2.Promise.write : Promise + 506. builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 506. builtin.Ref.write : Ref g a + 507. builtin.Ref.write : Ref g a -> a ->{g} () - 507. builtin.io2.TVar.write : TVar a + 508. builtin.io2.TVar.write : TVar a -> a ->{STM} () - 508. builtin.MutableByteArray.write16be : MutableByteArray + 509. builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 509. builtin.MutableByteArray.write32be : MutableByteArray + 510. builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 510. builtin.MutableByteArray.write64be : MutableByteArray + 511. builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 511. builtin.MutableByteArray.write8 : MutableByteArray + 512. builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 512. builtin.Int.xor : Int + 513. builtin.Int.xor : Int -> Int -> Int - 513. builtin.Nat.xor : Nat + 514. builtin.Nat.xor : Nat -> Nat -> Nat diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index b672651fc..08122c3cc 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #s4kjl4lbf3 .old` to make an old namespace + `fork #30tl6rkfqn .old` to make an old namespace accessible again, - `reset-root #s4kjl4lbf3` to reset the root namespace and + `reset-root #30tl6rkfqn` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #hr821c0ji5 add - 2. now #s4kjl4lbf3 add - 3. now #92606li9fc builtins.merge + 1. now #4t4aoo9vnt add + 2. now #30tl6rkfqn add + 3. now #mfof2amrm2 builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index 9f4e85dd0..1989efba6 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #3jjj6quqhh (start of history) + □ 1. #uqucjk22if (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #6qm36657l4 + ⊙ 1. #2g254tkpvt > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #72ip8q9i3l + ⊙ 2. #s54qi5ddk7 > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #3jjj6quqhh (start of history) + □ 3. #uqucjk22if (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #6qm36657l4 + ⊙ 1. #2g254tkpvt > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #72ip8q9i3l + ⊙ 2. #s54qi5ddk7 > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #3jjj6quqhh (start of history) + □ 3. #uqucjk22if (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #3jjj6quqhh (start of history) + □ 1. #uqucjk22if (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #p9ur8e0jlu + ⊙ 1. #9ootvo2tgi - Deletes: Nat.* Nat.+ - □ 2. #3jjj6quqhh (start of history) + □ 2. #uqucjk22if (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From 2867ae8a165d2b697b2307e4bbf59628e1f2a3ab Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 22 Feb 2023 11:07:17 -0600 Subject: [PATCH 367/467] Fix stack release version --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 027056b0d..fa91052bc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -104,7 +104,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.9.1-linux-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-linux-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: build @@ -176,7 +176,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.9.1-osx-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-osx-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: remove ~/.stack/setup-exe-cache on macOS @@ -252,7 +252,7 @@ jobs: working-directory: ${{ github.workspace }} run: | mkdir stack && cd stack - curl -L https://github.com/commercialhaskell/stack/releases/download/v2.7.5/stack-2.9.1-windows-x86_64.tar.gz | tar -xz + curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-windows-x86_64.tar.gz | tar -xz echo "$PWD/stack-"* >> $GITHUB_PATH - name: build From e2a3b9ae286ea7d07dd5a2571ffe3c1aeb671765 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 22 Feb 2023 12:36:57 -0600 Subject: [PATCH 368/467] Updates for safer migrations on Share (#3825) * Include schema version in backup and use vacuum into * Allow specifying not to backup on migration * Add ability to copy codebase safely (for share migrations) * Set migration strategies * Create dir to copy into if missing * Ormolu * ormolu --- .../src/Unison/Sqlite/Connection.hs | 2 +- .../src/Unison/Codebase/Init.hs | 14 +++++++++-- .../src/Unison/Codebase/SqliteCodebase.hs | 25 +++++++++++++------ .../Codebase/SqliteCodebase/Migrations.hs | 19 ++++++++------ .../Unison/Codebase/SqliteCodebase/Paths.hs | 7 +++--- unison-cli/unison/Main.hs | 12 ++++----- 6 files changed, 52 insertions(+), 27 deletions(-) diff --git a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs index 20274da98..2d1b9a387 100644 --- a/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs +++ b/lib/unison-sqlite/src/Unison/Sqlite/Connection.hs @@ -523,7 +523,7 @@ vacuum conn = Right () -> pure True -- | @VACUUM INTO@ -vacuumInto :: Connection -> Text -> IO () +vacuumInto :: Connection -> FilePath -> IO () vacuumInto conn file = execute conn "VACUUM INTO ?" (Sqlite.Only file) diff --git a/parser-typechecker/src/Unison/Codebase/Init.hs b/parser-typechecker/src/Unison/Codebase/Init.hs index 69a614586..97708e248 100644 --- a/parser-typechecker/src/Unison/Codebase/Init.hs +++ b/parser-typechecker/src/Unison/Codebase/Init.hs @@ -10,6 +10,7 @@ module Unison.Codebase.Init InitResult (..), SpecifiedCodebase (..), MigrationStrategy (..), + BackupStrategy (..), Pretty, createCodebase, initCodebaseAndExit, @@ -47,11 +48,20 @@ data CodebaseLockOption = DoLock | DontLock +data BackupStrategy + = -- Create a backup of the codebase in the same directory as the codebase, + -- see 'backupCodebasePath'. + Backup + | -- Don't create a backup when migrating, this might be used if the caller has + -- already created a copy of the codebase for instance. + NoBackup + deriving stock (Show, Eq, Ord) + data MigrationStrategy = -- | Perform a migration immediately if one is required. - MigrateAutomatically + MigrateAutomatically BackupStrategy | -- | Prompt the user that a migration is about to occur, continue after acknownledgment - MigrateAfterPrompt + MigrateAfterPrompt BackupStrategy | -- | Triggers an 'OpenCodebaseRequiresMigration' error instead of migrating DontMigrate deriving stock (Show, Eq, Ord) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs index 4848b4964..259761003 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs @@ -9,7 +9,9 @@ module Unison.Codebase.SqliteCodebase ( Unison.Codebase.SqliteCodebase.init, MigrationStrategy (..), + BackupStrategy (..), CodebaseLockOption (..), + copyCodebase, ) where @@ -47,7 +49,7 @@ import Unison.Codebase.Editor.RemoteRepo writeToReadGit, ) import qualified Unison.Codebase.GitError as GitError -import Unison.Codebase.Init (CodebaseLockOption (..), MigrationStrategy (..)) +import Unison.Codebase.Init (BackupStrategy (..), CodebaseLockOption (..), MigrationStrategy (..)) import qualified Unison.Codebase.Init as Codebase import qualified Unison.Codebase.Init.CreateCodebaseError as Codebase1 import Unison.Codebase.Init.OpenCodebaseError (OpenCodebaseError (..)) @@ -212,12 +214,12 @@ sqliteCodebase debugName root localOrRemote lockOption migrationStrategy action Migrations.CodebaseRequiresMigration fromSv toSv -> case migrationStrategy of DontMigrate -> pure $ Left (OpenCodebaseRequiresMigration fromSv toSv) - MigrateAfterPrompt -> do + MigrateAfterPrompt backupStrategy -> do let shouldPrompt = True - Migrations.ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer shouldPrompt conn - MigrateAutomatically -> do + Migrations.ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer shouldPrompt backupStrategy conn + MigrateAutomatically backupStrategy -> do let shouldPrompt = False - Migrations.ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer shouldPrompt conn + Migrations.ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer shouldPrompt backupStrategy conn case result of Left err -> pure $ Left err @@ -588,7 +590,7 @@ viewRemoteBranch' ReadGitRemoteNamespace {repo, sch, path} gitBranchBehavior act then throwIO (C.GitSqliteCodebaseError (GitError.NoDatabaseFile repo remotePath)) else throwIO exception - result <- sqliteCodebase "viewRemoteBranch.gitCache" remotePath Remote DoLock MigrateAfterPrompt \codebase -> do + result <- sqliteCodebase "viewRemoteBranch.gitCache" remotePath Remote DoLock (MigrateAfterPrompt Codebase.Backup) \codebase -> do -- try to load the requested branch from it branch <- time "Git fetch (sch)" $ case sch of -- no sub-branch was specified, so use the root. @@ -638,7 +640,7 @@ pushGitBranch srcConn repo (PushGitBranchOpts behavior _syncMode) action = Unlif -- set up the cache dir throwEitherMWith C.GitProtocolError . withRepo readRepo Git.CreateBranchIfMissing $ \pushStaging -> do newBranchOrErr <- throwEitherMWith (C.GitSqliteCodebaseError . C.gitErrorFromOpenCodebaseError (Git.gitDirToPath pushStaging) readRepo) - . withOpenOrCreateCodebase "push.dest" (Git.gitDirToPath pushStaging) Remote DoLock MigrateAfterPrompt + . withOpenOrCreateCodebase "push.dest" (Git.gitDirToPath pushStaging) Remote DoLock (MigrateAfterPrompt Codebase.Backup) $ \(codebaseStatus, destCodebase) -> do currentRootBranch <- Codebase1.runTransaction destCodebase CodebaseOps.getRootBranchExists >>= \case @@ -766,3 +768,12 @@ pushGitBranch srcConn repo (PushGitBranchOpts behavior _syncMode) action = Unlif (successful, _stdout, stderr) <- gitInCaptured remotePath $ ["push", url] ++ Git.gitVerbosity ++ maybe [] (pure @[]) mayGitBranch when (not successful) . throwIO $ GitError.PushException repo (Text.unpack stderr) pure True + +-- | Given two codebase roots (e.g. "./mycodebase"), safely copy the codebase +-- at the source to the destination. +-- Note: this does not copy the .unisonConfig file. +copyCodebase :: (MonadIO m) => CodebasePath -> CodebasePath -> m () +copyCodebase src dest = liftIO $ do + createDirectoryIfMissing True (makeCodebaseDirPath dest) + withConnection ("copy-from:" <> src) src $ \srcConn -> do + Sqlite.vacuumInto srcConn (makeCodebasePath dest) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs index f9563f992..9902065de 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs @@ -9,13 +9,13 @@ import qualified Data.Map as Map import qualified Data.Text as Text import Data.Time.Clock.POSIX (getPOSIXTime) import qualified System.Console.Regions as Region -import System.Directory (copyFile) import System.FilePath (()) import Text.Printf (printf) import qualified U.Codebase.Reference as C.Reference import U.Codebase.Sqlite.DbId (SchemaVersion (..)) import qualified U.Codebase.Sqlite.Queries as Q import Unison.Codebase (CodebasePath) +import Unison.Codebase.Init (BackupStrategy (..)) import Unison.Codebase.Init.OpenCodebaseError (OpenCodebaseError (OpenCodebaseUnknownSchemaVersion)) import qualified Unison.Codebase.Init.OpenCodebaseError as Codebase import Unison.Codebase.IntegrityCheck (IntegrityResult (..), integrityCheckAllBranches, integrityCheckAllCausals, prettyPrintIntegrityErrors) @@ -27,7 +27,7 @@ import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema4To5 (migrateSchem import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema5To6 (migrateSchema5To6) import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema6To7 (migrateSchema6To7) import qualified Unison.Codebase.SqliteCodebase.Operations as Ops2 -import Unison.Codebase.SqliteCodebase.Paths (backupCodebasePath, codebasePath) +import Unison.Codebase.SqliteCodebase.Paths (backupCodebasePath) import Unison.Codebase.Type (LocalOrRemote (..)) import qualified Unison.ConstructorType as CT import Unison.Hash (Hash) @@ -90,9 +90,10 @@ ensureCodebaseIsUpToDate :: TVar (Map Hash Ops2.TermBufferEntry) -> TVar (Map Hash Ops2.DeclBufferEntry) -> Bool -> + BackupStrategy -> Sqlite.Connection -> m (Either Codebase.OpenCodebaseError ()) -ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer shouldPrompt conn = +ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer shouldPrompt backupStrategy conn = (liftIO . UnliftIO.try) do regionVar <- newEmptyMVar let finalizeRegion :: IO () @@ -111,7 +112,9 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh let currentSchemaVersion = fst . head $ Map.toDescList migs when (schemaVersion > currentSchemaVersion) $ UnliftIO.throwIO $ OpenCodebaseUnknownSchemaVersion (fromIntegral schemaVersion) let migrationsToRun = Map.filterWithKey (\v _ -> v > schemaVersion) migs - when (localOrRemote == Local && (not . null) migrationsToRun) $ backupCodebase root shouldPrompt + when (localOrRemote == Local && (not . null) migrationsToRun) $ case backupStrategy of + Backup -> backupCodebase conn schemaVersion root shouldPrompt + NoBackup -> pure () -- This is a bit of a hack, hopefully we can remove this when we have a more -- reliable way to freeze old migration code in time. -- The problem is that 'saveObject' has been changed to flush temp entity tables, @@ -162,10 +165,10 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh Region.setConsoleRegion region ("🏁 Migrations complete 🏁" :: Text) -- | Copy the sqlite database to a new file with a unique name based on current time. -backupCodebase :: CodebasePath -> Bool -> IO () -backupCodebase root shouldPrompt = do - backupPath <- backupCodebasePath <$> getPOSIXTime - copyFile (root codebasePath) (root backupPath) +backupCodebase :: Sqlite.Connection -> SchemaVersion -> CodebasePath -> Bool -> IO () +backupCodebase conn schemaVersion root shouldPrompt = do + backupPath <- getPOSIXTime <&> (\t -> root backupCodebasePath schemaVersion t) + Sqlite.vacuumInto conn backupPath putStrLn ("📋 I backed up your codebase to " ++ (root backupPath)) putStrLn "⚠️ Please close all other ucm processes and wait for the migration to complete before interacting with your codebase." when shouldPrompt do diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Paths.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Paths.hs index d0e6871ef..cc65bd7e7 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Paths.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Paths.hs @@ -9,6 +9,7 @@ where import Data.Time (NominalDiffTime) import System.FilePath (()) +import U.Codebase.Sqlite.DbId (SchemaVersion (SchemaVersion)) import Unison.Codebase (CodebasePath) -- | Prefer makeCodebasePath or makeCodebaseDirPath when possible. @@ -27,6 +28,6 @@ makeCodebaseDirPath :: CodebasePath -> FilePath makeCodebaseDirPath root = root ".unison" "v2" -- | Makes a path to store a backup of a sqlite database given the current time. -backupCodebasePath :: NominalDiffTime -> FilePath -backupCodebasePath now = - codebasePath ++ "." ++ show @Int (floor now) +backupCodebasePath :: SchemaVersion -> NominalDiffTime -> FilePath +backupCodebasePath (SchemaVersion schemaVersion) now = + codebasePath ++ ".v" ++ show schemaVersion ++ "." ++ show @Int (floor now) diff --git a/unison-cli/unison/Main.hs b/unison-cli/unison/Main.hs index 69fae7cb5..0701863ce 100644 --- a/unison-cli/unison/Main.hs +++ b/unison-cli/unison/Main.hs @@ -118,7 +118,7 @@ main = withCP65001 . runInUnboundThread . Ki.scoped $ \scope -> do ] ) Run (RunFromSymbol mainName) args -> do - getCodebaseOrExit mCodePathOption SC.MigrateAutomatically \(_, _, theCodebase) -> do + getCodebaseOrExit mCodePathOption (SC.MigrateAutomatically SC.Backup) \(_, _, theCodebase) -> do RTI.withRuntime False RTI.OneOff Version.gitDescribeWithDate \runtime -> do withArgs args (execute theCodebase runtime mainName) >>= \case Left err -> exitError err @@ -130,7 +130,7 @@ main = withCP65001 . runInUnboundThread . Ki.scoped $ \scope -> do case e of Left _ -> exitError "I couldn't find that file or it is for some reason unreadable." Right contents -> do - getCodebaseOrExit mCodePathOption SC.MigrateAutomatically \(initRes, _, theCodebase) -> do + getCodebaseOrExit mCodePathOption (SC.MigrateAutomatically SC.Backup) \(initRes, _, theCodebase) -> do withRuntimes RTI.OneOff \(rt, sbrt) -> do let fileEvent = Input.UnisonFileChanged (Text.pack file) contents let noOpRootNotifier _ = pure () @@ -156,7 +156,7 @@ main = withCP65001 . runInUnboundThread . Ki.scoped $ \scope -> do case e of Left _ -> exitError "I had trouble reading this input." Right contents -> do - getCodebaseOrExit mCodePathOption SC.MigrateAutomatically \(initRes, _, theCodebase) -> do + getCodebaseOrExit mCodePathOption (SC.MigrateAutomatically SC.Backup) \(initRes, _, theCodebase) -> do withRuntimes RTI.OneOff \(rt, sbrt) -> do let fileEvent = Input.UnisonFileChanged (Text.pack "") contents let noOpRootNotifier _ = pure () @@ -247,7 +247,7 @@ main = withCP65001 . runInUnboundThread . Ki.scoped $ \scope -> do Nothing -> action Just fp -> recordRtsStats fp action Launch isHeadless codebaseServerOpts downloadBase mayStartingPath shouldWatchFiles -> do - getCodebaseOrExit mCodePathOption SC.MigrateAfterPrompt \(initRes, _, theCodebase) -> do + getCodebaseOrExit mCodePathOption (SC.MigrateAfterPrompt SC.Backup) \(initRes, _, theCodebase) -> do withRuntimes RTI.Persistent \(runtime, sbRuntime) -> do rootVar <- newEmptyTMVarIO pathVar <- newTVarIO initialPath @@ -342,7 +342,7 @@ prepareTranscriptDir shouldFork mCodePathOption shouldSaveCodebase = do case shouldFork of UseFork -> do -- A forked codebase does not need to Create a codebase, because it already exists - getCodebaseOrExit mCodePathOption SC.MigrateAutomatically $ const (pure ()) + getCodebaseOrExit mCodePathOption (SC.MigrateAutomatically SC.Backup) $ const (pure ()) path <- Codebase.getCodebaseDir (fmap codebasePathOptionToPath mCodePathOption) PT.putPrettyLn $ P.lines @@ -366,7 +366,7 @@ runTranscripts' progName mcodepath transcriptDir markdownFiles = do currentDir <- getCurrentDirectory configFilePath <- getConfigFilePath mcodepath -- We don't need to create a codebase through `getCodebaseOrExit` as we've already done so previously. - and <$> getCodebaseOrExit (Just (DontCreateCodebaseWhenMissing transcriptDir)) SC.MigrateAutomatically \(_, codebasePath, theCodebase) -> do + and <$> getCodebaseOrExit (Just (DontCreateCodebaseWhenMissing transcriptDir)) (SC.MigrateAutomatically SC.Backup) \(_, codebasePath, theCodebase) -> do TR.withTranscriptRunner Version.gitDescribeWithDate (Just configFilePath) $ \runTranscript -> do for markdownFiles $ \(MarkdownFile fileName) -> do transcriptSrc <- readUtf8 fileName From 2d4887d6ad1077b81728a96476b6b6c6b8c068e9 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 23 Feb 2023 10:57:58 -0600 Subject: [PATCH 369/467] Ormolu --- codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs index cebb4bc00..6d49b3f1e 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/NamedRef.hs @@ -52,7 +52,7 @@ toRowWithNamespace nr = toRow nr <> [SQLText namespace] -- -- Converts a NamedRef to SQLData of the form: -- [reversedName, namespace, lastNameSegment] <> ref fields... -namedRefToScopedRow :: ToRow ref => NamedRef ref -> [SQLData] +namedRefToScopedRow :: (ToRow ref) => NamedRef ref -> [SQLData] namedRefToScopedRow (NamedRef {reversedSegments = revSegments, ref}) = toRow $ (SQLText reversedName, SQLText namespace, SQLText lastNameSegment) :. ref where From 23990d1b3b4d3dd96ff385e3500d578837b0b289 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Thu, 23 Feb 2023 15:10:06 -0500 Subject: [PATCH 370/467] Use records for encoding unison structures - Previously we were using lists, because Chez has built-in support for treating them as tagged records with case analysis. - This instead introduces several Scheme record types for encoding the various sorts of data structures: * data records with a reference, tag and fields * sum records with a tag and fields * request records with an ability designation, tag and fields * pure records with a field (for pure abilty cases) - Macros are defined to allow pattern matching on these records - Various definitions have been tweaked to emit the right sort of record. - Corresponding unison compiler code will emit wrappers around these new record types. - The data record, for example, will be useful when eventually doing decompiling, since we need reference data to figure out what a data value actually is. --- scheme-libs/common/unison/boot.ss | 175 +++++++++++++++++++++------ scheme-libs/common/unison/data.ss | 71 +++++++++-- scheme-libs/common/unison/primops.ss | 67 +++++++--- scheme-libs/common/unison/vector.ss | 5 +- scheme-libs/racket/unison/core.ss | 46 ++----- 5 files changed, 262 insertions(+), 102 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 43ec4022a..fa8b01df6 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -19,13 +19,21 @@ handle identity name - record-case + data + data-case + request request-case + sum + sum-case unison-force) (import (rnrs) + (for + (only (unison core) syntax->list) + expand) (unison core) + (unison data) (unison cont) (unison crypto)) @@ -147,13 +155,14 @@ (prompt0-at p (let ([v (let-marks (list (quote r) ...) (cons p h) (prompt0-at p e ...))]) - (h (list 0 v)))))])) + (h (make-pure v)))))])) ; wrapper that more closely matches ability requests (define-syntax request (syntax-rules () [(request r t . args) - ((cdr (ref-mark (quote r))) (list (quote r) t . args))])) + (let ([rq (make-request (quote r) t (list . args))]) + ((cdr (ref-mark (quote r))) rq))])) ; See the explanation of `handle` for a more thorough understanding ; of why this is doing two control operations. @@ -169,38 +178,6 @@ (let ([p (car (ref-mark r))]) (control0-at p k (control0-at p _k e ...)))])) - ; Wrapper around record-case that more closely matches request - ; matching. This gets around having to manage an intermediate - ; variable name during code emission that doesn't correspond to an - ; actual ANF name, which was causing variable numbering problems in - ; the code emitter. Hygienic macros are a much more convenient - ; mechanism for this. - (define-syntax request-case - (syntax-rules (pure) - [(request-case scrut - [pure (pv ...) pe ...] - [ability - [effect (ev ...) ee ...] - ...] - ...) - - (record-case scrut - [0 (pv ...) pe ...] - [ability subscrut - (record-case subscrut - [effect (ev ...) ee ...] - ...)] - ...)])) - - (define-record-type - data - (fields type-ref payload)) - - (define-syntax data-case - (syntax-rules () - [(data-case scrut c ...) - (record-case (data-payload scrut) c ...)])) - (define (identity x) x) ; forces something that is expected to be a thunk, defined with @@ -209,4 +186,132 @@ (define (unison-force x) (if (procedure? x) (x) x)) + (define-syntax sum-case + (lambda (stx) + (define (make-case scrut-stx) + (lambda (cur) + (with-syntax ([scrut scrut-stx]) + (syntax-case cur (else) + [(else e ...) #'(else e ...)] + [((t ...) () e ...) #'((t ...) e ...)] + [(t () e ...) #'((t) e ...)] + [((t ...) (v ...) e ...) + #'((t ...) + (let-values + ([(v ...) (apply values (sum-fields scrut))]) + e ...))] + [(t (v ...) e ...) + #'((t) + (let-values + ([(v ...) (apply values (sum-fields scrut))]) + e ...))] + [((t ...) v e ...) + (identifier? #'v) + #'((t ...) + (let ([v (sum-fields scrut)]) + e ...))] + [(t v e ...) + (identifier? #'v) + #'((t) + (let ([v (sum-fields scrut)]) + e ...))])))) + + (syntax-case stx () + [(sum-case scrut c ...) + (with-syntax + ([(tc ...) + (map (make-case #'scrut) (syntax->list #'(c ...)))]) + #'(case (sum-tag scrut) tc ...))]))) + + (define-syntax data-case + (lambda (stx) + (define (make-case scrut-stx) + (lambda (cur) + (with-syntax ([scrut scrut-stx]) + (syntax-case cur (else) + [(else e ...) #'(else e ...)] + [((t ...) () e ...) #'((t ...) e ...)] + [(t () e ...) #'((t) e ...)] + [((t ...) (v ...) e ...) + #'((t ...) + (let-values + ([(v ...) (apply values (data-fields scrut))]) + e ...))] + [(t (v ...) e ...) + #'((t) + (let-values + ([(v ...) (apply values (data-fields scrut))]) + e ...))] + [((t ...) v e ...) + (identifier? #'v) + #'((t ...) + (let ([v (data-fields scrut)]) + e ...))] + [(t v e ...) + (identifier? #'v) + #'((t) + (let ([v (data-fields scrut)]) + e ...))])))) + (syntax-case stx () + [(data-case scrut c ...) + (with-syntax + ([(tc ...) + (map (make-case #'scrut) (syntax->list #'(c ...)))]) + #'(case (data-tag scrut) tc ...))]))) + + (define-syntax request-case + (lambda (stx) + (define (pure-case? c) + (syntax-case c (pure) + [(pure . xs) #t] + [_ #f])) + + (define (mk-pure scrut ps) + (if (null? ps) + #`(pure-val #,scrut) + (syntax-case (car ps) (pure) + [(pure (v) e ...) + #`(let ([v (pure-val #,scrut)]) + e ...)] + [(pure vs e ...) + (raise-syntax-error + #f + "pure cases receive exactly one variable" + (car ps) + #'vs)]))) + + (define (mk-req scrut-stx) + (lambda (stx) + (syntax-case stx () + [(t vs e ...) + (with-syntax ([scrut scrut-stx]) + #'((t) (let-values + ([vs (apply values (request-fields scrut))]) + e ...)))]))) + + (define (mk-abil scrut-stx) + (lambda (stx) + (syntax-case stx () + [(t sc ...) + (let ([sub (mk-req scrut-stx)]) + (with-syntax + ([(sc ...) (map sub (syntax->list #'(sc ...)))] + [scrut scrut-stx]) + #'((t) (case (request-tag scrut) sc ...))))]))) + + (syntax-case stx () + [(request-case scrut c ...) + (let-values + ([(ps as) (partition pure-case? (syntax->list #'(c ...)))]) + (if (> 1 (length ps)) + (raise-syntax-error + #f + "multiple pure cases in request-case" + stx) + (with-syntax + ([pc (mk-pure #'scrut ps)] + [(ac ...) (map (mk-abil #'scrut) as)]) + + #'(cond [(pure? scrut) pc] ac ...))))]))) + ) diff --git a/scheme-libs/common/unison/data.ss b/scheme-libs/common/unison/data.ss index d4848c111..f2be9823f 100644 --- a/scheme-libs/common/unison/data.ss +++ b/scheme-libs/common/unison/data.ss @@ -3,6 +3,30 @@ #!r6rs (library (unison data) (export + + make-data + data + data? + data-ref + data-tag + data-fields + + make-sum + sum + sum? + sum-tag + sum-fields + + make-pure + pure? + pure-val + + make-request + request? + request-ability + request-tag + request-fields + some none some? @@ -20,44 +44,69 @@ (import (rnrs)) + (define-record-type (unison-data make-data data?) + (fields + (immutable ref data-ref) + (immutable tag data-tag) + (immutable fields data-fields))) + + (define (data r t . args) (make-data r t args)) + + (define-record-type (unison-sum make-sum sum?) + (fields + (immutable tag sum-tag) + (immutable fields sum-fields))) + + (define (sum t . args) (make-sum t args)) + + (define-record-type (unison-pure make-pure pure?) + (fields + (immutable val pure-val))) + + (define-record-type (unison-request make-request request?) + (fields + (immutable ability request-ability) + (immutable tag request-tag) + (immutable fields request-fields))) + ; Option a - (define none `(0)) + (define none (sum 0)) ; a -> Option a - (define (some a) `(1 ,a)) + (define (some a) (sum 1 a)) ; Option a -> Bool - (define (some? option) (eq? 1 (car option))) + (define (some? option) (eq? 1 (sum-tag option))) ; Option a -> Bool - (define (none? option) (eq? 0 (car option))) + (define (none? option) (eq? 0 (sum-tag option))) ; Option a -> a (or #f) (define (option-get option) (if (some? option) - (car (cdr option)) + (car (sum-fields option)) (raise "Cannot get the value of an empty option "))) ; # works as well ; Unit - (define unit `(0)) + (define unit (sum 0)) ; Booleans are represented as numbers (define false 0) (define true 1) ; a -> Either b a - (define (right a) `(1 ,a)) + (define (right a) (sum 1 a)) ; b -> Either b a - (define (left b) `(0 ,b)) + (define (left b) (sum 0 b)) ; Either a b -> Boolean - (define (right? either) (eq? 1 (car either))) + (define (right? either) (eq? 1 (sum-tag either))) ; Either a b -> Boolean - (define (left? either) (eq? 0 (car either))) + (define (left? either) (eq? 0 (sum-tag either))) ; Either a b -> a | b - (define (either-get either) (car (cdr either)))) + (define (either-get either) (car (sum-fields either)))) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 98b32c886..b9af15d3d 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -48,6 +48,15 @@ unison-FOp-MutableArray.read unison-FOp-MutableArray.write + unison-FOp-MutableArray.size + unison-FOp-ImmutableArray.size + + unison-FOp-MutableByteArray.size + unison-FOp-ImmutableByteArray.size + + unison-FOp-MutableByteArray.length + unison-FOp-ImmutableByteArray.length + unison-FOp-ImmutableByteArray.copyTo! unison-FOp-ImmutableByteArray.read8 @@ -55,9 +64,16 @@ unison-FOp-MutableByteArray.write8 unison-FOp-Scope.bytearray + unison-FOp-Scope.bytearrayOf unison-FOp-Scope.array + unison-FOp-Scope.arrayOf unison-FOp-Scope.ref + unison-FOp-IO.bytearray + unison-FOp-IO.bytearrayOf + unison-FOp-IO.array + unison-FOp-IO.arrayOf + unison-FOp-IO.ref unison-FOp-Ref.read unison-FOp-Ref.write @@ -143,6 +159,7 @@ (import (rnrs) (unison core) + (unison data) (unison string) (unison crypto) (unison bytevector) @@ -162,7 +179,7 @@ (define (reify-exn thunk) (guard (e [else - (list 0 '() (exception->string e) e) ]) + (sum 0 '() (exception->string e) e)]) (thunk))) ; Core implemented primops, upon which primops-in-unison can be built. @@ -192,8 +209,8 @@ (define (unison-POp-FTOT f) (number->istring f)) (define (unison-POp-IDXB n bs) (bytevector-u8-ref bs n)) (define (unison-POp-IDXS n l) - (guard (x [else (list 0)]) - (list 1 (list-ref l n)))) + (guard (x [else (sum 0)]) + (sum 1 (list-ref l n)))) (define (unison-POp-IORN m n) (fxior m n)) (define (unison-POp-ITOT i) (signed-number->istring i)) (define (unison-POp-LEQN m n) (if (fx<=? m n) 1 0)) @@ -220,17 +237,17 @@ (display "\n")) (define (unison-POp-TTON s) (let ([mn (string->number s)]) - (if mn (list 1 mn) (list 0)))) + (if mn (sum 1 mn) (sum 0)))) (define (unison-POp-UPKT t) (string->list t)) (define (unison-POp-VWLS l) (if (null? l) - (list 0) - (list 1 (car l) (cdr l)))) + (sum 0) + (sum 1 (car l) (cdr l)))) (define (unison-POp-VWRS l) (if (null? l) - (list 0) + (sum 0) (let ([r (reverse l)]) - (list 1 (reverse (cdr l)) (car l))))) + (sum 1 (reverse (cdr l)) (car l))))) (define (unison-POp-XORN m n) (fxxor m n)) (define (unison-POp-VALU c) (decode-value c)) @@ -239,7 +256,7 @@ (begin (put-bytevector p bs) (flush-output-port p) - (list 1 #f))) + (sum 1 #f))) (define (unison-FOp-Char.toText c) (istring c)) @@ -254,7 +271,7 @@ [(2) stderr])) (define (unison-FOp-IO.getArgs.impl.v1) - (list 1 (cdr (command-line)))) + (sum 1 (cdr (command-line)))) (define (unison-FOp-Text.toUtf8 s) (string->bytevector s utf-8-transcoder)) @@ -277,14 +294,14 @@ (define (unison-FOp-ImmutableArray.read vec i) (catch-array (lambda () - (list 1 (vector-ref vec i))))) + (sum 1 (vector-ref vec i))))) (define (unison-FOp-ImmutableArray.copyTo! dst doff src soff n) (catch-array (lambda () (let next ([i (fx1- n)]) (if (< i 0) - (list 1 #f) + (sum 1 #f) (begin (vector-set! dst (+ doff i) (vector-ref src (+ soff i))) (next (fx1- i)))))))) @@ -296,24 +313,24 @@ (define (unison-FOp-MutableArray.read src i) (catch-array (lambda () - (list 1 (vector-ref src i))))) + (sum 1 (vector-ref src i))))) (define (unison-FOp-MutableArray.write dst i x) (catch-array (lambda () (vector-set! dst i x) - (list 1)))) + (sum 1)))) (define (unison-FOp-ImmutableByteArray.copyTo! dst doff src soff n) (catch-array (lambda () (bytevector-copy! src soff dst doff n) - (list 1 #f)))) + (sum 1 #f)))) (define (unison-FOp-ImmutableByteArray.read8 arr i) (catch-array (lambda () - (list 1 (bytevector-u8-ref arr i))))) + (sum 1 (bytevector-u8-ref arr i))))) (define unison-FOp-MutableByteArray.freeze! freeze-bytevector!) @@ -321,10 +338,26 @@ (catch-array (lambda () (bytevector-u8-set! arr i b) - (list 1)))) + (sum 1)))) (define (unison-FOp-Scope.bytearray n) (make-bytevector n)) + (define (unison-FOp-IO.bytearray n) (make-bytevector n)) + (define (unison-FOp-Scope.array n) (make-vector n)) + (define (unison-FOp-IO.array n) (make-vector n)) + + (define (unison-FOp-Scope.bytearrayOf b n) (make-bytevector n b)) + (define (unison-FOp-IO.bytearrayOf b n) (make-bytevector n b)) + + (define (unison-FOp-Scope.arrayOf v n) (make-vector n v)) + (define (unison-FOp-IO.arrayOf v n) (make-vector n v)) + + (define unison-FOp-MutableByteArray.length bytevector-length) + (define unison-FOp-ImmutableByteArray.length bytevector-length) + (define unison-FOp-MutableByteArray.size bytevector-length) + (define unison-FOp-ImmutableByteArray.size bytevector-length) + (define unison-FOp-MutableArray.size vector-length) + (define unison-FOp-ImmutableArray.size vector-length) (define (unison-POp-FORK thunk) (fork thunk)) (define (unison-FOp-IO.delay.impl.v3 micros) (sleep micros)) diff --git a/scheme-libs/common/unison/vector.ss b/scheme-libs/common/unison/vector.ss index bc237976b..a489314f9 100644 --- a/scheme-libs/common/unison/vector.ss +++ b/scheme-libs/common/unison/vector.ss @@ -6,7 +6,8 @@ freeze-subvector) (import (rnrs) - (unison core)) + (unison core) + (unison data)) (define (freeze-subvector src off len) (let ([dst (make-vector len)]) @@ -14,7 +15,7 @@ (if (< i 0) (begin (freeze-vector! dst) - (list 1 dst)) + (sum 1 dst)) (begin (vector-set! dst i (vector-ref src (+ off i))) (next (fx1- i))))))) diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss index fb651b786..1f93f5196 100644 --- a/scheme-libs/racket/unison/core.ss +++ b/scheme-libs/racket/unison/core.ss @@ -18,8 +18,10 @@ fx1- list-head + syntax->list + raise-syntax-error + exception->string - record-case let-marks ref-mark @@ -37,7 +39,8 @@ string-copy! bytes with-continuation-mark - continuation-mark-set-first) + continuation-mark-set-first + raise-syntax-error) (string-copy! racket-string-copy!) (bytes bytevector)) (racket exn) @@ -68,41 +71,10 @@ (define exception->string exn->string) - (define-syntax record-case - (lambda (stx) - (syntax-case stx () - [(record-case scrut c ...) - (begin - (define (syntax->list stx) - (syntax-case stx () - [() '()] - [(x . xs) (cons #'x (syntax->list #'xs))])) - - (define (make-case cur) - (syntax-case cur (else) - [(else e ...) #'(else e ...)] - [((t ...) () e ...) #'((t ...) e ...)] - [(t () e ...) #'((t) e ...)] - [((t ...) (v ...) e ...) - #'((t ...) - (let-values ([(v ...) (apply values (cdr scrut))]) - e ...))] - [(t (v ...) e ...) - #'((t) - (let-values ([(v ...) (apply values (cdr scrut))]) - e ...))] - [((t ...) v e ...) - (identifier? #'v) - #'((t ...) - (let ([v (cdr scrut)]) - e ...))] - [(t v e ...) - (identifier? #'v) - #'((t) - (let ([v (cdr scrut)]) - e ...))])) - #`(case (car scrut) - #,@(map make-case (syntax->list #'(c ...)))))]))) + (define (syntax->list stx) + (syntax-case stx () + [() '()] + [(x . xs) (cons #'x (syntax->list #'xs))])) (define (call-with-marks rs v f) (cond From 04fab24848fc2f4bfb20717c0f0de56a5f573fdc Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 23 Feb 2023 16:40:39 -0600 Subject: [PATCH 371/467] Fix bad ucm migration backups --- .../Codebase/SqliteCodebase/Migrations.hs | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs index 060ed5b6b..bb7ae508f 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs @@ -106,17 +106,19 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh Region.displayConsoleRegions do (`UnliftIO.finally` finalizeRegion) do + let migs = migrations getDeclType termBuffer declBuffer root + -- The highest schema that this ucm knows how to migrate to. + let highestKnownSchemaVersion = fst . head $ Map.toDescList migs + currentSchemaVersion <- Sqlite.runTransaction conn Q.schemaVersion + when (currentSchemaVersion > highestKnownSchemaVersion) $ UnliftIO.throwIO $ OpenCodebaseUnknownSchemaVersion (fromIntegral currentSchemaVersion) + backupCodebaseIfNecessary backupStrategy localOrRemote conn currentSchemaVersion highestKnownSchemaVersion root + let migrationsToRun = Map.filterWithKey (\v _ -> v > currentSchemaVersion) migs + when shouldPrompt do + putStrLn "Press to start the migration once all other ucm processes are shutdown..." + void $ liftIO getLine ranMigrations <- Sqlite.runWriteTransaction conn \run -> do schemaVersion <- run Q.schemaVersion - let migs = migrations getDeclType termBuffer declBuffer root - -- The highest schema that this ucm knows how to migrate to. - let currentSchemaVersion = fst . head $ Map.toDescList migs - when (schemaVersion > currentSchemaVersion) $ UnliftIO.throwIO $ OpenCodebaseUnknownSchemaVersion (fromIntegral schemaVersion) - let migrationsToRun = Map.filterWithKey (\v _ -> v > schemaVersion) migs - when (localOrRemote == Local && (not . null) migrationsToRun) $ case backupStrategy of - Backup -> backupCodebase conn schemaVersion root shouldPrompt - NoBackup -> pure () -- This is a bit of a hack, hopefully we can remove this when we have a more -- reliable way to freeze old migration code in time. -- The problem is that 'saveObject' has been changed to flush temp entity tables, @@ -169,13 +171,16 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh _success <- Sqlite.Connection.vacuum conn Region.setConsoleRegion region ("🏁 Migrations complete 🏁" :: Text) --- | Copy the sqlite database to a new file with a unique name based on current time. -backupCodebase :: Sqlite.Connection -> SchemaVersion -> CodebasePath -> Bool -> IO () -backupCodebase conn schemaVersion root shouldPrompt = do - backupPath <- getPOSIXTime <&> (\t -> root backupCodebasePath schemaVersion t) - Sqlite.vacuumInto conn backupPath - putStrLn ("📋 I backed up your codebase to " ++ (root backupPath)) - putStrLn "⚠️ Please close all other ucm processes and wait for the migration to complete before interacting with your codebase." - when shouldPrompt do - putStrLn "Press to start the migration once all other ucm processes are shutdown..." - void $ liftIO getLine +-- | If we need to make a backup, then copy the sqlite database to a new file with a unique name based on current time. +backupCodebaseIfNecessary :: BackupStrategy -> LocalOrRemote -> Sqlite.Connection -> SchemaVersion -> SchemaVersion -> CodebasePath -> IO () +backupCodebaseIfNecessary backupStrategy localOrRemote conn currentSchemaVersion highestKnownSchemaVersion root = do + case (backupStrategy, localOrRemote) of + (NoBackup, _) -> pure () + (_, Remote) -> pure () + (Backup, Local) + | (currentSchemaVersion >= highestKnownSchemaVersion) -> pure () + | otherwise -> do + backupPath <- getPOSIXTime <&> (\t -> root backupCodebasePath currentSchemaVersion t) + Sqlite.vacuumInto conn backupPath + putStrLn ("📋 I backed up your codebase to " ++ (root backupPath)) + putStrLn "⚠️ Please close all other ucm processes and wait for the migration to complete before interacting with your codebase." From eda768c94f0fe026168558e8f344b48664f1123c Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 23 Feb 2023 16:48:49 -0600 Subject: [PATCH 372/467] Fixups --- .../src/Unison/Codebase/SqliteCodebase/Migrations.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs index bb7ae508f..a03fb6cbb 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs @@ -112,13 +112,14 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh currentSchemaVersion <- Sqlite.runTransaction conn Q.schemaVersion when (currentSchemaVersion > highestKnownSchemaVersion) $ UnliftIO.throwIO $ OpenCodebaseUnknownSchemaVersion (fromIntegral currentSchemaVersion) backupCodebaseIfNecessary backupStrategy localOrRemote conn currentSchemaVersion highestKnownSchemaVersion root - let migrationsToRun = Map.filterWithKey (\v _ -> v > currentSchemaVersion) migs when shouldPrompt do putStrLn "Press to start the migration once all other ucm processes are shutdown..." void $ liftIO getLine ranMigrations <- Sqlite.runWriteTransaction conn \run -> do - schemaVersion <- run Q.schemaVersion + -- Get the schema version again now that we're in a transaction. + currentSchemaVersion <- run Q.schemaVersion + let migrationsToRun = Map.filterWithKey (\v _ -> v > currentSchemaVersion) migs -- This is a bit of a hack, hopefully we can remove this when we have a more -- reliable way to freeze old migration code in time. -- The problem is that 'saveObject' has been changed to flush temp entity tables, @@ -128,8 +129,8 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh -- -- Hopefully we can remove this once we've got better methods of freezing migration -- code in time. - when (schemaVersion < 5) $ run Q.addTempEntityTables - when (schemaVersion < 6) $ run Q.addNamespaceStatsTables + when (currentSchemaVersion < 5) $ run Q.addTempEntityTables + when (currentSchemaVersion < 6) $ run Q.addNamespaceStatsTables for_ (Map.toAscList migrationsToRun) $ \(SchemaVersion v, migration) -> do putStrLn $ "🔨 Migrating codebase to version " <> show v <> "..." run migration @@ -146,7 +147,7 @@ ensureCodebaseIsUpToDate localOrRemote root getDeclType termBuffer declBuffer sh -- integrityCheckAllHashObjects, let checks = Monoid.whenM - (schemaVersion < 7) -- Only certain migrations actually make changes which reasonably need to be checked + (currentSchemaVersion < 7) -- Only certain migrations actually make changes which reasonably need to be checked [ integrityCheckAllBranches, integrityCheckAllCausals ] From 45e1bc51bb2081dbdffcb8cb887a8f3fb0c10c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Ba=C5=A1i=C4=87?= Date: Fri, 24 Feb 2023 00:39:34 +0100 Subject: [PATCH 373/467] docs(lsp-helix): adds helix editor instructions for lsp --- docs/language-server.markdown | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/language-server.markdown b/docs/language-server.markdown index 04f5f9af1..13020efdb 100644 --- a/docs/language-server.markdown +++ b/docs/language-server.markdown @@ -79,6 +79,26 @@ Note that you'll need to start UCM _before_ you try connecting to it in your edi Simply install the [Unison Language VSCode extension](https://marketplace.visualstudio.com/items?itemName=unison-lang.unison). +### Helix Editor + +To `~/.config/helix/languages.toml` append this code: + +```toml +[[language]] +name = "unison" +scope = "source.unison" +injection-regex = "unison" +file-types = ["u"] +shebangs = [] +roots = [] +auto-format = false +comment-token = "--" +indent = { tab-width = 4, unit = " " } +language-server = { command = "ncat", args = ["localhost", "5757"] } +``` + +or follow the instructions for Unison in "[How to install the default language servers](https://github.com/helix-editor/helix/wiki/How-to-install-the-default-language-servers#unison)" wiki page. + ### Other Editors From 325b5f1c4ca99966cb0629e413f2ea09ac6cc42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Ba=C5=A1i=C4=87?= Date: Fri, 24 Feb 2023 00:47:06 +0100 Subject: [PATCH 374/467] feat(respect-ucm-host): makes codebase server use the correct host. Fixes #2689 --- unison-share-api/src/Unison/Server/CodebaseServer.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-share-api/src/Unison/Server/CodebaseServer.hs b/unison-share-api/src/Unison/Server/CodebaseServer.hs index f64d52eda..9892ad2e8 100644 --- a/unison-share-api/src/Unison/Server/CodebaseServer.hs +++ b/unison-share-api/src/Unison/Server/CodebaseServer.hs @@ -277,7 +277,7 @@ startServer env opts rt codebase onStart = do token <- case token opts of Just t -> return $ C8.pack t _ -> genToken - let baseUrl = BaseUrl "http://127.0.0.1" token + let baseUrl = BaseUrl (fromMaybe "http://127.0.0.1" (host opts)) token let settings = defaultSettings & maybe id setPort (port opts) From 6ba472479af397cc6105f7c2acd128d0f4c6917b Mon Sep 17 00:00:00 2001 From: Jordan Rule Date: Fri, 24 Feb 2023 16:16:19 -0600 Subject: [PATCH 375/467] Fix link to M1 Mac Docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a046567d..629d35a66 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ If these instructions don't work for you or are incomplete, please file an issue The build uses [Stack](http://docs.haskellstack.org/). If you don't already have it installed, [follow the install instructions](http://docs.haskellstack.org/en/stable/README.html#how-to-install) for your platform. (Hint: `brew update && brew install stack`) -If you have not set up the Haskell toolchain before and are trying to contribute to Unison on an M1 Mac, we have [some tips specifically for you](docs/m1-mac-setup-tips.markdown/new). +If you have not set up the Haskell toolchain before and are trying to contribute to Unison on an M1 Mac, we have [some tips specifically for you](docs/m1-mac-setup-tips.markdown). ```sh $ git clone https://github.com/unisonweb/unison.git From bd651ba49f671caf1f2bc084f1512f3f355be6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Ba=C5=A1i=C4=87?= Date: Sat, 25 Feb 2023 11:31:56 +0100 Subject: [PATCH 376/467] docs(contributors): updates contributors --- CONTRIBUTORS.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.markdown b/CONTRIBUTORS.markdown index 259c10518..93b64b1fc 100644 --- a/CONTRIBUTORS.markdown +++ b/CONTRIBUTORS.markdown @@ -73,3 +73,4 @@ The format for this list: name, GitHub handle * Jesse Looney (@jesselooney) * Vlad Posmangiu Luchian (@cstml) * Andrii Uvarov (@unorsk) +* Mario Bašić (@mabasic) From c8a175bc15ef6ad01ead1c60deea2696ce0ba9ad Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Sat, 25 Feb 2023 16:19:08 -0600 Subject: [PATCH 377/467] Allow specifying a username to fetch the compiler from MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This will make it much easier to test out changes to the compiler against our jit tests, and allows me to pin to a previous version of the compiler that works with the current scheme data types 😅 --- unison-cli/src/Unison/Codebase/Editor/HandleInput.hs | 12 ++++++------ unison-cli/src/Unison/Codebase/Editor/Input.hs | 4 ++-- unison-cli/src/Unison/CommandLine/InputPatterns.hs | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs index ec53e0fcb..05a3da7ea 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput.hs @@ -1168,7 +1168,7 @@ loop e = do CompileSchemeI output main -> doCompileScheme output main ExecuteSchemeI main args -> doRunAsScheme main args GenSchemeLibsI -> doGenerateSchemeBoot True Nothing - FetchSchemeCompilerI -> doFetchCompiler + FetchSchemeCompilerI name -> doFetchCompiler name IOTestI main -> handleIOTest main -- UpdateBuiltinsI -> do -- stepAt updateBuiltins @@ -1514,7 +1514,7 @@ inputDescription input = <> Text.unwords (fmap Text.pack args) CompileSchemeI fi nm -> pure ("compile.native " <> HQ.toText nm <> " " <> Text.pack fi) GenSchemeLibsI -> pure "compile.native.genlibs" - FetchSchemeCompilerI -> pure "compile.native.fetch" + FetchSchemeCompilerI name -> pure ("compile.native.fetch" <> Text.pack name) PullRemoteBranchI orepo dest0 _syncMode pullMode _ -> do dest <- p' dest0 let command = @@ -2619,8 +2619,8 @@ compilerPath = Path.Path' {Path.unPath' = Left abs} rootPath = Path.Path {Path.toSeq = Seq.fromList segs} abs = Path.Absolute {Path.unabsolute = rootPath} -doFetchCompiler :: Cli () -doFetchCompiler = +doFetchCompiler :: String -> Cli () +doFetchCompiler username = inputDescription pullInput >>= doPullRemoteBranch repo @@ -2633,7 +2633,7 @@ doFetchCompiler = ns = ReadShareRemoteNamespace { server = RemoteRepo.DefaultCodeserver, - repo = ShareUserHandle "unison", + repo = ShareUserHandle (Text.pack username), path = Path.fromList $ NameSegment <$> ["public", "internal", "trunk"] } @@ -2650,7 +2650,7 @@ doFetchCompiler = ensureCompilerExists :: Cli () ensureCompilerExists = Cli.branchExistsAtPath' compilerPath - >>= flip unless doFetchCompiler + >>= flip unless (doFetchCompiler "unison") getCacheDir :: Cli String getCacheDir = liftIO $ getXdgDirectory XdgCache "unisonlanguage" diff --git a/unison-cli/src/Unison/Codebase/Editor/Input.hs b/unison-cli/src/Unison/Codebase/Editor/Input.hs index 10336c782..a3d97a215 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Input.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Input.hs @@ -161,8 +161,8 @@ data Input CompileSchemeI String (HQ.HashQualified Name) | -- generate scheme libraries GenSchemeLibsI - | -- fetch scheme compiler - FetchSchemeCompilerI + | -- fetch scheme compiler from a given username + FetchSchemeCompilerI String | TestI TestInput | -- metadata -- `link metadata definitions` (adds metadata to all of `definitions`) diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index 9d8e6387d..d98a4c135 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -2234,7 +2234,8 @@ fetchScheme = ] ) ( \case - [] -> pure Input.FetchSchemeCompilerI + [] -> pure (Input.FetchSchemeCompilerI "unison") + [name] -> pure (Input.FetchSchemeCompilerI name) _ -> Left $ showPatternHelp fetchScheme ) From d163577d1b86ff1608a97adc825d160c976b19f6 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Sat, 25 Feb 2023 16:29:56 -0600 Subject: [PATCH 378/467] [fetch-username] docs --- unison-cli/src/Unison/CommandLine/InputPatterns.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unison-cli/src/Unison/CommandLine/InputPatterns.hs b/unison-cli/src/Unison/CommandLine/InputPatterns.hs index d98a4c135..67e87b68f 100644 --- a/unison-cli/src/Unison/CommandLine/InputPatterns.hs +++ b/unison-cli/src/Unison/CommandLine/InputPatterns.hs @@ -2229,7 +2229,10 @@ fetchScheme = <> "is run\ \ if the library is not already in the standard location\ \ (unison.internal). However, this command will force\ - \ a pull even if the library already exists." + \ a pull even if the library already exists. You can also specify\ + \ a username to pull from (the default is `unison`) to use an alternate\ + \ implementation of the scheme compiler. It will attempt to fetch\ + \ [username].public.internal.trunk for use." ) ] ) From 9e3dbb62b80df53a1ad5c019987d2c5a56f87674 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 29 Sep 2022 16:33:23 -0400 Subject: [PATCH 379/467] Add pattern match coverage checking --- .../src/Unison/PatternMatchCoverage.hs | 45 + .../src/Unison/PatternMatchCoverage/Class.hs | 32 + .../Unison/PatternMatchCoverage/Constraint.hs | 52 + .../Unison/PatternMatchCoverage/Desugar.hs | 204 ++++ .../src/Unison/PatternMatchCoverage/Fix.hs | 20 + .../Unison/PatternMatchCoverage/GrdTree.hs | 45 + .../PatternMatchCoverage/IntervalSet.hs | 203 ++++ .../Unison/PatternMatchCoverage/ListPat.hs | 15 + .../Unison/PatternMatchCoverage/Literal.hs | 61 ++ .../NormalizedConstraints.hs | 248 +++++ .../src/Unison/PatternMatchCoverage/PmGrd.hs | 64 ++ .../src/Unison/PatternMatchCoverage/PmLit.hs | 23 + .../src/Unison/PatternMatchCoverage/Solve.hs | 930 ++++++++++++++++++ .../src/Unison/PatternMatchCoverage/UFMap.hs | 227 +++++ parser-typechecker/src/Unison/PrintError.hs | 47 +- .../src/Unison/Syntax/TermPrinter.hs | 1 + .../src/Unison/Typechecker/Context.hs | 96 ++ .../src/Unison/Typechecker/Extractor.hs | 13 + .../src/Unison/Typechecker/TypeError.hs | 17 +- .../unison-parser-typechecker.cabal | 14 + unison-cli/src/Unison/LSP/FileAnalysis.hs | 28 +- .../transcripts/pattern-match-coverage.md | 190 ++++ .../pattern-match-coverage.output.md | 436 ++++++++ 23 files changed, 2997 insertions(+), 14 deletions(-) create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/IntervalSet.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/ListPat.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs create mode 100644 parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs create mode 100644 unison-src/transcripts/pattern-match-coverage.md create mode 100644 unison-src/transcripts/pattern-match-coverage.output.md diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage.hs b/parser-typechecker/src/Unison/PatternMatchCoverage.hs new file mode 100644 index 000000000..3ef3c8a94 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage.hs @@ -0,0 +1,45 @@ +-- Pattern match coverage checking following the algorithm described +-- in "Lower Your Guards". +-- https://simon.peytonjones.org/assets/pdfs/lower-your-guards.pdf +module Unison.PatternMatchCoverage where + +import qualified Data.Set as Set +import Debug.Trace +import Unison.Pattern (Pattern) +import Unison.PatternMatchCoverage.Class (Pmc (..)) +import Unison.PatternMatchCoverage.Desugar (desugarMatch) +import Unison.PatternMatchCoverage.GrdTree (prettyGrdTree) +import qualified Unison.PatternMatchCoverage.NormalizedConstraints as NC +import Unison.PatternMatchCoverage.PmGrd (prettyPmGrd) +import Unison.PatternMatchCoverage.Solve (classify, expand, expandSolution, uncoverAnnotate) +import qualified Unison.Term as Term +import qualified Unison.Type as Type +import qualified Unison.Util.Pretty as P + +checkMatch :: + forall vt v loc m. + (Pmc vt v loc m) => + loc -> + Type.Type vt loc -> + [Term.MatchCase loc (Term.Term' vt v loc)] -> + m ([loc], [loc], [Pattern ()]) +checkMatch matchLocation scrutineeType cases = do + v0 <- fresh + grdtree0 <- desugarMatch matchLocation scrutineeType v0 cases + (uncovered, grdtree1) <- uncoverAnnotate (Set.singleton (NC.declVar v0 scrutineeType id NC.emptyNormalizedConstraints)) grdtree0 + uncoveredExpanded <- concat . fmap Set.toList <$> traverse (expandSolution v0) (Set.toList uncovered) + let sols = map (expand v0) uncoveredExpanded + let (_accessible, inaccessible, redundant) = classify grdtree1 + let debugOutput = + P.sep + "\n" + [ P.hang "desugared:" (prettyGrdTree prettyPmGrd (\_ -> "") grdtree0), + P.hang "annotated:" (prettyGrdTree NC.prettyDnf (NC.prettyDnf . fst) grdtree1), + P.hang "uncovered:" (NC.prettyDnf uncovered), + P.hang "uncovered expanded:" (NC.prettyDnf (Set.fromList uncoveredExpanded)) + ] + shouldDebug = False + doDebug = case shouldDebug of + True -> trace (P.toPlainUnbroken debugOutput) + False -> id + doDebug (pure (redundant, inaccessible, sols)) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs new file mode 100644 index 000000000..f908a2072 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs @@ -0,0 +1,32 @@ +{-# LANGUAGE FunctionalDependencies #-} + +module Unison.PatternMatchCoverage.Class where + +import Control.Monad.Fix (MonadFix) +import Unison.ConstructorReference (ConstructorReference) +import Unison.PatternMatchCoverage.ListPat (ListPat) +import Unison.Type (Type) +import Unison.Var (Var) + +class (Ord loc, Var vt, Var v, MonadFix m) => Pmc vt v loc m | m -> vt v loc where + getConstructors :: Type vt loc -> m (EnumeratedConstructors vt v loc) + getConstructorVarTypes :: Type vt loc -> ConstructorReference -> m [Type vt loc] + fresh :: m v + +data EnumeratedConstructors vt v loc + = ConstructorType [(v, ConstructorReference, Type vt loc)] + | SequenceType [(ListPat, [Type vt loc])] + | BooleanType + | OtherType + deriving stock (Show) + +traverseConstructors :: + Applicative f => + (v -> ConstructorReference -> Type vt loc -> f (v, ConstructorReference, Type vt loc)) -> + EnumeratedConstructors vt v loc -> + f (EnumeratedConstructors vt v loc) +traverseConstructors f = \case + ConstructorType xs -> ConstructorType <$> traverse (\(a, b, c) -> f a b c) xs + SequenceType x -> pure (SequenceType x) + BooleanType -> pure BooleanType + OtherType -> pure OtherType diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs new file mode 100644 index 000000000..c465e023d --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs @@ -0,0 +1,52 @@ +module Unison.PatternMatchCoverage.Constraint where + +import Unison.ConstructorReference (ConstructorReference) +import Unison.PatternMatchCoverage.IntervalSet (IntervalSet) +import Unison.PatternMatchCoverage.PmLit +import qualified Unison.PrettyPrintEnv as PPE +import qualified Unison.Syntax.TypePrinter as TypePrinter +import Unison.Type (Type) +import Unison.Util.Pretty +import Unison.Var (Var) + +data Constraint vt v loc + = PosCon v ConstructorReference [(v, Type vt loc)] + | NegCon v ConstructorReference + | PosLit v PmLit + | NegLit v PmLit + | PosListHead + v + -- ^ list root + Int + -- ^ cons position (0 is head) + v + -- ^ element variable + | PosListTail + v + -- ^ list root + Int + -- ^ snoc position (0 is last) + v + -- ^ element variable + | NegListInterval v IntervalSet + | Effectful v + | Eq v v + deriving stock (Eq, Ord) + +prettyConstraint :: (Var vt, Var v) => Constraint vt v loc -> Pretty ColorText +prettyConstraint = \case + PosCon var con convars -> + let xs = pc con : fmap (\(trm, typ) -> sep " " [pv trm, ":", TypePrinter.pretty PPE.empty typ]) convars ++ ["<-", pv var] + in sep " " xs + NegCon var con -> sep " " [pv var, "≠", pc con] + PosLit var lit -> sep " " [prettyPmLit lit, "<-", pv var] + NegLit var lit -> sep " " [pv var, "≠", prettyPmLit lit] + PosListHead root n el -> sep " " [pv el, "<-", "head", pc n, pv root] + PosListTail root n el -> sep " " [pv el, "<-", "tail", pc n, pv root] + NegListInterval var x -> sep " " [pv var, "≠", string (show x)] + Effectful var -> "!" <> pv var + Eq v0 v1 -> sep " " [pv v0, "=", pv v1] + where + pv = string . show + pc :: forall a. Show a => a -> Pretty ColorText + pc = string . show diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs new file mode 100644 index 000000000..af81e3368 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs @@ -0,0 +1,204 @@ +module Unison.PatternMatchCoverage.Desugar where + +import Data.Functor.Compose +import Data.List.NonEmpty (NonEmpty (..)) +import qualified U.Core.ABT as ABT +import Unison.Pattern +import qualified Unison.Pattern as Pattern +import Unison.PatternMatchCoverage.Class +import Unison.PatternMatchCoverage.Fix +import Unison.PatternMatchCoverage.GrdTree +import Unison.PatternMatchCoverage.PmGrd +import qualified Unison.PatternMatchCoverage.PmLit as PmLit +import Unison.Term (MatchCase (..), Term', app, var) +import Unison.Type (Type) +import qualified Unison.Type as Type + +desugarMatch :: + forall loc vt v m. + Pmc vt v loc m => + -- | loc of match + loc -> + Type vt loc -> + v -> + [MatchCase loc (Term' vt v loc)] -> + m (GrdTree (PmGrd vt v loc) loc) +desugarMatch loc0 scrutineeType v0 cs0 = + traverse desugarClause cs0 >>= \case + [] -> pure $ Leaf loc0 + x : xs -> pure $ Fork (x :| xs) + where + desugarClause :: MatchCase loc (Term' vt v loc) -> m (GrdTree (PmGrd vt v loc) loc) + desugarClause MatchCase {matchPattern, matchGuard} = + desugarPattern scrutineeType v0 matchPattern (finalK (Pattern.loc matchPattern) matchGuard) [] + + finalK :: loc -> Maybe (Term' vt v loc) -> [v] -> m (GrdTree (PmGrd vt v loc) loc) + finalK loc mterm vs = case mterm of + Nothing -> pure (Leaf loc) + Just grdExpr -> do + let ann = ABT.annotation grdExpr + expr = foldr (\a b -> app ann (var ann a) b) grdExpr vs + typ = Type.boolean ann + v <- fresh + pure (Grd (PmLet v expr typ) (Grd (PmLit v (PmLit.Boolean True)) (Leaf loc))) + +desugarPattern :: + forall v vt loc m. + Pmc vt v loc m => + Type vt loc -> + v -> + Pattern loc -> + ([v] -> m (GrdTree (PmGrd vt v loc) loc)) -> + [v] -> + m (GrdTree (PmGrd vt v loc) loc) +desugarPattern typ v0 pat k vs = case pat of + Unbound _ -> k vs + Var _ -> k (v0 : vs) + Boolean _ x -> Grd (PmLit v0 $ PmLit.Boolean x) <$> k vs + Int _ x -> Grd (PmLit v0 $ PmLit.Int x) <$> k vs + Nat _ x -> Grd (PmLit v0 $ PmLit.Nat x) <$> k vs + Float _ x -> Grd (PmLit v0 $ PmLit.Float x) <$> k vs + Text _ x -> Grd (PmLit v0 $ PmLit.Text x) <$> k vs + Char _ x -> Grd (PmLit v0 $ PmLit.Char x) <$> k vs + Constructor _loc consRef pats -> do + contyps <- getConstructorVarTypes typ consRef + patvars <- assignFreshPatternVars pats + let c = PmCon v0 consRef convars + convars :: [(v, Type vt loc)] + convars = map (\(v, _, t) -> (v, t)) tpatvars + tpatvars = zipWith (\(v, p) t -> (v, p, t)) patvars contyps + rest <- foldr (\(v, pat, t) b -> desugarPattern t v pat b) k tpatvars vs + pure (Grd c rest) + As _ _ -> k (v0 : vs) + EffectPure {} -> k vs + EffectBind {} -> k vs + SequenceLiteral {} -> handleSequence typ v0 pat k vs + SequenceOp {} -> handleSequence typ v0 pat k vs + +handleSequence :: + forall v vt loc m. + Pmc vt v loc m => + Type vt loc -> + v -> + Pattern loc -> + ([v] -> m (GrdTree (PmGrd vt v loc) loc)) -> + [v] -> + m (GrdTree (PmGrd vt v loc) loc) +handleSequence typ v pat k vs = do + let listArg = case typ of + Type.App' _list arg -> arg + _ -> error "list type is not an application?" + listToGrdTree typ listArg v (normalizeList pat) k vs + +listToGrdTree :: + forall v vt loc m. + Pmc vt v loc m => + Type vt loc -> + Type vt loc -> + v -> + NormalizedList loc -> + ([v] -> m (GrdTree (PmGrd vt v loc) loc)) -> + [v] -> + m (GrdTree (PmGrd vt v loc) loc) +listToGrdTree _listTyp elemTyp listVar nl0 k0 vs0 = + let (minLen, maxLen) = countMinListLen nl0 + in Grd (PmListInterval listVar minLen maxLen) <$> go 0 0 nl0 k0 vs0 + where + go consCount snocCount (Fix pat) k vs = case pat of + N'ConsF x xs -> do + element <- fresh + let grd = PmListHead listVar consCount element elemTyp + let !consCount' = consCount + 1 + Grd grd <$> desugarPattern elemTyp element x (go consCount' snocCount xs k) vs + N'SnocF xs x -> do + element <- fresh + let grd = PmListTail listVar snocCount element elemTyp + let !snocCount' = snocCount + 1 + Grd grd <$> go consCount snocCount' xs (desugarPattern elemTyp element x k) vs + N'NilF -> k vs + N'VarF _ -> k (listVar : vs) + N'UnboundF _ -> k vs + + countMinListLen :: NormalizedList loc -> (Int, Int) + countMinListLen = + ($ 0) . cata \case + N'ConsF _ b -> \acc -> b $! acc + 1 + N'SnocF b _ -> \acc -> b $! acc + 1 + N'NilF -> \n -> (n, n) + N'VarF _ -> \n -> (n, maxBound) + N'UnboundF _ -> \n -> (n, maxBound) + +data NormalizedListF loc a + = N'ConsF (Pattern loc) a + | N'SnocF a (Pattern loc) + | N'NilF + | N'VarF loc + | N'UnboundF loc + deriving stock (Functor) + +type NormalizedList loc = Fix (NormalizedListF loc) + +type AnnotatedList loc = Fix (Compose ((,) (Int, Int)) (NormalizedListF loc)) + +pattern Ann :: Int -> Int -> NormalizedListF loc (AnnotatedList loc) -> AnnotatedList loc +pattern Ann lb ub rest = Fix (Compose ((lb, ub), rest)) + +pattern N'Cons x xs = Fix (N'ConsF x xs) + +pattern N'Snoc xs x = Fix (N'SnocF xs x) + +pattern N'Nil = Fix N'NilF + +pattern N'Var x = Fix (N'VarF x) + +pattern N'Unbound x = Fix (N'UnboundF x) + +-- | strip out sequence literals and concats +normalizeList :: Pattern loc -> NormalizedList loc +normalizeList pat0 = case goCons pat0 of + Left f -> f N'Nil + Right x -> x + where + goCons :: Pattern loc -> Either (NormalizedList loc -> NormalizedList loc) (NormalizedList loc) + goCons = \case + SequenceLiteral _loc xs -> + Left \nil -> foldr N'Cons nil xs + SequenceOp _loc lhs op rhs -> case op of + Cons -> + case goCons rhs of + Left f -> Left (N'Cons lhs . f) + Right x -> Right (N'Cons lhs x) + Snoc -> + case goCons lhs of + Left f -> Left (f . N'Cons rhs) + Right x -> Right (N'Snoc x rhs) + Concat -> + case goCons lhs of + Left f -> case goCons rhs of + Left g -> Left (f . g) + Right x -> Right (f x) + Right x -> Right (goSnoc rhs x) + Var loc -> Right (N'Var loc) + Unbound loc -> Right (N'Unbound loc) + -- as-patterns are not handled properly here, which is fine while we + -- only have boolean guards, but this needs to be fixed if we + -- introduce pattern guards + As _loc pat -> goCons pat + _ -> error "goCons: unexpected pattern" + + goSnoc :: Pattern loc -> NormalizedList loc -> NormalizedList loc + goSnoc pat nlp = case pat of + SequenceLiteral _loc xs -> + foldl N'Snoc nlp xs + SequenceOp _loc lhs op rhs -> case op of + Cons -> + goSnoc rhs (N'Snoc nlp lhs) + Snoc -> + N'Snoc (goSnoc rhs nlp) lhs + Concat -> + goSnoc rhs (goSnoc lhs nlp) + As _loc pat -> goSnoc pat nlp + _ -> error "goSnoc: unexpected pattern" + +assignFreshPatternVars :: Pmc vt v loc m => [Pattern loc] -> m [(v, Pattern loc)] +assignFreshPatternVars pats = traverse (\p -> (,p) <$> fresh) pats diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs new file mode 100644 index 000000000..99974ba72 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE QuantifiedConstraints #-} +{-# LANGUAGE TypeSynonymInstances #-} +{-# LANGUAGE UndecidableInstances #-} + +module Unison.PatternMatchCoverage.Fix where + +newtype Fix f = Fix {unFix :: f (Fix f)} + +deriving instance (forall a. Show a => Show (f a)) => Show (Fix f) + +deriving instance (forall a. Eq a => Eq (f a)) => Eq (Fix f) + +deriving instance (Eq (Fix f), forall a. Ord a => Ord (f a)) => Ord (Fix f) + +cata :: Functor f => (f a -> a) -> Fix f -> a +cata alg = let c = alg . fmap c . unFix in c + +para :: Functor f => (f (Fix f, a) -> a) -> Fix f -> a +para alg = let c = alg . fmap (\x -> (x, c x)) . unFix in c diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs new file mode 100644 index 000000000..c84e2daa7 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs @@ -0,0 +1,45 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Unison.PatternMatchCoverage.GrdTree where + +import Data.List.NonEmpty (NonEmpty (..)) +import qualified Data.List.NonEmpty as NEL +import Data.ListLike (ListLike) +import Unison.PatternMatchCoverage.Fix +import Unison.Prelude +import Unison.Util.Pretty + +type GrdTree n l = Fix (GrdTreeF n l) + +data GrdTreeF n l a + = LeafF l + | GrdF n a + | ForkF (NonEmpty a) + deriving stock (Functor, Show) + +prettyGrdTree :: forall n l s. (ListLike s Char, IsString s) => (n -> Pretty s) -> (l -> Pretty s) -> GrdTree n l -> Pretty s +prettyGrdTree prettyNode prettyLeaf = cata phi + where + phi = \case + LeafF l -> prettyLeaf l + GrdF n rest -> sep " " [prettyNode n, "──", rest] + ForkF xs -> "──" <> group (sep "\n" (makeTree $ NEL.toList xs)) + makeTree :: [Pretty s] -> [Pretty s] + makeTree = \case + [] -> [] + x : [] -> [sep " " ["──", x]] + x0 : x1 : xs -> + sep " " ["┬─", x0] : + let go y0 = \case + [] -> [sep " " ["└─", y0]] + y1 : ys -> "├─ " <> y0 : go y1 ys + in [indent " " (sep "\n" (go x1 xs))] + +pattern Leaf :: l -> GrdTree n l +pattern Leaf x = Fix (LeafF x) + +pattern Grd :: n -> GrdTree n l -> GrdTree n l +pattern Grd x rest = Fix (GrdF x rest) + +pattern Fork :: NonEmpty (GrdTree n l) -> GrdTree n l +pattern Fork alts = Fix (ForkF alts) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/IntervalSet.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/IntervalSet.hs new file mode 100644 index 000000000..ab1d2d4b3 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/IntervalSet.hs @@ -0,0 +1,203 @@ +module Unison.PatternMatchCoverage.IntervalSet + ( IntervalSet, + empty, + singleton, + fromList, + insert, + delete, + difference, + intersection, + complement, + null, + member, + extractSingleton, + intersectIntervals, + map, + foldr, + lookupMin, + lookupMax, + ) +where + +import Data.Coerce (coerce) +import Data.Function (on) +import Data.IntMap (IntMap) +import qualified Data.IntMap.Strict as IntMap +import Data.List (sortOn) +import Data.Maybe (catMaybes, fromMaybe, maybeToList) +import Prelude hiding (foldr, map, null) +import qualified Prelude + +newtype IntervalSet = IntervalSet {unIntervalSet :: IntMap Int} + deriving stock (Show, Eq, Ord) + +empty :: IntervalSet +empty = IntervalSet IntMap.empty + +singleton :: (Int, Int) -> IntervalSet +singleton x = insert x empty + +lookupMin :: IntervalSet -> Maybe Int +lookupMin = fmap fst . IntMap.lookupMin . unIntervalSet + +lookupMax :: IntervalSet -> Maybe Int +lookupMax = fmap snd . IntMap.lookupMax . unIntervalSet + +member :: Int -> IntervalSet -> Bool +member i is = + case splitLookupLE i is of + (_, m, _) -> case m of + Nothing -> False + Just (_, ub) -> i <= ub + +foldr :: (Int -> Int -> b -> b) -> b -> IntervalSet -> b +foldr f z = IntMap.foldrWithKey f z . unIntervalSet + +map :: ((Int, Int) -> (Int, Int)) -> IntervalSet -> IntervalSet +map f = IntervalSet . foldr phi IntMap.empty + where + phi k v b = let (k', v') = f (k, v) in IntMap.insert k' v' b + +-- | insert inclusive bounds interval into set +insert :: (Int, Int) -> IntervalSet -> IntervalSet +insert i@(lb, ub) is + | nullInterval i = is + | otherwise = + case splitLookupLE lb is of + (smaller, m1, xs) -> + case splitLookupLE ub xs of + (_, m2, larger) -> + IntervalSet $ + IntMap.unions + [ unIntervalSet smaller, + unIntervalSet $ fromList (maybeToList m1 ++ [i] ++ maybeToList m2), + unIntervalSet larger + ] + +delete :: (Int, Int) -> IntervalSet -> IntervalSet +delete i@(lb, ub) is + | nullInterval i = is + | otherwise = + case splitLookupLE lb is of + (smaller, m1, xs) -> + case splitLookupLE ub xs of + (_, m2, larger) -> + IntervalSet $ + IntMap.unions + [ unIntervalSet smaller, + case m1 of + Nothing -> IntMap.empty + Just j -> IntMap.fromList (catMaybes (Prelude.map (intersectIntervals j =<<) [upTo lb, downTo ub])), + fromMaybe IntMap.empty do + j <- m2 + aboveDelete <- downTo ub + uncurry IntMap.singleton <$> intersectIntervals aboveDelete j, + unIntervalSet larger + ] + +complement :: IntervalSet -> IntervalSet +complement (IntervalSet m) = fromAscList . (\xs -> Prelude.foldr phi z xs Nothing) . IntMap.toAscList $ m + where + phi (lb, ub) b mprevUb = + case mprevUb of + Nothing -> case upTo lb of + Nothing -> b (Just ub) + Just x -> x : b (Just ub) + Just lastUb -> + let !lbPred = safeAdd lb (-1) + !lastUbSucc = safeAdd lastUb 1 + proposedInterval = (lastUbSucc, lbPred) + in case nullInterval proposedInterval of + True -> b (Just ub) + False -> proposedInterval : b (Just ub) + z = \case + Nothing -> [(0, maxBound)] + Just prev -> case downTo prev of + Nothing -> [] + Just x -> [x] + +intersection :: IntervalSet -> IntervalSet -> IntervalSet +intersection a b = difference a (complement b) + +null :: IntervalSet -> Bool +null = IntMap.null . unIntervalSet + +extractSingleton :: IntervalSet -> Maybe Int +extractSingleton (IntervalSet m) = case IntMap.toList m of + [(lb, ub)] + | lb == ub -> Just lb + _ -> Nothing + +-- | add two integers, sticking to a bound if it would overflow +safeAdd :: Int -> Int -> Int +safeAdd a b = + let c = a + b + in case a > 0 && b > 0 of + True -> case c < 0 of + True -> maxBound + False -> c + False -> case a < 0 && b < 0 of + True -> case c >= 0 of + True -> minBound + False -> c + False -> c + +difference :: IntervalSet -> IntervalSet -> IntervalSet +difference x (IntervalSet y) = IntMap.foldlWithKey' (\b k v -> delete (k, v) b) x y + +-- | the interval [0, lb) +upTo :: Int -> Maybe (Int, Int) +upTo lb = case lb <= 0 of + True -> Nothing + False -> Just (0, safeAdd lb (-1)) + +-- | the interval (ub, maxBound] +downTo :: Int -> Maybe (Int, Int) +downTo ub = case ub == maxBound of + True -> Nothing + False -> Just (safeAdd ub 1, maxBound) + +nullInterval :: (Int, Int) -> Bool +nullInterval (lb, ub) = ub < lb + +-- | merge a list sorted on the lower bound ascending +fromAscList :: [(Int, Int)] -> IntervalSet +fromAscList = IntervalSet . IntMap.fromAscList . mergeOverlappingAscList + +fromList :: [(Int, Int)] -> IntervalSet +fromList = fromAscList . sortOn fst . filter (not . nullInterval) + +intersectIntervals :: (Int, Int) -> (Int, Int) -> Maybe (Int, Int) +intersectIntervals a b + | doOverlap a b = + let !lb = on max fst a b + !ub = on min snd a b + in Just (lb, ub) + | otherwise = Nothing + +mergeOverlappingAscList :: [(Int, Int)] -> [(Int, Int)] +mergeOverlappingAscList = \case + x0 : x1 : xs -> case doOverlap x0 x1 of + True -> spanIntervals x0 x1 : mergeOverlappingAscList xs + False -> x0 : x1 : mergeOverlappingAscList xs + [x] -> [x] + [] -> [] + +doOverlap :: (Int, Int) -> (Int, Int) -> Bool +doOverlap (lb0, ub0) (lb1, ub1) + | ub0 >= lb1 && lb0 <= ub1 = True + | otherwise = False + +spanIntervals :: (Int, Int) -> (Int, Int) -> (Int, Int) +spanIntervals (lb0, ub0) (lb1, ub1) = + let !lb = min lb0 lb1 + !ub = max ub0 ub1 + in (lb, ub) + +splitLookupLE :: Int -> IntervalSet -> (IntervalSet, Maybe (Int, Int), IntervalSet) +splitLookupLE k (IntervalSet m) = + coerce case IntMap.splitLookup k m of + (smaller, Just v, larger) -> (smaller, Just (k, v), larger) + (smaller, Nothing, larger) -> case IntMap.maxViewWithKey smaller of + Just ((k, v), smaller) -> (smaller, Just (k, v), larger) + Nothing -> (smaller, Nothing, larger) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/ListPat.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/ListPat.hs new file mode 100644 index 000000000..60178fb11 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/ListPat.hs @@ -0,0 +1,15 @@ +module Unison.PatternMatchCoverage.ListPat where + +import Unison.Util.Pretty + +data ListPat + = Cons + | Snoc + | Nil + deriving stock (Show, Eq, Ord) + +prettyListPat :: ListPat -> Pretty ColorText +prettyListPat = \case + Cons -> "Cons" + Snoc -> "Snoc" + Nil -> "Nil" diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs new file mode 100644 index 000000000..dd38f85b3 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs @@ -0,0 +1,61 @@ +module Unison.PatternMatchCoverage.Literal where + +import Unison.ConstructorReference (ConstructorReference) +import Unison.PatternMatchCoverage.IntervalSet (IntervalSet) +import Unison.PatternMatchCoverage.PmLit (PmLit, prettyPmLit) +import qualified Unison.PrettyPrintEnv as PPE +import qualified Unison.Syntax.TermPrinter as TermPrinter +import qualified Unison.Syntax.TypePrinter as TypePrinter +import Unison.Term (Term') +import Unison.Type (Type) +import Unison.Typechecker.TypeVar (TypeVar, lowerTerm) +import Unison.Util.Pretty +import Unison.Var (Var) + +data Literal vt v loc + = T + | F + | PosCon v ConstructorReference [(v, Type vt loc)] + | NegCon v ConstructorReference + | PosLit v PmLit + | NegLit v PmLit + | PosListHead + v + -- ^ list root + Int + -- ^ cons position (0 is head) + v + -- ^ element variable + (Type vt loc) + | PosListTail + v + -- ^ list root + Int + -- ^ snoc position (0 is last) + v + -- ^ element variable + (Type vt loc) + | NegListInterval v IntervalSet + | Effectful v + | Let v (Term' vt v loc) (Type vt loc) + deriving stock (Show) + +prettyLiteral :: Var v => Literal (TypeVar b v) v loc -> Pretty ColorText +prettyLiteral = \case + T -> "✓" + F -> "⨉" + PosCon var con convars -> + let xs = pc con : fmap (\(trm, typ) -> sep " " [pv trm, ":", TypePrinter.pretty PPE.empty typ]) convars ++ ["<-", pv var] + in sep " " xs + NegCon var con -> sep " " [pv var, "≠", pc con] + PosLit var lit -> sep " " [prettyPmLit lit, "<-", pv var] + NegLit var lit -> sep " " [pv var, "≠", prettyPmLit lit] + PosListHead root n el _ -> sep " " [pv el, "<-", "head", pc n, pv root] + PosListTail root n el _ -> sep " " [pv el, "<-", "tail", pc n, pv root] + NegListInterval var x -> sep " " [pv var, "≠", string (show x)] + Effectful var -> "!" <> pv var + Let var expr typ -> sep " " ["let", pv var, "=", TermPrinter.pretty PPE.empty (lowerTerm expr), ":", TypePrinter.pretty PPE.empty typ] + where + pv = string . show + pc :: forall a. Show a => a -> Pretty ColorText + pc = string . show diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs new file mode 100644 index 000000000..da0af8dfd --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs @@ -0,0 +1,248 @@ +module Unison.PatternMatchCoverage.NormalizedConstraints where + +import Data.Functor.Compose +import Data.List (intersperse) +import Data.Sequence (pattern Empty) +import qualified Data.Set as Set +import Unison.ConstructorReference (ConstructorReference) +import Unison.PatternMatchCoverage.Constraint +import Unison.PatternMatchCoverage.IntervalSet (IntervalSet) +import qualified Unison.PatternMatchCoverage.IntervalSet as IntervalSet +import qualified Unison.PatternMatchCoverage.PmLit as PmLit +import Unison.PatternMatchCoverage.UFMap (UFMap) +import qualified Unison.PatternMatchCoverage.UFMap as UFMap +import Unison.Prelude +import qualified Unison.PrettyPrintEnv as PPE +import qualified Unison.Syntax.TypePrinter as TypePrinter +import Unison.Type (Type, booleanRef, charRef, floatRef, intRef, listRef, natRef, textRef, pattern App', pattern Ref') +import Unison.Util.Pretty +import Unison.Var (Var) + +-- | Normalized refinement types (fig 6) +-- +-- Each variable may be associated with a number of constraints +-- represented by 'VarInfo'. A 'NormalizedConstraints' is conceptually +-- the conjunction of all constraints in the map. Disjunction is +-- represented by passing a Set of NormalizedConstraints. So, the +-- constraints are normalized into disjunctive normal form and each +-- @NormalizedConstraints@ is a DNF term. +-- +-- Additionally, the following invariants are enforced (Section 3.4) +-- +-- * Mutual compatibility: No two constraints should conflict with +-- each other. +-- +-- * Inhabitation: There must be at least one value that inhabits +-- each refinement type. (N.B. We only do a best effort enforcement of +-- this invariant, see 'inhabited' in +-- Unison.PatternMatchCoverage.NormalizedConstraints.Solve for +-- additional info) +-- +-- These invariants ensure that each term in our DNF has at least one +-- solution, and it is easy to expand and print these solutions. +data NormalizedConstraints vt v loc = NormalizedConstraints + { -- | Constraints keyed by the variable they constrain. Equality + -- constraints are handled by 'UFMap'. + constraintMap :: UFMap v (VarInfo vt v loc), + -- | dirty variables are ones that must be checked for inhabitance + dirtySet :: Set v + } + deriving stock (Eq, Ord, Show) + +-- | Mark a variable as requiring a new test for inhabitation. +markDirty :: + Ord v => + v -> + NormalizedConstraints vt v loc -> + NormalizedConstraints vt v loc +markDirty k nc@NormalizedConstraints {dirtySet} = + nc {dirtySet = Set.insert k dirtySet} + +dom :: NormalizedConstraints vt v loc -> [v] +dom NormalizedConstraints {constraintMap} = UFMap.keys constraintMap + +emptyNormalizedConstraints :: Ord v => NormalizedConstraints vt v loc +emptyNormalizedConstraints = + NormalizedConstraints + { constraintMap = UFMap.empty, + dirtySet = mempty + } + +expectCanon :: + forall vt v loc. + (Var v) => + v -> + NormalizedConstraints vt v loc -> + (v, VarInfo vt v loc, NormalizedConstraints vt v loc) +expectCanon k nc = + let ((v, vi), nc') = updateF k (\v vi -> ((v, vi), Ignore)) nc + in (v, vi, nc') + +-- | Alter a constraint, marks var as dirty if updated +alterF :: + forall vt v loc f. + (Var v, Functor f) => + v -> + f (ConstraintUpdate (VarInfo vt v loc)) -> + (v -> VarInfo vt v loc -> f (ConstraintUpdate (VarInfo vt v loc))) -> + NormalizedConstraints vt v loc -> + f (NormalizedConstraints vt v loc) +alterF v nothing just nc = + (\(f, x) -> f nc {constraintMap = x}) + <$> getCompose + ( UFMap.alterF + v + nothing' + just' + (constraintMap nc) + ) + where + just' canonK eqClassSize vi = + fmap (UFMap.Canonical eqClassSize) $ + Compose $ + just canonK vi <&> \case + Ignore -> (id, vi) + Update vi -> (markDirty canonK, vi) + nothing' = + Compose $ + nothing <&> \case + Ignore -> (id, Nothing) + Update x -> (markDirty v, Just x) +{-# INLINE alterF #-} + +updateF :: + forall vt v loc f. + (Var v, Functor f) => + v -> + (v -> VarInfo vt v loc -> f (ConstraintUpdate (VarInfo vt v loc))) -> + NormalizedConstraints vt v loc -> + f (NormalizedConstraints vt v loc) +updateF v just nc = + alterF v nothing just nc + where + nothing = error ("expected " <> show v <> " to be in UFMap") + +data ConstraintUpdate a + = Update a + | Ignore + deriving stock (Functor) + +declVar :: + forall vt v loc. + (Var v) => + v -> + Type vt loc -> + (VarInfo vt v loc -> VarInfo vt v loc) -> + NormalizedConstraints vt v loc -> + NormalizedConstraints vt v loc +declVar v t f nc@NormalizedConstraints {constraintMap} = + nc {constraintMap = UFMap.alter v nothing just constraintMap} + where + nothing = + let !vi = f (mkVarInfo v t) + in Just vi + just _ _ _ = error ("attempted to declare: " <> show v <> " but it already exists") + +mkVarInfo :: forall vt v loc. v -> Type vt loc -> VarInfo vt v loc +mkVarInfo v t = + VarInfo + { vi_id = v, + vi_typ = t, + vi_con = case t of + App' (Ref' r) t + | r == listRef -> Vc'ListRoot t Empty Empty (IntervalSet.singleton (0, maxBound)) + Ref' r + | r == booleanRef -> Vc'Boolean Nothing mempty + | r == intRef -> Vc'Int Nothing mempty + | r == natRef -> Vc'Nat Nothing mempty + | r == floatRef -> Vc'Float Nothing mempty + | r == textRef -> Vc'Text Nothing mempty + | r == charRef -> Vc'Char Nothing mempty + -- this may not be a constructor, but we won't be producing + -- any constraints for it in that case anyway + _ -> Vc'Constructor Nothing mempty, + vi_eff = IsNotEffectful + } + +data VarInfo vt v loc = VarInfo + { vi_id :: v, + vi_typ :: Type vt loc, + vi_con :: VarConstraints vt v loc, + vi_eff :: EffectInfo + } + deriving stock (Show, Eq, Ord, Generic) + +data VarConstraints vt v loc + = Vc'Constructor + (Maybe (ConstructorReference, [(v, Type vt loc)])) + (Set ConstructorReference) + | Vc'Boolean (Maybe Bool) (Set Bool) + | Vc'Int (Maybe Int64) (Set Int64) + | Vc'Nat (Maybe Word64) (Set Word64) + | Vc'Float (Maybe Double) (Set Double) + | Vc'Text (Maybe Text) (Set Text) + | Vc'Char (Maybe Char) (Set Char) + | -- | Vc'ListElem v (Either Int Int) + Vc'ListRoot + (Type vt loc) + -- ^ type of list elems + (Seq v) + -- ^ Positive constraint on cons elements + (Seq v) + -- ^ Positive constraint on snoc elements + IntervalSet + -- ^ positive constraint on input list size + deriving stock (Show, Eq, Ord, Generic) + +data EffectInfo + = IsEffectful + | IsNotEffectful + deriving stock (Show, Eq, Ord) + +prettyNormalizedConstraints :: forall vt v loc. (Var v, Var vt) => NormalizedConstraints vt v loc -> Pretty ColorText +prettyNormalizedConstraints (NormalizedConstraints {constraintMap}) = sep " " ["⟨", pconstraints, "⟩"] + where + cls = UFMap.toClasses constraintMap + + pconstraints = sep " " (intersperse "," $ prettyCon <$> cls) + prettyCon (kcanon, ks, vi) = + let posCon = fromMaybe [] $ case vi_con vi of + Vc'Constructor pos _neg -> + (\(datacon, convars) -> [PosCon kcanon datacon convars]) <$> pos + Vc'Boolean pos _neg -> + (\x -> [PosLit kcanon (PmLit.Boolean x)]) <$> pos + Vc'Int pos _neg -> + (\x -> [PosLit kcanon (PmLit.Int x)]) <$> pos + Vc'Nat pos _neg -> + (\x -> [PosLit kcanon (PmLit.Nat x)]) <$> pos + Vc'Float pos _neg -> + (\x -> [PosLit kcanon (PmLit.Float x)]) <$> pos + Vc'Text pos _neg -> + (\x -> [PosLit kcanon (PmLit.Text x)]) <$> pos + Vc'Char pos _neg -> + (\x -> [PosLit kcanon (PmLit.Char x)]) <$> pos + Vc'ListRoot _typ posCons posSnoc _iset -> + let consConstraints = fmap (\(i, x) -> PosListHead kcanon i x) (zip [0 ..] (toList posCons)) + snocConstraints = fmap (\(i, x) -> PosListTail kcanon i x) (zip [0 ..] (toList posSnoc)) + in Just (consConstraints ++ snocConstraints) + negConK :: forall x. Set x -> (v -> x -> Constraint vt v loc) -> [Constraint vt v loc] + negConK s f = foldr (\a b -> f kcanon a : b) [] s + negCon = case vi_con vi of + Vc'Constructor _pos neg -> negConK neg NegCon + Vc'Boolean _pos neg -> negConK neg (\v a -> NegLit v (PmLit.Boolean a)) + Vc'Int _pos neg -> negConK neg (\v a -> NegLit v (PmLit.Int a)) + Vc'Nat _pos neg -> negConK neg (\v a -> NegLit v (PmLit.Nat a)) + Vc'Float _pos neg -> negConK neg (\v a -> NegLit v (PmLit.Float a)) + Vc'Text _pos neg -> negConK neg (\v a -> NegLit v (PmLit.Text a)) + Vc'Char _pos neg -> negConK neg (\v a -> NegLit v (PmLit.Char a)) + Vc'ListRoot _typ _posCons _posSnoc iset -> [NegListInterval kcanon (IntervalSet.complement iset)] + botCon = case vi_eff vi of + IsNotEffectful -> [] + IsEffectful -> [Effectful kcanon] + in sep " " $ + pv kcanon : + fmap pv (Set.toList $ Set.delete kcanon ks) ++ [":", TypePrinter.pretty PPE.empty (vi_typ vi)] ++ ["|"] ++ [sep ", " $ fmap prettyConstraint (posCon ++ negCon ++ botCon)] + pv = string . show + +prettyDnf :: (Var v, Var vt) => Set (NormalizedConstraints vt v loc) -> Pretty ColorText +prettyDnf xs = sep " " ("{" : intersperse "," (prettyNormalizedConstraints <$> Set.toList xs) ++ ["}"]) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs new file mode 100644 index 000000000..8638c0c38 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs @@ -0,0 +1,64 @@ +module Unison.PatternMatchCoverage.PmGrd where + +import Unison.ConstructorReference (ConstructorReference) +import Unison.PatternMatchCoverage.PmLit (PmLit, prettyPmLit) +import qualified Unison.PrettyPrintEnv as PPE +import qualified Unison.Syntax.TypePrinter as TypePrinter +import Unison.Term (Term') +import Unison.Type (Type) +import Unison.Util.Pretty +import Unison.Var (Var) + +data + PmGrd + vt -- Type variable + v -- Term variable + loc -- annotation + = -- | @PmCon x Con xs ys@ corresponds to the constraint @Con ys <- x@ + PmCon + v + -- ^ Variable + ConstructorReference + -- ^ Constructor + [(v, Type vt loc)] + -- ^ Constructor argument values and types + | PmLit v PmLit + | PmListHead + v + -- ^ list root + Int + -- ^ cons position (0 is head) + v + -- ^ element variable + (Type vt loc) + -- ^ element type + | PmListTail + v + -- ^ list root + Int + -- ^ snoc position (0 is last) + v + -- ^ element variable + (Type vt loc) + -- ^ element type + | -- | The size of the list must fall within this inclusive range + PmListInterval v Int Int + | -- | If a guard performs an effect + PmBang v + | -- | @PmLet x expr@ corresponds to a @let x = expr@ guard. This actually + -- /binds/ @x@. + PmLet v (Term' vt v loc) (Type vt loc) + deriving stock (Show) + +prettyPmGrd :: (Var vt, Var v) => PmGrd vt v loc -> Pretty ColorText +prettyPmGrd = \case + PmCon var con convars -> + let xs = string (show con) : (formatConVar <$> convars) ++ ["<-", string (show var)] + formatConVar (v, t) = sep " " ["(", string (show v), "::", TypePrinter.pretty PPE.empty t, ")"] + in sep " " xs + PmListHead var n el _ -> sep " " ["Cons", string (show n), string (show el), "<-", string (show var)] + PmListTail var n el _ -> sep " " ["Snoc", string (show n), string (show el), "<-", string (show var)] + PmListInterval var minLen maxLen -> sep " " ["Interval", string (show (minLen, maxLen)), "<-", string (show var)] + PmLit var lit -> sep " " [prettyPmLit lit, "<-", string (show var)] + PmBang v -> "!" <> string (show v) + PmLet v _expr _ -> sep " " ["let", string (show v), "=", ""] diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs new file mode 100644 index 000000000..42ec9389f --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs @@ -0,0 +1,23 @@ +module Unison.PatternMatchCoverage.PmLit where + +import Unison.Prelude +import Unison.Util.Pretty (Pretty, string) + +data PmLit + = Int Int64 + | Nat Word64 + | Boolean Bool + | Float Double + | Text Text + | Char Char + deriving stock (Show, Eq, Ord) + +prettyPmLit :: IsString s => PmLit -> Pretty s +prettyPmLit = + string . \case + Int x -> show x + Nat x -> show x + Boolean x -> show x + Float x -> show x + Text x -> show x + Char x -> show x diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs new file mode 100644 index 000000000..8134aa5b7 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs @@ -0,0 +1,930 @@ +{-# LANGUAGE DataKinds #-} + +module Unison.PatternMatchCoverage.Solve where + +import Control.Monad.State +import Control.Monad.Trans.Compose +import Control.Monad.Trans.Maybe +import Data.Foldable +import Data.Function +import Data.Functor +import Data.Functor.Compose +import Data.List.NonEmpty (NonEmpty (..)) +import qualified Data.Sequence as Seq +import qualified Data.Set as Set +import Unison.ConstructorReference (ConstructorReference) +import Unison.Pattern (Pattern) +import qualified Unison.Pattern as Pattern +import Unison.PatternMatchCoverage.Class +import Unison.PatternMatchCoverage.Constraint (Constraint) +import qualified Unison.PatternMatchCoverage.Constraint as C +import Unison.PatternMatchCoverage.Fix +import Unison.PatternMatchCoverage.GrdTree +import Unison.PatternMatchCoverage.IntervalSet (IntervalSet) +import qualified Unison.PatternMatchCoverage.IntervalSet as IntervalSet +import Unison.PatternMatchCoverage.ListPat +import Unison.PatternMatchCoverage.Literal +import Unison.PatternMatchCoverage.NormalizedConstraints +import Unison.PatternMatchCoverage.PmGrd +import Unison.PatternMatchCoverage.PmLit (PmLit) +import qualified Unison.PatternMatchCoverage.PmLit as PmLit +import qualified Unison.PatternMatchCoverage.UFMap as UFMap +import Unison.Prelude +import Unison.Type (Type) +import qualified Unison.Util.Pretty as P +import Unison.Var (Var) + +-- | top-down traversal of the 'GrdTree' that produces: +-- +-- * a refinement type for values that do not match the 'GrdTree' +-- * a new 'GrdTree' annotated with refinement types at the nodes for +-- values that cause an effect to be performed and values that match +-- the case at the leaves. +-- +-- If the former is inhabited then its inhabitants are unmatched +-- values. If the leaves of the latter are inhabited then the case is +-- redundant. +uncoverAnnotate :: + forall vt v loc m l. + Pmc vt v loc m => + Set (NormalizedConstraints vt v loc) -> + GrdTree (PmGrd vt v loc) l -> + ( m + ( Set (NormalizedConstraints vt v loc), + GrdTree (Set (NormalizedConstraints vt v loc)) (Set (NormalizedConstraints vt v loc), l) + ) + ) +uncoverAnnotate z grdtree0 = cata phi grdtree0 z + where + phi = \case + -- There is no way to fail matching a leaf, return the empty set + -- to represent false. + LeafF l -> \nc -> pure (Set.empty, Leaf (nc, l)) + ForkF (kinit :| ks) -> \nc0 -> do + -- depth-first fold in match-case order to acculate the + -- constraints for a match failure at every case. + (nc1, t1) <- kinit nc0 + (ncfinal, ts) <- foldlM (\(nc, ts) a -> a nc >>= \(nc', t) -> pure (nc', t : ts)) (nc1, []) ks + pure (ncfinal, Fork (t1 :| reverse ts)) + GrdF grd k -> \nc0 -> case grd of + PmCon var con convars -> do + handleGrd (PosCon var con convars) (NegCon var con) k nc0 + PmLit var lit -> do + handleGrd (PosLit var lit) (NegLit var lit) k nc0 + PmListHead listVar n el elt -> do + nc <- addLiteral' nc0 (PosListHead listVar n el elt) + k nc + PmListTail listVar n el elt -> do + nc <- addLiteral' nc0 (PosListTail listVar n el elt) + k nc + PmListInterval listVar lb ub -> do + let iset = IntervalSet.singleton (lb, ub) + handleGrd (NegListInterval listVar (IntervalSet.complement iset)) (NegListInterval listVar iset) k nc0 + -- (ncmatch, t) <- k nc0 + -- ncNoMatch <- addLiteral' nc0 (NegListInterval listVar miset) + -- -- todo: limit size + -- pure (Set.union ncMatch ncNoMatch, t) + -- PmList var listPat mi convars -> + -- let miset = IntervalSet.singleton mi + -- in handleGrd (PosList var listPat miset convars) (NegList var miset) k nc0 + PmBang var -> do + (ncCont, t) <- k nc0 + ncEff <- addLiteral' nc0 (Effectful var) + let t' = Grd ncEff t + pure (ncCont, t') + PmLet var expr typ -> do + nc <- addLiteral' nc0 (Let var expr typ) + k nc + + -- Constructors and literals are handled uniformly except that + -- they pass different positive and negative literals. + handleGrd pos neg k nc0 = do + ncNoMatch <- addLiteral' nc0 neg + ncMatch <- addLiteral' nc0 pos + (ncMatch, t) <- k ncMatch + -- A match can fail bacause it fails to match the immediate + -- pattern or it can match the immediate pattern but fail to + -- match some pattern or guard defined later in this same case. + -- + -- This split can lead to an exponential number of terms, so we + -- limit this growth to a constant, conservatively + -- approximating. This is known as "throttling" in the paper and + -- described in section 5.2. + let ncFinalCandidate = Set.union ncMatch ncNoMatch + ncFinal = case Set.size ncFinalCandidate >= 30 of + True -> nc0 + False -> ncFinalCandidate + pure (ncFinal, t) + + -- Add a literal to each term in our DNF, dropping terms that + -- become contradictory + addLiteral' :: + Set (NormalizedConstraints vt v loc) -> + Literal vt v loc -> + m (Set (NormalizedConstraints vt v loc)) + addLiteral' ncs0 lit = foldlM phi Set.empty ncs0 + where + phi ncs nc = + addLiteral lit nc <&> \case + Nothing -> ncs + Just nc -> Set.insert nc ncs + +-- | Collect accessible, inaccessible, and redundant GRHSs +classify :: + forall vt v loc l. + GrdTree (Set (NormalizedConstraints vt v loc)) (Set (NormalizedConstraints vt v loc), l) -> + ([l], [l], [l]) +classify = cata classifyAlg + +classifyAlg :: + forall vt v loc l. + GrdTreeF (Set (NormalizedConstraints vt v loc)) (Set (NormalizedConstraints vt v loc), l) ([l], [l], [l]) -> + ([l], [l], [l]) +classifyAlg = \case + LeafF (rt, l) -> + case inh rt of + True -> ([l], [], []) + False -> ([], [], [l]) + GrdF rt rest -> + case inh rt of + True -> + -- The rest of the subtree is redundant, but an effect is + -- performed. Classify this as "Inaccessible". + case rest of + ([], [], x : xs) -> ([], [x], xs) + _ -> rest + False -> rest + ForkF xs -> foldr (\(a, b, c) ~(acc, inacc, redun) -> (a ++ acc, b ++ inacc, c ++ redun)) ([], [], []) xs + where + -- inhabitation check + inh = not . Set.null + +-- | Expand a full DNF term (i.e. each term identifies one and only +-- one solution) into a pattern. +expand :: + forall vt v loc. + Var v => + v -> + NormalizedConstraints vt v loc -> + Pattern () +expand x nc = + let (_xcanon, xvi, nc') = expectCanon x nc + in case vi_con xvi of + Vc'Constructor pos _neg -> case pos of + Nothing -> Pattern.Unbound () + Just (dc, convars) -> + Pattern.Constructor () dc (map (\(v, _) -> expand v nc') convars) + Vc'Boolean pos _neg -> case pos of + Nothing -> Pattern.Unbound () + Just b -> Pattern.Boolean () b + Vc'ListRoot _typ consPos snocPos intset -> + let matchedLength = on (+) length consPos snocPos + mmaxLength = IntervalSet.lookupMax intset + matchIsIncomplete = case mmaxLength of + Nothing -> True + Just maxLength -> matchedLength < maxLength + rootPat = case matchIsIncomplete of + True -> Pattern.Unbound () + False -> Pattern.SequenceLiteral () [] + snoced = foldr (\a b -> Pattern.SequenceOp () b Pattern.Snoc (expand a nc')) rootPat snocPos + consed = foldr (\a b -> Pattern.SequenceOp () (expand a nc') Pattern.Cons b) snoced consPos + in consed + _ -> Pattern.Unbound () + +-- | Expand the given variable into inhabited patterns. This is done +-- as a final step on the refinement type unmatched terms (see +-- 'uncoverAnnotate'). +generateInhabitants :: (Pmc vt v loc m) => v -> Set (NormalizedConstraints vt v loc) -> m [Pattern ()] +generateInhabitants v ncs = do + sols <- concat . fmap toList <$> traverse (expandSolution v) (toList ncs) + pure $ map (expand v) sols + +-- | Instantiate a variable to a given constructor. +instantiate :: + forall vt v loc x m. + (Pmc vt v loc m) => + Fuel -> + NormalizedConstraints vt v loc -> + v -> + -- | constructor + x -> + -- | type of datacon's args + [Type vt loc] -> + -- | produce positive constraint + (v -> x -> [(v, Type vt loc)] -> [Constraint vt v loc]) -> + m (Maybe (NormalizedConstraints vt v loc, [(v, Type vt loc)])) +instantiate fuel nc x c argTyps posConstraint = do + -- todo: centralize this declVar logic. Currently in 'addLiteral' and here. + newVars :: [(var, typ)] <- traverse (\t -> (,t) <$> fresh) argTyps + let nc' = foldr (\(v, t) b -> declVar v t id b) nc newVars + cons = posConstraint x c newVars + mnc <- runMaybeT do + nc <- MaybeT (addConstraints cons nc') + -- mark all new fields as dirty as we need to ensure they are + -- inhabited + let nc' = foldr (\(v, _) b -> markDirty v b) nc newVars + -- branching factor + let newFuel = case length newVars > 1 of + True -> min fuel 3 + False -> fuel + -- we must ensure that all strict fields are inhabited + MaybeT (ensureInhabited newFuel nc') + pure ((\x -> (x, newVars)) <$> mnc) + +-- | Given a variable and a term in DNF, expand it to an identical DNF +-- expression with enough positive info to print pattern suggestions. +expandSolution :: + forall vt v loc m. + Pmc vt v loc m => + v -> + NormalizedConstraints vt v loc -> + m (Set (NormalizedConstraints vt v loc)) +expandSolution x nc = + let go fuel x nc + -- If we run out of fuel conservatively assume the term is + -- inhabited. + | fuel == 0 = pure (Set.singleton nc) + | otherwise = + let (_xcanon, xvi, nc') = expectCanon x nc + in withConstructors (pure (Set.singleton nc')) xvi \cs posConstraint _negConstraint -> + -- We have some constructors to attempt + -- instantiation with. Instantiate each one, if + -- doesn't lead to a contradiction then add it to + -- the set of valid solutions. + let phi (cref, cvt) = do + instantiate initFuel nc' x cref cvt posConstraint >>= \case + Nothing -> pure Set.empty -- contradiction + Just (nc'', newVars) -> case newVars of + [] -> pure (Set.singleton nc'') + _ -> + -- If we have the match expression: + -- @ + -- match blerg : Maybe (Maybe ()) with + -- Nothing -> () + -- Just Nothing -> () + -- @ + -- + -- Then we would like to suggest @Just (Just _)@ rather than @Just _@. + -- To accomplish this, we recurse and expand variables for which we have + -- negative information. + + -- branching factor + let newFuel = case length newVars > 1 of + True -> min fuel 3 + False -> fuel + in Set.fromList + <$> foldlM + ( \b (v, _t) -> + Set.toList . Set.unions + <$> traverse + ( \nc -> + case expectCanon v nc of + (_vc, vi, nc') -> case vi_con vi of + Vc'Constructor _pos neg + | not (Set.null neg) -> go (newFuel - 1) v nc' + Vc'Boolean _pos neg + | not (Set.null neg) -> go (newFuel - 1) v nc' + Vc'ListRoot _typ _posCons _posSnoc neg + | not (IntervalSet.singleton (0, maxBound) == neg) -> go (newFuel - 1) v nc' + _ -> pure (Set.singleton nc') + ) + b + ) + [nc''] + newVars + in foldr (\a b s -> phi a >>= \a' -> b (Set.union a' s)) pure cs Set.empty + in go initFuel x nc + +withConstructors :: + forall vt v loc r m. + Pmc vt v loc m => + m r -> + VarInfo vt v loc -> + ( forall x. + [(x, [Type vt loc])] -> + (v -> x -> [(v, Type vt loc)] -> [Constraint vt v loc]) -> + (v -> x -> Constraint vt v loc) -> + m r + ) -> + m r +withConstructors nil vinfo k = do + getConstructors typ >>= \case + ConstructorType cs -> do + arg <- for cs \(v, cref, _) -> do + cvts <- getConstructorVarTypes typ cref + pure ((v, cref), cvts) + k arg (\v (_, cref) args -> [C.PosCon v cref args]) (\v (_, cref) -> C.NegCon v cref) + SequenceType _cs -> + let Vc'ListRoot elemType consPos snocPos iset = case vi_con vinfo of + Vc'ListRoot {} -> vi_con vinfo + _ -> error "impossible: constraint for sequence type not a list root" + varCount = length consPos + length snocPos + minLen = fromMaybe 0 $ IntervalSet.lookupMin iset + + mkPosCons :: (Int -> [v] -> [Constraint vt v loc]) -> Int -> [v] -> [Constraint vt v loc] + mkPosCons z elvs0 = foldr (\_ b n (elv : elvs) -> C.PosListHead v n elv : b (n + 1) elvs) z consPos elvs0 + + mkPosSnoc :: (Int -> [v] -> [Constraint vt v loc]) -> Int -> [v] -> [Constraint vt v loc] + mkPosSnoc z elvs0 = foldr (\_ b n (elv : elvs) -> C.PosListTail v n elv : b (n + 1) elvs) z snocPos elvs0 + + constraints :: [(([(v, Type vt loc)] -> [Constraint vt v loc], Constraint vt v loc), [Type vt loc])] + constraints = + let mk f elvs = mkPosCons (\_ elvs -> mkPosSnoc (\_ elvs -> f elvs) 0 elvs) 0 (map fst elvs) + in [ ((mk \[] -> [], C.NegListInterval v (IntervalSet.singleton (minLen, maxBound))), replicate varCount elemType) + ] + + mkPos _v (pos, _neg) args = + pos args + mkNeg _v (_pos, neg) = + neg + in k constraints mkPos mkNeg + BooleanType -> do + k [(True, []), (False, [])] (\v b _ -> [C.PosLit v (PmLit.Boolean b)]) (\v b -> C.NegLit v (PmLit.Boolean b)) + OtherType -> nil + where + typ = vi_typ vinfo + v = vi_id vinfo + +mkMatchingInterval :: ListPat -> IntervalSet +mkMatchingInterval = \case + Cons -> IntervalSet.singleton (1, maxBound) + Snoc -> IntervalSet.singleton (1, maxBound) + Nil -> IntervalSet.singleton (0, 0) + +-- | Test that the given variable is inhabited. This test is +-- undecidable in general so we adopt a fuel based approach as +-- described in section 3.7. +inhabited :: + forall vt v loc m. + Pmc vt v loc m => + Fuel -> + v -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +inhabited fuel x nc0 = + let (_xcanon, xvi, nc') = expectCanon x nc0 + in withConstructors (pure (Just nc')) xvi \cs posConstraint negConstraint -> + -- one of the constructors must be inhabited, Return the + -- first non-contradictory instantiation. + let phi (cref, cvt) b nc = do + instantiate fuel nc x cref cvt posConstraint >>= \case + Nothing -> do + -- record failed instantiation attempt so we don't + -- attempt to instantiate this constructor again + addConstraint (negConstraint x cref) nc >>= \case + Nothing -> b nc + Just nc -> b nc + Just _ -> pure (Just nc) + in foldr phi (\_ -> pure Nothing) cs nc' + +newtype Fuel = Fuel Int + deriving newtype (Show, Eq, Ord, Enum, Bounded, Num) + +initFuel :: Fuel +initFuel = 8 + +-- | Check that all variables marked dirty are inhabited. +ensureInhabited :: + forall vt v loc m. + Pmc vt v loc m => + Fuel -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +ensureInhabited fuel nc0@NormalizedConstraints {dirtySet} + | fuel == 0 = pure (Just clean) -- out of fuel, assume inhabited + | otherwise = do + -- all dirty vars must be inhabited or this NormalizedConstraints + -- is dropped + let phi dirtyVar b nc = do + nc <- MaybeT (inhabited (fuel - 1) dirtyVar nc) + b nc + in runMaybeT (foldr phi pure dirtySet clean) + where + clean = nc0 {dirtySet = mempty} + +-- | Add a formula literal to our normalized constraint set. This +-- corresponds to fig 7. +addLiteral :: + forall vt v loc m. + (Pmc vt v loc m) => + Literal vt v loc -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +addLiteral lit0 nabla0 = runMaybeT do + nc <- MaybeT $ case lit0 of + F -> pure Nothing + T -> pure (Just nabla0) + PosCon var datacon convars -> + let ctx = foldr (\(trm, typ) b -> declVar trm typ id b) nabla0 convars + c = C.PosCon var datacon convars + in addConstraint c ctx + NegCon var datacon -> addConstraint (C.NegCon var datacon) nabla0 + PosLit var lit -> addConstraint (C.PosLit var lit) nabla0 + NegLit var lit -> addConstraint (C.NegLit var lit) nabla0 + PosListHead listRoot n listElem listElemType -> do + let nabla1 = declVar listElem listElemType id nabla0 + c = C.PosListHead listRoot n listElem + addConstraint c nabla1 + PosListTail listRoot n listElem listElemType -> do + let nabla1 = declVar listElem listElemType id nabla0 + c = C.PosListTail listRoot n listElem + addConstraint c nabla1 + NegListInterval listVar iset -> addConstraint (C.NegListInterval listVar iset) nabla0 + Effectful var -> addConstraint (C.Effectful var) nabla0 + Let var _expr typ -> pure (Just (declVar var typ id nabla0)) + MaybeT (ensureInhabited initFuel nc) + +insertVarInfo :: + forall vt v loc. + Ord v => + v -> + VarInfo vt v loc -> + NormalizedConstraints vt v loc -> + NormalizedConstraints vt v loc +insertVarInfo k v nc@NormalizedConstraints {constraintMap} = + nc {constraintMap = UFMap.insert k v constraintMap} + +-- | Add a constraint to our normalized constraint set. This +-- corresponds to fig 7. +addConstraint :: + forall vt v loc m. + (Pmc vt v loc m) => + Constraint vt v loc -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +addConstraint con0 nc = + debugConstraint <$> case con0 of + C.PosLit var pmlit -> + let updateLiteral pos neg lit + | Just lit1 <- pos, + lit1 == lit = case lit1 == lit of + -- we already have this positive constraint + True -> (pure (), Ignore) + -- contradicts positive info + False -> (contradiction, Ignore) + -- the constraint contradicts negative info + | Set.member lit neg = (contradiction, Ignore) + | otherwise = (pure (), Update (Just lit, neg)) + in modifyLiteralC var pmlit updateLiteral nc + C.NegLit var pmlit -> + let updateLiteral pos neg lit + -- the constraint contradicts positive info + | Just lit1 <- pos, lit1 == lit = (contradiction, Ignore) + -- we already have this negative constraint + | Set.member lit neg = (pure (), Ignore) + | otherwise = (pure (), Update (pos, Set.insert lit neg)) + in modifyLiteralC var pmlit updateLiteral nc + C.NegListInterval var negMatchInterval -> + let updateList _typ pCons pSnoc posMatchInterval + -- No lengths are accepted + | IntervalSet.null newMatchInterval = (contradiction, Ignore) + -- This length constraint forces equating some cons and snoc matches + | let unconflictedLen = length pCons + length pSnoc, + Just maxLen <- IntervalSet.lookupMax newMatchInterval, + maxLen < unconflictedLen = + let varsToEquate = unconflictedLen - maxLen + (newPSnoc, vars) = + let (_as, bs) = Seq.splitAt (length pCons - varsToEquate) pCons + (cs, ds) = Seq.splitAt (length pSnoc - varsToEquate) pSnoc + in (cs, zip (toList bs) (toList ds)) + in (equate vars, Update (pCons, newPSnoc, newMatchInterval)) + | otherwise = + (populateCons var pCons newMatchInterval, Update (pCons, pSnoc, newMatchInterval)) + where + newMatchInterval = IntervalSet.difference posMatchInterval negMatchInterval + in modifyListC var updateList nc + C.PosListHead r n e -> + let updateList _elmType posCons posSnocs iset + -- there is an existing positive constraint on this element + | Just existingElemVar <- Seq.lookup n posCons = (equate [(e, existingElemVar)], Ignore) + -- a list of this length is proscribed + | let minPatLen = length posCons + 1, + Just maxLen <- IntervalSet.lookupMax iset, + maxLen < minPatLen = + (contradiction, Ignore) + -- the length constraint forces us to equate some cons and snoc patterns + | let unconflictedLen = length posCons + length posSnocs + 1, + Just maxLen <- IntervalSet.lookupMax iset, + maxLen < unconflictedLen = + let posCons' = posCons Seq.|> e + e' = Seq.index posSnocs (maxLen - length posCons') + in (equate [(e, e')], Update (posCons', posSnocs, iset)) + | otherwise = + let posCons' = posCons Seq.|> e + iset' = IntervalSet.delete (0, length posCons' - 1) iset + in (pure (), Update (posCons', posSnocs, iset')) + in modifyListC r updateList nc + C.PosListTail r n e -> + let updateList _elmType posCons posSnoc iset + -- there is an existing positive constraint on this element + | Just existingElemVar <- Seq.lookup n posSnoc = (equate [(e, existingElemVar)], Ignore) + -- a list of this length is proscribed + | let minPatLen = length posSnoc + 1, + Just maxLen <- IntervalSet.lookupMax iset, + maxLen < minPatLen = + (contradiction, Ignore) + -- the length constraint forces us to equate some cons and snoc patterns + | let unconflictedLen = length posCons + length posSnoc + 1, + Just maxLen <- IntervalSet.lookupMax iset, + maxLen < unconflictedLen = + let posSnoc' = posSnoc Seq.|> e + e' = Seq.index posCons (maxLen - length posSnoc') + in (equate [(e, e')], Update (posCons, posSnoc', iset)) + | otherwise = + let posSnoc' = posSnoc Seq.|> e + iset' = IntervalSet.delete (0, length posSnoc' - 1) iset + in (populateCons r posCons iset', Update (posCons, posSnoc', iset')) + in modifyListC r updateList nc + C.PosCon var datacon convars -> + let updateConstructor pos neg + | Just (datacon1, convars1) <- pos = case datacon == datacon1 of + True -> do + -- we already have an assertion, so equate convars + let varsToEquate = zipWith (\(y, _) (z, _) -> (y, z)) convars convars1 + (equate varsToEquate, Ignore) + False -> (contradiction, Ignore) + -- contradicts negative info + | True <- Set.member datacon neg = (contradiction, Ignore) + | otherwise = + -- no conflicting info, add constraint + (pure (), Update (Just (datacon, convars), neg)) + in modifyConstructorC var updateConstructor nc -- runC nc (put =<< modifyConstructor var updateConstructor =<< get) + C.NegCon var datacon -> + let updateConstructor pos neg + -- contradicts positive info + | Just (datacon1, _) <- pos, datacon1 == datacon = (contradiction, Ignore) + -- we already have this negative constraint + | Set.member datacon neg = (pure (), Ignore) + | otherwise = (pure (), Update (pos, Set.insert datacon neg)) + in modifyConstructorC var updateConstructor nc + C.Effectful var -> + case expectCanon var nc of + (var, vi, nc) + | otherwise -> pure $ Just $ insertVarInfo var vi {vi_eff = IsEffectful} nc + C.Eq x y -> union x y nc + where + debugConstraint x = + let debugOutput = + P.sep + "\n" + [ P.hang (P.red "input constraints: ") (prettyNormalizedConstraints nc), + P.hang (P.yellow "additional constraint: ") (C.prettyConstraint con0), + P.hang (P.green "resulting constraint: ") (maybe "contradiction" prettyNormalizedConstraints x), + "" + ] + in if False then trace (P.toAnsiUnbroken debugOutput) x else x + +-- | Like 'addConstraint', but for a list of constraints +addConstraints :: + forall vt v loc m. + (Pmc vt v loc m) => + [Constraint vt v loc] -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +addConstraints cs nc0 = runMaybeT $ foldlM (\b a -> MaybeT (addConstraint a b)) nc0 cs + +-- | Equate two variables +union :: + forall vt v loc m. + (Pmc vt v loc m) => + v -> + v -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +union v0 v1 nc@NormalizedConstraints {constraintMap} = + UFMap.union v0 v1 constraintMap \chosenCanon nonCanonValue m -> + -- In this block we want to collect the constraints from the + -- non-canonical value and add them to the canonical value. + + -- literals are handled uniformly + let handleLit :: forall x. (x -> PmLit) -> Maybe x -> Set x -> ([Constraint vt v loc], [Constraint vt v loc]) + handleLit toPmLit pos neg = + let posC = case pos of + Nothing -> [] + Just lit -> [C.PosLit chosenCanon (toPmLit lit)] + negC = foldr (\a b -> C.NegLit chosenCanon (toPmLit a) : b) [] neg + in (posC, negC) + constraints = posCon ++ negCon ++ effCon + (posCon, negCon) = case vi_con nonCanonValue of + Vc'Constructor pos neg -> + let posC = case pos of + Nothing -> [] + Just (datacon, convars) -> [C.PosCon chosenCanon datacon convars] + negC = foldr (\a b -> C.NegCon chosenCanon a : b) [] neg + in (posC, negC) + Vc'ListRoot _typ posCons posSnoc iset -> + let consConstraints = map (\(i, x) -> C.PosListHead chosenCanon i x) (zip [0 ..] (toList posCons)) + snocConstraints = map (\(i, x) -> C.PosListTail chosenCanon i x) (zip [0 ..] (toList posSnoc)) + neg = [C.NegListInterval chosenCanon (IntervalSet.complement iset)] + in (consConstraints ++ snocConstraints, neg) + Vc'Boolean pos neg -> handleLit PmLit.Boolean pos neg + Vc'Int pos neg -> handleLit PmLit.Int pos neg + Vc'Nat pos neg -> handleLit PmLit.Nat pos neg + Vc'Float pos neg -> handleLit PmLit.Float pos neg + Vc'Text pos neg -> handleLit PmLit.Text pos neg + Vc'Char pos neg -> handleLit PmLit.Char pos neg + effCon = case vi_eff nonCanonValue of + IsNotEffectful -> [] + IsEffectful -> [C.Effectful chosenCanon] + in addConstraints constraints nc {constraintMap = m} + +modifyList :: + forall vt v loc. + (Var v) => + v -> + ( Type vt loc -> + Seq v -> + Seq v -> + IntervalSet -> + ConstraintUpdate (Seq v, Seq v, IntervalSet) + ) -> + NormalizedConstraints vt v loc -> + NormalizedConstraints vt v loc +modifyList v f nc = runIdentity $ modifyListF v (\a b c d -> Identity (f a b c d)) nc + +modifyListC :: + forall vt v loc m. + (Pmc vt v loc m) => + v -> + ( Type vt loc -> + Seq v -> + Seq v -> + IntervalSet -> + (C vt v loc m (), ConstraintUpdate (Seq v, Seq v, IntervalSet)) + ) -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +modifyListC v f nc0 = + let (ccomp, nc1) = modifyListF v f nc0 + in fmap snd <$> runC nc1 ccomp + +modifyListF :: + forall vt v loc f. + (Var v, Functor f) => + v -> + ( Type vt loc -> + Seq v -> + Seq v -> + IntervalSet -> + f (ConstraintUpdate (Seq v, Seq v, IntervalSet)) + ) -> + NormalizedConstraints vt v loc -> + f (NormalizedConstraints vt v loc) +modifyListF v f nc = + let g vc = getCompose (posAndNegList (\typ pcons psnoc iset -> Compose (f typ pcons psnoc iset)) vc) + in modifyVarConstraints v g nc + +modifyConstructor :: + forall vt v loc. + (Var v) => + v -> + ( (Maybe (ConstructorReference, [(v, Type vt loc)])) -> + Set ConstructorReference -> + (ConstraintUpdate (Maybe (ConstructorReference, [(v, Type vt loc)]), Set ConstructorReference)) + ) -> + NormalizedConstraints vt v loc -> + NormalizedConstraints vt v loc +modifyConstructor v f nc = runIdentity $ modifyConstructorF v (\a b -> Identity (f a b)) nc + +modifyConstructorC :: + forall vt v loc m. + Pmc vt v loc m => + v -> + ( (Maybe (ConstructorReference, [(v, Type vt loc)])) -> + Set ConstructorReference -> + (C vt v loc m (), ConstraintUpdate (Maybe (ConstructorReference, [(v, Type vt loc)]), Set ConstructorReference)) + ) -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +modifyConstructorC v f nc0 = + let (ccomp, nc1) = modifyConstructorF v f nc0 + in fmap snd <$> runC nc1 ccomp + +modifyConstructorF :: + forall vt v loc f. + (Var v, Functor f) => + v -> + ( (Maybe (ConstructorReference, [(v, Type vt loc)])) -> + Set ConstructorReference -> + f (ConstraintUpdate (Maybe (ConstructorReference, [(v, Type vt loc)]), Set ConstructorReference)) + ) -> + NormalizedConstraints vt v loc -> + f (NormalizedConstraints vt v loc) +modifyConstructorF v f nc = + let g vc = getCompose (posAndNegConstructor (\pos neg -> Compose (f pos neg)) vc) + in modifyVarConstraints v g nc + +modifyLiteral :: + forall vt v loc. + (Var v) => + v -> + PmLit -> + ( forall a. + (Ord a) => + -- positive info + Maybe a -> + -- negative info + Set a -> + -- the passed in PmLit, unpacked + a -> + ConstraintUpdate (Maybe a, Set a) + ) -> + NormalizedConstraints vt v loc -> + NormalizedConstraints vt v loc +modifyLiteral v lit f nc = runIdentity $ modifyLiteralF v lit (\a b c -> Identity (f a b c)) nc + +modifyLiteralC :: + forall vt v loc m. + (Pmc vt v loc m) => + v -> + PmLit -> + ( forall a. + (Ord a) => + -- positive info + Maybe a -> + -- negative info + Set a -> + -- the passed in PmLit, unpacked + a -> + (C vt v loc m (), ConstraintUpdate (Maybe a, Set a)) + ) -> + NormalizedConstraints vt v loc -> + m (Maybe (NormalizedConstraints vt v loc)) +modifyLiteralC v lit f nc0 = + let (ccomp, nc1) = modifyLiteralF v lit f nc0 + in fmap snd <$> runC nc1 ccomp + +-- | Update constraints on some literal by only depending on their Ord +-- instance. +modifyLiteralF :: + forall vt v loc f. + (Var v, Functor f) => + v -> + PmLit -> + ( forall a. + (Ord a) => + -- positive info + Maybe a -> + -- negative info + Set a -> + -- the passed in PmLit, unpacked + a -> + f (ConstraintUpdate (Maybe a, Set a)) + ) -> + NormalizedConstraints vt v loc -> + f (NormalizedConstraints vt v loc) +modifyLiteralF v lit f nc = + let g vc = getCompose (posAndNegLiteral (\pos neg candidate -> Compose (f pos neg candidate)) lit vc) + in modifyVarConstraints v g nc + +modifyVarConstraints :: + forall vt v loc f. + (Var v, Functor f) => + v -> + ( VarConstraints vt v loc -> + f (ConstraintUpdate (VarConstraints vt v loc)) + ) -> + NormalizedConstraints vt v loc -> + -- | applied to 'Vc'Constructor' + f (NormalizedConstraints vt v loc) +modifyVarConstraints v updateVarConstraint nc0 = do + updateF v (\_v vi -> fmap (\vc -> vi {vi_con = vc}) <$> updateVarConstraint (vi_con vi)) nc0 +{-# INLINE modifyVarConstraints #-} + +-- | Modify the positive and negative constraints of a constructor. +posAndNegConstructor :: + forall f vt v loc. + Functor f => + ( (Maybe (ConstructorReference, [(v, Type vt loc)])) -> + Set ConstructorReference -> + f (Maybe (ConstructorReference, [(v, Type vt loc)]), Set ConstructorReference) + ) -> + VarConstraints vt v loc -> + f (VarConstraints vt v loc) +posAndNegConstructor f = \case + Vc'Constructor pos neg -> uncurry Vc'Constructor <$> f pos neg + _ -> error "impossible: posAndNegConstructor called on a literal" +{-# INLINE posAndNegConstructor #-} + +-- | Modify the positive and negative constraints in a way that +-- doesn't rely upon the particular literal type, but only on it being +-- an instance of Ord. +posAndNegLiteral :: + forall f vt v loc. + Functor f => + ( forall a. + (Ord a) => + Maybe a -> + Set a -> + a -> + f (Maybe a, Set a) + ) -> + PmLit -> + VarConstraints vt v loc -> + f (VarConstraints vt v loc) +posAndNegLiteral f lit = \case + Vc'Boolean pos neg + | PmLit.Boolean b <- lit -> uncurry Vc'Boolean <$> f pos neg b + Vc'Int pos neg + | PmLit.Int b <- lit -> uncurry Vc'Int <$> f pos neg b + Vc'Nat pos neg + | PmLit.Nat b <- lit -> uncurry Vc'Nat <$> f pos neg b + Vc'Float pos neg + | PmLit.Float b <- lit -> uncurry Vc'Float <$> f pos neg b + Vc'Text pos neg + | PmLit.Text b <- lit -> uncurry Vc'Text <$> f pos neg b + Vc'Char pos neg + | PmLit.Char b <- lit -> uncurry Vc'Char <$> f pos neg b + Vc'Constructor _ _ -> error "impossible: posAndNegLiteral called on constructor" + _ -> error "impossible: incompatible PmLit and VarConstraints types" +{-# INLINE posAndNegLiteral #-} + +posAndNegList :: + forall f vt v loc. + Functor f => + ( Type vt loc -> + Seq v -> + Seq v -> + IntervalSet -> + f (Seq v, Seq v, IntervalSet) + ) -> + VarConstraints vt v loc -> + f (VarConstraints vt v loc) +posAndNegList f = \case + Vc'ListRoot typ posCons posSnocs iset -> (\(posCons, posSnocs, iset) -> Vc'ListRoot typ posCons posSnocs iset) <$> f typ posCons posSnocs iset + _ -> error "impossible: posAndNegList called on a something that isn't a list" +{-# INLINE posAndNegList #-} + +newtype C vt v loc m a = C + { unC :: + NormalizedConstraints vt v loc -> + m (Maybe (a, NormalizedConstraints vt v loc)) + } + deriving + (Functor, Applicative, Monad, MonadState (NormalizedConstraints vt v loc)) + via StateT (NormalizedConstraints vt v loc) (MaybeT m) + deriving (MonadTrans) via ComposeT (StateT (NormalizedConstraints vt v loc)) MaybeT + +contradiction :: Applicative m => C vt v loc m a +contradiction = C \_ -> pure Nothing + +update :: Pmc vt v loc m => v -> VarConstraints vt v loc -> C vt v loc m () +update v vc = do + nc0 <- get + let (var, vi, nc1) = expectCanon v nc0 + nc2 = markDirty var ((insertVarInfo var vi {vi_con = vc}) nc1) + put nc2 + +equate :: Pmc vt v loc m => [(v, v)] -> C vt v loc m () +equate vs = addConstraintsC (map (uncurry C.Eq) vs) + +lookupListElemTypeC :: Pmc vt v loc m => v -> C vt v loc m (Type vt loc) +lookupListElemTypeC listVar = do + nc0 <- get + let (_var, vi, nc1) = expectCanon listVar nc0 + put nc1 + pure $ getConst (posAndNegList (\elemTyp _ _ _ -> Const elemTyp) (vi_con vi)) + +addConstraintsC :: Pmc vt v loc m => [Constraint vt v loc] -> C vt v loc m () +addConstraintsC cs = do + nc <- get + lift (addConstraints cs nc) >>= \case + Nothing -> contradiction + Just nc -> put nc + +declVarC :: + Pmc vt v loc m => + v -> + Type vt loc -> + (VarInfo vt v loc -> VarInfo vt v loc) -> + C vt v loc m () +declVarC v vt vimod = do + nc0 <- get + let nc1 = declVar v vt vimod nc0 + put nc1 + +freshC :: + Pmc vt v loc m => + C vt v loc m v +freshC = lift fresh + +populateCons :: Pmc vt v loc m => v -> Seq v -> IntervalSet -> C vt v loc m () +populateCons listVar pCons iset = do + case IntervalSet.lookupMin iset of + Just minLen + | minLen > 0, + let targets = [length pCons .. minLen - 1], + not (null targets) -> do + elemTyp <- lookupListElemTypeC listVar + for_ targets \idx -> do + elv <- freshC + declVarC elv elemTyp id + addConstraintsC [C.PosListHead listVar idx elv] + _ -> pure () + +runC :: + Applicative m => + NormalizedConstraints vt v loc -> + C vt v loc m a -> + m (Maybe (a, NormalizedConstraints vt v loc)) +runC nc0 ca = unC ca nc0 diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs new file mode 100644 index 000000000..1b95f1c19 --- /dev/null +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs @@ -0,0 +1,227 @@ +{-# LANGUAGE RecursiveDo #-} + +module Unison.PatternMatchCoverage.UFMap + ( UFMap, + UFValue (..), + empty, + lookupCanon, + insert, + union, + alterF, + alter, + keys, + toClasses, + ) +where + +import Control.Monad.Fix (MonadFix) +import Control.Monad.Trans.Except (ExceptT (..)) +import Data.Foldable (foldl') +import Data.Functor ((<&>)) +import Data.Functor.Compose (Compose (..)) +import Data.Functor.Identity (Identity (Identity, runIdentity)) +import Data.Functor.Sum (Sum (..)) +import Data.Map (Map) +import qualified Data.Map.Lazy as LazyMap +import qualified Data.Map.Strict as Map +import Data.Maybe (fromJust) +import Data.Set (Set) +import qualified Data.Set as Set + +-- import Lyg.Pretty + +newtype UFMap k v = UFMap (Map k (UFValue k v)) + deriving stock (Eq, Ord, Show) + +data UFValue k v + = -- | This is not the canonical value, lookup k in the map to try again + Indirection !k + | -- | The number of elements in the equivalence class + Canonical !Int !v + deriving stock (Eq, Ord, Show) + +empty :: UFMap k v +empty = UFMap Map.empty + +insert :: Ord k => k -> v -> UFMap k v -> UFMap k v +insert k !v m = + alter k (Just v) (\_ s _ -> Canonical s v) m + +alterF' :: + forall f k v. + (Functor f, Ord k) => + -- | The key to lookup + k -> + -- | The canonical key (use laziness to supply if unknown) + k -> + (k -> UFMap k v -> Maybe (f (UFMap k v))) -> + -- How to alter the canonical value + -- + -- N.B. deleting keys from a UFMap is not supported + -- + + -- | Nothing case + f (Maybe v) -> + -- | Just case + -- canonicalKey -> size -> value + (k -> Int -> v -> f (UFValue k v)) -> + UFMap k v -> + -- | Returns the canonical k, the size, the value, and the path + -- compressed UFMap + f (UFMap k v) +alterF' k0 kcanon loopGuard handleNothing handleJust map0 = + let phi :: k -> Maybe (UFValue k v) -> Sum ((,) k) f (Maybe (UFValue k v)) + phi k = + \case + Nothing -> InR (fmap (Canonical 1) <$> handleNothing) + Just alpha -> case alpha of + Indirection k -> InL (k, Just (Indirection kcanon)) + Canonical sizeOrig v -> InR (Just <$> handleJust k sizeOrig v) + go :: k -> UFMap k v -> f (UFMap k v) + go k ufm@(UFMap m) = case loopGuard k ufm of + Just short -> short + Nothing -> case LazyMap.alterF (phi k) k m of + InL (k, m') -> go k (UFMap m') + InR res -> UFMap <$> res + in go k0 map0 +{-# INLINE alterF' #-} + +alterFWithHalt :: + forall f k v. + (Functor f, Ord k) => + k -> + (k -> UFMap k v -> Maybe (f (UFMap k v))) -> + f (Maybe v) -> + (k -> Int -> v -> f (UFValue k v)) -> + UFMap k v -> + f (UFMap k v) +alterFWithHalt k0 isCanonical handleNothing handleJust map0 = + -- tie the canonicalK knot + let (canonicalK, res) = getCompose (alterF' k0 canonicalK loopGuard handleNothing' handleJust' map0) + handleNothing' = Compose (k0, handleNothing) + handleJust' k s v = Compose (k, handleJust k s v) + -- if the key is canonical then we halt and return it as the + -- left element of the tuple + loopGuard k m = Compose . (k,) <$> isCanonical k m + in res +{-# INLINE alterFWithHalt #-} + +alterF :: + forall f k v. + (Functor f, Ord k) => + k -> + f (Maybe v) -> + (k -> Int -> v -> f (UFValue k v)) -> + UFMap k v -> + f (UFMap k v) +alterF k = alterFWithHalt k (\_ _ -> Nothing) +{-# INLINE alterF #-} + +alter :: + forall k v. + (Ord k) => + k -> + Maybe v -> + (k -> Int -> v -> UFValue k v) -> + UFMap k v -> + UFMap k v +alter k handleNothing handleJust map0 = + runIdentity (alterF k (Identity handleNothing) (\k s v -> Identity (handleJust k s v)) map0) + +lookupCanon :: + Ord k => + k -> + UFMap k v -> + Maybe (k, Int, v, UFMap k v) +lookupCanon k m = + getCompose (alterF k nothing just m) + where + nothing = Compose Nothing + just k s v = Compose (Just (k, s, v, Canonical s v)) + +data UnionHaltReason k v + = KeyNotFound k + | MergeFailed v v + +data UnionValue k v a + = UnionValue k Int v (UFValue k v) a + deriving stock (Functor) + +union :: + forall m k v r. + (MonadFix m, Ord k) => + k -> + k -> + UFMap k v -> + (k -> v -> UFMap k v -> m (Maybe r)) -> + m (Maybe r) +union k0 k1 mapinit mergeValues = toMaybe do + rec let lu :: + k -> + UFMap k v -> + (k -> UFMap k v -> Maybe (Compose (Either (UnionHaltReason k v)) (UnionValue k v) (UFMap k v))) -> + Either (UnionHaltReason k v) (UnionValue k v (UFMap k v)) + lu k m loopGuard = getCompose (alterFWithHalt k loopGuard luNothing luJust m) + where + luNothing = Compose (Left (KeyNotFound k)) + luJust k s v = + -- a final value thunk is inserted before it is resolved, + -- as the final result cannot be known before we have + -- looked up both values and merged them + let newValue = + let newSize = case kcanon0 == kcanon1 of + True -> size0 + False -> size0 + size1 + in case chosenCanon == k of + True -> Canonical newSize canonValue + False -> Indirection chosenCanon + in Compose (Right (UnionValue k s v newValue newValue)) + UnionValue kcanon0 size0 v0 vfinal0 map0 <- ExceptT $ pure $ lu k0 mapinit \_ _ -> Nothing + UnionValue kcanon1 size1 v1 vfinal1 map1 <- ExceptT $ + pure $ lu k1 map0 \k m -> case k == kcanon0 of + False -> Nothing + True -> Just (Compose (Right (UnionValue k size0 v0 vfinal0 m))) + -- Join the smaller equivalence class to the larger to bound + -- worst case number of lookups to log(n). This is the same + -- strategy as the weighted fast-union algorithm. + let (chosenCanon, canonValue, nonCanonValue) = case size0 > size1 of + True -> (kcanon0, v0, v1) + False -> (kcanon1, v1, v0) + map2 <- + let res = + ExceptT $ + mergeValues chosenCanon nonCanonValue map1 <&> \case + Nothing -> Left (MergeFailed v0 v1) + Just x -> Right x + in -- Now that both lookups have completed we can safely force the + -- final values + vfinal0 `seq` vfinal1 `seq` res + pure map2 + where + toMaybe :: ExceptT (UnionHaltReason k v) m r -> m (Maybe r) + toMaybe (ExceptT action) = + action <&> \case + Right m -> Just m + Left r -> case r of + KeyNotFound _k -> Nothing + MergeFailed _v0 _v1 -> Nothing + +toClasses :: forall k v. Ord k => UFMap k v -> [(k, Set k, v)] +toClasses m0 = + let cmFinal :: Map k (k, Set k, v) + (_mfinal, cmFinal) = foldl' phi (m0, Map.empty) keys + keys = case m0 of + UFMap m -> Map.keys m + phi (m, cm) k = + let (kcanon, _, v, m') = fromJust (lookupCanon k m) + cm' = + Map.insertWith + (\(k0, s0, v0) (_k1, s1, _v1) -> (k0, s0 <> s1, v0)) + kcanon + (k, Set.singleton k, v) + cm + in (m', cm') + in Map.elems cmFinal + +keys :: UFMap k v -> [k] +keys (UFMap m) = Map.keys m diff --git a/parser-typechecker/src/Unison/PrintError.hs b/parser-typechecker/src/Unison/PrintError.hs index d785307b2..b4022f891 100644 --- a/parser-typechecker/src/Unison/PrintError.hs +++ b/parser-typechecker/src/Unison/PrintError.hs @@ -29,6 +29,7 @@ import qualified Unison.Names as Names import qualified Unison.Names.ResolutionResult as Names import qualified Unison.NamesWithHistory as NamesWithHistory import Unison.Parser.Ann (Ann (..)) +import Unison.Pattern (Pattern) import Unison.Prelude import qualified Unison.PrettyPrintEnv as PPE import qualified Unison.PrettyPrintEnv.Names as PPE @@ -37,6 +38,7 @@ import Unison.Referent (Referent, pattern Ref) import Unison.Result (Note (..)) import qualified Unison.Result as Result import qualified Unison.Settings as Settings +import Unison.Symbol (Symbol) import qualified Unison.Syntax.HashQualified as HQ (toString) import qualified Unison.Syntax.Lexer as L import qualified Unison.Syntax.Name as Name (toText) @@ -592,6 +594,24 @@ renderTypeError e env src curPath = case e of <> annotatedAsErrorSite src typeSite, "Make sure it's imported and spelled correctly." ] + UncoveredPatterns loc tms -> + mconcat + [ "Pattern match is non-exhaustive\n", + Pr.hang + "In the match:" + (annotatedAsErrorSite src loc), + "\n\n" + ] + <> Pr.hang + "Patterns not matched:\n" + ( Pr.bulleted + (map (\x -> Pr.lit (renderPattern env x)) (Nel.toList tms)) + ) + RedundantPattern loc -> + mconcat + [ "Pattern match is redundant\n", + Pr.hang "In the match case:" (annotatedAsErrorSite src loc) + ] UnknownTerm {..} -> let (correct, wrongTypes, wrongNames) = foldr sep id suggestions ([], [], []) @@ -810,6 +830,26 @@ renderTypeError e env src curPath = case e of -- C.InMatchBody -> "InMatchBody" simpleCause :: C.Cause v loc -> Pretty ColorText simpleCause = \case + C.UncoveredPatterns loc tms -> + mconcat + [ "Incomplete pattern matches:\n", + annotatedAsErrorSite src loc, + "\n\n", + "Uncovered cases:\n" + ] + <> Pr.sep "\n" (map (\x -> Pr.lit (renderPattern env x)) (Nel.toList tms)) + C.RedundantPattern loc -> + mconcat + [ "Redundant pattern match: ", + "\n", + annotatedAsErrorSite src loc + ] + C.InaccessiblePattern loc -> + mconcat + [ "Inaccessible pattern match: ", + "\n", + annotatedAsErrorSite src loc + ] C.TypeMismatch c -> mconcat ["TypeMismatch\n", " context:\n", renderContext env c] C.HandlerOfUnexpectedType loc typ -> @@ -1020,13 +1060,18 @@ renderContext env ctx@(C.Context es) = shortName v <> " : " <> renderType' env (C.apply ctx t) showElem _ (C.Marker v) = "|" <> shortName v <> "|" -renderTerm :: (IsString s, Var v) => Env -> C.Term v loc -> s +-- Term.Term' (TypeVar v loc) v loc + +renderTerm :: (IsString s, Var v) => Env -> Term.Term' (TypeVar.TypeVar loc0 v) v loc1 -> s renderTerm env e = let s = Color.toPlain $ TermPrinter.pretty' (Just 80) env (TypeVar.lowerTerm e) in if length s > Settings.renderTermMaxLength then fromString (take Settings.renderTermMaxLength s <> "...") else fromString s +renderPattern :: Env -> Pattern ann -> ColorText +renderPattern env e = Pr.renderUnbroken . Pr.syntaxToColor . fst $ TermPrinter.prettyPattern env TermPrinter.emptyAc 0 ([] :: [Symbol]) e + -- | renders a type with no special styling renderType' :: (IsString s, Var v) => Env -> Type v loc -> s renderType' env typ = diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index 9ed7c6d06..f2be2c7e3 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -9,6 +9,7 @@ module Unison.Syntax.TermPrinter prettyBindingWithoutTypeSignature, pretty0, runPretty, + prettyPattern, ) where diff --git a/parser-typechecker/src/Unison/Typechecker/Context.hs b/parser-typechecker/src/Unison/Typechecker/Context.hs index 161b07c28..0230fca92 100644 --- a/parser-typechecker/src/Unison/Typechecker/Context.hs +++ b/parser-typechecker/src/Unison/Typechecker/Context.hs @@ -42,10 +42,12 @@ where import Control.Lens (over, view, _2) import qualified Control.Monad.Fail as MonadFail +import Control.Monad.Fix (MonadFix (..)) import Control.Monad.State ( MonadState, StateT, evalState, + evalStateT, get, gets, put, @@ -59,6 +61,7 @@ import qualified Data.Foldable as Foldable import Data.Function (on) import Data.List import Data.List.NonEmpty (NonEmpty) +import qualified Data.List.NonEmpty as Nel import qualified Data.Map as Map import qualified Data.Sequence as Seq import Data.Sequence.NonEmpty (NESeq) @@ -81,9 +84,13 @@ import qualified Unison.DataDeclaration as DD import Unison.DataDeclaration.ConstructorId (ConstructorId) import Unison.Pattern (Pattern) import qualified Unison.Pattern as Pattern +import Unison.PatternMatchCoverage (checkMatch) +import Unison.PatternMatchCoverage.Class (EnumeratedConstructors (..), Pmc (..), traverseConstructors) +import qualified Unison.PatternMatchCoverage.ListPat as ListPat import Unison.Prelude import qualified Unison.PrettyPrintEnv as PPE import Unison.Reference (Reference) +import qualified Unison.Reference as Reference import Unison.Referent (Referent) import qualified Unison.Syntax.TypePrinter as TP import qualified Unison.Term as Term @@ -173,6 +180,14 @@ instance Monad (Result v loc) where CompilerBug bug es is >>= _ = CompilerBug bug es is {-# INLINE (>>=) #-} +instance MonadFix (Result v loc) where + mfix f = + let res = f theA + theA = case res of + Success _ a -> a + _ -> error "mfix Result: forced an unsuccessful value" + in res + btw' :: InfoNote v loc -> Result v loc () btw' note = Success (Seq.singleton note) () @@ -374,6 +389,9 @@ data Cause v loc | ConcatPatternWithoutConstantLength loc (Type v loc) | HandlerOfUnexpectedType loc (Type v loc) | DataEffectMismatch Unknown Reference (DataDeclaration v loc) + | UncoveredPatterns loc (NonEmpty (Pattern ())) + | RedundantPattern loc + | InaccessiblePattern loc deriving (Show) errorTerms :: ErrorNote v loc -> [Term v loc] @@ -765,6 +783,27 @@ getEffectDeclaration r = do getDataConstructorType :: (Var v, Ord loc) => ConstructorReference -> M v loc (Type v loc) getDataConstructorType = getConstructorType' Data getDataDeclaration +getDataConstructors :: (Var v) => Type v loc -> M v loc (EnumeratedConstructors (TypeVar v loc) v loc) +getDataConstructors typ + | Type.Ref' r <- typ, r == Type.booleanRef = pure BooleanType + | Type.App' (Type.Ref' r) arg <- typ, + r == Type.listRef = + let xs = + [ (ListPat.Cons, [arg]), + -- (ListPat.Snoc, [typ, arg]), + (ListPat.Nil, []) + ] + in pure (SequenceType xs) + | Just r <- theRef = do + decl <- getDataDeclaration r + pure $ ConstructorType [(v, ConstructorReference r i, ABT.vmap TypeVar.Universal t) | (i, (v, t)) <- zip [0 ..] (DD.constructors decl)] + | otherwise = pure OtherType + where + theRef = case typ of + Type.Apps' (Type.Ref' r@Reference.DerivedId {}) _targs -> Just r + Type.Ref' r@Reference.DerivedId {} -> Just r + _ -> Nothing + getEffectConstructorType :: (Var v, Ord loc) => ConstructorReference -> M v loc (Type v loc) getEffectConstructorType = getConstructorType' Effect go where @@ -1212,6 +1251,7 @@ synthesizeWanted e let outputType = existential' l B.Blank outputTypev appendContext [existential outputTypev] cwant <- checkCases scrutineeType outputType cases + pmcStuff e scrutinee scrutineeType cases want <- coalesceWanted cwant swant ctx <- getContext pure $ (apply ctx outputType, want) @@ -1219,6 +1259,57 @@ synthesizeWanted e l = loc e synthesizeWanted _e = compilerCrash PatternMatchFailure +getDataConstructorsAtType :: (Ord loc, Var v) => Type v loc -> M v loc (EnumeratedConstructors (TypeVar v loc) v loc) +getDataConstructorsAtType t0 = do + dataConstructors <- getDataConstructors t0 + res <- traverseConstructors (\v cr t -> (v,cr,) <$> fixType t) dataConstructors + pure res + where + fixType t = do + t <- ungeneralize t + let lastT = case t of + Type.Arrows' xs -> last xs + _ -> t + equate t0 lastT + applyM t + +instance (Ord loc, Var v) => Pmc (TypeVar v loc) v loc (StateT (Set v) (M v loc)) where + getConstructors = lift . getDataConstructorsAtType + getConstructorVarTypes t cref@(ConstructorReference _r cid) = do + getConstructors t >>= \case + ConstructorType cs -> case drop (fromIntegral cid) cs of + [] -> error $ show cref <> " not found in constructor list: " <> show cs + (_, _, consArgs) : _ -> case consArgs of + Type.Arrows' xs -> pure (init xs) + _ -> pure [] + BooleanType -> pure [] + OtherType -> pure [] + SequenceType {} -> pure [] + fresh = do + vs <- get + let v = Var.freshIn vs (Var.typed Var.Pattern) + put (Set.insert v vs) + pure v + +pmcStuff :: + forall v loc. + (Ord loc, Var v) => + Term v loc -> + Term v loc -> + Type v loc -> + [Term.MatchCase loc (Term v loc)] -> + MT v loc (Result v loc) () +pmcStuff wholeMatch _scrutinee scrutineeType cases = do + let matchLoc = ABT.annotation wholeMatch + scrutineeType <- applyM scrutineeType + (redundant, _inaccessible, uncovered) <- flip evalStateT (ABT.freeVars wholeMatch) do + checkMatch matchLoc scrutineeType cases + let checkUncovered = case Nel.nonEmpty uncovered of + Nothing -> pure () + Just xs -> failWith (UncoveredPatterns matchLoc xs) + checkRedundant = foldr (\a b -> failWith (RedundantPattern a) *> b) (pure ()) redundant + checkUncovered *> checkRedundant + checkCases :: (Var v) => (Ord loc) => @@ -3051,3 +3142,8 @@ instance (Monad f) => Applicative (MT v loc f) where instance (Monad f) => MonadState (Env v loc) (MT v loc f) where get = MT \_ _ env -> pure (env, env) put env = MT \_ _ _ -> pure ((), env) + +instance MonadFix f => MonadFix (MT v loc f) where + mfix f = MT \a b c -> + let res = mfix (\ ~(wubble, _finalenv) -> runM (f wubble) a b c) + in res diff --git a/parser-typechecker/src/Unison/Typechecker/Extractor.hs b/parser-typechecker/src/Unison/Typechecker/Extractor.hs index 8d1952b1d..8f98e16aa 100644 --- a/parser-typechecker/src/Unison/Typechecker/Extractor.hs +++ b/parser-typechecker/src/Unison/Typechecker/Extractor.hs @@ -6,6 +6,7 @@ import Data.List.NonEmpty (NonEmpty) import qualified Data.Set as Set import qualified Unison.Blank as B import Unison.ConstructorReference (ConstructorReference) +import Unison.Pattern (Pattern) import Unison.Prelude hiding (whenM) import qualified Unison.Term as Term import Unison.Type (Type) @@ -242,6 +243,18 @@ duplicateDefinitions = C.DuplicateDefinitions vs -> pure vs _ -> mzero +uncoveredPatterns :: ErrorExtractor v loc (loc, NonEmpty (Pattern ())) +uncoveredPatterns = + cause >>= \case + C.UncoveredPatterns matchLoc xs -> pure (matchLoc, xs) + _ -> empty + +redundantPattern :: ErrorExtractor v loc loc +redundantPattern = + cause >>= \case + C.RedundantPattern patternLoc -> pure patternLoc + _ -> empty + typeMismatch :: ErrorExtractor v loc (C.Context v loc) typeMismatch = cause >>= \case diff --git a/parser-typechecker/src/Unison/Typechecker/TypeError.hs b/parser-typechecker/src/Unison/Typechecker/TypeError.hs index f09d1ffe4..4670ead83 100644 --- a/parser-typechecker/src/Unison/Typechecker/TypeError.hs +++ b/parser-typechecker/src/Unison/Typechecker/TypeError.hs @@ -5,6 +5,7 @@ module Unison.Typechecker.TypeError where import Data.Bifunctor (second) import Data.List.NonEmpty (NonEmpty) import qualified Unison.ABT as ABT +import Unison.Pattern (Pattern) import Unison.Prelude hiding (whenM) import Unison.Type (Type) import qualified Unison.Type as Type @@ -103,6 +104,8 @@ data TypeError v loc { defns :: NonEmpty (v, [loc]), note :: C.ErrorNote v loc } + | UncoveredPatterns loc (NonEmpty (Pattern ())) + | RedundantPattern loc | Other (C.ErrorNote v loc) deriving (Show) @@ -145,7 +148,9 @@ allErrors = unguardedCycle, unknownType, unknownTerm, - duplicateDefinitions + duplicateDefinitions, + redundantPattern, + uncoveredPatterns ] topLevelComponent :: Ex.InfoExtractor v a (TypeInfo v a) @@ -153,6 +158,16 @@ topLevelComponent = do defs <- Ex.topLevelComponent pure $ TopLevelComponent defs +redundantPattern :: Ex.ErrorExtractor v a (TypeError v a) +redundantPattern = do + ploc <- Ex.redundantPattern + pure (RedundantPattern ploc) + +uncoveredPatterns :: Ex.ErrorExtractor v a (TypeError v a) +uncoveredPatterns = do + (mloc, uncoveredCases) <- Ex.uncoveredPatterns + pure (UncoveredPatterns mloc uncoveredCases) + abilityCheckFailure :: Ex.ErrorExtractor v a (TypeError v a) abilityCheckFailure = do (ambient, requested, _ctx) <- Ex.abilityCheckFailure diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 45a5ae71c..5e6b8305b 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -97,6 +97,20 @@ library Unison.FileParsers Unison.Hashing.V2.Convert Unison.Parsers + Unison.PatternMatchCoverage + Unison.PatternMatchCoverage.Class + Unison.PatternMatchCoverage.Constraint + Unison.PatternMatchCoverage.Desugar + Unison.PatternMatchCoverage.Fix + Unison.PatternMatchCoverage.GrdTree + Unison.PatternMatchCoverage.IntervalSet + Unison.PatternMatchCoverage.ListPat + Unison.PatternMatchCoverage.Literal + Unison.PatternMatchCoverage.NormalizedConstraints + Unison.PatternMatchCoverage.PmGrd + Unison.PatternMatchCoverage.PmLit + Unison.PatternMatchCoverage.Solve + Unison.PatternMatchCoverage.UFMap Unison.PrettyPrintEnv Unison.PrettyPrintEnv.FQN Unison.PrettyPrintEnv.MonadPretty diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 74cf42685..ae4bcf753 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -234,6 +234,10 @@ analyseNotes fileUri ppe src notes = do (_v, locs) <- toList defns (r, rs) <- withNeighbours (locs >>= aToR) pure (r, ("duplicate definition",) <$> rs) + TypeError.RedundantPattern _ploc -> do + empty + TypeError.UncoveredPatterns _mloc _pats -> do + empty -- These type errors don't have custom type error conversions, but some -- still have valid diagnostics. TypeError.Other e@(Context.ErrorNote {cause}) -> case cause of @@ -338,18 +342,18 @@ analyseNotes fileUri ppe src notes = do typeHoleReplacementCodeActions diags v typ | not (isUserBlank v) = pure [] | otherwise = do - Env {codebase} <- ask - ppe <- PPED.suffixifiedPPE <$> globalPPED - let cleanedTyp = Context.generalizeAndUnTypeVar typ -- TODO: is this right? - refs <- liftIO . Codebase.runTransaction codebase $ Codebase.termsOfType codebase cleanedTyp - forMaybe (toList refs) $ \ref -> runMaybeT $ do - hqNameSuggestion <- MaybeT . pure $ PPE.terms ppe ref - typ <- MaybeT . liftIO . Codebase.runTransaction codebase $ Codebase.getTypeOfReferent codebase ref - let prettyType = TypePrinter.prettyStr Nothing ppe typ - let txtName = HQ'.toText hqNameSuggestion - let ranges = (diags ^.. folded . range) - let rca = rangedCodeAction ("Use " <> txtName <> " : " <> Text.pack prettyType) diags ranges - pure $ includeEdits fileUri txtName ranges rca + Env {codebase} <- ask + ppe <- PPED.suffixifiedPPE <$> globalPPED + let cleanedTyp = Context.generalizeAndUnTypeVar typ -- TODO: is this right? + refs <- liftIO . Codebase.runTransaction codebase $ Codebase.termsOfType codebase cleanedTyp + forMaybe (toList refs) $ \ref -> runMaybeT $ do + hqNameSuggestion <- MaybeT . pure $ PPE.terms ppe ref + typ <- MaybeT . liftIO . Codebase.runTransaction codebase $ Codebase.getTypeOfReferent codebase ref + let prettyType = TypePrinter.prettyStr Nothing ppe typ + let txtName = HQ'.toText hqNameSuggestion + let ranges = (diags ^.. folded . range) + let rca = rangedCodeAction ("Use " <> txtName <> " : " <> Text.pack prettyType) diags ranges + pure $ includeEdits fileUri txtName ranges rca isUserBlank :: Symbol -> Bool isUserBlank v = case Var.typeOf v of Var.User name -> Text.isPrefixOf "_" name diff --git a/unison-src/transcripts/pattern-match-coverage.md b/unison-src/transcripts/pattern-match-coverage.md new file mode 100644 index 000000000..1affffa78 --- /dev/null +++ b/unison-src/transcripts/pattern-match-coverage.md @@ -0,0 +1,190 @@ +```ucm:hide +.> builtins.merge +``` + +# Basics +non-exhaustive patterns are reported +```unison:error +unique type T = A | B | C + +test : T -> () +test = cases + A -> 0 +``` + +redundant matches are reported +```unison:error +unique type T = A | B | C + +test : T -> () +test = cases + A -> 0 + B -> 0 + C -> 0 + _ -> 0 +``` + +patterns that would imply supplying an uninhabited type are not expected +```unison +unique type V = + +test : Optional (Optional V) -> () +test = cases + None -> () + Some None -> () +``` + +they are reported as redundant +```unison:error +unique type V = + +test : Optional (Optional V) -> () +test = cases + None -> () + Some None -> () + Some _ -> () +``` + +boolean guards are considered +```unison:error +test : () -> () +test = cases + () | false -> () +``` + +uncovered patterns are only instantiated as deeply as necessary to +distinguish them from existing patterns +```unison:error +unique type T = A | B | C + +test : Optional (Optional T) -> () +test = cases + None -> () + Some None -> () +``` + +```unison:error +unique type T = A | B | C + +test : Optional (Optional T) -> () +test = cases + None -> () + Some None -> () + Some (Some A) -> () +``` + +# Literals +non-exhaustive nat +```unison:error +test : Nat -> () +test = cases + 0 -> () +``` + +```unison +test : Nat -> () +test = cases + 0 -> () + _ -> () +``` + +non-exhaustive boolean +```unison:error +test : Boolean -> () +test = cases + true -> () +``` + +```unison +test : Boolean -> () +test = cases + true -> () + false -> () +``` + +redundant boolean +```unison:error +test : Boolean -> () +test = cases + true -> () + false -> () + _ -> () +``` + +# Sequences +```unison +test : [()] -> () +test = cases + [] -> () + x +: xs -> () +``` + +```unison:error +test : [()] -> () +test = cases + [] -> () +``` + +```unison:error +test : [()] -> () +test = cases + x +: xs -> () +``` + +```unison:error +test : [()] -> () +test = cases + xs :+ x -> () +``` + +```unison +unique type V = + +test : [V] -> () +test = cases + [] -> () +``` + +```unison:error +test : [()] -> () +test = cases + x0 +: (x1 +: xs) -> () + [] -> () +``` + +```unison:error +test : [()] -> () +test = cases + [] -> () + x0 +: [] -> () +``` + +cons and snoc patterns are equated when a length restriction implies +that they refer to the same element +```unison +test : [Boolean] -> () +test = cases + [a, b] ++ xs -> () + [] -> () + xs :+ false -> () + true +: xs -> () +``` + +```unison:error +test : [Boolean] -> () +test = cases + [a, b] ++ xs -> () + [] -> () + xs :+ true -> () + true +: xs -> () + _ -> () +``` + +```unison:error +test : [Boolean] -> () +test = cases + [a, b, c, d, f] ++ xs -> () + [true, _, true, _] ++ _ -> () + _ ++ [true, false, true, false] -> () + _ -> () +``` diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md new file mode 100644 index 000000000..0103006da --- /dev/null +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -0,0 +1,436 @@ +# Basics +non-exhaustive patterns are reported +```unison +unique type T = A | B | C + +test : T -> () +test = cases + A -> 0 +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 4 | test = cases + 5 | A -> 0 + + + Patterns not matched: + + * B + * C + +``` +redundant matches are reported +```unison +unique type T = A | B | C + +test : T -> () +test = cases + A -> 0 + B -> 0 + C -> 0 + _ -> 0 +``` + +```ucm + + Pattern match is redundant + In the match case: + 8 | _ -> 0 + + +``` +patterns that would imply supplying an uninhabited type are not expected +```unison +unique type V = + +test : Optional (Optional V) -> () +test = cases + None -> () + Some None -> () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type V + test : Optional (Optional V) -> () + +``` +they are reported as redundant +```unison +unique type V = + +test : Optional (Optional V) -> () +test = cases + None -> () + Some None -> () + Some _ -> () +``` + +```ucm + + Pattern match is redundant + In the match case: + 7 | Some _ -> () + + +``` +boolean guards are considered +```unison +test : () -> () +test = cases + () | false -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | () | false -> () + + + Patterns not matched: + * () + +``` +uncovered patterns are only instantiated as deeply as necessary to +distinguish them from existing patterns +```unison +unique type T = A | B | C + +test : Optional (Optional T) -> () +test = cases + None -> () + Some None -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 4 | test = cases + 5 | None -> () + 6 | Some None -> () + + + Patterns not matched: + * Some (Some _) + +``` +```unison +unique type T = A | B | C + +test : Optional (Optional T) -> () +test = cases + None -> () + Some None -> () + Some (Some A) -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 4 | test = cases + 5 | None -> () + 6 | Some None -> () + 7 | Some (Some A) -> () + + + Patterns not matched: + + * Some (Some B) + * Some (Some C) + +``` +# Literals +non-exhaustive nat +```unison +test : Nat -> () +test = cases + 0 -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | 0 -> () + + + Patterns not matched: + * _ + +``` +```unison +test : Nat -> () +test = cases + 0 -> () + _ -> () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test : Nat -> () + +``` +non-exhaustive boolean +```unison +test : Boolean -> () +test = cases + true -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | true -> () + + + Patterns not matched: + * false + +``` +```unison +test : Boolean -> () +test = cases + true -> () + false -> () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test : Boolean -> () + +``` +redundant boolean +```unison +test : Boolean -> () +test = cases + true -> () + false -> () + _ -> () +``` + +```ucm + + Pattern match is redundant + In the match case: + 5 | _ -> () + + +``` +# Sequences +```unison +test : [()] -> () +test = cases + [] -> () + x +: xs -> () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test : [()] -> () + +``` +```unison +test : [()] -> () +test = cases + [] -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | [] -> () + + + Patterns not matched: + * (_ +: _) + +``` +```unison +test : [()] -> () +test = cases + x +: xs -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | x +: xs -> () + + + Patterns not matched: + * [] + +``` +```unison +test : [()] -> () +test = cases + xs :+ x -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | xs :+ x -> () + + + Patterns not matched: + * [] + +``` +```unison +unique type V = + +test : [V] -> () +test = cases + [] -> () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type V + test : [V] -> () + +``` +```unison +test : [()] -> () +test = cases + x0 +: (x1 +: xs) -> () + [] -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | x0 +: (x1 +: xs) -> () + 4 | [] -> () + + + Patterns not matched: + * (_ +: []) + +``` +```unison +test : [()] -> () +test = cases + [] -> () + x0 +: [] -> () +``` + +```ucm + + Pattern match is non-exhaustive + In the match: + 2 | test = cases + 3 | [] -> () + 4 | x0 +: [] -> () + + + Patterns not matched: + * (_ +: (_ +: _)) + +``` +cons and snoc patterns are equated when a length restriction implies +that they refer to the same element +```unison +test : [Boolean] -> () +test = cases + [a, b] ++ xs -> () + [] -> () + xs :+ false -> () + true +: xs -> () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test : [Boolean] -> () + +``` +```unison +test : [Boolean] -> () +test = cases + [a, b] ++ xs -> () + [] -> () + xs :+ true -> () + true +: xs -> () + _ -> () +``` + +```ucm + + Pattern match is redundant + In the match case: + 6 | true +: xs -> () + + +``` +```unison +test : [Boolean] -> () +test = cases + [a, b, c, d, f] ++ xs -> () + [true, _, true, _] ++ _ -> () + _ ++ [true, false, true, false] -> () + _ -> () +``` + +```ucm + + Pattern match is redundant + In the match case: + 5 | _ ++ [true, false, true, false] -> () + + +``` From 768270a664e4f1d19765f97615e9737f7d75b404 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 12 Jan 2023 16:42:59 -0500 Subject: [PATCH 380/467] don't check coverage for ability handlers (yet) --- .../src/Unison/Typechecker/Context.hs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/parser-typechecker/src/Unison/Typechecker/Context.hs b/parser-typechecker/src/Unison/Typechecker/Context.hs index 0230fca92..e6b826c17 100644 --- a/parser-typechecker/src/Unison/Typechecker/Context.hs +++ b/parser-typechecker/src/Unison/Typechecker/Context.hs @@ -1251,7 +1251,7 @@ synthesizeWanted e let outputType = existential' l B.Blank outputTypev appendContext [existential outputTypev] cwant <- checkCases scrutineeType outputType cases - pmcStuff e scrutinee scrutineeType cases + ensurePatternCoverage e scrutinee scrutineeType cases want <- coalesceWanted cwant swant ctx <- getContext pure $ (apply ctx outputType, want) @@ -1291,7 +1291,7 @@ instance (Ord loc, Var v) => Pmc (TypeVar v loc) v loc (StateT (Set v) (M v loc) put (Set.insert v vs) pure v -pmcStuff :: +ensurePatternCoverage :: forall v loc. (Ord loc, Var v) => Term v loc -> @@ -1299,16 +1299,20 @@ pmcStuff :: Type v loc -> [Term.MatchCase loc (Term v loc)] -> MT v loc (Result v loc) () -pmcStuff wholeMatch _scrutinee scrutineeType cases = do +ensurePatternCoverage wholeMatch _scrutinee scrutineeType cases = do let matchLoc = ABT.annotation wholeMatch scrutineeType <- applyM scrutineeType - (redundant, _inaccessible, uncovered) <- flip evalStateT (ABT.freeVars wholeMatch) do - checkMatch matchLoc scrutineeType cases - let checkUncovered = case Nel.nonEmpty uncovered of - Nothing -> pure () - Just xs -> failWith (UncoveredPatterns matchLoc xs) - checkRedundant = foldr (\a b -> failWith (RedundantPattern a) *> b) (pure ()) redundant - checkUncovered *> checkRedundant + case scrutineeType of + -- Don't check coverage on ability handlers yet + Type.Apps' (Type.Ref' r) _args | r == Type.effectRef -> pure () + _ -> do + (redundant, _inaccessible, uncovered) <- flip evalStateT (ABT.freeVars wholeMatch) do + checkMatch matchLoc scrutineeType cases + let checkUncovered = case Nel.nonEmpty uncovered of + Nothing -> pure () + Just xs -> failWith (UncoveredPatterns matchLoc xs) + checkRedundant = foldr (\a b -> failWith (RedundantPattern a) *> b) (pure ()) redundant + checkUncovered *> checkRedundant checkCases :: (Var v) => From e2c0cb376e87510075f25164844211ecd0b26667 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 12 Jan 2023 16:43:38 -0500 Subject: [PATCH 381/467] print type failures in IOSource --- .../src/Unison/Runtime/IOSource.hs | 50 +++++++++++++++++-- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index f784e9576..0c437c2ef 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -7,18 +7,24 @@ import Control.Lens (view, _1) import Control.Monad.Morph (hoist) import Data.List (elemIndex, genericIndex) import qualified Data.Map as Map +import qualified Data.Text as Text import Debug.RecoverRTTI (anythingToString) import Text.RawString.QQ (r) import qualified Unison.Builtin as Builtin import Unison.Codebase.CodeLookup (CodeLookup (..)) import qualified Unison.Codebase.CodeLookup.Util as CL +import qualified Unison.Codebase.Path as Path import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.DataDeclaration as DD import qualified Unison.DataDeclaration.ConstructorId as DD import Unison.FileParsers (parseAndSynthesizeFile) import qualified Unison.NamesWithHistory as Names +import qualified Unison.NamesWithHistory as NamesWithHistory import Unison.Parser.Ann (Ann (..)) import Unison.Prelude +import qualified Unison.PrettyPrintEnv as PPE +import qualified Unison.PrettyPrintEnv.Names as PPE +import qualified Unison.PrintError as PrintError import qualified Unison.Reference as R import qualified Unison.Result as Result import Unison.Symbol (Symbol) @@ -26,6 +32,8 @@ import qualified Unison.Syntax.Parser as Parser import qualified Unison.Term as Term import qualified Unison.Typechecker.TypeLookup as TL import qualified Unison.UnisonFile as UF +import qualified Unison.UnisonFile.Names as UF +import Unison.Util.Monoid (intercalateMap) import qualified Unison.Var as Var debug :: Bool @@ -42,10 +50,9 @@ typecheckedFile' = tl = const $ pure (External <$ Builtin.typeLookup) env = Parser.ParsingEnv mempty (Names.NamesWithHistory Builtin.names0 mempty) r = parseAndSynthesizeFile [] tl env "" source - in case runIdentity $ Result.runResultT r of - (Nothing, notes) -> error $ "parsing failed: " <> anythingToString (toList notes) - (Just Left {}, notes) -> error $ "typechecking failed" <> anythingToString (toList notes) - (Just (Right file), _) -> file + in case decodeResult (Text.unpack source) r of + Left str -> error str + Right file -> file typecheckedFileTerms :: Map.Map Symbol R.Reference typecheckedFileTerms = view _1 <$> UF.hashTerms typecheckedFile @@ -959,3 +966,38 @@ syntax.docFormatConsole d = Special sf -> Pretty.lit (Left sf) go d |] + +type Note = Result.Note Symbol Ann + +type TFile = UF.TypecheckedUnisonFile Symbol Ann + +type SynthResult = + Result.Result + (Seq Note) + (Either (UF.UnisonFile Symbol Ann) TFile) + +type EitherResult = Either String TFile + +showNotes :: Foldable f => String -> PrintError.Env -> f Note -> String +showNotes source env = + intercalateMap "\n\n" $ PrintError.renderNoteAsANSI 60 env source Path.absoluteEmpty + +decodeResult :: + String -> SynthResult -> EitherResult -- String (UF.TypecheckedUnisonFile Symbol Ann) +decodeResult source (Result.Result notes Nothing) = + Left $ showNotes source ppEnv notes +decodeResult source (Result.Result notes (Just (Left uf))) = + let errNames = UF.toNames uf + in Left $ + showNotes + source + ( PPE.fromNames + 10 + (NamesWithHistory.shadowing errNames Builtin.names) + ) + notes +decodeResult _source (Result.Result _notes (Just (Right uf))) = + Right uf + +ppEnv :: PPE.PrettyPrintEnv +ppEnv = PPE.fromNames 10 Builtin.names From c69dc75fd19c33a6536d8fd1ba235d6bb81e6b2a Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 12 Jan 2023 16:44:11 -0500 Subject: [PATCH 382/467] fix builtins.mergeio bug --- parser-typechecker/src/Unison/Runtime/IOSource.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index 0c437c2ef..33b1392c7 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -715,6 +715,7 @@ Pretty.map f p = Lit _ t -> Lit () (f t) Wrap _ p -> Wrap () (go p) OrElse _ p1 p2 -> OrElse () (go p1) (go p2) + Table _ xs -> Table () (List.map (List.map go) xs) Indent _ i0 iN p -> Indent () (go i0) (go iN) (go p) Annotated.Append _ ps -> Annotated.Append () (List.map go ps) Pretty (go (Pretty.get p)) From 1cf470a7074623bf6355b7f62ca6ddf232323c27 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 13 Jan 2023 10:01:25 -0500 Subject: [PATCH 383/467] Fix bug in desugarPattern --- parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs index af81e3368..3551d863b 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs @@ -69,7 +69,7 @@ desugarPattern typ v0 pat k vs = case pat of tpatvars = zipWith (\(v, p) t -> (v, p, t)) patvars contyps rest <- foldr (\(v, pat, t) b -> desugarPattern t v pat b) k tpatvars vs pure (Grd c rest) - As _ _ -> k (v0 : vs) + As _ rest -> desugarPattern typ v0 rest k (v0 : vs) EffectPure {} -> k vs EffectBind {} -> k vs SequenceLiteral {} -> handleSequence typ v0 pat k vs From 4b2a757f72ffb13eb9cdf0bb25d773333aab3ec7 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 27 Feb 2023 11:06:34 -0500 Subject: [PATCH 384/467] A couple fixes. - Fixed record-case macro. Was missing a case and putting the case analysis branches directly in a cond. - Record equality in standard scheme seems to not be structural even for entirely immutable records (unlike chez), so we need to manually implement a structural equality on `data` for universal equality. --- scheme-libs/common/unison/boot.ss | 4 +++- scheme-libs/common/unison/primops.ss | 2 +- scheme-libs/racket/unison/core.ss | 20 +++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index fa8b01df6..2e4607a0d 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -312,6 +312,8 @@ ([pc (mk-pure #'scrut ps)] [(ac ...) (map (mk-abil #'scrut) as)]) - #'(cond [(pure? scrut) pc] ac ...))))]))) + #'(cond + [(pure? scrut) pc] + [else (case (request-ability scrut) ac ...)]))))]))) ) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 31b325c45..fceebb016 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -200,7 +200,7 @@ (define (unison-POp-DRPT n t) (istring-drop n t)) (define (unison-POp-EQLN m n) (if (fx=? m n) 1 0)) (define (unison-POp-EQLT s t) (if (string=? s t) 1 0)) - (define (unison-POp-EQLU x y) (if (equal? x y) 1 0)) + (define (unison-POp-EQLU x y) (if (universal-equal? x y) 1 0)) (define (unison-POp-EROR fnm x) (let-values ([(p g) (open-string-output-port)]) (put-string p fnm) diff --git a/scheme-libs/racket/unison/core.ss b/scheme-libs/racket/unison/core.ss index 1f93f5196..ee0a96bb4 100644 --- a/scheme-libs/racket/unison/core.ss +++ b/scheme-libs/racket/unison/core.ss @@ -14,6 +14,7 @@ decode-value universal-compare + universal-equal? fx1- list-head @@ -44,7 +45,8 @@ (string-copy! racket-string-copy!) (bytes bytevector)) (racket exn) - (racket unsafe ops)) + (racket unsafe ops) + (unison data)) (define (fx1- n) (fx- n 1)) @@ -69,6 +71,22 @@ [(and (number? l) (number? r)) (if (< l r) 0 2)] [else (raise "universal-compare: unimplemented")])) + (define (universal-equal? l r) + (define (pointwise ll lr) + (let ([nl (null? ll)] [nr (null? lr)]) + (cond + [(and nl nr) #t] + [(or nl nr) #f] + [else + (and (universal-equal? (car ll) (car lr)) + (pointwise (cdr ll) (cdr lr)))]))) + (cond + [(eq? l r) 1] + [(and (data? l) (data? r)) + (and + (eqv? (data-tag l) (data-tag r)) + (pointwise (data-fields l) (data-fields r)))])) + (define exception->string exn->string) (define (syntax->list stx) From bfe8364bb0f4b125e86f62993e1d12d8da3040a1 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 13 Jan 2023 10:07:03 -0500 Subject: [PATCH 385/467] make patterns complete in base.u --- .../src/Unison/Runtime/IOSource.hs | 1 - .../all-base-hashes.output.md | 24 +++++++++---------- unison-src/transcripts-using-base/base.u | 4 ++-- .../transcripts/move-namespace.output.md | 24 +++++++++---------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index 33b1392c7..c7c589389 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -8,7 +8,6 @@ import Control.Monad.Morph (hoist) import Data.List (elemIndex, genericIndex) import qualified Data.Map as Map import qualified Data.Text as Text -import Debug.RecoverRTTI (anythingToString) import Text.RawString.QQ (r) import qualified Unison.Builtin as Builtin import Unison.Codebase.CodeLookup (CodeLookup (..)) diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index 61393a036..1af0e709f 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -13,19 +13,19 @@ This transcript is intended to make visible accidental changes to the hashing al autoCleaned.handler : '{IO} (Request {TempDirs} r ->{IO, Exception} r) - 4. -- #fajcv3ki8h80htov5pu2beu6f9d5dqsr0he47jssjvivgcpo2n1mqmbh7e0plv5cuqte3kjg18ken8gv1kmtpppkjjein4rr7a50ep8 + 4. -- #p1lh7ba73bdka6e18v9hmkrj811f2qsrogjumssr36drdjfgrfd6e6qotaqksb3o4lk44274fbcaqnj8e41rh0pjn56cbvsb3gv0880 bContains : [(a, b)] -> a -> Boolean - 5. -- #js3u40odrqs74lpcqjoemr1b08cbu7co41sf0ubp7gq3eaohl72db3khi0p1neqtmk2ede9f00n07no0kju13i7tliopsgsm69nh38o + 5. -- #ck9knej1qu6jt87i9qun1btc67kvthamubpl658se75po13oe2vto97jck965ibs6uspmopt3097lqd1pmqnegmba8e2bbfgtre9ovo bInsert : [(a, b)] -> a -> b -> [(a, b)] - 6. -- #avou19csadtmkejvdovufstrhtsbvnauqan05o9na0kqo7jon7ql05f7ooccbv777k68jj56ufufthp1cjd0jvium7j2ghrlpghnh58 + 6. -- #k1ge36n1ouvbaqjamm69pu7uuul0qc842tgqufm0ncaeb5h7im3r3vh9b7vikdu896p3f9ep2tf0dec3ifnrbr197k9lucl733rjpc0 bSearch : [(a, b)] -> a -> Optional b - 7. -- #ps5jpme6lr6fgv1a3cjmd4tpqr62pg3flmunkhcu9creojv2hsmei86nb6nndiam5p4q79nlerddrgto5um4ugm0p9evb8isoqu9ur0 + 7. -- #0nmd69uoat0mr9tl1917mdb16cpvd2q8oev5uj9s5d6virfcolc4t7js3l9do0c6c26tj7mvd82fpcumjr513bfudelnunvbok317fo bSort : [(a, b)] -> [(a, b)] - 8. -- #vb7eo70iavak378net6hohjkosud6ooabo1j0dev8l7254ls2j48f4e8gmk46d4016l41tpe7k8gqjqtb84g0gdc93vrh8bh4d62nf8 + 8. -- #re1saul4fhhdmg0b91ssrp3ok604nitpsler5dijra4eutcugsinmqvh9om3ah7qmcj1da57h3git1fn032lj8qs9kpqj3ujfs2ueig bSplit : [(a, b)] -> a -> ([(a, b)], [(a, b)]) 9. -- #1j3e8vsn97qrprjr69ls6llab601sdh577uuvtu8pafmngf59suakbjr7asheadidcj3red140fnmdagsv9ihhdar1mc05ig28jtfr0 @@ -2069,7 +2069,7 @@ This transcript is intended to make visible accidental changes to the hashing al 584. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 585. -- #pn811nf59d63s8711bpktjqub65sb748pmajg7r8n7h7cnap5ecb4n1072ccult24q6gcfac66scrm77cjsa779mcckqrs8si4716sg + 585. -- #kfgfekabh7tiprb6ljjkf4qa5puqp6bbpe1oiqv9r39taljs8ahtb518mpcmec3plesvpssn3bpgvq3e7d71giot6lb2j7mbk23dtqo builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 @@ -2202,7 +2202,7 @@ This transcript is intended to make visible accidental changes to the hashing al [Doc2.Term])] -> Doc2 - 624. -- #4rv8dvuvf5br3vhhuturaejt1l2u8j5eidjid01f5mo7o0fgjatttmph34ma0b9s1i2badcqj3ale005jb1hnisabnh93i4is1d8kng + 624. -- #inrar1e9lnt58n0ru88v05a9d9d0la94m7ok5l6i7pr3pg4lapc9vegr542ffog1kl7pfqhmltr53of3qkci8nnrt8gig93qsnggisg builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) @@ -2474,7 +2474,7 @@ This transcript is intended to make visible accidental changes to the hashing al 710. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 711. -- #7o1e77u808vpg8i6k1mvutg8h6tdr14hegfad23e9sjou1ft10kvfr95goo0kv2ldqlsaa4pmvdl8d7jd6h252i3jija05b4vpqbg5g + 711. -- #2cl9ivrimnadurkum2blduls21kcihu89oasj2efmi03s1vfm433pi6c4k1d2a3obpmf2orm3c9lfgffnlhuc6ktaa98a1ccdhfueqo Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] @@ -2502,7 +2502,7 @@ This transcript is intended to make visible accidental changes to the hashing al 715. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 716. -- #tgvna0i8ea98jvnd2oka85cdtas1prcbq3snvc4qfns6082mlckps2cspk8jln11mklg19bna025tog5m9sb671o27ujsa90lfrbnkg + 716. -- #pen6v1vcqdsg5ar8ajio0baiujthquamelbqd00p66amfjftk2o3stod4n81snc3hb9sc4fmnitf6ada0n5sfqfroi8sv1nbn7rnq48 crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] @@ -2708,10 +2708,10 @@ This transcript is intended to make visible accidental changes to the hashing al runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 779. -- #va4fcp72qog4dvo8dn4gipr2i1big1lqgpcqfuv9kc98ut8le1bj23s68df7svam7b5sg01s4uf95o458f4rs90mtp71nj84t90ra1o + 779. -- #b59q94bf9mrvv4gl8gqjd04dc3ahq373ka5esh4grtjupkm8ov7o7h0n56q2dg3ocdsreqvm973rlhs4etua1tbrsuabc398e5pvs0o saveSelfContained : a -> Text ->{IO, Exception} () - 780. -- #5hbn4gflbo8l4jq0s9l1r0fpee6ie44fbbl6j6km67l25inaaq5avg18g7j6mig2m6eaod04smif7el34tcclvvf8oll39rfonupt2o + 780. -- #f55p4o2hlhka9olk8a9dnan57o51605g4q26jtpsbkt0g652s322779sej71182ntb6lkh01gom3g26cmngqq7vtl7m7oovdi0koc70 saveTestCase : Text -> (a -> Text) -> a @@ -2801,7 +2801,7 @@ This transcript is intended to make visible accidental changes to the hashing al uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 807. -- #u2j1bektndcqdo1m13fvu6apt9td96s4tqonelg23tauklak2pqnbisf41v632fmlrcc6f9orqo3iu9757q36ue5ol1khe0hh8pktro + 807. -- #rhak55ntto40n4utgv5o93jvlmv82lceb625slrt8tsmg74vin5bclf10vkl1sgpau3thqsa6guiihog74qoknlsqbuce5th60bu2eg Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] 808. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo diff --git a/unison-src/transcripts-using-base/base.u b/unison-src/transcripts-using-base/base.u index daaa0e5aa..84afda95c 100644 --- a/unison-src/transcripts-using-base/base.u +++ b/unison-src/transcripts-using-base/base.u @@ -274,7 +274,7 @@ bSearch m k = Some (k', v) | k == k' -> Some v | k > k' -> find (i+1) u - | k < k' -> find l i + | otherwise -> find l i None -> None find 0 (size m) @@ -299,7 +299,7 @@ bSplit m k = Some (k', _) | k == k' -> (List.take i m, List.drop (i+1) m) | k > k' -> find (i+1) u - | k < k' -> find l i + | otherwise -> find l i None -> (m, []) find 0 (size m) diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 030e44616..9689c3d79 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -278,7 +278,7 @@ I should be able to move the root into a sub-namespace - □ 1. #hu6p22qbe4 (start of history) + □ 1. #j17hvtt1rm (start of history) ``` ```ucm @@ -294,7 +294,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #8rae339vn9 + ⊙ 1. #epknijg4pk - Deletes: @@ -305,7 +305,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #r697qei02b + ⊙ 2. #pmecta5so9 + Adds / updates: @@ -317,26 +317,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #ca0k6ug92t + ⊙ 3. #lc7lsqgcmo + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #7nnrjj85km + ⊙ 4. #j36gjaovv9 > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #01cflse46b + ⊙ 5. #domisg9f2n - Deletes: history.b.termInB - ⊙ 6. #cna2qqmgcq + ⊙ 6. #69vk74hidq + Adds / updates: @@ -347,13 +347,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #qoce7dt2h1 + ⊙ 7. #hslilthrkd + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #g8m2g6bd1g + ⊙ 8. #ap9o8u4m1a > Moves: @@ -363,7 +363,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #ngl33npfah + ⊙ 9. #tpka2u10nq + Adds / updates: @@ -373,7 +373,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #1rnd8dpisq + ⊙ 10. #ebk6c1po2f + Adds / updates: @@ -385,7 +385,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #7s9j9tscke + ⊙ 11. #c5i2vql0hi ``` From 4482098370e728fa60d6126f5386f113b702243d Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 13 Jan 2023 10:15:24 -0500 Subject: [PATCH 386/467] Remove test catching missing case in match this is handled at compile time now --- unison-src/transcripts-using-base/fix2049.md | 2 -- unison-src/transcripts-using-base/fix2049.output.md | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/unison-src/transcripts-using-base/fix2049.md b/unison-src/transcripts-using-base/fix2049.md index 4fa2edf70..5ccb89a46 100644 --- a/unison-src/transcripts-using-base/fix2049.md +++ b/unison-src/transcripts-using-base/fix2049.md @@ -13,8 +13,6 @@ catcher act = tests _ = [ catcher do - match None with Some x -> x - , catcher do _ = 1/0 () , catcher '(bug "testing") diff --git a/unison-src/transcripts-using-base/fix2049.output.md b/unison-src/transcripts-using-base/fix2049.output.md index bbc29e767..9ed56a65d 100644 --- a/unison-src/transcripts-using-base/fix2049.output.md +++ b/unison-src/transcripts-using-base/fix2049.output.md @@ -9,8 +9,6 @@ catcher act = tests _ = [ catcher do - match None with Some x -> x - , catcher do _ = 1/0 () , catcher '(bug "testing") @@ -45,12 +43,11 @@ tests _ = New test results: - ◉ tests caught ◉ tests caught ◉ tests caught ◉ tests got the right answer - ✅ 4 test(s) passing + ✅ 3 test(s) passing Tip: Use view tests to view the source of a test. From aab7d46677d3e0e95cea57c3f99cb8a4d6c893f5 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 13 Jan 2023 10:16:07 -0500 Subject: [PATCH 387/467] complete patterns in random-deserial --- unison-src/transcripts-using-base/random-deserial.md | 1 + unison-src/transcripts-using-base/random-deserial.output.md | 1 + 2 files changed, 2 insertions(+) diff --git a/unison-src/transcripts-using-base/random-deserial.md b/unison-src/transcripts-using-base/random-deserial.md index 526705b3b..9b0672764 100644 --- a/unison-src/transcripts-using-base/random-deserial.md +++ b/unison-src/transcripts-using-base/random-deserial.md @@ -23,6 +23,7 @@ shuffle = | otherwise -> match gen seed (size l) with (k, seed) -> match (take k l, drop k l) with (pre, x +: post) -> pick (acc :+ x) seed (pre ++ post) + (pre, []) -> pick acc seed pre pick [] diff --git a/unison-src/transcripts-using-base/random-deserial.output.md b/unison-src/transcripts-using-base/random-deserial.output.md index d7f278426..24f21d771 100644 --- a/unison-src/transcripts-using-base/random-deserial.output.md +++ b/unison-src/transcripts-using-base/random-deserial.output.md @@ -19,6 +19,7 @@ shuffle = | otherwise -> match gen seed (size l) with (k, seed) -> match (take k l, drop k l) with (pre, x +: post) -> pick (acc :+ x) seed (pre ++ post) + (pre, []) -> pick acc seed pre pick [] From c2a896eeac1c4898d9626be5ec9a390c197b49c9 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 13 Jan 2023 10:16:36 -0500 Subject: [PATCH 388/467] complete patterns in tls --- unison-src/transcripts-using-base/tls.md | 4 +++- unison-src/transcripts-using-base/tls.output.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unison-src/transcripts-using-base/tls.md b/unison-src/transcripts-using-base/tls.md index fff979ede..7da872603 100644 --- a/unison-src/transcripts-using-base/tls.md +++ b/unison-src/transcripts-using-base/tls.md @@ -61,7 +61,9 @@ serverThread portVar toSend = 'let cert = decodeCert (toUtf8 self_signed_cert_pem2) -- assume there is exactly one key decoded from our Bytes - key = match (decodePrivateKey (toUtf8 self_signed_key_pem)) with k +: _ -> k + key = match (decodePrivateKey (toUtf8 self_signed_key_pem)) with + k +: _ -> k + [] -> bug "oh no" -- create a default configuration using our credentials (certificate chain and key) tlsconfig = Tls.ServerConfig.default [cert] key diff --git a/unison-src/transcripts-using-base/tls.output.md b/unison-src/transcripts-using-base/tls.output.md index 1e4cb5120..52dae392d 100644 --- a/unison-src/transcripts-using-base/tls.output.md +++ b/unison-src/transcripts-using-base/tls.output.md @@ -78,7 +78,9 @@ serverThread portVar toSend = 'let cert = decodeCert (toUtf8 self_signed_cert_pem2) -- assume there is exactly one key decoded from our Bytes - key = match (decodePrivateKey (toUtf8 self_signed_key_pem)) with k +: _ -> k + key = match (decodePrivateKey (toUtf8 self_signed_key_pem)) with + k +: _ -> k + [] -> bug "oh no" -- create a default configuration using our credentials (certificate chain and key) tlsconfig = Tls.ServerConfig.default [cert] key From fb039aaa53f277a92336eddb683f4f63b49cafba Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 13 Jan 2023 10:16:55 -0500 Subject: [PATCH 389/467] complete patterns in utf8 --- unison-src/transcripts-using-base/utf8.md | 1 + unison-src/transcripts-using-base/utf8.output.md | 1 + 2 files changed, 2 insertions(+) diff --git a/unison-src/transcripts-using-base/utf8.md b/unison-src/transcripts-using-base/utf8.md index 127f46660..07cd53a4b 100644 --- a/unison-src/transcripts-using-base/utf8.md +++ b/unison-src/transcripts-using-base/utf8.md @@ -55,5 +55,6 @@ greek_bytes = Bytes.fromList [206, 145, 206, 146, 206, 147, 206, 148, 206] -- Its an error if we drop the first byte > match fromUtf8.impl (drop 1 greek_bytes) with Left (Failure _ t _) -> t + _ -> bug "expected a left" ``` diff --git a/unison-src/transcripts-using-base/utf8.output.md b/unison-src/transcripts-using-base/utf8.output.md index 372185222..ab99fd866 100644 --- a/unison-src/transcripts-using-base/utf8.output.md +++ b/unison-src/transcripts-using-base/utf8.output.md @@ -111,6 +111,7 @@ greek_bytes = Bytes.fromList [206, 145, 206, 146, 206, 147, 206, 148, 206] -- Its an error if we drop the first byte > match fromUtf8.impl (drop 1 greek_bytes) with Left (Failure _ t _) -> t + _ -> bug "expected a left" ``` From 96197d9d188f15521f238f5380836ed84c9bc390 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 13 Jan 2023 10:18:20 -0500 Subject: [PATCH 390/467] complete patterns in destructuring-binds --- unison-src/transcripts/destructuring-binds.md | 2 ++ unison-src/transcripts/destructuring-binds.output.md | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/unison-src/transcripts/destructuring-binds.md b/unison-src/transcripts/destructuring-binds.md index 953cf6349..f9a1eef97 100644 --- a/unison-src/transcripts/destructuring-binds.md +++ b/unison-src/transcripts/destructuring-binds.md @@ -49,10 +49,12 @@ Even though the parser accepts any pattern on the LHS of a bind, it looks pretty ex5 : 'Text ex5 _ = match 99 + 1 with 12 -> "Hi" + _ -> "Bye" ex5a : 'Text ex5a _ = match (99 + 1, "hi") with (x, "hi") -> "Not printed as a destructuring bind." + _ -> "impossible" ``` ```ucm diff --git a/unison-src/transcripts/destructuring-binds.output.md b/unison-src/transcripts/destructuring-binds.output.md index f4c759964..1ca633ea7 100644 --- a/unison-src/transcripts/destructuring-binds.output.md +++ b/unison-src/transcripts/destructuring-binds.output.md @@ -106,10 +106,12 @@ Even though the parser accepts any pattern on the LHS of a bind, it looks pretty ex5 : 'Text ex5 _ = match 99 + 1 with 12 -> "Hi" + _ -> "Bye" ex5a : 'Text ex5a _ = match (99 + 1, "hi") with (x, "hi") -> "Not printed as a destructuring bind." + _ -> "impossible" ``` ```ucm @@ -137,13 +139,16 @@ ex5a _ = match (99 + 1, "hi") with ex5 : 'Text ex5 _ = use Nat + - match 99 + 1 with 12 -> "Hi" + match 99 + 1 with + 12 -> "Hi" + _ -> "Bye" ex5a : 'Text ex5a _ = use Nat + match (99 + 1, "hi") with (x, "hi") -> "Not printed as a destructuring bind." + _ -> "impossible" ``` Notice how it prints both an ordinary match. From 05edb55049924e69a2f5b4300953aee2b7235578 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 09:55:24 -0500 Subject: [PATCH 391/467] complete patterns in lambdacase --- unison-src/transcripts/lambdacase.md | 4 ++-- unison-src/transcripts/lambdacase.output.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/unison-src/transcripts/lambdacase.md b/unison-src/transcripts/lambdacase.md index dcbc2559d..1b794b5ba 100644 --- a/unison-src/transcripts/lambdacase.md +++ b/unison-src/transcripts/lambdacase.md @@ -77,11 +77,11 @@ structural type B = T | F blah = cases T, x -> "hi" - x, F -> "bye" + x, y -> "bye" blorf = cases x, T -> x - T, x -> x + x, y -> y > blah T F > blah F F diff --git a/unison-src/transcripts/lambdacase.output.md b/unison-src/transcripts/lambdacase.output.md index 573138be6..31cd7b599 100644 --- a/unison-src/transcripts/lambdacase.output.md +++ b/unison-src/transcripts/lambdacase.output.md @@ -121,11 +121,11 @@ structural type B = T | F blah = cases T, x -> "hi" - x, F -> "bye" + x, y -> "bye" blorf = cases x, T -> x - T, x -> x + x, y -> y > blah T F > blah F F @@ -141,7 +141,7 @@ blorf = cases ⍟ These new definitions are ok to `add`: structural type B - blah : B -> B -> Text + blah : B -> hod1jusqau2 -> Text blorf : B -> B -> B Now evaluating any watch expressions (lines starting with From b7da02658d15eb375a9203bcd6da598155623379 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 09:55:38 -0500 Subject: [PATCH 392/467] complete patterns in pattern-pretty-print-2345 --- .../transcripts/pattern-pretty-print-2345.md | 11 ++++ .../pattern-pretty-print-2345.output.md | 61 ++++++++++++++----- 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/unison-src/transcripts/pattern-pretty-print-2345.md b/unison-src/transcripts/pattern-pretty-print-2345.md index 83cb13d7a..8f77046d3 100644 --- a/unison-src/transcripts/pattern-pretty-print-2345.md +++ b/unison-src/transcripts/pattern-pretty-print-2345.md @@ -11,45 +11,56 @@ structural ability Ab where dopey = cases ?0 -> () + _ -> () grumpy = cases d -> () happy = cases true -> () + false -> () sneezy = cases +1 -> () + _ -> () bashful = cases Some a -> () + _ -> () mouthy = cases [] -> () + _ -> () pokey = cases h +: t -> () + _ -> () sleepy = cases i :+ l -> () + _ -> () demure = cases [0] -> () + _ -> () angry = cases a ++ [] -> () tremulous = cases (0,1) -> () + _ -> () throaty = cases { Ab.a a -> k } -> () agitated = cases a | a == 2 -> () + _ -> () doc = cases y@4 -> () + _ -> () ``` ```ucm diff --git a/unison-src/transcripts/pattern-pretty-print-2345.output.md b/unison-src/transcripts/pattern-pretty-print-2345.output.md index a764580fa..610c75699 100644 --- a/unison-src/transcripts/pattern-pretty-print-2345.output.md +++ b/unison-src/transcripts/pattern-pretty-print-2345.output.md @@ -7,45 +7,56 @@ structural ability Ab where dopey = cases ?0 -> () + _ -> () grumpy = cases d -> () happy = cases true -> () + false -> () sneezy = cases +1 -> () + _ -> () bashful = cases Some a -> () + _ -> () mouthy = cases [] -> () + _ -> () pokey = cases h +: t -> () + _ -> () sleepy = cases i :+ l -> () + _ -> () demure = cases [0] -> () + _ -> () angry = cases a ++ [] -> () tremulous = cases (0,1) -> () + _ -> () throaty = cases { Ab.a a -> k } -> () agitated = cases a | a == 2 -> () + _ -> () doc = cases y@4 -> () + _ -> () ``` ```ucm @@ -63,7 +74,7 @@ doc = cases demure : [Nat] -> () doc : Nat -> () dopey : Char -> () - grumpy : p4kl4dn7b41 -> () + grumpy : ff284oqf651 -> () happy : Boolean -> () mouthy : [t] -> () pokey : [t] -> () @@ -85,7 +96,7 @@ doc = cases demure : [Nat] -> () doc : Nat -> () dopey : Char -> () - grumpy : p4kl4dn7b41 -> () + grumpy : ff284oqf651 -> () happy : Boolean -> () mouthy : [t] -> () pokey : [t] -> () @@ -97,47 +108,63 @@ doc = cases .> view dopey dopey : Char -> () - dopey = cases ?0 -> () + dopey = cases + ?0 -> () + _ -> () .> view grumpy - grumpy : p4kl4dn7b41 -> () + grumpy : ff284oqf651 -> () grumpy = cases d -> () .> view happy happy : Boolean -> () - happy = cases true -> () + happy = cases + true -> () + false -> () .> view sneezy sneezy : Int -> () - sneezy = cases +1 -> () + sneezy = cases + +1 -> () + _ -> () .> view bashful bashful : Optional a -> () - bashful = cases Some a -> () + bashful = cases + Some a -> () + _ -> () .> view mouthy mouthy : [t] -> () - mouthy = cases [] -> () + mouthy = cases + [] -> () + _ -> () .> view pokey pokey : [t] -> () - pokey = cases h +: t -> () + pokey = cases + h +: t -> () + _ -> () .> view sleepy sleepy : [t] -> () - sleepy = cases i :+ l -> () + sleepy = cases + i :+ l -> () + _ -> () .> view demure demure : [Nat] -> () - demure = cases [0] -> () + demure = cases + [0] -> () + _ -> () .> view angry @@ -147,7 +174,9 @@ doc = cases .> view tremulous tremulous : (Nat, Nat) -> () - tremulous = cases (0, 1) -> () + tremulous = cases + (0, 1) -> () + _ -> () .> view throaty @@ -157,11 +186,15 @@ doc = cases .> view agitated agitated : Nat -> () - agitated = cases a | a == 2 -> () + agitated = cases + a | a == 2 -> () + _ -> () .> view doc doc : Nat -> () - doc = cases y@4 -> () + doc = cases + y@4 -> () + _ -> () ``` From e63e37c2723b48a80a01736472dc95667d19509e Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 10:26:38 -0500 Subject: [PATCH 393/467] complete patterns in caseguard.u --- unison-src/tests/caseguard.u | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/tests/caseguard.u b/unison-src/tests/caseguard.u index 16e949af5..94eb6ce1a 100644 --- a/unison-src/tests/caseguard.u +++ b/unison-src/tests/caseguard.u @@ -10,6 +10,6 @@ use Universal == f = cases x | x == "woot" -> false - y | y == "foo" -> true + y | otherwise -> true -- > f "woot" From 21a2fdff08a0e2b5fbd1a64165559d9c1d900843 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 10:26:47 -0500 Subject: [PATCH 394/467] complete patterns in imports.u --- unison-src/tests/imports.u | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/tests/imports.u b/unison-src/tests/imports.u index 0748ae284..2647c9f57 100644 --- a/unison-src/tests/imports.u +++ b/unison-src/tests/imports.u @@ -19,4 +19,4 @@ use Nat drop > match Some (100 + 200 / 3 * 2) with Optional.None -> 19 - Some 200 -> 20 + Some _ -> 20 From 8d2e57f29a718e03e00034cd364d14f4b75c8e2f Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 10:26:59 -0500 Subject: [PATCH 395/467] complete patterns in inner-lambda.u --- unison-src/tests/inner-lambda1.u | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/tests/inner-lambda1.u b/unison-src/tests/inner-lambda1.u index 708a59e78..43c196c8d 100644 --- a/unison-src/tests/inner-lambda1.u +++ b/unison-src/tests/inner-lambda1.u @@ -12,4 +12,5 @@ search hit bot top = +0 -> Some mid -1 -> go bot (drop mid 1) +1 -> go (mid + 1) top + _ -> bug "unexpected" go bot top From 271a7211aff2dff11864bdc6984ce564938e59dd Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 10:27:42 -0500 Subject: [PATCH 396/467] complete patterns in inner-lambda2 --- unison-src/tests/inner-lambda2.u | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/tests/inner-lambda2.u b/unison-src/tests/inner-lambda2.u index 6900e8fd3..f356cbcfe 100644 --- a/unison-src/tests/inner-lambda2.u +++ b/unison-src/tests/inner-lambda2.u @@ -13,4 +13,5 @@ search hit bot top = +0 -> Some mid -1 -> go bot (drop mid 1) +1 -> go (mid + 1) top + _ -> bug "unexpected" go bot top From c0da1727c03ce65d82953efebfb6eed459a3de2b Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 11:05:53 -0500 Subject: [PATCH 397/467] complete patterns in pattern-matching.u --- unison-src/tests/methodical/pattern-matching.u | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/tests/methodical/pattern-matching.u b/unison-src/tests/methodical/pattern-matching.u index e1883d120..9740b29b2 100644 --- a/unison-src/tests/methodical/pattern-matching.u +++ b/unison-src/tests/methodical/pattern-matching.u @@ -17,7 +17,7 @@ pat6 x y = cases (p1, _) -> (x + y : Nat, p1) pat7 x y = cases (p1, _) | p1 == 9 -> (x + y : Nat, p1) - (p1, _) | true -> (0, p1) + (p1, _) | otherwise -> (0, p1) bpat = cases false -> 0 From 6b0021f1cd130e25f3400dbc248b333ed01bce1e Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 11:06:14 -0500 Subject: [PATCH 398/467] complete patterns in parenthesized-blocks --- unison-src/tests/parenthesized-blocks.u | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/tests/parenthesized-blocks.u b/unison-src/tests/parenthesized-blocks.u index 5824dbbec..db7bff5db 100644 --- a/unison-src/tests/parenthesized-blocks.u +++ b/unison-src/tests/parenthesized-blocks.u @@ -1,5 +1,5 @@ x = (if true then 1 else 0) + 1 -y = (match 1 with 1 -> 1) + 1 +y = (match 1 with _ -> 1) + 1 > (x, y) From 344949c03658e6f5310afc74d6cf64c6b44e2a61 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 17 Jan 2023 11:08:52 -0500 Subject: [PATCH 399/467] fix pattern coverage in pattern-match-seq --- unison-src/tests/pattern-match-seq.u | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unison-src/tests/pattern-match-seq.u b/unison-src/tests/pattern-match-seq.u index 58c0a0484..c1485544a 100644 --- a/unison-src/tests/pattern-match-seq.u +++ b/unison-src/tests/pattern-match-seq.u @@ -11,12 +11,12 @@ lenLit = cases [_] -> 1 [_, _] -> 2 [_, _, _] -> 3 + _ -> bug "unexpected" lenCons : [a] -> Nat lenCons = cases [] -> 0 _ +: t -> 1 + lenCons t - _ +: (_ +: t) -> 2 + lenCons t lenSnoc : [a] -> Nat lenSnoc = cases From e8c6ad06113f5f65444ab55477b8b466b0ce5efa Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 09:49:25 -0500 Subject: [PATCH 400/467] fix pattern coverage in pattern-matching.u --- unison-src/tests/pattern-matching.u | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unison-src/tests/pattern-matching.u b/unison-src/tests/pattern-matching.u index b1e2b3c7e..8be597d2f 100644 --- a/unison-src/tests/pattern-matching.u +++ b/unison-src/tests/pattern-matching.u @@ -16,8 +16,8 @@ y = match Foo1 1 with Foo1 _ -> 10 z = match Foo2 1 "hi" with - Foo2 x _ -> x Foo2 1 _ -> 1 + Foo2 x _ -> x w = match Foo3.Foo3 1 2 "bye" with Foo3.Foo3 1 2 x -> x Text.++ "bye" @@ -26,7 +26,6 @@ w = match Foo3.Foo3 1 2 "bye" with w2 = cases Foo3.Foo3 1 4 x -> x Text.++ "bye" Foo3.Foo3 x y z -> z Text.++ z - _ -> "hi" len : List a -> Nat len = cases From 9724f26c211cab915b3f9fdade823059093c4c95 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 09:50:15 -0500 Subject: [PATCH 401/467] fix pattern coverage in pattern-matching2.u --- unison-src/tests/pattern-matching2.u | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unison-src/tests/pattern-matching2.u b/unison-src/tests/pattern-matching2.u index 4f6dd8c40..e17364946 100644 --- a/unison-src/tests/pattern-matching2.u +++ b/unison-src/tests/pattern-matching2.u @@ -15,7 +15,8 @@ y = match Foo1 1 with Foo1 _ -> 10 z = match Foo2 1 "hi" with - Foo2 x "bye" -> x Foo2 1 "hi" -> 1 + Foo2 x "bye" -> x + _ -> bug "unexpected" > z From f1c74c22f3a94b9abd1114a3e52e2ac9c8bbd991 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 09:51:25 -0500 Subject: [PATCH 402/467] fix pattern coverage in r2 --- unison-src/tests/r2.u | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/tests/r2.u b/unison-src/tests/r2.u index 8218decb7..b7eaf7d71 100644 --- a/unison-src/tests/r2.u +++ b/unison-src/tests/r2.u @@ -3,4 +3,5 @@ r2 : Nat r2 = match Optional.Some true with Optional.Some true -> 1 Optional.Some false -> 0 + Optional.None -> bug "unexpected" From f38e5d3a1c5c1ae6e5d172b6b6ed2bcca2b34760 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 09:51:36 -0500 Subject: [PATCH 403/467] fix pattern coverage in r3 --- unison-src/tests/r3.u | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/tests/r3.u b/unison-src/tests/r3.u index 74b76105f..93e13894c 100644 --- a/unison-src/tests/r3.u +++ b/unison-src/tests/r3.u @@ -2,5 +2,6 @@ r3 : Nat r3 = match Optional.Some true with Optional.Some true -> 1 Optional.Some false -> 0 + Optional.None -> bug "unexpected" From 45238c72e8de5a782fb2219d936c37efc8784ff6 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 09:52:22 -0500 Subject: [PATCH 404/467] fix pattern coverage in r4x --- unison-src/tests/r4x.u | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/tests/r4x.u b/unison-src/tests/r4x.u index 1e7123f6e..dda1d0227 100644 --- a/unison-src/tests/r4x.u +++ b/unison-src/tests/r4x.u @@ -1,3 +1,4 @@ r4 : Int -> Int r4 = cases +1 -> +1 + x -> x From 1488d7fc0d04347d586d58ea219d77c194fd4f83 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 09:53:13 -0500 Subject: [PATCH 405/467] fix pattern coverage in sequence-at-0 --- unison-src/tests/sequence-at-0.u | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/tests/sequence-at-0.u b/unison-src/tests/sequence-at-0.u index 37f642935..ea80e80d0 100644 --- a/unison-src/tests/sequence-at-0.u +++ b/unison-src/tests/sequence-at-0.u @@ -1,2 +1,3 @@ > match at 0 [100] with Optional.Some _ -> "Hooray!" + Optional.None -> bug "unexpected" From 60482576b647846c48e44be2925341c4b230464a Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 09:53:53 -0500 Subject: [PATCH 406/467] fix pattern coverage in sequence-literal-argument-parsing.u --- unison-src/tests/sequence-literal-argument-parsing.u | 1 + 1 file changed, 1 insertion(+) diff --git a/unison-src/tests/sequence-literal-argument-parsing.u b/unison-src/tests/sequence-literal-argument-parsing.u index d6d495bca..f5901bb1e 100644 --- a/unison-src/tests/sequence-literal-argument-parsing.u +++ b/unison-src/tests/sequence-literal-argument-parsing.u @@ -3,3 +3,4 @@ structural type X a = X [a] f : X a -> a f = cases X.X [b] -> b + X.X _ -> bug "unexpected" From 1739cafc8338ad7fd67a51932351a668b74730e2 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 18 Jan 2023 10:28:20 -0500 Subject: [PATCH 407/467] fix pattern coverage in tictactoe2 --- unison-src/tests/tictactoe2.u | 55 ++++++++++++++++------------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/unison-src/tests/tictactoe2.u b/unison-src/tests/tictactoe2.u index 9ebaf3b30..d5965c244 100644 --- a/unison-src/tests/tictactoe2.u +++ b/unison-src/tests/tictactoe2.u @@ -7,6 +7,18 @@ use Board Board use P O X E use Optional Some None +foldLeft : (b -> a -> b) -> b -> [a] -> b +foldLeft f = + go z xs = match xs with + [] -> z + a +: as -> go (f z a) as + go + +orElse a b = + match a with + None -> b + a -> a + isWin : Board -> Optional P isWin board = same : P -> P -> P -> Optional P @@ -18,36 +30,19 @@ isWin board = -- horizontal left/center/right -- diagonal rising/falling Board a b c - _ _ _ - _ _ _ -> same a b c - - Board _ _ _ - a b c - _ _ _ -> same a b c - - Board _ _ _ - _ _ _ - a b c -> same a b c - - Board a _ _ - b _ _ - c _ _ -> same a b c - - Board _ a _ - _ b _ - _ c _ -> same a b c - - Board _ _ a - _ _ b - _ _ c -> same a b c - - Board a _ _ - _ b _ - _ _ c -> same a b c - - Board _ _ a - _ b _ - c _ _ -> same a b c + d e f + g h i + -> + foldLeft orElse None + [ same a b c + , same d e f + , same g h i + , same a d g + , same b e h + , same c f i + , same a e i + , same g e c + ] x = isWin (Board X O X O X X From 281e8f1ddfbb1b3b93aaced365973bb5cbdf0fe7 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 11:30:44 -0500 Subject: [PATCH 408/467] complete patterns in patternMatchTls --- unison-src/transcripts/patternMatchTls.md | 15 ++++++++----- .../transcripts/patternMatchTls.output.md | 21 ++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/unison-src/transcripts/patternMatchTls.md b/unison-src/transcripts/patternMatchTls.md index 6d600f535..1fe2c295b 100644 --- a/unison-src/transcripts/patternMatchTls.md +++ b/unison-src/transcripts/patternMatchTls.md @@ -13,13 +13,18 @@ use builtin.io2.Tls newClient send handshake terminate frank: '{IO} () frank = do - (Right socket) = clientSocket.impl "example.com" "443" + socket = assertRight (clientSocket.impl "example.com" "443") config = ClientConfig.default "example.com" 0xs - (Right tls) = newClient.impl config socket - (Right ()) = handshake.impl tls - (Right ()) = send.impl tls 0xs - (Right ()) = terminate.impl tls + tls = assertRight (newClient.impl config socket) + () = assertRight (handshake.impl tls) + () = assertRight (send.impl tls 0xs) + () = assertRight (terminate.impl tls) () + +assertRight : Either a b -> b +assertRight = cases + Right x -> x + Left _ -> bug "expected a right but got a left" ``` diff --git a/unison-src/transcripts/patternMatchTls.output.md b/unison-src/transcripts/patternMatchTls.output.md index b1dd77c96..726af9f86 100644 --- a/unison-src/transcripts/patternMatchTls.output.md +++ b/unison-src/transcripts/patternMatchTls.output.md @@ -8,13 +8,18 @@ use builtin.io2.Tls newClient send handshake terminate frank: '{IO} () frank = do - (Right socket) = clientSocket.impl "example.com" "443" + socket = assertRight (clientSocket.impl "example.com" "443") config = ClientConfig.default "example.com" 0xs - (Right tls) = newClient.impl config socket - (Right ()) = handshake.impl tls - (Right ()) = send.impl tls 0xs - (Right ()) = terminate.impl tls + tls = assertRight (newClient.impl config socket) + () = assertRight (handshake.impl tls) + () = assertRight (send.impl tls 0xs) + () = assertRight (terminate.impl tls) () + +assertRight : Either a b -> b +assertRight = cases + Right x -> x + Left _ -> bug "expected a right but got a left" ``` ```ucm @@ -25,7 +30,8 @@ frank = do ⍟ These new definitions are ok to `add`: - frank : '{IO} () + assertRight : Either a b -> b + frank : '{IO} () ``` ```ucm @@ -33,7 +39,8 @@ frank = do ⍟ I've added these definitions: - frank : '{IO} () + assertRight : Either a b -> b + frank : '{IO} () .> run frank From 2833779f58929c77f79fe62414f6805e083d29b9 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 11:31:41 -0500 Subject: [PATCH 409/467] update pattern-match-coverage transcript --- .../transcripts/pattern-match-coverage.output.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index 0103006da..c9c5cf96c 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -5,7 +5,7 @@ unique type T = A | B | C test : T -> () test = cases - A -> 0 + A -> () ``` ```ucm @@ -13,7 +13,7 @@ test = cases Pattern match is non-exhaustive In the match: 4 | test = cases - 5 | A -> 0 + 5 | A -> () Patterns not matched: @@ -28,17 +28,17 @@ unique type T = A | B | C test : T -> () test = cases - A -> 0 - B -> 0 - C -> 0 - _ -> 0 + A -> () + B -> () + C -> () + _ -> () ``` ```ucm Pattern match is redundant In the match case: - 8 | _ -> 0 + 8 | _ -> () ``` From ecae9aa967b9739d689a3b7d1f8ac8abd960f158 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 11:32:23 -0500 Subject: [PATCH 410/467] ormolu --- unison-core/src/Unison/Term.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/unison-core/src/Unison/Term.hs b/unison-core/src/Unison/Term.hs index 1656d3380..7a84998e9 100644 --- a/unison-core/src/Unison/Term.hs +++ b/unison-core/src/Unison/Term.hs @@ -164,16 +164,16 @@ bindNames unsafeVarToName keepFreeTerms ns0 e = do okTm (v, a) = case Names.lookupHQTerm (Name.convert $ unsafeVarToName v) ns of rs | Set.size rs == 1 -> - pure (v, fromReferent a $ Set.findMin rs) + pure (v, fromReferent a $ Set.findMin rs) | otherwise -> case NES.nonEmptySet rs of - Nothing -> Left (pure (Names.TermResolutionFailure v a Names.NotFound)) - Just refs -> Left (pure (Names.TermResolutionFailure v a (Names.Ambiguous ns0 refs))) + Nothing -> Left (pure (Names.TermResolutionFailure v a Names.NotFound)) + Just refs -> Left (pure (Names.TermResolutionFailure v a (Names.Ambiguous ns0 refs))) okTy (v, a) = case Names.lookupHQType (Name.convert $ unsafeVarToName v) ns of rs | Set.size rs == 1 -> pure (v, Type.ref a $ Set.findMin rs) | otherwise -> case NES.nonEmptySet rs of - Nothing -> Left (pure (Names.TypeResolutionFailure v a Names.NotFound)) - Just refs -> Left (pure (Names.TypeResolutionFailure v a (Names.Ambiguous ns0 refs))) + Nothing -> Left (pure (Names.TypeResolutionFailure v a Names.NotFound)) + Just refs -> Left (pure (Names.TypeResolutionFailure v a (Names.Ambiguous ns0 refs))) termSubsts <- validate okTm freeTmVars typeSubsts <- validate okTy freeTyVars pure . substTypeVars typeSubsts . ABT.substsInheritAnnotation termSubsts $ e @@ -218,7 +218,7 @@ prepareTDNR t = fmap fst . ABT.visitPure f $ ABT.annotateBound t where f (ABT.Term _ (a, bound) (ABT.Var v)) | Set.notMember v bound = - Just $ resolve (a, bound) a (Text.unpack $ Var.name v) + Just $ resolve (a, bound) a (Text.unpack $ Var.name v) f _ = Nothing amap :: (Ord v) => (a -> a2) -> Term v a -> Term v a2 @@ -390,10 +390,10 @@ substTypeVar vt ty = go Set.empty -- variable name for v which is unique, v', and rename v to v' in e. uncapture vs e t@(Type.Forall' body) | Set.member (ABT.variable body) fvs = - let v = ABT.variable body - v2 = Var.freshIn (ABT.freeVars t) . Var.freshIn (Set.insert vt fvs) $ v - t2 = ABT.bindInheritAnnotation body (Type.var () v2) - in uncapture ((ABT.annotation t, v2) : vs) (renameTypeVar v v2 e) t2 + let v = ABT.variable body + v2 = Var.freshIn (ABT.freeVars t) . Var.freshIn (Set.insert vt fvs) $ v + t2 = ABT.bindInheritAnnotation body (Type.var () v2) + in uncapture ((ABT.annotation t, v2) : vs) (renameTypeVar v v2 e) t2 uncapture vs e t0 = let t = foldl (\body (loc, v) -> Type.forall loc v body) t0 vs bound' = case Type.unForalls (Type.stripIntroOuters t) of @@ -631,7 +631,7 @@ unDelay :: (Ord v) => Term2 vt at ap v a -> Maybe (Term2 vt at ap v a) unDelay tm = case ABT.out tm of ABT.Tm (Lam (ABT.Term _ _ (ABT.Abs v body))) | Set.notMember v (ABT.freeVars body) -> - Just body + Just body _ -> Nothing pattern LamNamed' :: From aaf0b4c8ab5f48900bd369644203ee4711dec955 Mon Sep 17 00:00:00 2001 From: Dan Doel Date: Mon, 27 Feb 2023 15:14:48 -0500 Subject: [PATCH 411/467] Make crypto ffi code more cross platform Racket seems to support providing version numbers for shared library files, which I presume works better than putting the version number in the string. Some racket code I've seen is a bit more elaborate than what I've done here, but this seems to work. --- scheme-libs/racket/unison/crypto.rkt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scheme-libs/racket/unison/crypto.rkt b/scheme-libs/racket/unison/crypto.rkt index 6569f916a..16036700a 100644 --- a/scheme-libs/racket/unison/crypto.rkt +++ b/scheme-libs/racket/unison/crypto.rkt @@ -2,6 +2,7 @@ (require ffi/unsafe ffi/unsafe/define racket/exn + openssl/libcrypto ) (provide (prefix-out unison-FOp-crypto. @@ -18,10 +19,12 @@ hmacBytes))) (define libcrypto - (with-handlers [[exn:fail? exn->string]] (ffi-lib "libcrypto.1.1"))) + (with-handlers [[exn:fail? exn->string]] + (ffi-lib "libcrypto" openssl-lib-versions))) (define libb2 - (with-handlers [[exn:fail? exn->string]] (ffi-lib "libb2"))) + (with-handlers [[exn:fail? exn->string]] + (ffi-lib "libb2" '("" "1")))) (define _EVP-pointer (_cpointer 'EVP)) From 16585a41509c1be120618868f63e63e64900afab Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 16:02:22 -0500 Subject: [PATCH 412/467] Ensure data declaration map is populated as expected by pattern match coverage checker --- parser-typechecker/src/Unison/Codebase.hs | 39 +++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase.hs b/parser-typechecker/src/Unison/Codebase.hs index b38a404c6..757f87ea5 100644 --- a/parser-typechecker/src/Unison/Codebase.hs +++ b/parser-typechecker/src/Unison/Codebase.hs @@ -161,6 +161,7 @@ import Unison.Symbol (Symbol) import Unison.Term (Term) import qualified Unison.Term as Term import Unison.Type (Type) +import qualified Unison.Type as Type import Unison.Typechecker.TypeLookup (TypeLookup (TypeLookup)) import qualified Unison.Typechecker.TypeLookup as TL import qualified Unison.UnisonFile as UF @@ -338,6 +339,7 @@ lookupWatchCache codebase h = do maybe (getWatch codebase WK.TestWatch h) (pure . Just) m1 typeLookupForDependencies :: + forall m a. (BuiltinAnnotation a) => Codebase m Symbol a -> Set Reference -> @@ -347,17 +349,34 @@ typeLookupForDependencies codebase s = do foldM go mempty s where go tl ref@(Reference.DerivedId id) = - fmap (tl <>) $ - getTypeOfTerm codebase ref >>= \case - Just typ -> pure $ TypeLookup (Map.singleton ref typ) mempty mempty - Nothing -> - getTypeDeclaration codebase id >>= \case - Just (Left ed) -> - pure $ TypeLookup mempty mempty (Map.singleton ref ed) - Just (Right dd) -> - pure $ TypeLookup mempty (Map.singleton ref dd) mempty - Nothing -> pure mempty + getTypeOfTerm codebase ref >>= \case + Just typ -> pure $ tl <> TypeLookup (Map.singleton ref typ) mempty mempty + Nothing -> + getTypeDeclaration codebase id >>= \case + Just (Left ed) -> + pure $ tl <> TypeLookup mempty mempty (Map.singleton ref ed) + Just (Right dd) -> do + -- We need the transitive dependencies of data decls + -- that are scrutinized in a match expression for + -- pattern match coverage checking (specifically for + -- the inhabitation check). We ensure these are found + -- by collecting all type dependencies for all data + -- decls. + let constructorTypes :: [Type Symbol a] + constructorTypes = snd <$> DD.constructors dd + + -- All references from constructorTypes that we + -- have not already gathered. + constructorRefs :: Set Reference + constructorRefs = foldl' (\b a -> Set.filter (unseen tl) (Type.dependencies a) <> b) mempty constructorTypes + + -- recursively call go for each constructor ref + let z = tl <> TypeLookup mempty (Map.singleton ref dd) mempty + foldM go z constructorRefs + Nothing -> pure tl go tl Reference.Builtin {} = pure tl -- codebase isn't consulted for builtins + unseen :: TL.TypeLookup Symbol a -> Reference -> Bool + unseen tl r = isNothing (Map.lookup r (TL.dataDecls tl)) toCodeLookup :: (MonadIO m) => Codebase m Symbol Parser.Ann -> CL.CodeLookup Symbol m Parser.Ann toCodeLookup c = From 74cd76b49f586cd8e883cbec824e8044f74827e6 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 16:12:10 -0500 Subject: [PATCH 413/467] typos and transcript edit --- parser-typechecker/src/Unison/PrintError.hs | 2 +- parser-typechecker/src/Unison/Runtime/Interface.hs | 2 ++ unison-cli/src/Unison/Codebase/Editor/Propagate.hs | 2 +- unison-src/transcripts/pattern-match-coverage.md | 10 +++++----- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/parser-typechecker/src/Unison/PrintError.hs b/parser-typechecker/src/Unison/PrintError.hs index b4022f891..cc352f778 100644 --- a/parser-typechecker/src/Unison/PrintError.hs +++ b/parser-typechecker/src/Unison/PrintError.hs @@ -976,7 +976,7 @@ renderCompilerBug env _src bug = mconcat $ case bug of C.Data -> " data type" C.Effect -> " ability", "\n", - " reerence = ", + " reference = ", showTypeRef env rf ] C.UnknownConstructor sort (ConstructorReference rf i) _decl -> diff --git a/parser-typechecker/src/Unison/Runtime/Interface.hs b/parser-typechecker/src/Unison/Runtime/Interface.hs index 22ca1cfe4..c1374f169 100644 --- a/parser-typechecker/src/Unison/Runtime/Interface.hs +++ b/parser-typechecker/src/Unison/Runtime/Interface.hs @@ -151,6 +151,7 @@ recursiveDeclDeps :: Set RF.LabeledDependency -> CodeLookup Symbol IO () -> Decl Symbol () -> + -- (type deps, term deps) IO (Set Reference, Set Reference) recursiveDeclDeps seen0 cl d = do rec <- for (toList newDeps) $ \case @@ -176,6 +177,7 @@ recursiveTermDeps :: Set RF.LabeledDependency -> CodeLookup Symbol IO () -> Term Symbol -> + -- (type deps, term deps) IO (Set Reference, Set Reference) recursiveTermDeps seen0 cl tm = do rec <- for (toList (deps \\ seen0)) $ \case diff --git a/unison-cli/src/Unison/Codebase/Editor/Propagate.hs b/unison-cli/src/Unison/Codebase/Editor/Propagate.hs index af90bd55f..61a56d03e 100644 --- a/unison-cli/src/Unison/Codebase/Editor/Propagate.hs +++ b/unison-cli/src/Unison/Codebase/Editor/Propagate.hs @@ -559,7 +559,7 @@ typecheckFile :: Codebase m Symbol Ann -> [Type Symbol Ann] -> UF.UnisonFile Symbol Ann -> - Sqlite.Transaction (Result.Result (Seq (Result.Note Symbol Ann)) (Either Names (UF.TypecheckedUnisonFile Symbol Ann))) + Sqlite.Transaction (Result.Result (Seq (Result.Note Symbol Ann)) (Either x (UF.TypecheckedUnisonFile Symbol Ann))) typecheckFile codebase ambient file = do typeLookup <- Codebase.typeLookupForDependencies codebase (UF.dependencies file) pure . fmap Right $ synthesizeFile' ambient (typeLookup <> Builtin.typeLookup) file diff --git a/unison-src/transcripts/pattern-match-coverage.md b/unison-src/transcripts/pattern-match-coverage.md index 1affffa78..6034984b8 100644 --- a/unison-src/transcripts/pattern-match-coverage.md +++ b/unison-src/transcripts/pattern-match-coverage.md @@ -9,7 +9,7 @@ unique type T = A | B | C test : T -> () test = cases - A -> 0 + A -> () ``` redundant matches are reported @@ -18,10 +18,10 @@ unique type T = A | B | C test : T -> () test = cases - A -> 0 - B -> 0 - C -> 0 - _ -> 0 + A -> () + B -> () + C -> () + _ -> () ``` patterns that would imply supplying an uninhabited type are not expected From e11574e4723c28a19fc5bcf978dd4ee9feb76259 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 16:14:19 -0500 Subject: [PATCH 414/467] ormolu --- unison-core/src/Unison/Term.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/unison-core/src/Unison/Term.hs b/unison-core/src/Unison/Term.hs index 7a84998e9..1656d3380 100644 --- a/unison-core/src/Unison/Term.hs +++ b/unison-core/src/Unison/Term.hs @@ -164,16 +164,16 @@ bindNames unsafeVarToName keepFreeTerms ns0 e = do okTm (v, a) = case Names.lookupHQTerm (Name.convert $ unsafeVarToName v) ns of rs | Set.size rs == 1 -> - pure (v, fromReferent a $ Set.findMin rs) + pure (v, fromReferent a $ Set.findMin rs) | otherwise -> case NES.nonEmptySet rs of - Nothing -> Left (pure (Names.TermResolutionFailure v a Names.NotFound)) - Just refs -> Left (pure (Names.TermResolutionFailure v a (Names.Ambiguous ns0 refs))) + Nothing -> Left (pure (Names.TermResolutionFailure v a Names.NotFound)) + Just refs -> Left (pure (Names.TermResolutionFailure v a (Names.Ambiguous ns0 refs))) okTy (v, a) = case Names.lookupHQType (Name.convert $ unsafeVarToName v) ns of rs | Set.size rs == 1 -> pure (v, Type.ref a $ Set.findMin rs) | otherwise -> case NES.nonEmptySet rs of - Nothing -> Left (pure (Names.TypeResolutionFailure v a Names.NotFound)) - Just refs -> Left (pure (Names.TypeResolutionFailure v a (Names.Ambiguous ns0 refs))) + Nothing -> Left (pure (Names.TypeResolutionFailure v a Names.NotFound)) + Just refs -> Left (pure (Names.TypeResolutionFailure v a (Names.Ambiguous ns0 refs))) termSubsts <- validate okTm freeTmVars typeSubsts <- validate okTy freeTyVars pure . substTypeVars typeSubsts . ABT.substsInheritAnnotation termSubsts $ e @@ -218,7 +218,7 @@ prepareTDNR t = fmap fst . ABT.visitPure f $ ABT.annotateBound t where f (ABT.Term _ (a, bound) (ABT.Var v)) | Set.notMember v bound = - Just $ resolve (a, bound) a (Text.unpack $ Var.name v) + Just $ resolve (a, bound) a (Text.unpack $ Var.name v) f _ = Nothing amap :: (Ord v) => (a -> a2) -> Term v a -> Term v a2 @@ -390,10 +390,10 @@ substTypeVar vt ty = go Set.empty -- variable name for v which is unique, v', and rename v to v' in e. uncapture vs e t@(Type.Forall' body) | Set.member (ABT.variable body) fvs = - let v = ABT.variable body - v2 = Var.freshIn (ABT.freeVars t) . Var.freshIn (Set.insert vt fvs) $ v - t2 = ABT.bindInheritAnnotation body (Type.var () v2) - in uncapture ((ABT.annotation t, v2) : vs) (renameTypeVar v v2 e) t2 + let v = ABT.variable body + v2 = Var.freshIn (ABT.freeVars t) . Var.freshIn (Set.insert vt fvs) $ v + t2 = ABT.bindInheritAnnotation body (Type.var () v2) + in uncapture ((ABT.annotation t, v2) : vs) (renameTypeVar v v2 e) t2 uncapture vs e t0 = let t = foldl (\body (loc, v) -> Type.forall loc v body) t0 vs bound' = case Type.unForalls (Type.stripIntroOuters t) of @@ -631,7 +631,7 @@ unDelay :: (Ord v) => Term2 vt at ap v a -> Maybe (Term2 vt at ap v a) unDelay tm = case ABT.out tm of ABT.Tm (Lam (ABT.Term _ _ (ABT.Abs v body))) | Set.notMember v (ABT.freeVars body) -> - Just body + Just body _ -> Nothing pattern LamNamed' :: From 41d05fc145943b383895d7d30273cb64a0c0cf5c Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 17:48:25 -0500 Subject: [PATCH 415/467] ormolu --- .../src/Unison/PatternMatchCoverage/Class.hs | 2 +- .../Unison/PatternMatchCoverage/Constraint.hs | 2 +- .../Unison/PatternMatchCoverage/Desugar.hs | 10 ++--- .../src/Unison/PatternMatchCoverage/Fix.hs | 10 ++--- .../Unison/PatternMatchCoverage/GrdTree.hs | 10 ++--- .../Unison/PatternMatchCoverage/Literal.hs | 4 +- .../NormalizedConstraints.hs | 11 +++-- .../src/Unison/PatternMatchCoverage/PmLit.hs | 2 +- .../src/Unison/PatternMatchCoverage/Solve.hs | 40 +++++++++---------- .../src/Unison/PatternMatchCoverage/UFMap.hs | 6 +-- 10 files changed, 50 insertions(+), 47 deletions(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs index f908a2072..30f5407f4 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs @@ -21,7 +21,7 @@ data EnumeratedConstructors vt v loc deriving stock (Show) traverseConstructors :: - Applicative f => + (Applicative f) => (v -> ConstructorReference -> Type vt loc -> f (v, ConstructorReference, Type vt loc)) -> EnumeratedConstructors vt v loc -> f (EnumeratedConstructors vt v loc) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs index c465e023d..034d5cf75 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs @@ -48,5 +48,5 @@ prettyConstraint = \case Eq v0 v1 -> sep " " [pv v0, "=", pv v1] where pv = string . show - pc :: forall a. Show a => a -> Pretty ColorText + pc :: forall a. (Show a) => a -> Pretty ColorText pc = string . show diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs index 3551d863b..d60ef92c8 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs @@ -16,7 +16,7 @@ import qualified Unison.Type as Type desugarMatch :: forall loc vt v m. - Pmc vt v loc m => + (Pmc vt v loc m) => -- | loc of match loc -> Type vt loc -> @@ -44,7 +44,7 @@ desugarMatch loc0 scrutineeType v0 cs0 = desugarPattern :: forall v vt loc m. - Pmc vt v loc m => + (Pmc vt v loc m) => Type vt loc -> v -> Pattern loc -> @@ -77,7 +77,7 @@ desugarPattern typ v0 pat k vs = case pat of handleSequence :: forall v vt loc m. - Pmc vt v loc m => + (Pmc vt v loc m) => Type vt loc -> v -> Pattern loc -> @@ -92,7 +92,7 @@ handleSequence typ v pat k vs = do listToGrdTree :: forall v vt loc m. - Pmc vt v loc m => + (Pmc vt v loc m) => Type vt loc -> Type vt loc -> v -> @@ -200,5 +200,5 @@ normalizeList pat0 = case goCons pat0 of As _loc pat -> goSnoc pat nlp _ -> error "goSnoc: unexpected pattern" -assignFreshPatternVars :: Pmc vt v loc m => [Pattern loc] -> m [(v, Pattern loc)] +assignFreshPatternVars :: (Pmc vt v loc m) => [Pattern loc] -> m [(v, Pattern loc)] assignFreshPatternVars pats = traverse (\p -> (,p) <$> fresh) pats diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs index 99974ba72..9accc06fb 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Fix.hs @@ -7,14 +7,14 @@ module Unison.PatternMatchCoverage.Fix where newtype Fix f = Fix {unFix :: f (Fix f)} -deriving instance (forall a. Show a => Show (f a)) => Show (Fix f) +deriving instance (forall a. (Show a) => Show (f a)) => Show (Fix f) -deriving instance (forall a. Eq a => Eq (f a)) => Eq (Fix f) +deriving instance (forall a. (Eq a) => Eq (f a)) => Eq (Fix f) -deriving instance (Eq (Fix f), forall a. Ord a => Ord (f a)) => Ord (Fix f) +deriving instance (Eq (Fix f), forall a. (Ord a) => Ord (f a)) => Ord (Fix f) -cata :: Functor f => (f a -> a) -> Fix f -> a +cata :: (Functor f) => (f a -> a) -> Fix f -> a cata alg = let c = alg . fmap c . unFix in c -para :: Functor f => (f (Fix f, a) -> a) -> Fix f -> a +para :: (Functor f) => (f (Fix f, a) -> a) -> Fix f -> a para alg = let c = alg . fmap (\x -> (x, c x)) . unFix in c diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs index c84e2daa7..e11a5b842 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs @@ -29,11 +29,11 @@ prettyGrdTree prettyNode prettyLeaf = cata phi [] -> [] x : [] -> [sep " " ["──", x]] x0 : x1 : xs -> - sep " " ["┬─", x0] : - let go y0 = \case - [] -> [sep " " ["└─", y0]] - y1 : ys -> "├─ " <> y0 : go y1 ys - in [indent " " (sep "\n" (go x1 xs))] + sep " " ["┬─", x0] + : let go y0 = \case + [] -> [sep " " ["└─", y0]] + y1 : ys -> "├─ " <> y0 : go y1 ys + in [indent " " (sep "\n" (go x1 xs))] pattern Leaf :: l -> GrdTree n l pattern Leaf x = Fix (LeafF x) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs index dd38f85b3..7d0f52c54 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs @@ -40,7 +40,7 @@ data Literal vt v loc | Let v (Term' vt v loc) (Type vt loc) deriving stock (Show) -prettyLiteral :: Var v => Literal (TypeVar b v) v loc -> Pretty ColorText +prettyLiteral :: (Var v) => Literal (TypeVar b v) v loc -> Pretty ColorText prettyLiteral = \case T -> "✓" F -> "⨉" @@ -57,5 +57,5 @@ prettyLiteral = \case Let var expr typ -> sep " " ["let", pv var, "=", TermPrinter.pretty PPE.empty (lowerTerm expr), ":", TypePrinter.pretty PPE.empty typ] where pv = string . show - pc :: forall a. Show a => a -> Pretty ColorText + pc :: forall a. (Show a) => a -> Pretty ColorText pc = string . show diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs index da0af8dfd..44a6fabaa 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs @@ -51,7 +51,7 @@ data NormalizedConstraints vt v loc = NormalizedConstraints -- | Mark a variable as requiring a new test for inhabitation. markDirty :: - Ord v => + (Ord v) => v -> NormalizedConstraints vt v loc -> NormalizedConstraints vt v loc @@ -61,7 +61,7 @@ markDirty k nc@NormalizedConstraints {dirtySet} = dom :: NormalizedConstraints vt v loc -> [v] dom NormalizedConstraints {constraintMap} = UFMap.keys constraintMap -emptyNormalizedConstraints :: Ord v => NormalizedConstraints vt v loc +emptyNormalizedConstraints :: (Ord v) => NormalizedConstraints vt v loc emptyNormalizedConstraints = NormalizedConstraints { constraintMap = UFMap.empty, @@ -240,8 +240,11 @@ prettyNormalizedConstraints (NormalizedConstraints {constraintMap}) = sep " " [" IsNotEffectful -> [] IsEffectful -> [Effectful kcanon] in sep " " $ - pv kcanon : - fmap pv (Set.toList $ Set.delete kcanon ks) ++ [":", TypePrinter.pretty PPE.empty (vi_typ vi)] ++ ["|"] ++ [sep ", " $ fmap prettyConstraint (posCon ++ negCon ++ botCon)] + pv kcanon + : fmap pv (Set.toList $ Set.delete kcanon ks) + ++ [":", TypePrinter.pretty PPE.empty (vi_typ vi)] + ++ ["|"] + ++ [sep ", " $ fmap prettyConstraint (posCon ++ negCon ++ botCon)] pv = string . show prettyDnf :: (Var v, Var vt) => Set (NormalizedConstraints vt v loc) -> Pretty ColorText diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs index 42ec9389f..1a2f5e2a2 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/PmLit.hs @@ -12,7 +12,7 @@ data PmLit | Char Char deriving stock (Show, Eq, Ord) -prettyPmLit :: IsString s => PmLit -> Pretty s +prettyPmLit :: (IsString s) => PmLit -> Pretty s prettyPmLit = string . \case Int x -> show x diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs index 8134aa5b7..742d78656 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs @@ -46,7 +46,7 @@ import Unison.Var (Var) -- redundant. uncoverAnnotate :: forall vt v loc m l. - Pmc vt v loc m => + (Pmc vt v loc m) => Set (NormalizedConstraints vt v loc) -> GrdTree (PmGrd vt v loc) l -> ( m @@ -163,7 +163,7 @@ classifyAlg = \case -- one solution) into a pattern. expand :: forall vt v loc. - Var v => + (Var v) => v -> NormalizedConstraints vt v loc -> Pattern () @@ -235,7 +235,7 @@ instantiate fuel nc x c argTyps posConstraint = do -- expression with enough positive info to print pattern suggestions. expandSolution :: forall vt v loc m. - Pmc vt v loc m => + (Pmc vt v loc m) => v -> NormalizedConstraints vt v loc -> m (Set (NormalizedConstraints vt v loc)) @@ -297,7 +297,7 @@ expandSolution x nc = withConstructors :: forall vt v loc r m. - Pmc vt v loc m => + (Pmc vt v loc m) => m r -> VarInfo vt v loc -> ( forall x. @@ -356,7 +356,7 @@ mkMatchingInterval = \case -- described in section 3.7. inhabited :: forall vt v loc m. - Pmc vt v loc m => + (Pmc vt v loc m) => Fuel -> v -> NormalizedConstraints vt v loc -> @@ -386,7 +386,7 @@ initFuel = 8 -- | Check that all variables marked dirty are inhabited. ensureInhabited :: forall vt v loc m. - Pmc vt v loc m => + (Pmc vt v loc m) => Fuel -> NormalizedConstraints vt v loc -> m (Maybe (NormalizedConstraints vt v loc)) @@ -436,7 +436,7 @@ addLiteral lit0 nabla0 = runMaybeT do insertVarInfo :: forall vt v loc. - Ord v => + (Ord v) => v -> VarInfo vt v loc -> NormalizedConstraints vt v loc -> @@ -688,7 +688,7 @@ modifyConstructor v f nc = runIdentity $ modifyConstructorF v (\a b -> Identity modifyConstructorC :: forall vt v loc m. - Pmc vt v loc m => + (Pmc vt v loc m) => v -> ( (Maybe (ConstructorReference, [(v, Type vt loc)])) -> Set ConstructorReference -> @@ -794,7 +794,7 @@ modifyVarConstraints v updateVarConstraint nc0 = do -- | Modify the positive and negative constraints of a constructor. posAndNegConstructor :: forall f vt v loc. - Functor f => + (Functor f) => ( (Maybe (ConstructorReference, [(v, Type vt loc)])) -> Set ConstructorReference -> f (Maybe (ConstructorReference, [(v, Type vt loc)]), Set ConstructorReference) @@ -811,7 +811,7 @@ posAndNegConstructor f = \case -- an instance of Ord. posAndNegLiteral :: forall f vt v loc. - Functor f => + (Functor f) => ( forall a. (Ord a) => Maybe a -> @@ -841,7 +841,7 @@ posAndNegLiteral f lit = \case posAndNegList :: forall f vt v loc. - Functor f => + (Functor f) => ( Type vt loc -> Seq v -> Seq v -> @@ -865,27 +865,27 @@ newtype C vt v loc m a = C via StateT (NormalizedConstraints vt v loc) (MaybeT m) deriving (MonadTrans) via ComposeT (StateT (NormalizedConstraints vt v loc)) MaybeT -contradiction :: Applicative m => C vt v loc m a +contradiction :: (Applicative m) => C vt v loc m a contradiction = C \_ -> pure Nothing -update :: Pmc vt v loc m => v -> VarConstraints vt v loc -> C vt v loc m () +update :: (Pmc vt v loc m) => v -> VarConstraints vt v loc -> C vt v loc m () update v vc = do nc0 <- get let (var, vi, nc1) = expectCanon v nc0 nc2 = markDirty var ((insertVarInfo var vi {vi_con = vc}) nc1) put nc2 -equate :: Pmc vt v loc m => [(v, v)] -> C vt v loc m () +equate :: (Pmc vt v loc m) => [(v, v)] -> C vt v loc m () equate vs = addConstraintsC (map (uncurry C.Eq) vs) -lookupListElemTypeC :: Pmc vt v loc m => v -> C vt v loc m (Type vt loc) +lookupListElemTypeC :: (Pmc vt v loc m) => v -> C vt v loc m (Type vt loc) lookupListElemTypeC listVar = do nc0 <- get let (_var, vi, nc1) = expectCanon listVar nc0 put nc1 pure $ getConst (posAndNegList (\elemTyp _ _ _ -> Const elemTyp) (vi_con vi)) -addConstraintsC :: Pmc vt v loc m => [Constraint vt v loc] -> C vt v loc m () +addConstraintsC :: (Pmc vt v loc m) => [Constraint vt v loc] -> C vt v loc m () addConstraintsC cs = do nc <- get lift (addConstraints cs nc) >>= \case @@ -893,7 +893,7 @@ addConstraintsC cs = do Just nc -> put nc declVarC :: - Pmc vt v loc m => + (Pmc vt v loc m) => v -> Type vt loc -> (VarInfo vt v loc -> VarInfo vt v loc) -> @@ -904,11 +904,11 @@ declVarC v vt vimod = do put nc1 freshC :: - Pmc vt v loc m => + (Pmc vt v loc m) => C vt v loc m v freshC = lift fresh -populateCons :: Pmc vt v loc m => v -> Seq v -> IntervalSet -> C vt v loc m () +populateCons :: (Pmc vt v loc m) => v -> Seq v -> IntervalSet -> C vt v loc m () populateCons listVar pCons iset = do case IntervalSet.lookupMin iset of Just minLen @@ -923,7 +923,7 @@ populateCons listVar pCons iset = do _ -> pure () runC :: - Applicative m => + (Applicative m) => NormalizedConstraints vt v loc -> C vt v loc m a -> m (Maybe (a, NormalizedConstraints vt v loc)) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs index 1b95f1c19..d5d2ca9e4 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs @@ -43,7 +43,7 @@ data UFValue k v empty :: UFMap k v empty = UFMap Map.empty -insert :: Ord k => k -> v -> UFMap k v -> UFMap k v +insert :: (Ord k) => k -> v -> UFMap k v -> UFMap k v insert k !v m = alter k (Just v) (\_ s _ -> Canonical s v) m @@ -129,7 +129,7 @@ alter k handleNothing handleJust map0 = runIdentity (alterF k (Identity handleNothing) (\k s v -> Identity (handleJust k s v)) map0) lookupCanon :: - Ord k => + (Ord k) => k -> UFMap k v -> Maybe (k, Int, v, UFMap k v) @@ -206,7 +206,7 @@ union k0 k1 mapinit mergeValues = toMaybe do KeyNotFound _k -> Nothing MergeFailed _v0 _v1 -> Nothing -toClasses :: forall k v. Ord k => UFMap k v -> [(k, Set k, v)] +toClasses :: forall k v. (Ord k) => UFMap k v -> [(k, Set k, v)] toClasses m0 = let cmFinal :: Map k (k, Set k, v) (_mfinal, cmFinal) = foldl' phi (m0, Map.empty) keys From d69071fb2ca90e8836375e292f17aee9cbeb98ef Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 27 Feb 2023 17:51:17 -0500 Subject: [PATCH 416/467] ormolu --- .../src/Unison/Runtime/IOSource.hs | 2 +- .../src/Unison/Typechecker/Context.hs | 2 +- unison-cli/src/Unison/LSP/FileAnalysis.hs | 24 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index c7c589389..11bec2fa3 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -978,7 +978,7 @@ type SynthResult = type EitherResult = Either String TFile -showNotes :: Foldable f => String -> PrintError.Env -> f Note -> String +showNotes :: (Foldable f) => String -> PrintError.Env -> f Note -> String showNotes source env = intercalateMap "\n\n" $ PrintError.renderNoteAsANSI 60 env source Path.absoluteEmpty diff --git a/parser-typechecker/src/Unison/Typechecker/Context.hs b/parser-typechecker/src/Unison/Typechecker/Context.hs index e6b826c17..54b4a578c 100644 --- a/parser-typechecker/src/Unison/Typechecker/Context.hs +++ b/parser-typechecker/src/Unison/Typechecker/Context.hs @@ -3147,7 +3147,7 @@ instance (Monad f) => MonadState (Env v loc) (MT v loc f) where get = MT \_ _ env -> pure (env, env) put env = MT \_ _ _ -> pure ((), env) -instance MonadFix f => MonadFix (MT v loc f) where +instance (MonadFix f) => MonadFix (MT v loc f) where mfix f = MT \a b c -> let res = mfix (\ ~(wubble, _finalenv) -> runM (f wubble) a b c) in res diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index ae4bcf753..7b264d3c1 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -342,18 +342,18 @@ analyseNotes fileUri ppe src notes = do typeHoleReplacementCodeActions diags v typ | not (isUserBlank v) = pure [] | otherwise = do - Env {codebase} <- ask - ppe <- PPED.suffixifiedPPE <$> globalPPED - let cleanedTyp = Context.generalizeAndUnTypeVar typ -- TODO: is this right? - refs <- liftIO . Codebase.runTransaction codebase $ Codebase.termsOfType codebase cleanedTyp - forMaybe (toList refs) $ \ref -> runMaybeT $ do - hqNameSuggestion <- MaybeT . pure $ PPE.terms ppe ref - typ <- MaybeT . liftIO . Codebase.runTransaction codebase $ Codebase.getTypeOfReferent codebase ref - let prettyType = TypePrinter.prettyStr Nothing ppe typ - let txtName = HQ'.toText hqNameSuggestion - let ranges = (diags ^.. folded . range) - let rca = rangedCodeAction ("Use " <> txtName <> " : " <> Text.pack prettyType) diags ranges - pure $ includeEdits fileUri txtName ranges rca + Env {codebase} <- ask + ppe <- PPED.suffixifiedPPE <$> globalPPED + let cleanedTyp = Context.generalizeAndUnTypeVar typ -- TODO: is this right? + refs <- liftIO . Codebase.runTransaction codebase $ Codebase.termsOfType codebase cleanedTyp + forMaybe (toList refs) $ \ref -> runMaybeT $ do + hqNameSuggestion <- MaybeT . pure $ PPE.terms ppe ref + typ <- MaybeT . liftIO . Codebase.runTransaction codebase $ Codebase.getTypeOfReferent codebase ref + let prettyType = TypePrinter.prettyStr Nothing ppe typ + let txtName = HQ'.toText hqNameSuggestion + let ranges = (diags ^.. folded . range) + let rca = rangedCodeAction ("Use " <> txtName <> " : " <> Text.pack prettyType) diags ranges + pure $ includeEdits fileUri txtName ranges rca isUserBlank :: Symbol -> Bool isUserBlank v = case Var.typeOf v of Var.User name -> Text.isPrefixOf "_" name From df42177839e01f41aa32cbe1d14e35ed09ecc095 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 27 Feb 2023 22:18:57 -0600 Subject: [PATCH 417/467] [fix-re-raise] ok --- scheme-libs/common/unison/boot.ss | 1 - 1 file changed, 1 deletion(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 491a9337b..444a6d974 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -167,7 +167,6 @@ (raise (list r t . args)) ((cdr current-mark) rq))))])) - ; See the explanation of `handle` for a more thorough understanding ; of why this is doing two control operations. ; From 6bf277924595e2663a1ac764eaa5e837317518e8 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 27 Feb 2023 22:23:25 -0600 Subject: [PATCH 418/467] [fix-re-raise] raise condition --- scheme-libs/common/unison/boot.ss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 444a6d974..24ff48e1b 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -164,7 +164,10 @@ (let ([rq (make-request (quote r) t (list . args))]) (let ([current-mark (ref-mark (quote r))]) (if (equal? #f current-mark) - (raise (list r t . args)) + (raise (condition + (make-error) + (make-message-condition "Unhandled top-level effect!") + (make-message-condition (list r t . args)))) ((cdr current-mark) rq))))])) ; See the explanation of `handle` for a more thorough understanding From 41ab1b9397956f146275a44fb76e6d08a88d7054 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 27 Feb 2023 22:41:29 -0600 Subject: [PATCH 419/467] [fix-re-raise] condfition --- scheme-libs/common/unison/boot.ss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 24ff48e1b..0d520f31b 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -32,6 +32,7 @@ (for (only (unison core) syntax->list) expand) + (srfi :28) ; gives us "format" (unison core) (unison data) (unison cont) @@ -166,8 +167,7 @@ (if (equal? #f current-mark) (raise (condition (make-error) - (make-message-condition "Unhandled top-level effect!") - (make-message-condition (list r t . args)))) + (make-message-condition (format "Unhandled top-level effect! ~a" (list r t . args))))) ((cdr current-mark) rq))))])) ; See the explanation of `handle` for a more thorough understanding From 9777b68c084edab0bb0e03ec3307dc209ee100a0 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 27 Feb 2023 22:43:43 -0600 Subject: [PATCH 420/467] [fix-re-raise] only --- scheme-libs/common/unison/boot.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheme-libs/common/unison/boot.ss b/scheme-libs/common/unison/boot.ss index 0d520f31b..f813c379d 100644 --- a/scheme-libs/common/unison/boot.ss +++ b/scheme-libs/common/unison/boot.ss @@ -32,7 +32,7 @@ (for (only (unison core) syntax->list) expand) - (srfi :28) ; gives us "format" + (only (srfi :28) format) (unison core) (unison data) (unison cont) From 036bdcc6d1108d9a5a732874aac486a68c2d1eff Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 27 Feb 2023 23:29:42 -0600 Subject: [PATCH 421/467] [tcp] first bit --- scheme-libs/common/unison/primops.ss | 13 ++++++++++- scheme-libs/racket/unison/tcp.rkt | 35 ++++++++++++++++++++++++++++ unison-src/builtin-tests/tests.u | 12 ++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 scheme-libs/racket/unison/tcp.rkt diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index fceebb016..6a28414d0 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -33,7 +33,7 @@ unison-FOp-IO.closeFile.impl.v3 unison-FOp-IO.openFile.impl.v3 unison-FOp-IO.putBytes.impl.v3 - ; unison-FOp-Text.fromUtf8.impl.v3 + unison-FOp-Text.fromUtf8.impl.v3 unison-FOp-Text.repeat unison-FOp-Text.toUtf8 ; unison-FOp-Value.serialize @@ -103,6 +103,7 @@ unison-POp-DIVN unison-POp-DRPB unison-POp-DRPS + unison-POp-DRPT unison-POp-EQLN unison-POp-EQLT unison-POp-EQLU @@ -156,6 +157,11 @@ unison-FOp-crypto.HashAlgorithm.Blake2s_256 unison-FOp-crypto.HashAlgorithm.Blake2b_256 unison-FOp-crypto.HashAlgorithm.Blake2b_512 + + unison-FOp-IO.clientSocket.impl.v3 + unison-FOp-IO.closeSocket.impl.v3 + unison-FOp-IO.socketReceive.impl.v3 + unison-FOp-IO.socketSend.impl.v3 ) (import (rnrs) @@ -163,6 +169,8 @@ (unison data) (unison string) (unison crypto) + (unison data) + (unison tcp) (unison bytevector) (unison vector) (unison concurrent)) @@ -274,6 +282,9 @@ (define (unison-FOp-IO.getArgs.impl.v1) (sum 1 (cdr (command-line)))) + (define (unison-FOp-Text.fromUtf8.impl.v3 s) + (right (bytevector->string s utf-8-transcoder))) + (define (unison-FOp-Text.toUtf8 s) (string->bytevector s utf-8-transcoder)) diff --git a/scheme-libs/racket/unison/tcp.rkt b/scheme-libs/racket/unison/tcp.rkt new file mode 100644 index 000000000..3e2681e68 --- /dev/null +++ b/scheme-libs/racket/unison/tcp.rkt @@ -0,0 +1,35 @@ +; TLS primitives! Supplied by openssl (libssl) +#lang racket/base +(require racket/exn + racket/tcp + unison/data) + +(provide (prefix-out unison-FOp-IO. (combine-out + clientSocket.impl.v3 + closeSocket.impl.v3 + socketReceive.impl.v3 + socketSend.impl.v3))) + +(define (input socket) (car socket)) +(define (output socket) (car (cdr socket))) + +(define (closeSocket.impl.v3 socket) + (close-input-port (input socket)) + (close-output-port (output socket)) + (right none)) + +(define (clientSocket.impl.v3 host port) + (with-handlers + [[exn:fail:network? (lambda (e) (exception "IOFailure" (exn->string e) '()))] + [(lambda _ #t) (lambda (e) (exception "MiscFailure" "Unknown exception" e))] ] + + (let-values ([(input output) (tcp-connect host (string->number port))]) + (right (list input output))))) + +(define (socketSend.impl.v3 socket data) + (write-bytes data (output socket)) + (flush-output (output socket)) + (right none)) + +(define (socketReceive.impl.v3 socket amt) + (right (read-bytes amt (input socket)))) \ No newline at end of file diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 57ab19abe..de543ace4 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -4,8 +4,20 @@ tests = Tests.main do !crypto.hash.tests !hmac.tests !concurrency.tests + !tcp.tests check "bug is caught" do isLeft (catchAll do bug ()) +tcp.tests = do + check "connects to example.com" do + socket = Socket.client (HostName "example.com") (Port "80") + Socket.send socket (toUtf8 "GET /index.html HTTP/1.0\r\n\r\n") + response = Socket.receive socket + Socket.close socket + contains "HTTP/1.0 200 OK" (base.Text.fromUtf8 response) + check "times out" do + _ = Socket.client (HostName "example.com") (Port "1000") + false + crypto.hash.tests = do hash alg = hashBytes alg (toUtf8 "") tag name = name ++ " hashBytes" From 184e47f44732779d1feadc608cd63118d667d816 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 28 Feb 2023 09:56:53 -0500 Subject: [PATCH 422/467] make pattern match complete in LSP test --- unison-cli/tests/Unison/Test/LSP.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unison-cli/tests/Unison/Test/LSP.hs b/unison-cli/tests/Unison/Test/LSP.hs index 0db0a3c44..95b7aaeda 100644 --- a/unison-cli/tests/Unison/Test/LSP.hs +++ b/unison-cli/tests/Unison/Test/LSP.hs @@ -11,10 +11,12 @@ import qualified Data.Text as Text import EasyTest import qualified System.IO.Temp as Temp import qualified Unison.ABT as ABT +import Unison.Builtin.Decls (unitRef) import qualified Unison.Cli.TypeCheck as Typecheck import Unison.Codebase (Codebase) import qualified Unison.Codebase.Init as Codebase.Init import qualified Unison.Codebase.SqliteCodebase as SC +import Unison.ConstructorReference (GConstructorReference (..)) import qualified Unison.LSP.Queries as LSPQ import qualified Unison.Lexer.Pos as Lexer import Unison.Parser.Ann (Ann (..)) @@ -138,11 +140,11 @@ term = let ( "Test annotations within pattern binds", [here| term = let - (third, tr^ue) = (false, true) + (third, (^)) = (false, ()) true |], True, - pat (Pattern.Boolean () True) + pat (Pattern.Constructor () (ConstructorReference unitRef 0) []) ), ( "Test annotations for types with arrows", [here| From ecfc8b84527fa875a851d914efaf8291a3e2be98 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 28 Feb 2023 10:23:29 -0500 Subject: [PATCH 423/467] complete patterns in prettyprint round trip tests --- unison-src/transcripts-round-trip/main.md | 13 +- .../transcripts-round-trip/main.output.md | 189 +++++++++--------- 2 files changed, 109 insertions(+), 93 deletions(-) diff --git a/unison-src/transcripts-round-trip/main.md b/unison-src/transcripts-round-trip/main.md index 26f5ab918..17ec97087 100644 --- a/unison-src/transcripts-round-trip/main.md +++ b/unison-src/transcripts-round-trip/main.md @@ -84,17 +84,20 @@ f x = let Regression test for https://github.com/unisonweb/unison/issues/2224 ```unison:hide -f : [a] -> a +f : [()] -> () f xs = match xs with x +: (x' +: rest) -> x + _ -> () -g : [a] -> a +g : [()] -> () g xs = match xs with - (rest :+ x') :+ x -> x + (rest :+ x') :+ x -> () + _ -> () -h : [[a]] -> a +h : [[()]] -> () h xs = match xs with (rest :+ (rest' :+ x)) -> x + _ -> () ``` ```ucm @@ -301,6 +304,7 @@ broken tvar = ```unison:hide broken = cases Some loooooooooooooooooooooooooooooooooooooooooooooooooooooooong | loooooooooooooooooooooooooooooooooooooooooooooooooooooooong == 1 -> () + _ -> () ``` ``` ucm @@ -325,6 +329,7 @@ foo = let lijaefliejalfijelfj == aefilaeifhlei -> 0 SomethingUnusuallyLong lijaefliejalfijelfj aefilaeifhlei liaehjffeafijij | lijaefliejalfijelfj == liaehjffeafijij -> 1 + _ -> 2 go (SomethingUnusuallyLong "one" "two" "three") ``` diff --git a/unison-src/transcripts-round-trip/main.output.md b/unison-src/transcripts-round-trip/main.output.md index 9f8099478..51fa395e3 100644 --- a/unison-src/transcripts-round-trip/main.output.md +++ b/unison-src/transcripts-round-trip/main.output.md @@ -34,17 +34,17 @@ x = 1 + 1 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #c5i2vql0hi .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #c5i2vql0hi` to reset the root namespace and its history to that of the specified namespace. - When Root Hash Action - 1. now #pdrl1ktsa0 add - 2. 1 secs ago #l7cnk7raag builtins.mergeio - 3. #sg60bvjo91 history starts here + When Root Hash Action + 1. now #88srvru2o0 add + 2. now #c5i2vql0hi builtins.mergeio + 3. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between two points in history. @@ -120,19 +120,19 @@ Without the above stanza, the `edit` will send the definition to the most recent most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #c5i2vql0hi .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #c5i2vql0hi` to reset the root namespace and its history to that of the specified namespace. - When Root Hash Action - 1. now #7a6vnmv5c9 add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #pdrl1ktsa0 add - 4. 1 secs ago #l7cnk7raag builtins.mergeio - 5. #sg60bvjo91 history starts here + When Root Hash Action + 1. now #a16i2glj04 add + 2. now #c5i2vql0hi reset-root #c5i2vql0hi + 3. now #88srvru2o0 add + 4. now #c5i2vql0hi builtins.mergeio + 5. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between two points in history. @@ -199,21 +199,21 @@ f x = let most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #c5i2vql0hi .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #c5i2vql0hi` to reset the root namespace and its history to that of the specified namespace. - When Root Hash Action - 1. now #obak7jnhcv add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #7a6vnmv5c9 add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #pdrl1ktsa0 add - 6. 1 secs ago #l7cnk7raag builtins.mergeio - 7. #sg60bvjo91 history starts here + When Root Hash Action + 1. now #8pc9a0uci4 add + 2. now #c5i2vql0hi reset-root #c5i2vql0hi + 3. now #a16i2glj04 add + 4. now #c5i2vql0hi reset-root #c5i2vql0hi + 5. now #88srvru2o0 add + 6. now #c5i2vql0hi builtins.mergeio + 7. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between two points in history. @@ -241,17 +241,20 @@ f x = let Regression test for https://github.com/unisonweb/unison/issues/2224 ```unison -f : [a] -> a +f : [()] -> () f xs = match xs with x +: (x' +: rest) -> x + _ -> () -g : [a] -> a +g : [()] -> () g xs = match xs with - (rest :+ x') :+ x -> x + (rest :+ x') :+ x -> () + _ -> () -h : [[a]] -> a +h : [[()]] -> () h xs = match xs with (rest :+ (rest' :+ x)) -> x + _ -> () ``` ```ucm @@ -259,22 +262,26 @@ h xs = match xs with ⍟ I've added these definitions: - f : [a] -> a - g : [a] -> a - h : [[a]] -> a + f : [()] -> () + g : [()] -> () + h : [[()]] -> () .> edit f g ☝️ I added these definitions to the top of - /Users/runar/work/unison/scratch.u + /home/traveler/code/haskell/unison/pattern-match-coverage/scratch.u - f : [a] -> a - f = cases x +: (x' +: rest) -> x + f : [()] -> () + f = cases + x +: (x' +: rest) -> x + _ -> () - g : [a] -> a - g = cases rest :+ x' :+ x -> x + g : [()] -> () + g = cases + rest :+ x' :+ x -> () + _ -> () You can edit them there, then do `update` to replace the definitions currently in this namespace. @@ -285,23 +292,23 @@ h xs = match xs with most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #c5i2vql0hi .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #c5i2vql0hi` to reset the root namespace and its history to that of the specified namespace. - When Root Hash Action - 1. now #4skv4f38cf add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #obak7jnhcv add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #7a6vnmv5c9 add - 6. now #l7cnk7raag reset-root #l7cnk7raag - 7. now #pdrl1ktsa0 add - 8. 1 secs ago #l7cnk7raag builtins.mergeio - 9. #sg60bvjo91 history starts here + When Root Hash Action + 1. now #psi40d6du2 add + 2. now #c5i2vql0hi reset-root #c5i2vql0hi + 3. now #8pc9a0uci4 add + 4. now #c5i2vql0hi reset-root #c5i2vql0hi + 5. now #a16i2glj04 add + 6. now #c5i2vql0hi reset-root #c5i2vql0hi + 7. now #88srvru2o0 add + 8. now #c5i2vql0hi builtins.mergeio + 9. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between two points in history. @@ -320,8 +327,8 @@ h xs = match xs with ⍟ These new definitions are ok to `add`: - f : [a] -> a - g : [a] -> a + f : [()] -> () + g : [()] -> () ``` ## Type application inserts necessary parens @@ -350,7 +357,7 @@ foo n _ = n ☝️ I added these definitions to the top of - /Users/runar/work/unison/scratch.u + /home/traveler/code/haskell/unison/pattern-match-coverage/scratch.u unique type Foo x y = @@ -369,25 +376,25 @@ foo n _ = n most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #c5i2vql0hi .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #c5i2vql0hi` to reset the root namespace and its history to that of the specified namespace. - When Root Hash Action - 1. now #fdnrhfkoot add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #4skv4f38cf add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #obak7jnhcv add - 6. now #l7cnk7raag reset-root #l7cnk7raag - 7. now #7a6vnmv5c9 add - 8. now #l7cnk7raag reset-root #l7cnk7raag - 9. now #pdrl1ktsa0 add - 10. 1 secs ago #l7cnk7raag builtins.mergeio - 11. #sg60bvjo91 history starts here + When Root Hash Action + 1. now #9i8g6b1m8k add + 2. now #c5i2vql0hi reset-root #c5i2vql0hi + 3. now #psi40d6du2 add + 4. now #c5i2vql0hi reset-root #c5i2vql0hi + 5. now #8pc9a0uci4 add + 6. now #c5i2vql0hi reset-root #c5i2vql0hi + 7. now #a16i2glj04 add + 8. now #c5i2vql0hi reset-root #c5i2vql0hi + 9. now #88srvru2o0 add + 10. now #c5i2vql0hi builtins.mergeio + 11. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between two points in history. @@ -452,27 +459,27 @@ foo = most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #c5i2vql0hi .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #c5i2vql0hi` to reset the root namespace and its history to that of the specified namespace. - When Root Hash Action - 1. now #dblf9f7ggq add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #fdnrhfkoot add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #4skv4f38cf add - 6. now #l7cnk7raag reset-root #l7cnk7raag - 7. now #obak7jnhcv add - 8. now #l7cnk7raag reset-root #l7cnk7raag - 9. now #7a6vnmv5c9 add - 10. now #l7cnk7raag reset-root #l7cnk7raag - 11. now #pdrl1ktsa0 add - 12. 1 secs ago #l7cnk7raag builtins.mergeio - 13. #sg60bvjo91 history starts here + When Root Hash Action + 1. now #mqg8tqk7i6 add + 2. now #c5i2vql0hi reset-root #c5i2vql0hi + 3. now #9i8g6b1m8k add + 4. now #c5i2vql0hi reset-root #c5i2vql0hi + 5. now #psi40d6du2 add + 6. now #c5i2vql0hi reset-root #c5i2vql0hi + 7. now #8pc9a0uci4 add + 8. now #c5i2vql0hi reset-root #c5i2vql0hi + 9. now #a16i2glj04 add + 10. now #c5i2vql0hi reset-root #c5i2vql0hi + 11. now #88srvru2o0 add + 12. now #c5i2vql0hi builtins.mergeio + 13. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between two points in history. @@ -875,7 +882,7 @@ broken tvar = (cases Some _ -> "oh boy isn't this a very very very very very very very long string?" - None -> "")) + None -> "")) tvarmodify : tvar -> fun -> () tvarmodify tvar fun = () @@ -909,6 +916,7 @@ broken tvar = ```unison broken = cases Some loooooooooooooooooooooooooooooooooooooooooooooooooooooooong | loooooooooooooooooooooooooooooooooooooooooooooooooooooooong == 1 -> () + _ -> () ``` ```ucm @@ -928,9 +936,10 @@ broken = cases broken : Optional Nat -> () broken = cases Some - loooooooooooooooooooooooooooooooooooooooooooooooooooooooong | loooooooooooooooooooooooooooooooooooooooooooooooooooooooong - == 1 -> + loooooooooooooooooooooooooooooooooooooooooooooooooooooooong| loooooooooooooooooooooooooooooooooooooooooooooooooooooooong + == 1 -> () + _ -> () You can edit them there, then do `update` to replace the definitions currently in this namespace. @@ -968,6 +977,7 @@ foo = let lijaefliejalfijelfj == aefilaeifhlei -> 0 SomethingUnusuallyLong lijaefliejalfijelfj aefilaeifhlei liaehjffeafijij | lijaefliejalfijelfj == liaehjffeafijij -> 1 + _ -> 2 go (SomethingUnusuallyLong "one" "two" "three") ``` @@ -994,9 +1004,10 @@ foo = let go x = '(match (a -> a) x with SomethingUnusuallyLong - lijaefliejalfijelfj aefilaeifhlei liaehjffeafijij - | lijaefliejalfijelfj == aefilaeifhlei -> 0 - | lijaefliejalfijelfj == liaehjffeafijij -> 1) + lijaefliejalfijelfj aefilaeifhlei liaehjffeafijij + | lijaefliejalfijelfj == aefilaeifhlei -> 0 + | lijaefliejalfijelfj == liaehjffeafijij -> 1 + _ -> 2) go (SomethingUnusuallyLong "one" "two" "three") You can edit them there, then do `update` to replace the @@ -1375,7 +1386,7 @@ afun x f = f x roundtripLastLam = afun "foo" (n -> let - 1 + 1 + _ = 1 + 1 3 ) ``` @@ -1402,7 +1413,7 @@ roundtripLastLam = roundtripLastLam : Nat roundtripLastLam = afun "foo" do - 1 + 1 + _ = 1 + 1 3 You can edit them there, then do `update` to replace the From e80e87f755ab895985e348c9ac2c185324d67317 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Tue, 28 Feb 2023 16:15:52 -0500 Subject: [PATCH 424/467] documentation --- .../src/Unison/PatternMatchCoverage.hs | 45 +++++++++++++++++-- .../NormalizedConstraints.hs | 10 ++--- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage.hs b/parser-typechecker/src/Unison/PatternMatchCoverage.hs index 3ef3c8a94..d3fc4a530 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage.hs @@ -1,7 +1,39 @@ --- Pattern match coverage checking following the algorithm described --- in "Lower Your Guards". --- https://simon.peytonjones.org/assets/pdfs/lower-your-guards.pdf -module Unison.PatternMatchCoverage where +-- | Pattern match coverage checking is implemented following the +-- algorithm described in [Lower Your +-- Guards](https://simon.peytonjones.org/assets/pdfs/lower-your-guards.pdf). The +-- goal of pattern match coverage checking is to identify the +-- following problems that may arise in a pattern match: +-- +-- * It is missing clauses (/i.e./ it is non-exhaustive) +-- * It contains redundant patterns (/i.e./ the case can be deleted without altering the program) +-- * It contains inaccessible patterns (/i.e/ the rhs can never be entered) +-- +-- Furthermore, in the case of a non-exhaustive match, the goal to +-- present the user with concrete values that do not match any of the +-- existing patterns. +-- +-- /N.B./ An inaccessible pattern in unison would be one that performs +-- effects in a guard although the constraints are unsatisfiable. Such +-- a pattern cannot be deleted without altering the program. +-- +-- == High-level algorithm overview +-- +-- 1. [Desugar]("Unison.PatternMatchCoverage.Desugar") a match expression into a 'Unison.PatternMatchCoverage.GrdTree.GrdTree'. +-- 2. Annotate the @GrdTree@ nodes with [refinement types]("Unison.PatternMatchCoverage.NormalizedConstraints") +-- representing values that match this node. Redundant and inaccessible patterns are then identified by @GrdTree@ leaves +-- with uninhabited refinement types. Inaccessible patterns are distinguished by an effect being performed between the +-- @GrdTree@ root and the leaf. +-- 3. Traverse the @GrdTree@ building up a refinement type representing uncovered values. If the resulting refinement type +-- is inhabited then the match is missing clauses. +-- 4. Find inhabitants of the uncovered refinement type to present to the user. +-- +-- Step (1) is implemented by 'desugarMatch'. Steps (2) and (3) are +-- implemented as a single traversal: 'uncoverAnnotate'. Step (4) is +-- implemented by 'expandSolution'. +module Unison.PatternMatchCoverage + ( checkMatch, + ) +where import qualified Data.Set as Set import Debug.Trace @@ -16,12 +48,17 @@ import qualified Unison.Term as Term import qualified Unison.Type as Type import qualified Unison.Util.Pretty as P +-- | Perform pattern match coverage checking on a match expression checkMatch :: forall vt v loc m. (Pmc vt v loc m) => + -- | the match location loc -> + -- | scrutinee type Type.Type vt loc -> + -- | match cases [Term.MatchCase loc (Term.Term' vt v loc)] -> + -- | (redundant locations, inaccessible locations, inhabitants of uncovered refinement type) m ([loc], [loc], [Pattern ()]) checkMatch matchLocation scrutineeType cases = do v0 <- fresh diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs index 44a6fabaa..50ef55483 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs @@ -32,11 +32,11 @@ import Unison.Var (Var) -- * Mutual compatibility: No two constraints should conflict with -- each other. -- --- * Inhabitation: There must be at least one value that inhabits --- each refinement type. (N.B. We only do a best effort enforcement of --- this invariant, see 'inhabited' in --- Unison.PatternMatchCoverage.NormalizedConstraints.Solve for --- additional info) +-- * Inhabitation: There must be at least one value that inhabits each +-- refinement type. (N.B. We don't truly know if a type is inhabited, +-- see 'inhabited' in "Unison.PatternMatchCoverage.Solve" for +-- details. However, the refinement type is inhabited as far as our +-- inhabitation checker is concerned.) -- -- These invariants ensure that each term in our DNF has at least one -- solution, and it is easy to expand and print these solutions. From 1ab327e01bae6adb403f0e588b418a78a83e5177 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 1 Mar 2023 10:28:44 -0500 Subject: [PATCH 425/467] document GrdTree --- .../Unison/PatternMatchCoverage/GrdTree.hs | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs index e11a5b842..681382f5d 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs @@ -1,6 +1,14 @@ {-# LANGUAGE OverloadedStrings #-} -module Unison.PatternMatchCoverage.GrdTree where +module Unison.PatternMatchCoverage.GrdTree + ( GrdTree, + GrdTreeF (..), + pattern Leaf, + pattern Grd, + pattern Fork, + prettyGrdTree, + ) +where import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NEL @@ -9,12 +17,45 @@ import Unison.PatternMatchCoverage.Fix import Unison.Prelude import Unison.Util.Pretty +-- | A @GrdTree@ is the simple language to desugar matches into. All +-- pattern matching constructs (/e.g./ structural pattern matching, +-- boolean guards, pattern guards, view patterns, etc) are desugared +-- into this simpler structure. +-- +-- It is parameterized by the values at guard nodes, @n@, and the +-- values at the leaves, @l@. When desugaring, @n@ is +-- 'Unison.PatternMatchCoverage.PmGrd.PmGrd' and @l@ is the source +-- location. After annotating the @GrdTree@, @n@ is a refinement type +-- representing matching values and the @l@ is pairs of the +-- aforementioned refinement type and source location. +-- +-- For example: +-- +-- @ +-- example : Optional Nat -> Nat +-- example = cases +-- None -> 0 +-- Some x +-- | isEven x -> 0 +-- | otherwise -> 1 +-- @ +-- +-- is desugared into +-- +-- @ +-- ──┬─ None <- v0 ── srcloc +-- ├─ Some ( v1 :: ##Nat ) <- v0 ── let v2 = isEven v1 ── True <- v2 ── srcloc +-- └─ Some ( v3 :: ##Nat ) <- v0 ── srcloc +-- @ type GrdTree n l = Fix (GrdTreeF n l) data GrdTreeF n l a - = LeafF l - | GrdF n a - | ForkF (NonEmpty a) + = -- | A successful match + LeafF l + | -- | A constraint of some kind (structural pattern match, boolan guard, etc) + GrdF n a + | -- | A list of alternative matches, tried in order + ForkF (NonEmpty a) deriving stock (Functor, Show) prettyGrdTree :: forall n l s. (ListLike s Char, IsString s) => (n -> Pretty s) -> (l -> Pretty s) -> GrdTree n l -> Pretty s From d9eeea9012afd85b9b9e8e2207dd198ca3a0d4d5 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 1 Mar 2023 14:53:57 -0500 Subject: [PATCH 426/467] documentation and cleanup --- .../src/Unison/PatternMatchCoverage.hs | 14 +-- .../src/Unison/PatternMatchCoverage/Class.hs | 14 ++- .../Unison/PatternMatchCoverage/Constraint.hs | 40 +++++-- .../Unison/PatternMatchCoverage/Desugar.hs | 26 +++-- .../Unison/PatternMatchCoverage/Literal.hs | 44 ++++++-- .../NormalizedConstraints.hs | 39 ++++++- .../src/Unison/PatternMatchCoverage/Solve.hs | 103 ++++-------------- .../src/Unison/PatternMatchCoverage/UFMap.hs | 23 ++-- 8 files changed, 165 insertions(+), 138 deletions(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage.hs b/parser-typechecker/src/Unison/PatternMatchCoverage.hs index d3fc4a530..a43bc0e38 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage.hs @@ -19,17 +19,17 @@ -- == High-level algorithm overview -- -- 1. [Desugar]("Unison.PatternMatchCoverage.Desugar") a match expression into a 'Unison.PatternMatchCoverage.GrdTree.GrdTree'. --- 2. Annotate the @GrdTree@ nodes with [refinement types]("Unison.PatternMatchCoverage.NormalizedConstraints") --- representing values that match this node. Redundant and inaccessible patterns are then identified by @GrdTree@ leaves +-- 2. Annotate the @GrdTree@ leaves with [refinement types]("Unison.PatternMatchCoverage.NormalizedConstraints") +-- describing values that match this branch. Redundant and inaccessible patterns are then identified by @GrdTree@ leaves -- with uninhabited refinement types. Inaccessible patterns are distinguished by an effect being performed between the -- @GrdTree@ root and the leaf. --- 3. Traverse the @GrdTree@ building up a refinement type representing uncovered values. If the resulting refinement type +-- 3. Traverse the @GrdTree@ building up a refinement type describing uncovered values. If the resulting refinement type -- is inhabited then the match is missing clauses. -- 4. Find inhabitants of the uncovered refinement type to present to the user. -- -- Step (1) is implemented by 'desugarMatch'. Steps (2) and (3) are --- implemented as a single traversal: 'uncoverAnnotate'. Step (4) is --- implemented by 'expandSolution'. +-- implemented as a single traversal: 'uncoverAnnotate'/'classify'. Step (4) is +-- implemented by 'expandSolution'/'generateInhabitants'. module Unison.PatternMatchCoverage ( checkMatch, ) @@ -43,7 +43,7 @@ import Unison.PatternMatchCoverage.Desugar (desugarMatch) import Unison.PatternMatchCoverage.GrdTree (prettyGrdTree) import qualified Unison.PatternMatchCoverage.NormalizedConstraints as NC import Unison.PatternMatchCoverage.PmGrd (prettyPmGrd) -import Unison.PatternMatchCoverage.Solve (classify, expand, expandSolution, uncoverAnnotate) +import Unison.PatternMatchCoverage.Solve (classify, expandSolution, generateInhabitants, uncoverAnnotate) import qualified Unison.Term as Term import qualified Unison.Type as Type import qualified Unison.Util.Pretty as P @@ -65,7 +65,7 @@ checkMatch matchLocation scrutineeType cases = do grdtree0 <- desugarMatch matchLocation scrutineeType v0 cases (uncovered, grdtree1) <- uncoverAnnotate (Set.singleton (NC.declVar v0 scrutineeType id NC.emptyNormalizedConstraints)) grdtree0 uncoveredExpanded <- concat . fmap Set.toList <$> traverse (expandSolution v0) (Set.toList uncovered) - let sols = map (expand v0) uncoveredExpanded + let sols = map (generateInhabitants v0) uncoveredExpanded let (_accessible, inaccessible, redundant) = classify grdtree1 let debugOutput = P.sep diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs index 30f5407f4..55647a570 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Class.hs @@ -1,6 +1,11 @@ {-# LANGUAGE FunctionalDependencies #-} -module Unison.PatternMatchCoverage.Class where +module Unison.PatternMatchCoverage.Class + ( Pmc (..), + EnumeratedConstructors (..), + traverseConstructors, + ) +where import Control.Monad.Fix (MonadFix) import Unison.ConstructorReference (ConstructorReference) @@ -8,9 +13,16 @@ import Unison.PatternMatchCoverage.ListPat (ListPat) import Unison.Type (Type) import Unison.Var (Var) +-- | A typeclass for the queries required to perform pattern match +-- coverage checking. class (Ord loc, Var vt, Var v, MonadFix m) => Pmc vt v loc m | m -> vt v loc where + -- | Get the constructors of a type getConstructors :: Type vt loc -> m (EnumeratedConstructors vt v loc) + + -- | Get the types of the arguments of a specific constructor getConstructorVarTypes :: Type vt loc -> ConstructorReference -> m [Type vt loc] + + -- | Get a fresh variable fresh :: m v data EnumeratedConstructors vt v loc diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs index 034d5cf75..70bc4613d 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Constraint.hs @@ -1,4 +1,8 @@ -module Unison.PatternMatchCoverage.Constraint where +module Unison.PatternMatchCoverage.Constraint + ( Constraint (..), + prettyConstraint, + ) +where import Unison.ConstructorReference (ConstructorReference) import Unison.PatternMatchCoverage.IntervalSet (IntervalSet) @@ -9,28 +13,44 @@ import Unison.Type (Type) import Unison.Util.Pretty import Unison.Var (Var) +-- | A constraint to add to a [normalized constraint +-- set]("Unison.PatternMatchCoverage.NormalizedConstraints") (fig 6) +-- See 'Unison.PatternMatchCoverage.Solve.addConstraint' data Constraint vt v loc - = PosCon v ConstructorReference [(v, Type vt loc)] - | NegCon v ConstructorReference - | PosLit v PmLit - | NegLit v PmLit - | PosListHead + = -- | Positive constraint regarding data type. States that the + -- given variable must be the given constructor, and it also binds + -- variables corresponding to constructor arguments. + PosCon v ConstructorReference [(v, Type vt loc)] + | -- | Negative constraint concerning data type. States that the + -- given variable must not be the given constructor. + NegCon v ConstructorReference + | -- | Positive constraint regarding literal + PosLit v PmLit + | -- | Negative constraint regarding literal + NegLit v PmLit + | -- | Positive constraint on list element with position relative to head of list + PosListHead v -- ^ list root Int -- ^ cons position (0 is head) v -- ^ element variable - | PosListTail + | -- | Positive constraint on list element with position relative to end of list + PosListTail v -- ^ list root Int -- ^ snoc position (0 is last) v -- ^ element variable - | NegListInterval v IntervalSet - | Effectful v - | Eq v v + | -- | Negative constraint on length of the list (/i.e./ the list + -- may not be an element of the interval set) + NegListInterval v IntervalSet + | -- | An effect is performed + Effectful v + | -- | Equality constraint + Eq v v deriving stock (Eq, Ord) prettyConstraint :: (Var vt, Var v) => Constraint vt v loc -> Pretty ColorText diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs index d60ef92c8..5a3741f14 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Desugar.hs @@ -1,6 +1,8 @@ -module Unison.PatternMatchCoverage.Desugar where +module Unison.PatternMatchCoverage.Desugar + ( desugarMatch, + ) +where -import Data.Functor.Compose import Data.List.NonEmpty (NonEmpty (..)) import qualified U.Core.ABT as ABT import Unison.Pattern @@ -14,13 +16,17 @@ import Unison.Term (MatchCase (..), Term', app, var) import Unison.Type (Type) import qualified Unison.Type as Type +-- | Desugar a match into a 'GrdTree' desugarMatch :: forall loc vt v m. (Pmc vt v loc m) => -- | loc of match loc -> + -- | scrutinee type Type vt loc -> + -- | scrutinee variable v -> + -- | match cases [MatchCase loc (Term' vt v loc)] -> m (GrdTree (PmGrd vt v loc) loc) desugarMatch loc0 scrutineeType v0 cs0 = @@ -124,9 +130,9 @@ listToGrdTree _listTyp elemTyp listVar nl0 k0 vs0 = ($ 0) . cata \case N'ConsF _ b -> \acc -> b $! acc + 1 N'SnocF b _ -> \acc -> b $! acc + 1 - N'NilF -> \n -> (n, n) - N'VarF _ -> \n -> (n, maxBound) - N'UnboundF _ -> \n -> (n, maxBound) + N'NilF -> \ !n -> (n, n) + N'VarF _ -> \ !n -> (n, maxBound) + N'UnboundF _ -> \ !n -> (n, maxBound) data NormalizedListF loc a = N'ConsF (Pattern loc) a @@ -138,19 +144,19 @@ data NormalizedListF loc a type NormalizedList loc = Fix (NormalizedListF loc) -type AnnotatedList loc = Fix (Compose ((,) (Int, Int)) (NormalizedListF loc)) - -pattern Ann :: Int -> Int -> NormalizedListF loc (AnnotatedList loc) -> AnnotatedList loc -pattern Ann lb ub rest = Fix (Compose ((lb, ub), rest)) - +pattern N'Cons :: Pattern loc -> Fix (NormalizedListF loc) -> Fix (NormalizedListF loc) pattern N'Cons x xs = Fix (N'ConsF x xs) +pattern N'Snoc :: Fix (NormalizedListF loc) -> Pattern loc -> Fix (NormalizedListF loc) pattern N'Snoc xs x = Fix (N'SnocF xs x) +pattern N'Nil :: Fix (NormalizedListF loc) pattern N'Nil = Fix N'NilF +pattern N'Var :: loc -> Fix (NormalizedListF loc) pattern N'Var x = Fix (N'VarF x) +pattern N'Unbound :: loc -> Fix (NormalizedListF loc) pattern N'Unbound x = Fix (N'UnboundF x) -- | strip out sequence literals and concats diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs index 7d0f52c54..312ba394b 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Literal.hs @@ -1,4 +1,8 @@ -module Unison.PatternMatchCoverage.Literal where +module Unison.PatternMatchCoverage.Literal + ( Literal (..), + prettyLiteral, + ) +where import Unison.ConstructorReference (ConstructorReference) import Unison.PatternMatchCoverage.IntervalSet (IntervalSet) @@ -12,14 +16,25 @@ import Unison.Typechecker.TypeVar (TypeVar, lowerTerm) import Unison.Util.Pretty import Unison.Var (Var) +-- | Refinement type literals (fig 3) data Literal vt v loc - = T - | F - | PosCon v ConstructorReference [(v, Type vt loc)] - | NegCon v ConstructorReference - | PosLit v PmLit - | NegLit v PmLit - | PosListHead + = -- | True + T + | -- | False + F + | -- | Positive constraint regarding data type. States that the + -- given variable must be the given constructor, and it also binds + -- variables corresponding to constructor arguments. + PosCon v ConstructorReference [(v, Type vt loc)] + | -- | Negative constraint concerning data type. States that the + -- given variable must not be the given constructor. + NegCon v ConstructorReference + | -- | Positive constraint regarding literal + PosLit v PmLit + | -- | Negative constraint regarding literal + NegLit v PmLit + | -- | Positive constraint on list element with position relative to head of list + PosListHead v -- ^ list root Int @@ -27,7 +42,8 @@ data Literal vt v loc v -- ^ element variable (Type vt loc) - | PosListTail + | -- | Positive constraint on list element with position relative to end of list + PosListTail v -- ^ list root Int @@ -35,9 +51,13 @@ data Literal vt v loc v -- ^ element variable (Type vt loc) - | NegListInterval v IntervalSet - | Effectful v - | Let v (Term' vt v loc) (Type vt loc) + | -- | Negative constraint on length of the list (/i.e./ the list + -- may not be an element of the interval set) + NegListInterval v IntervalSet + | -- | An effect is performed + Effectful v + | -- | Introduce a binding for a term + Let v (Term' vt v loc) (Type vt loc) deriving stock (Show) prettyLiteral :: (Var v) => Literal (TypeVar b v) v loc -> Pretty ColorText diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs index 50ef55483..97740b417 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/NormalizedConstraints.hs @@ -1,4 +1,18 @@ -module Unison.PatternMatchCoverage.NormalizedConstraints where +module Unison.PatternMatchCoverage.NormalizedConstraints + ( NormalizedConstraints (..), + VarInfo (..), + VarConstraints (..), + EffectInfo (..), + markDirty, + emptyNormalizedConstraints, + updateF, + ConstraintUpdate (..), + expectCanon, + declVar, + prettyNormalizedConstraints, + prettyDnf, + ) +where import Data.Functor.Compose import Data.List (intersperse) @@ -58,9 +72,6 @@ markDirty :: markDirty k nc@NormalizedConstraints {dirtySet} = nc {dirtySet = Set.insert k dirtySet} -dom :: NormalizedConstraints vt v loc -> [v] -dom NormalizedConstraints {constraintMap} = UFMap.keys constraintMap - emptyNormalizedConstraints :: (Ord v) => NormalizedConstraints vt v loc emptyNormalizedConstraints = NormalizedConstraints @@ -68,6 +79,8 @@ emptyNormalizedConstraints = dirtySet = mempty } +-- | Lookup the canonical value of @v@ from the constraint map. Throws +-- an error if the variable is not in the map. expectCanon :: forall vt v loc. (Var v) => @@ -110,11 +123,16 @@ alterF v nothing just nc = Update x -> (markDirty v, Just x) {-# INLINE alterF #-} +-- | Generic function to lookup or alter constraints in the constraint +-- map. Throws an error if the variable is not in the map. updateF :: forall vt v loc f. (Var v, Functor f) => + -- | variable to lookup v -> + -- | update function (v -> VarInfo vt v loc -> f (ConstraintUpdate (VarInfo vt v loc))) -> + -- | constraint map NormalizedConstraints vt v loc -> f (NormalizedConstraints vt v loc) updateF v just nc = @@ -127,12 +145,18 @@ data ConstraintUpdate a | Ignore deriving stock (Functor) +-- | Install a new variable into the constraint map. Throws an error +-- if the variable already exists in the map. declVar :: forall vt v loc. (Var v) => + -- | new variable to install v -> + -- | type of variable Type vt loc -> + -- | modifier for the default var info of the given type (VarInfo vt v loc -> VarInfo vt v loc) -> + -- | Normalized constraints to install the variable into NormalizedConstraints vt v loc -> NormalizedConstraints vt v loc declVar v t f nc@NormalizedConstraints {constraintMap} = @@ -164,6 +188,7 @@ mkVarInfo v t = vi_eff = IsNotEffectful } +-- | Normalized constraints on a specific variable data VarInfo vt v loc = VarInfo { vi_id :: v, vi_typ :: Type vt loc, @@ -172,6 +197,9 @@ data VarInfo vt v loc = VarInfo } deriving stock (Show, Eq, Ord, Generic) +-- | The constraints are different for different types, although most +-- of them take the form of an optional positive constraint and a set +-- of negative constraints. data VarConstraints vt v loc = Vc'Constructor (Maybe (ConstructorReference, [(v, Type vt loc)])) @@ -182,8 +210,7 @@ data VarConstraints vt v loc | Vc'Float (Maybe Double) (Set Double) | Vc'Text (Maybe Text) (Set Text) | Vc'Char (Maybe Char) (Set Char) - | -- | Vc'ListElem v (Either Int Int) - Vc'ListRoot + | Vc'ListRoot (Type vt loc) -- ^ type of list elems (Seq v) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs index 742d78656..ae6d75853 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs @@ -1,6 +1,12 @@ {-# LANGUAGE DataKinds #-} -module Unison.PatternMatchCoverage.Solve where +module Unison.PatternMatchCoverage.Solve + ( uncoverAnnotate, + classify, + expandSolution, + generateInhabitants, + ) +where import Control.Monad.State import Control.Monad.Trans.Compose @@ -22,7 +28,6 @@ import Unison.PatternMatchCoverage.Fix import Unison.PatternMatchCoverage.GrdTree import Unison.PatternMatchCoverage.IntervalSet (IntervalSet) import qualified Unison.PatternMatchCoverage.IntervalSet as IntervalSet -import Unison.PatternMatchCoverage.ListPat import Unison.PatternMatchCoverage.Literal import Unison.PatternMatchCoverage.NormalizedConstraints import Unison.PatternMatchCoverage.PmGrd @@ -36,8 +41,9 @@ import Unison.Var (Var) -- | top-down traversal of the 'GrdTree' that produces: -- --- * a refinement type for values that do not match the 'GrdTree' --- * a new 'GrdTree' annotated with refinement types at the nodes for +-- * a refinement type describing values that do not match the 'GrdTree' +-- (the "uncovered" set) +-- * a new 'GrdTree' annotated with refinement types at the nodes describing -- values that cause an effect to be performed and values that match -- the case at the leaves. -- @@ -80,13 +86,6 @@ uncoverAnnotate z grdtree0 = cata phi grdtree0 z PmListInterval listVar lb ub -> do let iset = IntervalSet.singleton (lb, ub) handleGrd (NegListInterval listVar (IntervalSet.complement iset)) (NegListInterval listVar iset) k nc0 - -- (ncmatch, t) <- k nc0 - -- ncNoMatch <- addLiteral' nc0 (NegListInterval listVar miset) - -- -- todo: limit size - -- pure (Set.union ncMatch ncNoMatch, t) - -- PmList var listPat mi convars -> - -- let miset = IntervalSet.singleton mi - -- in handleGrd (PosList var listPat miset convars) (NegList var miset) k nc0 PmBang var -> do (ncCont, t) <- k nc0 ncEff <- addLiteral' nc0 (Effectful var) @@ -146,6 +145,8 @@ classifyAlg = \case True -> ([l], [], []) False -> ([], [], [l]) GrdF rt rest -> + -- The presence of a 'GrdF' node indicates that an effect was + -- performed (see 'uncoverAnnotate'). case inh rt of True -> -- The rest of the subtree is redundant, but an effect is @@ -159,21 +160,21 @@ classifyAlg = \case -- inhabitation check inh = not . Set.null --- | Expand a full DNF term (i.e. each term identifies one and only --- one solution) into a pattern. -expand :: +-- | Expand a full DNF term (i.e. each term identifies exactly one +-- solution) into an inhabiting pattern. +generateInhabitants :: forall vt v loc. (Var v) => v -> NormalizedConstraints vt v loc -> Pattern () -expand x nc = +generateInhabitants x nc = let (_xcanon, xvi, nc') = expectCanon x nc in case vi_con xvi of Vc'Constructor pos _neg -> case pos of Nothing -> Pattern.Unbound () Just (dc, convars) -> - Pattern.Constructor () dc (map (\(v, _) -> expand v nc') convars) + Pattern.Constructor () dc (map (\(v, _) -> generateInhabitants v nc') convars) Vc'Boolean pos _neg -> case pos of Nothing -> Pattern.Unbound () Just b -> Pattern.Boolean () b @@ -186,19 +187,11 @@ expand x nc = rootPat = case matchIsIncomplete of True -> Pattern.Unbound () False -> Pattern.SequenceLiteral () [] - snoced = foldr (\a b -> Pattern.SequenceOp () b Pattern.Snoc (expand a nc')) rootPat snocPos - consed = foldr (\a b -> Pattern.SequenceOp () (expand a nc') Pattern.Cons b) snoced consPos + snoced = foldr (\a b -> Pattern.SequenceOp () b Pattern.Snoc (generateInhabitants a nc')) rootPat snocPos + consed = foldr (\a b -> Pattern.SequenceOp () (generateInhabitants a nc') Pattern.Cons b) snoced consPos in consed _ -> Pattern.Unbound () --- | Expand the given variable into inhabited patterns. This is done --- as a final step on the refinement type unmatched terms (see --- 'uncoverAnnotate'). -generateInhabitants :: (Pmc vt v loc m) => v -> Set (NormalizedConstraints vt v loc) -> m [Pattern ()] -generateInhabitants v ncs = do - sols <- concat . fmap toList <$> traverse (expandSolution v) (toList ncs) - pure $ map (expand v) sols - -- | Instantiate a variable to a given constructor. instantiate :: forall vt v loc x m. @@ -345,12 +338,6 @@ withConstructors nil vinfo k = do typ = vi_typ vinfo v = vi_id vinfo -mkMatchingInterval :: ListPat -> IntervalSet -mkMatchingInterval = \case - Cons -> IntervalSet.singleton (1, maxBound) - Snoc -> IntervalSet.singleton (1, maxBound) - Nil -> IntervalSet.singleton (0, 0) - -- | Test that the given variable is inhabited. This test is -- undecidable in general so we adopt a fuel based approach as -- described in section 3.7. @@ -628,20 +615,6 @@ union v0 v1 nc@NormalizedConstraints {constraintMap} = IsEffectful -> [C.Effectful chosenCanon] in addConstraints constraints nc {constraintMap = m} -modifyList :: - forall vt v loc. - (Var v) => - v -> - ( Type vt loc -> - Seq v -> - Seq v -> - IntervalSet -> - ConstraintUpdate (Seq v, Seq v, IntervalSet) - ) -> - NormalizedConstraints vt v loc -> - NormalizedConstraints vt v loc -modifyList v f nc = runIdentity $ modifyListF v (\a b c d -> Identity (f a b c d)) nc - modifyListC :: forall vt v loc m. (Pmc vt v loc m) => @@ -674,18 +647,6 @@ modifyListF v f nc = let g vc = getCompose (posAndNegList (\typ pcons psnoc iset -> Compose (f typ pcons psnoc iset)) vc) in modifyVarConstraints v g nc -modifyConstructor :: - forall vt v loc. - (Var v) => - v -> - ( (Maybe (ConstructorReference, [(v, Type vt loc)])) -> - Set ConstructorReference -> - (ConstraintUpdate (Maybe (ConstructorReference, [(v, Type vt loc)]), Set ConstructorReference)) - ) -> - NormalizedConstraints vt v loc -> - NormalizedConstraints vt v loc -modifyConstructor v f nc = runIdentity $ modifyConstructorF v (\a b -> Identity (f a b)) nc - modifyConstructorC :: forall vt v loc m. (Pmc vt v loc m) => @@ -714,25 +675,6 @@ modifyConstructorF v f nc = let g vc = getCompose (posAndNegConstructor (\pos neg -> Compose (f pos neg)) vc) in modifyVarConstraints v g nc -modifyLiteral :: - forall vt v loc. - (Var v) => - v -> - PmLit -> - ( forall a. - (Ord a) => - -- positive info - Maybe a -> - -- negative info - Set a -> - -- the passed in PmLit, unpacked - a -> - ConstraintUpdate (Maybe a, Set a) - ) -> - NormalizedConstraints vt v loc -> - NormalizedConstraints vt v loc -modifyLiteral v lit f nc = runIdentity $ modifyLiteralF v lit (\a b c -> Identity (f a b c)) nc - modifyLiteralC :: forall vt v loc m. (Pmc vt v loc m) => @@ -868,13 +810,6 @@ newtype C vt v loc m a = C contradiction :: (Applicative m) => C vt v loc m a contradiction = C \_ -> pure Nothing -update :: (Pmc vt v loc m) => v -> VarConstraints vt v loc -> C vt v loc m () -update v vc = do - nc0 <- get - let (var, vi, nc1) = expectCanon v nc0 - nc2 = markDirty var ((insertVarInfo var vi {vi_con = vc}) nc1) - put nc2 - equate :: (Pmc vt v loc m) => [(v, v)] -> C vt v loc m () equate vs = addConstraintsC (map (uncurry C.Eq) vs) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs index d5d2ca9e4..0fdab0e59 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs @@ -28,8 +28,9 @@ import Data.Maybe (fromJust) import Data.Set (Set) import qualified Data.Set as Set --- import Lyg.Pretty - +-- | A union-find structure. Used by +-- 'Unison.PatternMatchCoverage.NormalizedConstraints.NormalizedConstraints' +-- to provide efficient unification. newtype UFMap k v = UFMap (Map k (UFValue k v)) deriving stock (Eq, Ord, Show) @@ -54,16 +55,15 @@ alterF' :: k -> -- | The canonical key (use laziness to supply if unknown) k -> + -- | Return Just to short-circuit the indirection lookup loop (k -> UFMap k v -> Maybe (f (UFMap k v))) -> - -- How to alter the canonical value - -- - -- N.B. deleting keys from a UFMap is not supported - -- - -- | Nothing case f (Maybe v) -> -- | Just case - -- canonicalKey -> size -> value + -- + -- @canonicalKey -> size -> value -> new value@ + -- + -- /N.B./ deleting a value is not supported (k -> Int -> v -> f (UFValue k v)) -> UFMap k v -> -- | Returns the canonical k, the size, the value, and the path @@ -128,10 +128,17 @@ alter :: alter k handleNothing handleJust map0 = runIdentity (alterF k (Identity handleNothing) (\k s v -> Identity (handleJust k s v)) map0) +-- | Lookup the canonical value lookupCanon :: (Ord k) => k -> UFMap k v -> + -- | returns: + -- + -- * the canonical member of the equivalence set + -- * the size of the equivalence set + -- * the associated value + -- * the @UFMap@ after path compression Maybe (k, Int, v, UFMap k v) lookupCanon k m = getCompose (alterF k nothing just m) From 7314d09623835160243811827e0dcd9d9c86a93b Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 1 Mar 2023 15:28:16 -0500 Subject: [PATCH 427/467] error message tweaks --- parser-typechecker/src/Unison/PrintError.hs | 12 ++--- .../transcripts/pattern-match-coverage.md | 2 +- .../pattern-match-coverage.output.md | 50 +++++++------------ 3 files changed, 23 insertions(+), 41 deletions(-) diff --git a/parser-typechecker/src/Unison/PrintError.hs b/parser-typechecker/src/Unison/PrintError.hs index cc352f778..3e54f177e 100644 --- a/parser-typechecker/src/Unison/PrintError.hs +++ b/parser-typechecker/src/Unison/PrintError.hs @@ -596,9 +596,8 @@ renderTypeError e env src curPath = case e of ] UncoveredPatterns loc tms -> mconcat - [ "Pattern match is non-exhaustive\n", - Pr.hang - "In the match:" + [ Pr.hang + "Pattern match doesn't cover all possible cases:" (annotatedAsErrorSite src loc), "\n\n" ] @@ -608,10 +607,9 @@ renderTypeError e env src curPath = case e of (map (\x -> Pr.lit (renderPattern env x)) (Nel.toList tms)) ) RedundantPattern loc -> - mconcat - [ "Pattern match is redundant\n", - Pr.hang "In the match case:" (annotatedAsErrorSite src loc) - ] + Pr.hang + "This case would be ignored because it's already covered by the preceding case(s):" + (annotatedAsErrorSite src loc) UnknownTerm {..} -> let (correct, wrongTypes, wrongNames) = foldr sep id suggestions ([], [], []) diff --git a/unison-src/transcripts/pattern-match-coverage.md b/unison-src/transcripts/pattern-match-coverage.md index 6034984b8..b6e478256 100644 --- a/unison-src/transcripts/pattern-match-coverage.md +++ b/unison-src/transcripts/pattern-match-coverage.md @@ -24,7 +24,7 @@ test = cases _ -> () ``` -patterns that would imply supplying an uninhabited type are not expected +uninhabited patterns are not expected ```unison unique type V = diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index c9c5cf96c..34d874134 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -10,8 +10,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 4 | test = cases 5 | A -> () @@ -36,13 +35,12 @@ test = cases ```ucm - Pattern match is redundant - In the match case: + This case would be ignored because it's already covered by the preceding case(s): 8 | _ -> () ``` -patterns that would imply supplying an uninhabited type are not expected +uninhabited patterns are not expected ```unison unique type V = @@ -77,8 +75,7 @@ test = cases ```ucm - Pattern match is redundant - In the match case: + This case would be ignored because it's already covered by the preceding case(s): 7 | Some _ -> () @@ -92,8 +89,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | () | false -> () @@ -115,8 +111,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 4 | test = cases 5 | None -> () 6 | Some None -> () @@ -138,8 +133,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 4 | test = cases 5 | None -> () 6 | Some None -> () @@ -162,8 +156,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | 0 -> () @@ -199,8 +192,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | true -> () @@ -238,8 +230,7 @@ test = cases ```ucm - Pattern match is redundant - In the match case: + This case would be ignored because it's already covered by the preceding case(s): 5 | _ -> () @@ -271,8 +262,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | [] -> () @@ -289,8 +279,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | x +: xs -> () @@ -307,8 +296,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | xs :+ x -> () @@ -346,8 +334,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | x0 +: (x1 +: xs) -> () 4 | [] -> () @@ -366,8 +353,7 @@ test = cases ```ucm - Pattern match is non-exhaustive - In the match: + Pattern match doesn't cover all possible cases: 2 | test = cases 3 | [] -> () 4 | x0 +: [] -> () @@ -411,8 +397,7 @@ test = cases ```ucm - Pattern match is redundant - In the match case: + This case would be ignored because it's already covered by the preceding case(s): 6 | true +: xs -> () @@ -428,8 +413,7 @@ test = cases ```ucm - Pattern match is redundant - In the match case: + This case would be ignored because it's already covered by the preceding case(s): 5 | _ ++ [true, false, true, false] -> () From a3e760f6674176da88963330218d5e9e790ad735 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 1 Mar 2023 16:46:06 -0600 Subject: [PATCH 428/467] Add diagnostic ranges for pattern match errors in LSP --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 7b264d3c1..18b58bfc7 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -234,10 +234,8 @@ analyseNotes fileUri ppe src notes = do (_v, locs) <- toList defns (r, rs) <- withNeighbours (locs >>= aToR) pure (r, ("duplicate definition",) <$> rs) - TypeError.RedundantPattern _ploc -> do - empty - TypeError.UncoveredPatterns _mloc _pats -> do - empty + TypeError.RedundantPattern loc -> singleRange loc + TypeError.UncoveredPatterns loc _pats -> singleRange loc -- These type errors don't have custom type error conversions, but some -- still have valid diagnostics. TypeError.Other e@(Context.ErrorNote {cause}) -> case cause of From 1e66edcdf2996f1c6c7dfa99de7dc1c7e94825af Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 09:11:13 -0500 Subject: [PATCH 429/467] add type sig to lambdacase transcript --- unison-src/transcripts/lambdacase.md | 1 + unison-src/transcripts/lambdacase.output.md | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/unison-src/transcripts/lambdacase.md b/unison-src/transcripts/lambdacase.md index 1b794b5ba..e2e3a557e 100644 --- a/unison-src/transcripts/lambdacase.md +++ b/unison-src/transcripts/lambdacase.md @@ -75,6 +75,7 @@ Here's another example: ```unison structural type B = T | F +blah : B -> B -> Text blah = cases T, x -> "hi" x, y -> "bye" diff --git a/unison-src/transcripts/lambdacase.output.md b/unison-src/transcripts/lambdacase.output.md index 31cd7b599..6fc1d5387 100644 --- a/unison-src/transcripts/lambdacase.output.md +++ b/unison-src/transcripts/lambdacase.output.md @@ -119,6 +119,7 @@ Here's another example: ```unison structural type B = T | F +blah : B -> B -> Text blah = cases T, x -> "hi" x, y -> "bye" @@ -141,21 +142,21 @@ blorf = cases ⍟ These new definitions are ok to `add`: structural type B - blah : B -> hod1jusqau2 -> Text + blah : B -> B -> Text blorf : B -> B -> B Now evaluating any watch expressions (lines starting with `>`)... Ctrl+C cancels. - 11 | > blah T F + 12 | > blah T F ⧩ "hi" - 12 | > blah F F + 13 | > blah F F ⧩ "bye" - 13 | > blorf T F + 14 | > blorf T F ⧩ F From 7d1a03b38536e95985fe67070b5e6a1b66ef541d Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 11:21:41 -0500 Subject: [PATCH 430/467] instantiate when we have positive information as well --- parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs index ae6d75853..6a6ef469c 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs @@ -259,7 +259,7 @@ expandSolution x nc = -- -- Then we would like to suggest @Just (Just _)@ rather than @Just _@. -- To accomplish this, we recurse and expand variables for which we have - -- negative information. + -- positive or negative information. -- branching factor let newFuel = case length newVars > 1 of @@ -273,7 +273,8 @@ expandSolution x nc = ( \nc -> case expectCanon v nc of (_vc, vi, nc') -> case vi_con vi of - Vc'Constructor _pos neg + Vc'Constructor pos neg + | Just _ <- pos -> go newFuel v nc' | not (Set.null neg) -> go (newFuel - 1) v nc' Vc'Boolean _pos neg | not (Set.null neg) -> go (newFuel - 1) v nc' From de90ae783b842e542b0384d4f296b64fb1d77da5 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 11:22:52 -0500 Subject: [PATCH 431/467] always instantiate Unit --- parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs index 6a6ef469c..9b2c067b2 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs @@ -18,6 +18,7 @@ import Data.Functor.Compose import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.Sequence as Seq import qualified Data.Set as Set +import Unison.Builtin.Decls (unitRef) import Unison.ConstructorReference (ConstructorReference) import Unison.Pattern (Pattern) import qualified Unison.Pattern as Pattern @@ -36,6 +37,7 @@ import qualified Unison.PatternMatchCoverage.PmLit as PmLit import qualified Unison.PatternMatchCoverage.UFMap as UFMap import Unison.Prelude import Unison.Type (Type) +import qualified Unison.Type as Type import qualified Unison.Util.Pretty as P import Unison.Var (Var) @@ -274,6 +276,8 @@ expandSolution x nc = case expectCanon v nc of (_vc, vi, nc') -> case vi_con vi of Vc'Constructor pos neg + -- always instantiate unit, this ensures we print tuple patterns correctly + | Type.Ref' x <- vi_typ vi, x == unitRef -> go newFuel v nc' | Just _ <- pos -> go newFuel v nc' | not (Set.null neg) -> go (newFuel - 1) v nc' Vc'Boolean _pos neg From bda4ea5382ff3e153959c2e016325c6d30659d66 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 10:04:36 -0500 Subject: [PATCH 432/467] expand pattern match coverage transcript --- .../transcripts/pattern-match-coverage.md | 136 +++++++-- .../pattern-match-coverage.output.md | 270 +++++++++++++----- 2 files changed, 313 insertions(+), 93 deletions(-) diff --git a/unison-src/transcripts/pattern-match-coverage.md b/unison-src/transcripts/pattern-match-coverage.md index b6e478256..85eab251c 100644 --- a/unison-src/transcripts/pattern-match-coverage.md +++ b/unison-src/transcripts/pattern-match-coverage.md @@ -3,7 +3,7 @@ ``` # Basics -non-exhaustive patterns are reported +## non-exhaustive patterns ```unison:error unique type T = A | B | C @@ -12,7 +12,18 @@ test = cases A -> () ``` -redundant matches are reported +```unison:error +unique type T = A | B + +test : (T, Optional T) -> () +test = cases + (A, Some _) -> () + (A, None) -> () + (B, Some A) -> () + (B, None) -> () +``` + +## redundant patterns ```unison:error unique type T = A | B | C @@ -24,7 +35,21 @@ test = cases _ -> () ``` -uninhabited patterns are not expected +```unison:error +unique type T = A | B + +test : (T, Optional T) -> () +test = cases + (A, Some _) -> () + (A, None) -> () + (B, Some _) -> () + (B, None) -> () + (A, Some A) -> () +``` + +# Uninhabited patterns + +match is complete without covering uninhabited patterns ```unison unique type V = @@ -34,7 +59,7 @@ test = cases Some None -> () ``` -they are reported as redundant +uninhabited patterns are reported as redundant ```unison:error unique type V = @@ -45,15 +70,37 @@ test = cases Some _ -> () ``` -boolean guards are considered +# Guards + +## Incomplete patterns due to guards should be reported ```unison:error test : () -> () test = cases () | false -> () ``` -uncovered patterns are only instantiated as deeply as necessary to -distinguish them from existing patterns +```unison:error +test : Optional Nat -> Nat +test = cases + None -> 0 + Some x + | isEven x -> x +``` + +## Complete patterns with guards should be accepted +```unison:error +test : Optional Nat -> Nat +test = cases + None -> 0 + Some x + | isEven x -> x + | otherwise -> 0 +``` + +# Pattern instantiation depth + +Uncovered patterns are only instantiated as deeply as necessary to +distinguish them from existing patterns. ```unison:error unique type T = A | B | C @@ -74,13 +121,26 @@ test = cases ``` # Literals -non-exhaustive nat + +## Non-exhaustive + +Nat ```unison:error test : Nat -> () test = cases 0 -> () ``` +Boolean +```unison:error +test : Boolean -> () +test = cases + true -> () +``` + +## Exhaustive + +Nat ```unison test : Nat -> () test = cases @@ -88,13 +148,7 @@ test = cases _ -> () ``` -non-exhaustive boolean -```unison:error -test : Boolean -> () -test = cases - true -> () -``` - +Boolean ```unison test : Boolean -> () test = cases @@ -102,7 +156,18 @@ test = cases false -> () ``` -redundant boolean +# Redundant + +Nat +```unison:error +test : Nat -> () +test = cases + 0 -> () + 0 -> () + _ -> () +``` + +Boolean ```unison:error test : Boolean -> () test = cases @@ -112,6 +177,8 @@ test = cases ``` # Sequences + +## Exhaustive ```unison test : [()] -> () test = cases @@ -119,6 +186,7 @@ test = cases x +: xs -> () ``` +## Non-exhaustive ```unison:error test : [()] -> () test = cases @@ -137,14 +205,6 @@ test = cases xs :+ x -> () ``` -```unison -unique type V = - -test : [V] -> () -test = cases - [] -> () -``` - ```unison:error test : [()] -> () test = cases @@ -159,8 +219,25 @@ test = cases x0 +: [] -> () ``` -cons and snoc patterns are equated when a length restriction implies -that they refer to the same element +## Uninhabited + +`Cons` is not expected since `V` is uninhabited +```unison +unique type V = + +test : [V] -> () +test = cases + [] -> () +``` + +## Length restrictions can equate cons and nil patterns + +Here the first pattern matches lists of length two or greater, the +second pattern matches lists of length 0. The third case matches when the +final element is `false`, while the fourth pattern matches when the +first element is `true`. However, the only possible list length at +the third or fourth clause is 1, so the first and final element must +be equal. Thus, the pattern match is exhaustive. ```unison test : [Boolean] -> () test = cases @@ -170,6 +247,7 @@ test = cases true +: xs -> () ``` +This is the same idea as above but shows that fourth match is redundant. ```unison:error test : [Boolean] -> () test = cases @@ -180,6 +258,12 @@ test = cases _ -> () ``` +This is another similar example. The first pattern matches lists of +length 5 or greater. The second matches lists of length 4 or greater where the +first and third element are true. The third matches lists of length 4 +or greater where the final 4 elements are `true, false, true, false`. +The list must be exactly of length 4 to arrive at the second or third +clause, so the third pattern is redundant. ```unison:error test : [Boolean] -> () test = cases diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index 34d874134..400a4382d 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -1,5 +1,5 @@ # Basics -non-exhaustive patterns are reported +## non-exhaustive patterns ```unison unique type T = A | B | C @@ -21,7 +21,32 @@ test = cases * C ``` -redundant matches are reported +```unison +unique type T = A | B + +test : (T, Optional T) -> () +test = cases + (A, Some _) -> () + (A, None) -> () + (B, Some A) -> () + (B, None) -> () +``` + +```ucm + + Pattern match doesn't cover all possible cases: + 4 | test = cases + 5 | (A, Some _) -> () + 6 | (A, None) -> () + 7 | (B, Some A) -> () + 8 | (B, None) -> () + + + Patterns not matched: + * (B, Some B) + +``` +## redundant patterns ```unison unique type T = A | B | C @@ -40,7 +65,28 @@ test = cases ``` -uninhabited patterns are not expected +```unison +unique type T = A | B + +test : (T, Optional T) -> () +test = cases + (A, Some _) -> () + (A, None) -> () + (B, Some _) -> () + (B, None) -> () + (A, Some A) -> () +``` + +```ucm + + This case would be ignored because it's already covered by the preceding case(s): + 9 | (A, Some A) -> () + + +``` +# Uninhabited patterns + +match is complete without covering uninhabited patterns ```unison unique type V = @@ -62,7 +108,7 @@ test = cases test : Optional (Optional V) -> () ``` -they are reported as redundant +uninhabited patterns are reported as redundant ```unison unique type V = @@ -80,7 +126,9 @@ test = cases ``` -boolean guards are considered +# Guards + +## Incomplete patterns due to guards should be reported ```unison test : () -> () test = cases @@ -98,8 +146,52 @@ test = cases * () ``` -uncovered patterns are only instantiated as deeply as necessary to -distinguish them from existing patterns +```unison +test : Optional Nat -> Nat +test = cases + None -> 0 + Some x + | isEven x -> x +``` + +```ucm + + Pattern match doesn't cover all possible cases: + 2 | test = cases + 3 | None -> 0 + 4 | Some x + 5 | | isEven x -> x + + + Patterns not matched: + * Some _ + +``` +## Complete patterns with guards should be accepted +```unison +test : Optional Nat -> Nat +test = cases + None -> 0 + Some x + | isEven x -> x + | otherwise -> 0 +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + test : Optional Nat -> Nat + +``` +# Pattern instantiation depth + +Uncovered patterns are only instantiated as deeply as necessary to +distinguish them from existing patterns. ```unison unique type T = A | B | C @@ -147,7 +239,10 @@ test = cases ``` # Literals -non-exhaustive nat + +## Non-exhaustive + +Nat ```unison test : Nat -> () test = cases @@ -165,6 +260,27 @@ test = cases * _ ``` +Boolean +```unison +test : Boolean -> () +test = cases + true -> () +``` + +```ucm + + Pattern match doesn't cover all possible cases: + 2 | test = cases + 3 | true -> () + + + Patterns not matched: + * false + +``` +## Exhaustive + +Nat ```unison test : Nat -> () test = cases @@ -183,24 +299,7 @@ test = cases test : Nat -> () ``` -non-exhaustive boolean -```unison -test : Boolean -> () -test = cases - true -> () -``` - -```ucm - - Pattern match doesn't cover all possible cases: - 2 | test = cases - 3 | true -> () - - - Patterns not matched: - * false - -``` +Boolean ```unison test : Boolean -> () test = cases @@ -219,7 +318,25 @@ test = cases test : Boolean -> () ``` -redundant boolean +# Redundant + +Nat +```unison +test : Nat -> () +test = cases + 0 -> () + 0 -> () + _ -> () +``` + +```ucm + + This case would be ignored because it's already covered by the preceding case(s): + 4 | 0 -> () + + +``` +Boolean ```unison test : Boolean -> () test = cases @@ -236,6 +353,8 @@ test = cases ``` # Sequences + +## Exhaustive ```unison test : [()] -> () test = cases @@ -254,6 +373,7 @@ test = cases test : [()] -> () ``` +## Non-exhaustive ```unison test : [()] -> () test = cases @@ -268,7 +388,7 @@ test = cases Patterns not matched: - * (_ +: _) + * (() +: _) ``` ```unison @@ -306,6 +426,47 @@ test = cases ``` ```unison +test : [()] -> () +test = cases + x0 +: (x1 +: xs) -> () + [] -> () +``` + +```ucm + + Pattern match doesn't cover all possible cases: + 2 | test = cases + 3 | x0 +: (x1 +: xs) -> () + 4 | [] -> () + + + Patterns not matched: + * (() +: []) + +``` +```unison +test : [()] -> () +test = cases + [] -> () + x0 +: [] -> () +``` + +```ucm + + Pattern match doesn't cover all possible cases: + 2 | test = cases + 3 | [] -> () + 4 | x0 +: [] -> () + + + Patterns not matched: + * (() +: (() +: _)) + +``` +## Uninhabited + +`Cons` is not expected since `V` is uninhabited +```unison unique type V = test : [V] -> () @@ -325,46 +486,14 @@ test = cases test : [V] -> () ``` -```unison -test : [()] -> () -test = cases - x0 +: (x1 +: xs) -> () - [] -> () -``` +## Length restrictions can equate cons and nil patterns -```ucm - - Pattern match doesn't cover all possible cases: - 2 | test = cases - 3 | x0 +: (x1 +: xs) -> () - 4 | [] -> () - - - Patterns not matched: - * (_ +: []) - -``` -```unison -test : [()] -> () -test = cases - [] -> () - x0 +: [] -> () -``` - -```ucm - - Pattern match doesn't cover all possible cases: - 2 | test = cases - 3 | [] -> () - 4 | x0 +: [] -> () - - - Patterns not matched: - * (_ +: (_ +: _)) - -``` -cons and snoc patterns are equated when a length restriction implies -that they refer to the same element +Here the first pattern matches lists of length two or greater, the +second pattern matches lists of length 0. The third case matches when the +final element is `false`, while the fourth pattern matches when the +first element is `true`. However, the only possible list length at +the third or fourth clause is 1, so the first and final element must +be equal. Thus, the pattern match is exhaustive. ```unison test : [Boolean] -> () test = cases @@ -385,6 +514,7 @@ test = cases test : [Boolean] -> () ``` +This is the same idea as above but shows that fourth match is redundant. ```unison test : [Boolean] -> () test = cases @@ -402,6 +532,12 @@ test = cases ``` +This is another similar example. The first pattern matches lists of +length 5 or greater. The second matches lists of length 4 or greater where the +first and third element are true. The third matches lists of length 4 +or greater where the final 4 elements are `true, false, true, false`. +The list must be exactly of length 4 to arrive at the second or third +clause, so the third pattern is redundant. ```unison test : [Boolean] -> () test = cases From fe619f612fd3955e055cba1587299f1788b18dea Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 17:08:04 -0500 Subject: [PATCH 433/467] Update parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs Co-authored-by: Chris Penner --- parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs index 8638c0c38..64d86b5a5 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/PmGrd.hs @@ -54,7 +54,7 @@ prettyPmGrd :: (Var vt, Var v) => PmGrd vt v loc -> Pretty ColorText prettyPmGrd = \case PmCon var con convars -> let xs = string (show con) : (formatConVar <$> convars) ++ ["<-", string (show var)] - formatConVar (v, t) = sep " " ["(", string (show v), "::", TypePrinter.pretty PPE.empty t, ")"] + formatConVar (v, t) = sep " " ["(", string (show v), ":", TypePrinter.pretty PPE.empty t, ")"] in sep " " xs PmListHead var n el _ -> sep " " ["Cons", string (show n), string (show el), "<-", string (show var)] PmListTail var n el _ -> sep " " ["Snoc", string (show n), string (show el), "<-", string (show var)] From 465737054bd5d461554d3884f7d1be986de13284 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 11:57:00 -0500 Subject: [PATCH 434/467] Use Unison.DataDeclaration.dependencies --- parser-typechecker/src/Unison/Codebase.hs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase.hs b/parser-typechecker/src/Unison/Codebase.hs index 757f87ea5..f93099367 100644 --- a/parser-typechecker/src/Unison/Codebase.hs +++ b/parser-typechecker/src/Unison/Codebase.hs @@ -161,7 +161,6 @@ import Unison.Symbol (Symbol) import Unison.Term (Term) import qualified Unison.Term as Term import Unison.Type (Type) -import qualified Unison.Type as Type import Unison.Typechecker.TypeLookup (TypeLookup (TypeLookup)) import qualified Unison.Typechecker.TypeLookup as TL import qualified Unison.UnisonFile as UF @@ -362,13 +361,11 @@ typeLookupForDependencies codebase s = do -- the inhabitation check). We ensure these are found -- by collecting all type dependencies for all data -- decls. - let constructorTypes :: [Type Symbol a] - constructorTypes = snd <$> DD.constructors dd - -- All references from constructorTypes that we - -- have not already gathered. - constructorRefs :: Set Reference - constructorRefs = foldl' (\b a -> Set.filter (unseen tl) (Type.dependencies a) <> b) mempty constructorTypes + -- All references from constructorTypes that we + -- have not already gathered. + let constructorRefs :: Set Reference + constructorRefs = Set.filter (unseen tl) (DD.dependencies dd) -- recursively call go for each constructor ref let z = tl <> TypeLookup mempty (Map.singleton ref dd) mempty From a7f201ef6e4b67a87b59a08e6cbcc99448643693 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 17:04:43 -0500 Subject: [PATCH 435/467] stray trash comments --- parser-typechecker/src/Unison/PrintError.hs | 2 -- parser-typechecker/src/Unison/Typechecker/Context.hs | 1 - 2 files changed, 3 deletions(-) diff --git a/parser-typechecker/src/Unison/PrintError.hs b/parser-typechecker/src/Unison/PrintError.hs index 3e54f177e..4c52a7ccf 100644 --- a/parser-typechecker/src/Unison/PrintError.hs +++ b/parser-typechecker/src/Unison/PrintError.hs @@ -1058,8 +1058,6 @@ renderContext env ctx@(C.Context es) = shortName v <> " : " <> renderType' env (C.apply ctx t) showElem _ (C.Marker v) = "|" <> shortName v <> "|" --- Term.Term' (TypeVar v loc) v loc - renderTerm :: (IsString s, Var v) => Env -> Term.Term' (TypeVar.TypeVar loc0 v) v loc1 -> s renderTerm env e = let s = Color.toPlain $ TermPrinter.pretty' (Just 80) env (TypeVar.lowerTerm e) diff --git a/parser-typechecker/src/Unison/Typechecker/Context.hs b/parser-typechecker/src/Unison/Typechecker/Context.hs index 54b4a578c..15d2e1529 100644 --- a/parser-typechecker/src/Unison/Typechecker/Context.hs +++ b/parser-typechecker/src/Unison/Typechecker/Context.hs @@ -790,7 +790,6 @@ getDataConstructors typ r == Type.listRef = let xs = [ (ListPat.Cons, [arg]), - -- (ListPat.Snoc, [typ, arg]), (ListPat.Nil, []) ] in pure (SequenceType xs) From 2cadd28947ff28bf4af36be7c81e46476064b911 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Thu, 2 Mar 2023 17:05:49 -0500 Subject: [PATCH 436/467] document toClasses --- .../src/Unison/PatternMatchCoverage/UFMap.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs index 0fdab0e59..f33e1a5bd 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/UFMap.hs @@ -213,13 +213,22 @@ union k0 k1 mapinit mergeValues = toMaybe do KeyNotFound _k -> Nothing MergeFailed _v0 _v1 -> Nothing -toClasses :: forall k v. (Ord k) => UFMap k v -> [(k, Set k, v)] +-- | Dump the @UFmap@ to a list grouped by equivalence class +toClasses :: + forall k v. + (Ord k) => + UFMap k v -> + -- | [(canonical key, equivalence class, value)] + [(k, Set k, v)] toClasses m0 = let cmFinal :: Map k (k, Set k, v) - (_mfinal, cmFinal) = foldl' phi (m0, Map.empty) keys + (_mfinal, cmFinal) = + -- we fold over the UFMap's keys and build up a Map that + -- groups the keys by equivalence class. + foldl' buildCmFinal (m0, Map.empty) keys keys = case m0 of UFMap m -> Map.keys m - phi (m, cm) k = + buildCmFinal (m, cm) k = let (kcanon, _, v, m') = fromJust (lookupCanon k m) cm' = Map.insertWith From 3231afa6cf8219bc27f84be95e91a55d96678434 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Mar 2023 09:02:10 -0600 Subject: [PATCH 437/467] allow multiline raw text literals --- unison-src/transcripts/text-literals.md | 30 +++++++++++ .../transcripts/text-literals.output.md | 50 +++++++++++++++++++ unison-syntax/src/Unison/Syntax/Lexer.hs | 8 ++- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 unison-src/transcripts/text-literals.md create mode 100644 unison-src/transcripts/text-literals.output.md diff --git a/unison-src/transcripts/text-literals.md b/unison-src/transcripts/text-literals.md new file mode 100644 index 000000000..1a334ae4b --- /dev/null +++ b/unison-src/transcripts/text-literals.md @@ -0,0 +1,30 @@ + +```ucm:hide +.> builtins.merge +``` + +This transcript shows some syntax for text literals. + +```unison +lit1 = """ +This is a raw text literal. +It can start with 3 or more ", +and is terminated by the same number of quotes. +Nothing is escaped. \n + +The initial newline, if it exists, is ignored. +""" + +> lit1 + +lit2 = """" +This is a raw text literal. +It can start with 3 or more ", +and is terminated by the same number of quotes. +Nothing is escaped. \n + +This doesn't terminate the literal - """ +"""" + +> lit2 +``` \ No newline at end of file diff --git a/unison-src/transcripts/text-literals.output.md b/unison-src/transcripts/text-literals.output.md new file mode 100644 index 000000000..b0684c6f3 --- /dev/null +++ b/unison-src/transcripts/text-literals.output.md @@ -0,0 +1,50 @@ + +This transcript shows some syntax for text literals. + +```unison +lit1 = """ +This is a raw text literal. +It can start with 3 or more ", +and is terminated by the same number of quotes. +Nothing is escaped. \n + +The initial newline, if it exists, is ignored. +""" + +> lit1 + +lit2 = """" +This is a raw text literal. +It can start with 3 or more ", +and is terminated by the same number of quotes. +Nothing is escaped. \n + +This doesn't terminate the literal - """ +"""" + +> lit2 +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + lit1 : Text + lit2 : Text + + Now evaluating any watch expressions (lines starting with + `>`)... Ctrl+C cancels. + + 10 | > lit1 + ⧩ + "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThe initial newline, if it exists, is ignored.\n" + + 21 | > lit2 + ⧩ + "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" + +``` diff --git a/unison-syntax/src/Unison/Syntax/Lexer.hs b/unison-syntax/src/Unison/Syntax/Lexer.hs index 110fe52b4..f185c9b4f 100644 --- a/unison-syntax/src/Unison/Syntax/Lexer.hs +++ b/unison-syntax/src/Unison/Syntax/Lexer.hs @@ -783,7 +783,13 @@ lexemes' eof = semi = char ';' $> Semi False textual = Textual <$> quoted - quoted = char '"' *> P.manyTill (LP.charLiteral <|> sp) (char '"') + quoted = quotedRaw <|> quotedSingleLine + quotedRaw = do + _ <- lit "\"\"\"" + n <- many (char '"') + _ <- optional (char '\n') -- initial newline is skipped + P.manyTill P.anySingle (lit (replicate (length n + 3) '"')) + quotedSingleLine = char '"' *> P.manyTill (LP.charLiteral <|> sp) (char '"') where sp = lit "\\s" $> ' ' character = Character <$> (char '?' *> (spEsc <|> LP.charLiteral)) From 8faa72a349822e037f3a1c900cf879bed19c6193 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 3 Mar 2023 10:25:41 -0500 Subject: [PATCH 438/467] Use Unison.Debug flags --- lib/unison-prelude/src/Unison/Debug.hs | 14 ++++++++++++++ .../src/Unison/PatternMatchCoverage.hs | 4 ++-- .../src/Unison/PatternMatchCoverage/Solve.hs | 3 ++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/unison-prelude/src/Unison/Debug.hs b/lib/unison-prelude/src/Unison/Debug.hs index defaff3b0..f646b48d7 100644 --- a/lib/unison-prelude/src/Unison/Debug.hs +++ b/lib/unison-prelude/src/Unison/Debug.hs @@ -39,6 +39,8 @@ data DebugFlag Temp | -- | Shows Annotations when printing terms Annotations + | PatternCoverage + | PatternCoverageConstraintSolver deriving (Eq, Ord, Show, Bounded, Enum) debugFlags :: Set DebugFlag @@ -61,6 +63,8 @@ debugFlags = case (unsafePerformIO (lookupEnv "UNISON_DEBUG")) of "TIMING" -> pure Timing "TEMP" -> pure Temp "ANNOTATIONS" -> pure Annotations + "PATTERN_COVERAGE" -> pure PatternCoverage + "PATTERN_COVERAGE_CONSTRAINT_SOLVER" -> pure PatternCoverageConstraintSolver _ -> empty {-# NOINLINE debugFlags #-} @@ -108,6 +112,14 @@ debugAnnotations :: Bool debugAnnotations = Annotations `Set.member` debugFlags {-# NOINLINE debugAnnotations #-} +debugPatternCoverage :: Bool +debugPatternCoverage = PatternCoverage `Set.member` debugFlags +{-# NOINLINE debugPatternCoverage #-} + +debugPatternCoverageConstraintSolver :: Bool +debugPatternCoverageConstraintSolver = PatternCoverageConstraintSolver `Set.member` debugFlags +{-# NOINLINE debugPatternCoverageConstraintSolver #-} + -- | Use for trace-style selective debugging. -- E.g. 1 + (debug Git "The second number" 2) -- @@ -159,3 +171,5 @@ shouldDebug = \case Timing -> debugTiming Temp -> debugTemp Annotations -> debugAnnotations + PatternCoverage -> debugPatternCoverage + PatternCoverageConstraintSolver -> debugPatternCoverageConstraintSolver diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage.hs b/parser-typechecker/src/Unison/PatternMatchCoverage.hs index a43bc0e38..05a1531fe 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage.hs @@ -37,6 +37,7 @@ where import qualified Data.Set as Set import Debug.Trace +import Unison.Debug import Unison.Pattern (Pattern) import Unison.PatternMatchCoverage.Class (Pmc (..)) import Unison.PatternMatchCoverage.Desugar (desugarMatch) @@ -75,8 +76,7 @@ checkMatch matchLocation scrutineeType cases = do P.hang "uncovered:" (NC.prettyDnf uncovered), P.hang "uncovered expanded:" (NC.prettyDnf (Set.fromList uncoveredExpanded)) ] - shouldDebug = False - doDebug = case shouldDebug of + doDebug = case shouldDebug PatternCoverage of True -> trace (P.toPlainUnbroken debugOutput) False -> id doDebug (pure (redundant, inaccessible, sols)) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs index 9b2c067b2..72146fed0 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs @@ -20,6 +20,7 @@ import qualified Data.Sequence as Seq import qualified Data.Set as Set import Unison.Builtin.Decls (unitRef) import Unison.ConstructorReference (ConstructorReference) +import Unison.Debug (DebugFlag (PatternCoverageConstraintSolver), shouldDebug) import Unison.Pattern (Pattern) import qualified Unison.Pattern as Pattern import Unison.PatternMatchCoverage.Class @@ -564,7 +565,7 @@ addConstraint con0 nc = P.hang (P.green "resulting constraint: ") (maybe "contradiction" prettyNormalizedConstraints x), "" ] - in if False then trace (P.toAnsiUnbroken debugOutput) x else x + in if shouldDebug PatternCoverageConstraintSolver then trace (P.toAnsiUnbroken debugOutput) x else x -- | Like 'addConstraint', but for a list of constraints addConstraints :: From 1eefcdc5d3ed6d0d2281b24908d323efe24baa02 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 3 Mar 2023 10:42:07 -0500 Subject: [PATCH 439/467] stray comment --- parser-typechecker/src/Unison/Runtime/IOSource.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/Runtime/IOSource.hs b/parser-typechecker/src/Unison/Runtime/IOSource.hs index 11bec2fa3..458398f8e 100644 --- a/parser-typechecker/src/Unison/Runtime/IOSource.hs +++ b/parser-typechecker/src/Unison/Runtime/IOSource.hs @@ -983,7 +983,7 @@ showNotes source env = intercalateMap "\n\n" $ PrintError.renderNoteAsANSI 60 env source Path.absoluteEmpty decodeResult :: - String -> SynthResult -> EitherResult -- String (UF.TypecheckedUnisonFile Symbol Ann) + String -> SynthResult -> EitherResult decodeResult source (Result.Result notes Nothing) = Left $ showNotes source ppEnv notes decodeResult source (Result.Result notes (Just (Left uf))) = From 96bcbcf2b7edf139cab152d286150b03c13fc5c9 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Fri, 3 Mar 2023 10:50:35 -0500 Subject: [PATCH 440/467] add complete pragma --- parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs index 681382f5d..7644cacf3 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/GrdTree.hs @@ -84,3 +84,5 @@ pattern Grd x rest = Fix (GrdF x rest) pattern Fork :: NonEmpty (GrdTree n l) -> GrdTree n l pattern Fork alts = Fix (ForkF alts) + +{-# COMPLETE Leaf, Grd, Fork #-} From b384671ff7e1c0f818c6681cfee8129954ca4660 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Mar 2023 13:32:31 -0600 Subject: [PATCH 441/467] pretty-printer uses raw text syntax opportunistically (not yet working) --- .../src/Unison/Syntax/TermPrinter.hs | 13 +++++++++ unison-src/transcripts/text-literals.md | 8 +++++- .../transcripts/text-literals.output.md | 27 ++++++++++++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index 9ed7c6d06..c3a865e93 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -15,6 +15,7 @@ where import Control.Lens (unsnoc, (^.)) import Control.Monad.State (evalState) import qualified Control.Monad.State as State +import Data.Char (isPrint) import Data.List import qualified Data.Map as Map import qualified Data.Set as Set @@ -226,6 +227,18 @@ pretty0 -- metaprograms), then it needs to be able to print them (and then the -- parser ought to be able to parse them, to maintain symmetry.) Boolean' b -> pure . fmt S.BooleanLiteral $ if b then l "true" else l "false" + Text' s | Just quotes <- useRaw s -> + pure . fmt S.TextLiteral $ PP.text quotes <> "\n" <> PP.text s <> PP.text quotes + where + useRaw _ | p > 0 = Nothing -- only do this + useRaw s | Text.find (== '\n') s == Just '\n' && Text.all isPrint s = n 3 + useRaw _ = Nothing + -- Picks smallest number of surrounding """ to be unique + n 10 = Nothing -- bail at 10, avoiding quadratic behavior in weird cases + n cur = + if null (Text.breakOnAll quotes s) then Just quotes + else n (cur + 1) + where quotes = Text.pack (replicate cur '"') Text' s -> pure . fmt S.TextLiteral $ l $ U.ushow s Char' c -> pure . fmt S.CharLiteral diff --git a/unison-src/transcripts/text-literals.md b/unison-src/transcripts/text-literals.md index 1a334ae4b..d7e96dd61 100644 --- a/unison-src/transcripts/text-literals.md +++ b/unison-src/transcripts/text-literals.md @@ -3,7 +3,7 @@ .> builtins.merge ``` -This transcript shows some syntax for text literals. +This transcript shows some syntax for raw text literals. ```unison lit1 = """ @@ -27,4 +27,10 @@ This doesn't terminate the literal - """ """" > lit2 +> Some lit2 +``` + +```ucm +.> add +.> view lit1 lit2 ``` \ No newline at end of file diff --git a/unison-src/transcripts/text-literals.output.md b/unison-src/transcripts/text-literals.output.md index b0684c6f3..a9ac0e74e 100644 --- a/unison-src/transcripts/text-literals.output.md +++ b/unison-src/transcripts/text-literals.output.md @@ -1,5 +1,5 @@ -This transcript shows some syntax for text literals. +This transcript shows some syntax for raw text literals. ```unison lit1 = """ @@ -23,6 +23,7 @@ This doesn't terminate the literal - """ """" > lit2 +> Some lit2 ``` ```ucm @@ -46,5 +47,29 @@ This doesn't terminate the literal - """ 21 | > lit2 ⧩ "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" + + 22 | > Some lit2 + ⧩ + Some + "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + lit1 : Text + lit2 : Text + +.> view lit1 lit2 + + lit1 : Text + lit1 = + "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThe initial newline, if it exists, is ignored.\n" + + lit2 : Text + lit2 = + "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" ``` From 02006ffefe37c1150ea5dd519d0e79efed177f35 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Mar 2023 15:10:30 -0600 Subject: [PATCH 442/467] lexer strips leading whitespace from raw literals, and pretty-printer also uses syntax opportunistically --- .../src/Unison/Syntax/TermPrinter.hs | 7 +- unison-src/transcripts/text-literals.md | 13 ++-- .../transcripts/text-literals.output.md | 64 ++++++++++++++----- unison-syntax/src/Unison/Syntax/Lexer.hs | 12 +++- 4 files changed, 72 insertions(+), 24 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index c3a865e93..c7e5a878b 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -230,9 +230,12 @@ pretty0 Text' s | Just quotes <- useRaw s -> pure . fmt S.TextLiteral $ PP.text quotes <> "\n" <> PP.text s <> PP.text quotes where - useRaw _ | p > 0 = Nothing -- only do this - useRaw s | Text.find (== '\n') s == Just '\n' && Text.all isPrint s = n 3 + -- we only use this syntax if we're not wrapped in something else, + -- to avoid possible round trip issues if the text ends at an odd column + useRaw _ | p > 0 = Nothing + useRaw s | Text.find (== '\n') s == Just '\n' && Text.all ok s = n 3 useRaw _ = Nothing + ok ch = isPrint ch || ch == '\n' || ch == '\r' -- Picks smallest number of surrounding """ to be unique n 10 = Nothing -- bail at 10, avoiding quadratic behavior in weird cases n cur = diff --git a/unison-src/transcripts/text-literals.md b/unison-src/transcripts/text-literals.md index d7e96dd61..f9336b040 100644 --- a/unison-src/transcripts/text-literals.md +++ b/unison-src/transcripts/text-literals.md @@ -16,15 +16,16 @@ The initial newline, if it exists, is ignored. """ > lit1 +> Some lit1 lit2 = """" -This is a raw text literal. -It can start with 3 or more ", -and is terminated by the same number of quotes. -Nothing is escaped. \n + This is a raw text literal, indented. + It can start with 3 or more ", + and is terminated by the same number of quotes. + Nothing is escaped. \n -This doesn't terminate the literal - """ -"""" + This doesn't terminate the literal - """ + """" > lit2 > Some lit2 diff --git a/unison-src/transcripts/text-literals.output.md b/unison-src/transcripts/text-literals.output.md index a9ac0e74e..9ca0f7619 100644 --- a/unison-src/transcripts/text-literals.output.md +++ b/unison-src/transcripts/text-literals.output.md @@ -12,15 +12,16 @@ The initial newline, if it exists, is ignored. """ > lit1 +> Some lit1 lit2 = """" -This is a raw text literal. -It can start with 3 or more ", -and is terminated by the same number of quotes. -Nothing is escaped. \n + This is a raw text literal, indented. + It can start with 3 or more ", + and is terminated by the same number of quotes. + Nothing is escaped. \n -This doesn't terminate the literal - """ -"""" + This doesn't terminate the literal - """ + """" > lit2 > Some lit2 @@ -42,16 +43,35 @@ This doesn't terminate the literal - """ 10 | > lit1 ⧩ - "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThe initial newline, if it exists, is ignored.\n" + """ + This is a raw text literal. + It can start with 3 or more ", + and is terminated by the same number of quotes. + Nothing is escaped. \n + + The initial newline, if it exists, is ignored. + """ - 21 | > lit2 - ⧩ - "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" - - 22 | > Some lit2 + 11 | > Some lit1 ⧩ Some - "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" + "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThe initial newline, if it exists, is ignored.\n" + + 22 | > lit2 + ⧩ + """" + This is a raw text literal, indented. + It can start with 3 or more ", + and is terminated by the same number of quotes. + Nothing is escaped. \n + + This doesn't terminate the literal - """ + """" + + 23 | > Some lit2 + ⧩ + Some + "This is a raw text literal, indented.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" ``` ```ucm @@ -66,10 +86,24 @@ This doesn't terminate the literal - """ lit1 : Text lit1 = - "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThe initial newline, if it exists, is ignored.\n" + """ + This is a raw text literal. + It can start with 3 or more ", + and is terminated by the same number of quotes. + Nothing is escaped. \n + + The initial newline, if it exists, is ignored. + """ lit2 : Text lit2 = - "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\"\n" + """" + This is a raw text literal, indented. + It can start with 3 or more ", + and is terminated by the same number of quotes. + Nothing is escaped. \n + + This doesn't terminate the literal - """ + """" ``` diff --git a/unison-syntax/src/Unison/Syntax/Lexer.hs b/unison-syntax/src/Unison/Syntax/Lexer.hs index f185c9b4f..23266831b 100644 --- a/unison-syntax/src/Unison/Syntax/Lexer.hs +++ b/unison-syntax/src/Unison/Syntax/Lexer.hs @@ -787,8 +787,18 @@ lexemes' eof = quotedRaw = do _ <- lit "\"\"\"" n <- many (char '"') + col <- column <$> P.lookAhead (P.takeWhileP (Just "spaces") isSpace *> pos) _ <- optional (char '\n') -- initial newline is skipped - P.manyTill P.anySingle (lit (replicate (length n + 3) '"')) + s <- P.manyTill P.anySingle (lit (replicate (length n + 3) '"')) + let leading = replicate (max 0 (col - 1)) ' ' + -- lines "foo\n" will produce ["foo"] (ignoring last newline), + -- lines' "foo\n" will produce ["foo",""] (preserving trailing newline) + let lines' s = lines s <> (if take 1 (reverse s) == "\n" then [""] else []) + pure $ case lines' s of + [] -> s + ls + | all (\l -> isPrefixOf leading l || all isSpace l) ls -> intercalate "\n" (drop (length leading) <$> ls) + | otherwise -> s quotedSingleLine = char '"' *> P.manyTill (LP.charLiteral <|> sp) (char '"') where sp = lit "\\s" $> ' ' From fbf2a58f86552135f554f39405dba20cc3a1c156 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Mar 2023 15:23:55 -0600 Subject: [PATCH 443/467] key off the final trailing """ instead of first non-space character --- unison-syntax/src/Unison/Syntax/Lexer.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unison-syntax/src/Unison/Syntax/Lexer.hs b/unison-syntax/src/Unison/Syntax/Lexer.hs index 23266831b..4707b3c1c 100644 --- a/unison-syntax/src/Unison/Syntax/Lexer.hs +++ b/unison-syntax/src/Unison/Syntax/Lexer.hs @@ -787,9 +787,10 @@ lexemes' eof = quotedRaw = do _ <- lit "\"\"\"" n <- many (char '"') - col <- column <$> P.lookAhead (P.takeWhileP (Just "spaces") isSpace *> pos) _ <- optional (char '\n') -- initial newline is skipped s <- P.manyTill P.anySingle (lit (replicate (length n + 3) '"')) + col0 <- column <$> pos + let col = col0 - (length n) - 3 let leading = replicate (max 0 (col - 1)) ' ' -- lines "foo\n" will produce ["foo"] (ignoring last newline), -- lines' "foo\n" will produce ["foo",""] (preserving trailing newline) From a6fae7cd6542425e0419f092be24450cd5af969f Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Fri, 3 Mar 2023 15:26:09 -0600 Subject: [PATCH 444/467] ormolu --- .../src/Unison/Syntax/TermPrinter.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index c7e5a878b..f1c6ca250 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -227,8 +227,9 @@ pretty0 -- metaprograms), then it needs to be able to print them (and then the -- parser ought to be able to parse them, to maintain symmetry.) Boolean' b -> pure . fmt S.BooleanLiteral $ if b then l "true" else l "false" - Text' s | Just quotes <- useRaw s -> - pure . fmt S.TextLiteral $ PP.text quotes <> "\n" <> PP.text s <> PP.text quotes + Text' s + | Just quotes <- useRaw s -> + pure . fmt S.TextLiteral $ PP.text quotes <> "\n" <> PP.text s <> PP.text quotes where -- we only use this syntax if we're not wrapped in something else, -- to avoid possible round trip issues if the text ends at an odd column @@ -238,10 +239,12 @@ pretty0 ok ch = isPrint ch || ch == '\n' || ch == '\r' -- Picks smallest number of surrounding """ to be unique n 10 = Nothing -- bail at 10, avoiding quadratic behavior in weird cases - n cur = - if null (Text.breakOnAll quotes s) then Just quotes - else n (cur + 1) - where quotes = Text.pack (replicate cur '"') + n cur = + if null (Text.breakOnAll quotes s) + then Just quotes + else n (cur + 1) + where + quotes = Text.pack (replicate cur '"') Text' s -> pure . fmt S.TextLiteral $ l $ U.ushow s Char' c -> pure . fmt S.CharLiteral From d9cdf6b40bbf769c1dedfec87b64a1a7153ff25d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Fri, 3 Mar 2023 21:03:40 -0500 Subject: [PATCH 445/467] Fix roundtrip error with block lambdas --- .../src/Unison/Syntax/TermPrinter.hs | 26 +++++++------ unison-src/transcripts/fix2053.output.md | 15 ++++---- unison-src/transcripts/fix3265.output.md | 38 ++++++++++--------- 3 files changed, 43 insertions(+), 36 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index 9ed7c6d06..8241d157c 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -86,12 +86,12 @@ data AmbientContext = AmbientContext { -- The operator precedence of the enclosing context (a number from 0 to 11, -- or -1 to render without outer parentheses unconditionally). -- Function application has precedence 10. - precedence :: Int, - blockContext :: BlockContext, - infixContext :: InfixContext, - imports :: Imports, - docContext :: DocLiteralContext, - elideUnit :: Bool -- `True` if a `()` at the end of a block should be elided + precedence :: !Int, + blockContext :: !BlockContext, + infixContext :: !InfixContext, + imports :: !Imports, + docContext :: !DocLiteralContext, + elideUnit :: !Bool -- `True` if a `()` at the end of a block should be elided } -- Description of the position of this ABT node, when viewed in the @@ -470,7 +470,7 @@ pretty0 paren (p >= 10) <$> do lastArg' <- pretty0 (ac 10 Normal im doc) lastArg booleanOps (fmt S.ControlKeyword "||") xs lastArg' - _ -> case (term, nonForcePred) of + _other -> case (term, nonForcePred) of OverappliedBinaryAppPred' f a b r | binaryOpsPred f -> -- Special case for overapplied binary op @@ -484,16 +484,20 @@ pretty0 f' <- pretty0 (ac 10 Normal im doc) f args' <- PP.spacedTraverse (pretty0 (ac 10 Normal im doc)) args pure $ f' `PP.hang` args' - _ -> case (term, \v -> nonUnitArgPred v && not (isDelay term)) of + _other -> case (term, \v -> nonUnitArgPred v && not (isDelay term)) of (LamsNamedMatch' [] branches, _) -> do pbs <- printCase im doc branches pure . paren (p >= 3) $ PP.group (fmt S.ControlKeyword "cases") `PP.hang` pbs LamsNamedPred' vs body -> do - prettyBody <- pretty0 (ac 2 Block im doc) body + prettyBody <- pretty0 (ac 2 Normal im doc) body + let hang = case body of + Delay' (Lets' _ _) -> PP.softHang + Lets' _ _ -> PP.softHang + _ -> PP.hang pure . paren (p >= 3) $ - PP.group (varList vs <> fmt S.ControlKeyword " ->") `PP.hang` prettyBody - _ -> go term + PP.group (varList vs <> fmt S.ControlKeyword " ->") `hang` prettyBody + _other -> go term isDelay (Delay' _) = True isDelay _ = False diff --git a/unison-src/transcripts/fix2053.output.md b/unison-src/transcripts/fix2053.output.md index 1009a11a5..f0f2df91b 100644 --- a/unison-src/transcripts/fix2053.output.md +++ b/unison-src/transcripts/fix2053.output.md @@ -2,12 +2,13 @@ .> display List.map f a -> - go i as acc = - match List.at i as with - None -> acc - Some a -> - use Nat + - go (i + 1) as (acc :+ f a) - go 0 a [] + let + go i as acc = + match List.at i as with + None -> acc + Some a -> + use Nat + + go (i + 1) as (acc :+ f a) + go 0 a [] ``` diff --git a/unison-src/transcripts/fix3265.output.md b/unison-src/transcripts/fix3265.output.md index 6cdf798ae..5d68e8e55 100644 --- a/unison-src/transcripts/fix3265.output.md +++ b/unison-src/transcripts/fix3265.output.md @@ -33,19 +33,20 @@ are three cases that need to be 'fixed up.' ⧩ Any (w x -> - use Nat + drop - f1 y = - match y with - 0 -> w + x - n -> 1 + f0 (drop y 1) - f0 y = - match y with - 0 -> x - n -> 1 + f1 (drop y 1) - f2 x = f2 x - f3 x y = 1 + y + f2 x - g h = h 1 + x - g (z -> x + f0 z)) + let + use Nat + drop + f1 y = + match y with + 0 -> w + x + n -> 1 + f0 (drop y 1) + f0 y = + match y with + 0 -> x + n -> 1 + f1 (drop y 1) + f2 x = f2 x + f3 x y = 1 + y + f2 x + g h = h 1 + x + g (z -> x + f0 z)) ``` Also check for some possible corner cases. @@ -77,10 +78,11 @@ discard its arguments, where `f` also occurs. ⧩ Any (x -> - f x y = - match y with - 0 -> 0 - _ -> f x (f y (Nat.drop y 1)) - f x 20) + let + f x y = + match y with + 0 -> 0 + _ -> f x (f y (Nat.drop y 1)) + f x 20) ``` From 2a590486a5a5b9f0b5069b5b5123cbdd7b5144a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAnar?= Date: Fri, 3 Mar 2023 21:42:30 -0500 Subject: [PATCH 446/467] Transcript test --- unison-src/transcripts-round-trip/main.md | 37 ++- .../transcripts-round-trip/main.output.md | 223 +++++++++++++----- 2 files changed, 197 insertions(+), 63 deletions(-) diff --git a/unison-src/transcripts-round-trip/main.md b/unison-src/transcripts-round-trip/main.md index 26f5ab918..30cf93695 100644 --- a/unison-src/transcripts-round-trip/main.md +++ b/unison-src/transcripts-round-trip/main.md @@ -506,4 +506,39 @@ foo = cases ```ucm .> load scratch.u -``` \ No newline at end of file +``` + +# Multi-line lambda let + +Regression test for #3110 and #3801 + +```unison:hide +foreach x f = + _ = List.map f x + () + +ignore x = () + +test1 : () +test1 = + foreach [1, 2, 3] let x -> let + y = Nat.increment x + () + +test2 = foreach [1, 2, 3] let x -> ignore (Nat.increment x) + +test3 = foreach [1, 2, 3] do x -> do + y = Nat.increment x + () +``` + +```ucm +.> add +.> edit test1 test2 test3 foreach ignore +.> undo +``` + +```ucm +.> load scratch.u +``` + diff --git a/unison-src/transcripts-round-trip/main.output.md b/unison-src/transcripts-round-trip/main.output.md index 9f8099478..65f6c5cad 100644 --- a/unison-src/transcripts-round-trip/main.output.md +++ b/unison-src/transcripts-round-trip/main.output.md @@ -34,16 +34,16 @@ x = 1 + 1 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #7s9j9tscke .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #7s9j9tscke` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #pdrl1ktsa0 add - 2. 1 secs ago #l7cnk7raag builtins.mergeio + 1. now #42cab6b47j add + 2. 1 secs ago #7s9j9tscke builtins.mergeio 3. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between @@ -120,18 +120,18 @@ Without the above stanza, the `edit` will send the definition to the most recent most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #7s9j9tscke .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #7s9j9tscke` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #7a6vnmv5c9 add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #pdrl1ktsa0 add - 4. 1 secs ago #l7cnk7raag builtins.mergeio + 1. now #jsuccp4qsq add + 2. now #7s9j9tscke reset-root #7s9j9tscke + 3. now #42cab6b47j add + 4. 1 secs ago #7s9j9tscke builtins.mergeio 5. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between @@ -199,20 +199,20 @@ f x = let most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #7s9j9tscke .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #7s9j9tscke` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #obak7jnhcv add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #7a6vnmv5c9 add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #pdrl1ktsa0 add - 6. 1 secs ago #l7cnk7raag builtins.mergeio + 1. now #5nq1cqgki0 add + 2. now #7s9j9tscke reset-root #7s9j9tscke + 3. now #jsuccp4qsq add + 4. now #7s9j9tscke reset-root #7s9j9tscke + 5. now #42cab6b47j add + 6. 1 secs ago #7s9j9tscke builtins.mergeio 7. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between @@ -285,22 +285,22 @@ h xs = match xs with most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #7s9j9tscke .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #7s9j9tscke` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #4skv4f38cf add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #obak7jnhcv add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #7a6vnmv5c9 add - 6. now #l7cnk7raag reset-root #l7cnk7raag - 7. now #pdrl1ktsa0 add - 8. 1 secs ago #l7cnk7raag builtins.mergeio + 1. now #70m5luveeu add + 2. now #7s9j9tscke reset-root #7s9j9tscke + 3. now #5nq1cqgki0 add + 4. now #7s9j9tscke reset-root #7s9j9tscke + 5. now #jsuccp4qsq add + 6. now #7s9j9tscke reset-root #7s9j9tscke + 7. now #42cab6b47j add + 8. 1 secs ago #7s9j9tscke builtins.mergeio 9. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between @@ -369,24 +369,24 @@ foo n _ = n most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #7s9j9tscke .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #7s9j9tscke` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #fdnrhfkoot add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #4skv4f38cf add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #obak7jnhcv add - 6. now #l7cnk7raag reset-root #l7cnk7raag - 7. now #7a6vnmv5c9 add - 8. now #l7cnk7raag reset-root #l7cnk7raag - 9. now #pdrl1ktsa0 add - 10. 1 secs ago #l7cnk7raag builtins.mergeio + 1. now #vniupjo3hs add + 2. now #7s9j9tscke reset-root #7s9j9tscke + 3. now #70m5luveeu add + 4. now #7s9j9tscke reset-root #7s9j9tscke + 5. now #5nq1cqgki0 add + 6. now #7s9j9tscke reset-root #7s9j9tscke + 7. now #jsuccp4qsq add + 8. now #7s9j9tscke reset-root #7s9j9tscke + 9. now #42cab6b47j add + 10. 1 secs ago #7s9j9tscke builtins.mergeio 11. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between @@ -452,26 +452,26 @@ foo = most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #l7cnk7raag .old` to make an old namespace + `fork #7s9j9tscke .old` to make an old namespace accessible again, - `reset-root #l7cnk7raag` to reset the root namespace and + `reset-root #7s9j9tscke` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #dblf9f7ggq add - 2. now #l7cnk7raag reset-root #l7cnk7raag - 3. now #fdnrhfkoot add - 4. now #l7cnk7raag reset-root #l7cnk7raag - 5. now #4skv4f38cf add - 6. now #l7cnk7raag reset-root #l7cnk7raag - 7. now #obak7jnhcv add - 8. now #l7cnk7raag reset-root #l7cnk7raag - 9. now #7a6vnmv5c9 add - 10. now #l7cnk7raag reset-root #l7cnk7raag - 11. now #pdrl1ktsa0 add - 12. 1 secs ago #l7cnk7raag builtins.mergeio + 1. now #u6beqn7af5 add + 2. now #7s9j9tscke reset-root #7s9j9tscke + 3. now #vniupjo3hs add + 4. now #7s9j9tscke reset-root #7s9j9tscke + 5. now #70m5luveeu add + 6. now #7s9j9tscke reset-root #7s9j9tscke + 7. now #5nq1cqgki0 add + 8. now #7s9j9tscke reset-root #7s9j9tscke + 9. now #jsuccp4qsq add + 10. now #7s9j9tscke reset-root #7s9j9tscke + 11. now #42cab6b47j add + 12. 1 secs ago #7s9j9tscke builtins.mergeio 13. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between @@ -875,7 +875,7 @@ broken tvar = (cases Some _ -> "oh boy isn't this a very very very very very very very long string?" - None -> "")) + None -> "")) tvarmodify : tvar -> fun -> () tvarmodify tvar fun = () @@ -928,8 +928,8 @@ broken = cases broken : Optional Nat -> () broken = cases Some - loooooooooooooooooooooooooooooooooooooooooooooooooooooooong | loooooooooooooooooooooooooooooooooooooooooooooooooooooooong - == 1 -> + loooooooooooooooooooooooooooooooooooooooooooooooooooooooong| loooooooooooooooooooooooooooooooooooooooooooooooooooooooong + == 1 -> () You can edit them there, then do `update` to replace the @@ -994,9 +994,9 @@ foo = let go x = '(match (a -> a) x with SomethingUnusuallyLong - lijaefliejalfijelfj aefilaeifhlei liaehjffeafijij - | lijaefliejalfijelfj == aefilaeifhlei -> 0 - | lijaefliejalfijelfj == liaehjffeafijij -> 1) + lijaefliejalfijelfj aefilaeifhlei liaehjffeafijij + | lijaefliejalfijelfj == aefilaeifhlei -> 0 + | lijaefliejalfijelfj == liaehjffeafijij -> 1) go (SomethingUnusuallyLong "one" "two" "three") You can edit them there, then do `update` to replace the @@ -1375,7 +1375,7 @@ afun x f = f x roundtripLastLam = afun "foo" (n -> let - 1 + 1 + _ = 1 + 1 3 ) ``` @@ -1402,7 +1402,7 @@ roundtripLastLam = roundtripLastLam : Nat roundtripLastLam = afun "foo" do - 1 + 1 + _ = 1 + 1 3 You can edit them there, then do `update` to replace the @@ -1529,3 +1529,102 @@ foo = cases foo : Nat -> Nat -> Nat ``` +# Multi-line lambda let + +Regression test for #3110 and #3801 + +```unison +foreach x f = + _ = List.map f x + () + +ignore x = () + +test1 : () +test1 = + foreach [1, 2, 3] let x -> let + y = Nat.increment x + () + +test2 = foreach [1, 2, 3] let x -> ignore (Nat.increment x) + +test3 = foreach [1, 2, 3] do x -> do + y = Nat.increment x + () +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + foreach : [a] -> (a ->{e} t) ->{e} () + ignore : x -> () + test1 : () + test2 : () + test3 : () + +.> edit test1 test2 test3 foreach ignore + + ☝️ + + I added these definitions to the top of + /Users/runar/work/unison/scratch.u + + foreach : [a] -> (a ->{e} t) ->{e} () + foreach x f = + _ = List.map f x + () + + ignore : x -> () + ignore x = () + + test1 : () + test1 = + foreach + [1, 2, 3] (x -> let + y = Nat.increment x + ()) + + test2 : () + test2 = foreach [1, 2, 3] (x -> ignore (Nat.increment x)) + + test3 : () + test3 = + foreach + [1, 2, 3] '(x -> do + y = Nat.increment x + ()) + + You can edit them there, then do `update` to replace the + definitions currently in this namespace. + +.> undo + + Here are the changes I undid + + Added definitions: + + 1. foreach : [a] -> (a ->{e} t) ->{e} () + 2. ignore : x -> () + 3. test1 : () + 4. test2 : () + 5. test3 : () + +``` +```ucm +.> load scratch.u + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + foreach : [a] -> (a ->{e} t) ->{e} () + ignore : x -> () + test1 : () + test2 : () + test3 : () + +``` From d045cb05142f6323305b2e7901673753d8868575 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Mon, 27 Feb 2023 23:53:23 -0600 Subject: [PATCH 447/467] [tcp] handle contract --- scheme-libs/racket/unison/tcp.rkt | 1 + unison-src/builtin-tests/tests.u | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scheme-libs/racket/unison/tcp.rkt b/scheme-libs/racket/unison/tcp.rkt index 3e2681e68..7ea827781 100644 --- a/scheme-libs/racket/unison/tcp.rkt +++ b/scheme-libs/racket/unison/tcp.rkt @@ -21,6 +21,7 @@ (define (clientSocket.impl.v3 host port) (with-handlers [[exn:fail:network? (lambda (e) (exception "IOFailure" (exn->string e) '()))] + [exn:fail:contract? (lambda (e) (exception "InvalidArguments" (exn->string e) '()))] [(lambda _ #t) (lambda (e) (exception "MiscFailure" "Unknown exception" e))] ] (let-values ([(input output) (tcp-connect host (string->number port))]) diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index de543ace4..d282d5360 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -14,9 +14,13 @@ tcp.tests = do response = Socket.receive socket Socket.close socket contains "HTTP/1.0 200 OK" (base.Text.fromUtf8 response) - check "times out" do - _ = Socket.client (HostName "example.com") (Port "1000") - false +-- TODO: Enable this when ability handlers are a thing? +-- right now, this is somehow dropping the failure on the floor 🤔 +-- check "rejects invalid port" do +-- handle '(Socket.client (HostName "example.com") (Port "what")) with cases +-- { a } -> false +-- {raise failure -> _} -> true + crypto.hash.tests = do hash alg = hashBytes alg (toUtf8 "") From e3bf626ccde9370dcdf2a0945d2e9f1941478075 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Tue, 28 Feb 2023 06:14:32 -0600 Subject: [PATCH 448/467] [tcp] socket accept --- scheme-libs/common/unison/primops.ss | 6 +++ scheme-libs/racket/unison/tcp.rkt | 77 +++++++++++++++++++++------- unison-src/builtin-tests/tests.u | 11 ++-- 3 files changed, 69 insertions(+), 25 deletions(-) diff --git a/scheme-libs/common/unison/primops.ss b/scheme-libs/common/unison/primops.ss index 6a28414d0..49f725485 100644 --- a/scheme-libs/common/unison/primops.ss +++ b/scheme-libs/common/unison/primops.ss @@ -162,6 +162,10 @@ unison-FOp-IO.closeSocket.impl.v3 unison-FOp-IO.socketReceive.impl.v3 unison-FOp-IO.socketSend.impl.v3 + unison-FOp-IO.socketPort.impl.v3 + unison-FOp-IO.serverSocket.impl.v3 + unison-FOp-IO.socketAccept.impl.v3 + unison-FOp-IO.listen.impl.v3 ) (import (rnrs) @@ -242,6 +246,8 @@ (define (unison-POp-TRCE s x) (display s) (display "\n") + (display x) + (display "\n") (display (describe-value x)) (display "\n")) (define (unison-POp-TTON s) diff --git a/scheme-libs/racket/unison/tcp.rkt b/scheme-libs/racket/unison/tcp.rkt index 7ea827781..823b0a99d 100644 --- a/scheme-libs/racket/unison/tcp.rkt +++ b/scheme-libs/racket/unison/tcp.rkt @@ -1,36 +1,77 @@ ; TLS primitives! Supplied by openssl (libssl) #lang racket/base (require racket/exn + racket/match racket/tcp unison/data) -(provide (prefix-out unison-FOp-IO. (combine-out - clientSocket.impl.v3 - closeSocket.impl.v3 - socketReceive.impl.v3 - socketSend.impl.v3))) +(provide + (prefix-out + unison-FOp-IO. + (combine-out + clientSocket.impl.v3 + closeSocket.impl.v3 + socketReceive.impl.v3 + socketPort.impl.v3 + serverSocket.impl.v3 + listen.impl.v3 + socketAccept.impl.v3 + socketSend.impl.v3))) (define (input socket) (car socket)) (define (output socket) (car (cdr socket))) (define (closeSocket.impl.v3 socket) - (close-input-port (input socket)) - (close-output-port (output socket)) - (right none)) + (close-input-port (input socket)) + (close-output-port (output socket)) + (right none)) (define (clientSocket.impl.v3 host port) - (with-handlers - [[exn:fail:network? (lambda (e) (exception "IOFailure" (exn->string e) '()))] - [exn:fail:contract? (lambda (e) (exception "InvalidArguments" (exn->string e) '()))] - [(lambda _ #t) (lambda (e) (exception "MiscFailure" "Unknown exception" e))] ] + (with-handlers + [[exn:fail:network? (lambda (e) (exception "IOFailure" (exn->string e) '()))] + [exn:fail:contract? (lambda (e) (exception "InvalidArguments" (exn->string e) '()))] + [(lambda _ #t) (lambda (e) (exception "MiscFailure" "Unknown exception" e))] ] - (let-values ([(input output) (tcp-connect host (string->number port))]) - (right (list input output))))) + (let-values ([(input output) (tcp-connect host (string->number port))]) + (right (list input output))))) (define (socketSend.impl.v3 socket data) - (write-bytes data (output socket)) - (flush-output (output socket)) - (right none)) + (write-bytes data (output socket)) + (flush-output (output socket)) + (right none)) (define (socketReceive.impl.v3 socket amt) - (right (read-bytes amt (input socket)))) \ No newline at end of file + (let ([buffer (make-bytes amt)]) + (read-bytes-avail! buffer (input socket)) + (right buffer)) + ) + +(define (socketPort.impl.v3 socket) + (let-values ([(_ local-port __ ___) (tcp-addresses (input socket) #t)]) + (right local-port))) + +(define serverSocket.impl.v3 + (lambda args + (let-values ([(hostname port) + (match args + [(list _ port) (values #f port)] + [(list _ hostname port) (values hostname port)])]) + + (with-handlers + [[exn:fail:network? (lambda (e) (exception "IOFailure" (exn->string e) '()))] + [exn:fail:contract? (lambda (e) (exception "InvalidArguments" (exn->string e) '()))] + [(lambda _ #t) (lambda (e) (exception "MiscFailure" "Unknown exception" e))] ] + (display "hostname ") + (display hostname) + (display "\n") + (let ([listener (tcp-listen (string->number port) 4 #f (if (equal? 0 hostname) #f hostname))]) + (right listener)))))) + +; NOTE: This is a no-op, because racket's public TCP stack doesn't have separate operations for +; "bind" vs "listen". Because of this, `serverSocket` binds and listens at the same time. +(define (listen.impl.v3 _listener) + (right none)) + +(define (socketAccept.impl.v3 listener) + (let-values ([(input output) (tcp-accept listener)]) + (right (list input output)))) diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index d282d5360..e68c9b8e3 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -14,13 +14,10 @@ tcp.tests = do response = Socket.receive socket Socket.close socket contains "HTTP/1.0 200 OK" (base.Text.fromUtf8 response) --- TODO: Enable this when ability handlers are a thing? --- right now, this is somehow dropping the failure on the floor 🤔 --- check "rejects invalid port" do --- handle '(Socket.client (HostName "example.com") (Port "what")) with cases --- { a } -> false --- {raise failure -> _} -> true - + check "rejects invalid port" do + handle (Socket.client (HostName "example.com") (Port "what")) with cases + { a } -> false + {raise failure -> _} -> true crypto.hash.tests = do hash alg = hashBytes alg (toUtf8 "") From b8a2c357274017a502461feefbd76bae21990735 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 1 Mar 2023 21:28:15 -0600 Subject: [PATCH 449/467] [tcp] add a nice test that passes on interpreter --- unison-src/builtin-tests/jit-tests.output.md | 2 ++ unison-src/builtin-tests/tests.u | 28 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index 016ea7e65..f4277ee45 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -8,4 +8,6 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native tests + Scheme evaluation failed. + ``` diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index e68c9b8e3..d3b0b30f2 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -19,6 +19,34 @@ tcp.tests = do { a } -> false {raise failure -> _} -> true + setup = catchAll do + socket = Socket.listen (server None (Port "0")) + port = match socket with + ListeningServerSocket sock -> Socket.port sock + (socket, port) + + match setup with + (Left exn) -> Tests.fail "Unable to bind and listen on a socket" "" + (Right (socket, port)) -> + serve = do + sock = Socket.accept socket + data = Socket.receive sock + Socket.send sock (toUtf8 "from server") + base.Text.fromUtf8 data + + serveResult = Promise.new () + _ = fork do Promise.write serveResult (catchAll serve) + + data = catchAll do + clientSocket = Socket.client (HostName "localhost") (Port (Nat.toText port)) + Socket.send clientSocket (toUtf8 "from client") + base.Text.fromUtf8 (Socket.receive clientSocket) + + checkEqual "Server received data" (Promise.read serveResult) (Right "from client") + checkEqual "Client received data" data (Right "from server") + + + crypto.hash.tests = do hash alg = hashBytes alg (toUtf8 "") tag name = name ++ " hashBytes" From 38344ff767d7479755212395438b67275988a2e7 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 1 Mar 2023 21:32:33 -0600 Subject: [PATCH 450/467] [tcp] ok passing on jit! --- scheme-libs/racket/unison/tcp.rkt | 2 +- unison-src/builtin-tests/tests.u | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scheme-libs/racket/unison/tcp.rkt b/scheme-libs/racket/unison/tcp.rkt index 823b0a99d..6e407b5c1 100644 --- a/scheme-libs/racket/unison/tcp.rkt +++ b/scheme-libs/racket/unison/tcp.rkt @@ -47,7 +47,7 @@ ) (define (socketPort.impl.v3 socket) - (let-values ([(_ local-port __ ___) (tcp-addresses (input socket) #t)]) + (let-values ([(_ local-port __ ___) (tcp-addresses (if (pair? socket) (input socket) socket) #t)]) (right local-port))) (define serverSocket.impl.v3 diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index d3b0b30f2..10c86a7a8 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -26,7 +26,9 @@ tcp.tests = do (socket, port) match setup with - (Left exn) -> Tests.fail "Unable to bind and listen on a socket" "" + (Left exn) -> + Debug.trace "Setup failed" exn + Tests.fail "Unable to bind and listen on a socket" "" (Right (socket, port)) -> serve = do sock = Socket.accept socket From 05f31d47f43dd2472fd1ee796ed137c8cb4312fc Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 1 Mar 2023 21:45:19 -0600 Subject: [PATCH 451/467] [tcp] more checks --- scheme-libs/racket/unison/tcp.rkt | 3 --- unison-src/builtin-tests/jit-tests.output.md | 2 -- unison-src/builtin-tests/tests.u | 21 +++++++++++--------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/scheme-libs/racket/unison/tcp.rkt b/scheme-libs/racket/unison/tcp.rkt index 6e407b5c1..9a4a56eda 100644 --- a/scheme-libs/racket/unison/tcp.rkt +++ b/scheme-libs/racket/unison/tcp.rkt @@ -61,9 +61,6 @@ [[exn:fail:network? (lambda (e) (exception "IOFailure" (exn->string e) '()))] [exn:fail:contract? (lambda (e) (exception "InvalidArguments" (exn->string e) '()))] [(lambda _ #t) (lambda (e) (exception "MiscFailure" "Unknown exception" e))] ] - (display "hostname ") - (display hostname) - (display "\n") (let ([listener (tcp-listen (string->number port) 4 #f (if (equal? 0 hostname) #f hostname))]) (right listener)))))) diff --git a/unison-src/builtin-tests/jit-tests.output.md b/unison-src/builtin-tests/jit-tests.output.md index f4277ee45..016ea7e65 100644 --- a/unison-src/builtin-tests/jit-tests.output.md +++ b/unison-src/builtin-tests/jit-tests.output.md @@ -8,6 +8,4 @@ to `Tests.check` and `Tests.checkEqual`). ```ucm .> run.native tests - Scheme evaluation failed. - ``` diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 10c86a7a8..644932daa 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -14,10 +14,15 @@ tcp.tests = do response = Socket.receive socket Socket.close socket contains "HTTP/1.0 200 OK" (base.Text.fromUtf8 response) - check "rejects invalid port" do - handle (Socket.client (HostName "example.com") (Port "what")) with cases - { a } -> false - {raise failure -> _} -> true + check "rejects invalid port" do isLeft <| catchAll do Socket.client (HostName "example.com") (Port "what") + check "no send after close" do isLeft <| catchAll do + socket = Socket.client (HostName "example.com") (Port "80") + Socket.close socket + Socket.send socket (toUtf8 "GET /index.html HTTP/1.0\r\n\r\n") + check "no send on listener" do isLeft <| catchAll do + match Socket.server None (Port "0") with + BoundServerSocket socket -> Socket.send socket (toUtf8 "what") + setup = catchAll do socket = Socket.listen (server None (Port "0")) @@ -26,17 +31,17 @@ tcp.tests = do (socket, port) match setup with - (Left exn) -> + Left exn -> Debug.trace "Setup failed" exn Tests.fail "Unable to bind and listen on a socket" "" - (Right (socket, port)) -> + Right (socket, port) -> serve = do sock = Socket.accept socket data = Socket.receive sock Socket.send sock (toUtf8 "from server") base.Text.fromUtf8 data - serveResult = Promise.new () + serveResult = !Promise.new _ = fork do Promise.write serveResult (catchAll serve) data = catchAll do @@ -47,8 +52,6 @@ tcp.tests = do checkEqual "Server received data" (Promise.read serveResult) (Right "from client") checkEqual "Client received data" data (Right "from server") - - crypto.hash.tests = do hash alg = hashBytes alg (toUtf8 "") tag name = name ++ " hashBytes" From 880787cf07e11bf22afe0d5ffe50b05c51ee94ef Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 1 Mar 2023 21:47:26 -0600 Subject: [PATCH 452/467] [tcp] helper --- unison-src/builtin-tests/tests.u | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/unison-src/builtin-tests/tests.u b/unison-src/builtin-tests/tests.u index 644932daa..9a2c5a493 100644 --- a/unison-src/builtin-tests/tests.u +++ b/unison-src/builtin-tests/tests.u @@ -1,11 +1,13 @@ +shouldFail fn = isLeft <| catchAll fn + tests : '{IO,Exception} () tests = Tests.main do !crypto.hash.tests !hmac.tests !concurrency.tests !tcp.tests - check "bug is caught" do isLeft (catchAll do bug ()) + check "bug is caught" do shouldFail do bug () tcp.tests = do check "connects to example.com" do @@ -14,12 +16,12 @@ tcp.tests = do response = Socket.receive socket Socket.close socket contains "HTTP/1.0 200 OK" (base.Text.fromUtf8 response) - check "rejects invalid port" do isLeft <| catchAll do Socket.client (HostName "example.com") (Port "what") - check "no send after close" do isLeft <| catchAll do + check "rejects invalid port" do shouldFail do Socket.client (HostName "example.com") (Port "what") + check "no send after close" do shouldFail do socket = Socket.client (HostName "example.com") (Port "80") Socket.close socket Socket.send socket (toUtf8 "GET /index.html HTTP/1.0\r\n\r\n") - check "no send on listener" do isLeft <| catchAll do + check "no send on listener" do shouldFail do match Socket.server None (Port "0") with BoundServerSocket socket -> Socket.send socket (toUtf8 "what") From abde5b9f0b74af5da6a8f5f53ed3d2a1d8b6771a Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Wed, 1 Mar 2023 21:59:01 -0600 Subject: [PATCH 453/467] [tcp] docs, more defensiveness around arguments --- scheme-libs/racket/unison/tcp.rkt | 43 +++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/scheme-libs/racket/unison/tcp.rkt b/scheme-libs/racket/unison/tcp.rkt index 9a4a56eda..776033459 100644 --- a/scheme-libs/racket/unison/tcp.rkt +++ b/scheme-libs/racket/unison/tcp.rkt @@ -22,8 +22,11 @@ (define (output socket) (car (cdr socket))) (define (closeSocket.impl.v3 socket) - (close-input-port (input socket)) - (close-output-port (output socket)) + (if (pair? socket) + (begin + (close-input-port (input socket)) + (close-output-port (output socket))) + (tcp-close socket)) (right none)) (define (clientSocket.impl.v3 host port) @@ -36,16 +39,23 @@ (right (list input output))))) (define (socketSend.impl.v3 socket data) - (write-bytes data (output socket)) - (flush-output (output socket)) - (right none)) + (if (not (pair? socket)) + (exception "InvalidArguments" "Cannot send on a server socket") + (begin + (write-bytes data (output socket)) + (flush-output (output socket)) + (right none)))) (define (socketReceive.impl.v3 socket amt) - (let ([buffer (make-bytes amt)]) - (read-bytes-avail! buffer (input socket)) - (right buffer)) - ) + (if (not (pair? socket)) + (exception "InvalidArguments" "Cannot receive on a server socket") + (begin + (let ([buffer (make-bytes amt)]) + (read-bytes-avail! buffer (input socket)) + (right buffer))))) +; A "connected" socket is represented as a list of (list input-port output-port), +; while a "listening" socket is just the tcp-listener itself. (define (socketPort.impl.v3 socket) (let-values ([(_ local-port __ ___) (tcp-addresses (if (pair? socket) (input socket) socket) #t)]) (right local-port))) @@ -64,11 +74,18 @@ (let ([listener (tcp-listen (string->number port) 4 #f (if (equal? 0 hostname) #f hostname))]) (right listener)))))) -; NOTE: This is a no-op, because racket's public TCP stack doesn't have separate operations for -; "bind" vs "listen". Because of this, `serverSocket` binds and listens at the same time. +; NOTE: This is a no-op because racket's public TCP stack doesn't have separate operations for +; "bind" vs "listen". We've decided to have `serverSocket` do the "bind & listen", and have +; this do nothing. +; If we want ~a little better parity with the haskell implementation, we might set a flag or +; something on the listener, and error if you try to `accept` on a server socket that you haven't +; called `listen` on yet. (define (listen.impl.v3 _listener) (right none)) (define (socketAccept.impl.v3 listener) - (let-values ([(input output) (tcp-accept listener)]) - (right (list input output)))) + (if (pair? listener) + (exception "InvalidArguments" "Cannot accept on a non-server socket") + (begin + (let-values ([(input output) (tcp-accept listener)]) + (right (list input output)))))) From 2bc28073d3eeb6ed8fc9acdcddba39a49ebe4714 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 8 Mar 2023 12:24:21 -0500 Subject: [PATCH 454/467] add basic uninhabited check --- .../transcripts/pattern-match-coverage.md | 8 ++++++++ .../pattern-match-coverage.output.md | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/unison-src/transcripts/pattern-match-coverage.md b/unison-src/transcripts/pattern-match-coverage.md index 85eab251c..ae66c5bb0 100644 --- a/unison-src/transcripts/pattern-match-coverage.md +++ b/unison-src/transcripts/pattern-match-coverage.md @@ -63,6 +63,14 @@ uninhabited patterns are reported as redundant ```unison:error unique type V = +test0 : V -> () +test0 = cases + _ -> () +``` + +```unison:error +unique type V = + test : Optional (Optional V) -> () test = cases None -> () diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index 400a4382d..934c269ab 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -112,6 +112,26 @@ uninhabited patterns are reported as redundant ```unison unique type V = +test0 : V -> () +test0 = cases + _ -> () +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type V + test0 : V -> () + +``` +```unison +unique type V = + test : Optional (Optional V) -> () test = cases None -> () From 491366ece0ba8bad3196c73c21bee254af8bc40d Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 8 Mar 2023 12:25:09 -0500 Subject: [PATCH 455/467] bugfix: ensure unconstrained sets are inhabited --- .../src/Unison/PatternMatchCoverage.hs | 2 +- .../src/Unison/PatternMatchCoverage/Solve.hs | 14 +++++++++++++- .../transcripts/pattern-match-coverage.output.md | 9 ++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage.hs b/parser-typechecker/src/Unison/PatternMatchCoverage.hs index 05a1531fe..037e2937c 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage.hs @@ -64,7 +64,7 @@ checkMatch :: checkMatch matchLocation scrutineeType cases = do v0 <- fresh grdtree0 <- desugarMatch matchLocation scrutineeType v0 cases - (uncovered, grdtree1) <- uncoverAnnotate (Set.singleton (NC.declVar v0 scrutineeType id NC.emptyNormalizedConstraints)) grdtree0 + (uncovered, grdtree1) <- uncoverAnnotate (Set.singleton (NC.markDirty v0 $ NC.declVar v0 scrutineeType id NC.emptyNormalizedConstraints)) grdtree0 uncoveredExpanded <- concat . fmap Set.toList <$> traverse (expandSolution v0) (Set.toList uncovered) let sols = map (generateInhabitants v0) uncoveredExpanded let (_accessible, inaccessible, redundant) = classify grdtree1 diff --git a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs index 72146fed0..d1917d1eb 100644 --- a/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs +++ b/parser-typechecker/src/Unison/PatternMatchCoverage/Solve.hs @@ -68,7 +68,9 @@ uncoverAnnotate z grdtree0 = cata phi grdtree0 z phi = \case -- There is no way to fail matching a leaf, return the empty set -- to represent false. - LeafF l -> \nc -> pure (Set.empty, Leaf (nc, l)) + LeafF l -> \nc -> do + nc' <- ensureInhabited' nc + pure (Set.empty, Leaf (nc', l)) ForkF (kinit :| ks) -> \nc0 -> do -- depth-first fold in match-case order to acculate the -- constraints for a match failure at every case. @@ -118,6 +120,16 @@ uncoverAnnotate z grdtree0 = cata phi grdtree0 z False -> ncFinalCandidate pure (ncFinal, t) + ensureInhabited' :: + Set (NormalizedConstraints vt v loc) -> + m (Set (NormalizedConstraints vt v loc)) + ensureInhabited' ncs0 = foldlM phi Set.empty ncs0 + where + phi ncs nc = + ensureInhabited initFuel nc <&> \case + Nothing -> ncs + Just nc -> Set.insert nc ncs + -- Add a literal to each term in our DNF, dropping terms that -- become contradictory addLiteral' :: diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index 934c269ab..8161710d2 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -119,14 +119,9 @@ test0 = cases ```ucm - I found and typechecked these definitions in scratch.u. If you - do an `add` or `update`, here's how your codebase would - change: - - ⍟ These new definitions are ok to `add`: + This case would be ignored because it's already covered by the preceding case(s): + 5 | _ -> () - unique type V - test0 : V -> () ``` ```unison From cc8eeff414becb4b99f7b620cf428d67e55954ae Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 8 Mar 2023 10:53:46 -0500 Subject: [PATCH 456/467] add data decl test --- .../transcripts/pattern-match-coverage.md | 44 +++++++++++++ .../pattern-match-coverage.output.md | 63 +++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/unison-src/transcripts/pattern-match-coverage.md b/unison-src/transcripts/pattern-match-coverage.md index ae66c5bb0..a07253c85 100644 --- a/unison-src/transcripts/pattern-match-coverage.md +++ b/unison-src/transcripts/pattern-match-coverage.md @@ -280,3 +280,47 @@ test = cases _ ++ [true, false, true, false] -> () _ -> () ``` + +# bugfix: Sufficient data decl map + +```unison +unique type T = A + +unit2t : Unit -> T +unit2t = cases + () -> A +``` + +```ucm +.> add +``` + +Pattern coverage checking needs the data decl map to contain all +transitive type dependencies of the scrutinee type. We do this +before typechecking begins in a roundabout way: fetching all +transitive type dependencies of references that appear in the expression. + +This test ensures that we have fetched the `T` type although there is +no data decl reference to `T` in `witht`. +```unison +witht : Unit +witht = match unit2t () with + x -> () +``` + +```unison +unique type V = + +evil : Unit -> V +evil = bug "" +``` + +```ucm +.> add +``` + +```unison:error +withV : Unit +withV = match evil () with + x -> () +``` diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index 8161710d2..e1991409f 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -569,3 +569,66 @@ test = cases ``` +# bugfix: Sufficient data decl map + +```unison +unique type T = A + +unit2t : Unit -> T +unit2t = cases + () -> A +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type T + unit2t : 'T + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + unique type T + unit2t : 'T + +``` +Pattern coverage checking needs the data decl map to contain all +transitive type dependencies of the scrutinee type. We do this +before typechecking begins in a roundabout way: fetching all +transitive type dependencies of references that appear in the expression. + +This test ensures that we have fetched the `T` type although there is +no data decl reference to `T` in `witht`. +```unison +witht : Unit +witht = match unit2t () with + x -> () +``` + +```ucm + + UnknownDecl: + data type + reference = T + +``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + UnknownDecl: + data type + reference = T + From 0c9949b525250d825b1bb5e4477759278cb13cbe Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 8 Mar 2023 10:44:03 -0500 Subject: [PATCH 457/467] Gather all type dependencies for pattern coverage checking --- parser-typechecker/src/Unison/Codebase.hs | 42 +++++++++------- .../pattern-match-coverage.output.md | 49 ++++++++++++++++--- 2 files changed, 64 insertions(+), 27 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase.hs b/parser-typechecker/src/Unison/Codebase.hs index f93099367..8bf383e36 100644 --- a/parser-typechecker/src/Unison/Codebase.hs +++ b/parser-typechecker/src/Unison/Codebase.hs @@ -161,6 +161,7 @@ import Unison.Symbol (Symbol) import Unison.Term (Term) import qualified Unison.Term as Term import Unison.Type (Type) +import qualified Unison.Type as Type import Unison.Typechecker.TypeLookup (TypeLookup (TypeLookup)) import qualified Unison.Typechecker.TypeLookup as TL import qualified Unison.UnisonFile as UF @@ -345,35 +346,38 @@ typeLookupForDependencies :: Sqlite.Transaction (TL.TypeLookup Symbol a) typeLookupForDependencies codebase s = do when debug $ traceM $ "typeLookupForDependencies " ++ show s - foldM go mempty s + depthFirstAccum mempty s where + depthFirstAccum :: TL.TypeLookup Symbol a -> Set Reference -> Sqlite.Transaction (TL.TypeLookup Symbol a) + depthFirstAccum tl refs = foldM go tl (Set.filter (unseen tl) refs) + + -- We need the transitive dependencies of data decls + -- that are scrutinized in a match expression for + -- pattern match coverage checking (specifically for + -- the inhabitation check). We ensure these are found + -- by collecting all transitive type dependencies. go tl ref@(Reference.DerivedId id) = getTypeOfTerm codebase ref >>= \case - Just typ -> pure $ tl <> TypeLookup (Map.singleton ref typ) mempty mempty + Just typ -> + let z = tl <> TypeLookup (Map.singleton ref typ) mempty mempty + in depthFirstAccum z (Type.dependencies typ) Nothing -> getTypeDeclaration codebase id >>= \case Just (Left ed) -> - pure $ tl <> TypeLookup mempty mempty (Map.singleton ref ed) - Just (Right dd) -> do - -- We need the transitive dependencies of data decls - -- that are scrutinized in a match expression for - -- pattern match coverage checking (specifically for - -- the inhabitation check). We ensure these are found - -- by collecting all type dependencies for all data - -- decls. - - -- All references from constructorTypes that we - -- have not already gathered. - let constructorRefs :: Set Reference - constructorRefs = Set.filter (unseen tl) (DD.dependencies dd) - - -- recursively call go for each constructor ref + let z = tl <> TypeLookup mempty mempty (Map.singleton ref ed) + in depthFirstAccum z (DD.dependencies $ DD.toDataDecl ed) + Just (Right dd) -> let z = tl <> TypeLookup mempty (Map.singleton ref dd) mempty - foldM go z constructorRefs + in depthFirstAccum z (DD.dependencies dd) Nothing -> pure tl go tl Reference.Builtin {} = pure tl -- codebase isn't consulted for builtins unseen :: TL.TypeLookup Symbol a -> Reference -> Bool - unseen tl r = isNothing (Map.lookup r (TL.dataDecls tl)) + unseen tl r = + isNothing + ( Map.lookup r (TL.dataDecls tl) $> () + <|> Map.lookup r (TL.typeOfTerms tl) $> () + <|> Map.lookup r (TL.effectDecls tl) $> () + ) toCodeLookup :: (MonadIO m) => Codebase m Symbol Parser.Ann -> CL.CodeLookup Symbol m Parser.Ann toCodeLookup c = diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index e1991409f..de86cbd44 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -615,20 +615,53 @@ witht = match unit2t () with ```ucm - UnknownDecl: - data type - reference = T + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + witht : () ``` +```unison +unique type V = +evil : Unit -> V +evil = bug "" +``` +```ucm -🛑 + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type V + evil : 'V -The transcript failed due to an error in the stanza above. The error is: +``` +```ucm +.> add + ⍟ I've added these definitions: + + unique type V + evil : 'V - UnknownDecl: - data type - reference = T +``` +```unison +withV : Unit +withV = match evil () with + x -> () +``` +```ucm + + This case would be ignored because it's already covered by the preceding case(s): + 3 | x -> () + + +``` From a7aecd32c38c8fc98955bed010dfe602c994430a Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Thu, 9 Mar 2023 13:30:13 -0600 Subject: [PATCH 458/467] Fix missing column in primary key for name lookup indexes (#3850) * Add migration to fix bad primary key in scoped_type_lookup * Drop indexes before creating new ones. * Remove "on conflict do nothing" when building name lookups * Change Migration 8 to 9 to be a pure sql migration --- .../U/Codebase/Sqlite/Queries.hs | 10 +- .../sql/004-fix-scoped-name-lookup-tables.sql | 120 ++++++++++++++++++ .../unison-codebase-sqlite.cabal | 3 +- .../Codebase/SqliteCodebase/Migrations.hs | 4 +- .../Migrations/MigrateSchema8To9.hs | 11 ++ .../unison-parser-typechecker.cabal | 1 + 6 files changed, 144 insertions(+), 5 deletions(-) create mode 100644 codebase2/codebase-sqlite/sql/004-fix-scoped-name-lookup-tables.sql create mode 100644 parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema8To9.hs diff --git a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs index 40931a779..f2007f42b 100644 --- a/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs +++ b/codebase2/codebase-sqlite/U/Codebase/Sqlite/Queries.hs @@ -116,6 +116,7 @@ module U.Codebase.Sqlite.Queries countWatches, getCausalsWithoutBranchObjects, removeHashObjectsByHashingVersion, + fixScopedNameLookupTables, -- ** type index addToTypeIndex, @@ -287,7 +288,7 @@ import qualified Unison.Util.Lens as Lens -- * main squeeze currentSchemaVersion :: SchemaVersion -currentSchemaVersion = 8 +currentSchemaVersion = 9 createSchema :: Transaction () createSchema = do @@ -296,6 +297,7 @@ createSchema = do addTempEntityTables addNamespaceStatsTables addReflogTable + fixScopedNameLookupTables where insertSchemaVersionSql = [here| @@ -314,6 +316,10 @@ addReflogTable :: Transaction () addReflogTable = executeFile [hereFile|unison/sql/002-reflog-table.sql|] +fixScopedNameLookupTables :: Transaction () +fixScopedNameLookupTables = + executeFile [hereFile|unison/sql/004-fix-scoped-name-lookup-tables.sql|] + executeFile :: String -> Transaction () executeFile = traverse_ (execute_ . fromString) . filter (not . null) . List.splitOn ";" @@ -1657,7 +1663,6 @@ insertScopedTermNames bhId names = do [here| INSERT INTO scoped_term_name_lookup (root_branch_hash_id, reversed_name, namespace, last_name_segment, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) - ON CONFLICT DO NOTHING |] -- | Insert the given set of type names into the name lookup table @@ -1669,7 +1674,6 @@ insertScopedTypeNames bhId names = [here| INSERT INTO scoped_type_name_lookup (root_branch_hash_id, reversed_name, namespace, last_name_segment, reference_builtin, reference_component_hash, reference_component_index) VALUES (?, ?, ?, ?, ?, ?, ?) - ON CONFLICT DO NOTHING |] -- | Remove the given set of term names into the name lookup table diff --git a/codebase2/codebase-sqlite/sql/004-fix-scoped-name-lookup-tables.sql b/codebase2/codebase-sqlite/sql/004-fix-scoped-name-lookup-tables.sql new file mode 100644 index 000000000..aeb4d6999 --- /dev/null +++ b/codebase2/codebase-sqlite/sql/004-fix-scoped-name-lookup-tables.sql @@ -0,0 +1,120 @@ +ALTER TABLE scoped_term_name_lookup +RENAME TO scoped_term_name_lookup_old; + +ALTER TABLE scoped_type_name_lookup +RENAME TO scoped_type_name_lookup_old; + +-- Drop all existing indexes because we'll re-create them on the new table. +DROP INDEX scoped_term_names_by_namespace_and_last_name_segment; +DROP INDEX scoped_term_name_by_referent_lookup; +DROP INDEX scoped_term_names_by_namespace; +DROP INDEX scoped_type_names_by_namespace_and_last_name_segment; +DROP INDEX scoped_type_name_by_reference_lookup; +DROP INDEX scoped_type_names_by_namespace; + +-- Create the new tables. +CREATE TABLE scoped_term_name_lookup ( + root_branch_hash_id INTEGER NOT NULL REFERENCES name_lookups(root_branch_hash_id) ON DELETE CASCADE, + + -- The name of the term in reversed form, with a trailing '.': + -- E.g. map.List.base. + -- + -- The trailing '.' is helpful when performing suffix queries where we may not know + -- whether the suffix is complete or not, e.g. we could suffix search using any of the + -- following globs and it would still find 'map.List.base.': + -- map.List.base.* + -- map.List.* + -- map.* + reversed_name TEXT NOT NULL, + + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' + last_name_segment TEXT NOT NULL, + + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' + namespace TEXT NOT NULL, + referent_builtin TEXT NULL, + referent_component_hash TEXT NULL, + referent_component_index INTEGER NULL, + referent_constructor_index INTEGER NULL, + referent_constructor_type INTEGER NULL, + PRIMARY KEY (root_branch_hash_id, reversed_name, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index) +); + + +-- This index allows finding all names we need to consider within a given namespace for +-- suffixification of a name. +-- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here +-- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search +-- over both namespace and reversed_name, but we can EXACT match on last_name_segment and +-- then glob search on the namespace prefix, and have SQLite do the final glob search on +-- reversed_name over rows with a matching last segment without using an index and should be plenty fast. +CREATE INDEX scoped_term_names_by_namespace_and_last_name_segment ON scoped_term_name_lookup(root_branch_hash_id, last_name_segment, namespace); + + -- This index allows us to find all names with a given ref within a specific namespace +CREATE INDEX scoped_term_name_by_referent_lookup ON scoped_term_name_lookup(root_branch_hash_id, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, namespace); + +-- Allows fetching ALL names within a specific namespace prefix. We currently use this to +-- pretty-print on share, but will be replaced with a more precise set of queries soon. +CREATE INDEX scoped_term_names_by_namespace ON scoped_term_name_lookup(root_branch_hash_id, namespace); + + +CREATE TABLE scoped_type_name_lookup ( + root_branch_hash_id INTEGER NOT NULL REFERENCES name_lookups(root_branch_hash_id) ON DELETE CASCADE, + + -- The name of the term: E.g. List.base + reversed_name TEXT NOT NULL, + + -- The last name segment of the name. This is used when looking up names for + -- suffixification when building PPEs. + -- E.g. for the name 'base.List.map' this would be 'map' + last_name_segment TEXT NOT NULL, + -- The namespace containing this definition, not reversed, with a trailing '.' + -- The trailing '.' simplifies GLOB queries, so that 'base.*' matches both things in + -- 'base' and 'base.List', but not 'base1', which allows us to avoid an OR in our where + -- clauses which in turn helps the sqlite query planner use indexes more effectively. + -- + -- example value: 'base.List.' + namespace TEXT NOT NULL, + reference_builtin TEXT NULL, + reference_component_hash INTEGER NULL, + reference_component_index INTEGER NULL, + PRIMARY KEY (root_branch_hash_id, reversed_name, reference_builtin, reference_component_hash, reference_component_index) +); + +-- This index allows finding all names we need to consider within a given namespace for +-- suffixification of a name. +-- It may seem strange to use last_name_segment rather than a suffix search over reversed_name name here +-- but SQLite will only optimize for a single prefix-glob at once, so we can't glob search +-- over both namespace and reversed_name, but we can EXACT match on last_name_segment and +-- then glob search on the namespace prefix, and have SQLite do the final glob search on +-- reversed_name over rows with a matching last segment without using an index and should be plenty fast. +CREATE INDEX scoped_type_names_by_namespace_and_last_name_segment ON scoped_type_name_lookup(root_branch_hash_id, last_name_segment, namespace); + +-- This index allows us to find all names with a given ref within a specific namespace. +CREATE INDEX scoped_type_name_by_reference_lookup ON scoped_type_name_lookup(root_branch_hash_id, reference_builtin, reference_component_hash, reference_component_index, namespace); + +-- Allows fetching ALL names within a specific namespace prefix. We currently use this to +-- pretty-print on share, but will be replaced with a more precise set of queries soon. +CREATE INDEX scoped_type_names_by_namespace ON scoped_type_name_lookup(root_branch_hash_id, namespace); + +-- Copy the old tables over to the new ones +INSERT INTO scoped_term_name_lookup (root_branch_hash_id, reversed_name, last_name_segment, namespace, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type) + SELECT root_branch_hash_id, reversed_name, last_name_segment, namespace, referent_builtin, referent_component_hash, referent_component_index, referent_constructor_index, referent_constructor_type + FROM scoped_term_name_lookup_old; + +INSERT INTO scoped_type_name_lookup (root_branch_hash_id, reversed_name, last_name_segment, namespace, reference_builtin, reference_component_hash, reference_component_index) + SELECT root_branch_hash_id, reversed_name, last_name_segment, namespace, reference_builtin, reference_component_hash, reference_component_index + FROM scoped_type_name_lookup_old; + +-- Remove the old tables +DROP TABLE scoped_term_name_lookup_old; +DROP TABLE scoped_type_name_lookup_old + +-- Semicolons intentionally omitted diff --git a/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal b/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal index 20da93a9b..26412e728 100644 --- a/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal +++ b/codebase2/codebase-sqlite/unison-codebase-sqlite.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack @@ -13,6 +13,7 @@ extra-source-files: sql/001-temp-entity-tables.sql sql/002-reflog-table.sql sql/003-namespace-statistics.sql + sql/004-fix-scoped-name-lookup-tables.sql sql/create.sql source-repository head diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs index a03fb6cbb..d56c78637 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations.hs @@ -27,6 +27,7 @@ import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema4To5 (migrateSchem import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema5To6 (migrateSchema5To6) import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema6To7 (migrateSchema6To7) import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema7To8 (migrateSchema7To8) +import Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema8To9 (migrateSchema8To9) import qualified Unison.Codebase.SqliteCodebase.Operations as Ops2 import Unison.Codebase.SqliteCodebase.Paths (backupCodebasePath) import Unison.Codebase.Type (LocalOrRemote (..)) @@ -57,7 +58,8 @@ migrations getDeclType termBuffer declBuffer rootCodebasePath = (5, migrateSchema4To5), (6, migrateSchema5To6 rootCodebasePath), (7, migrateSchema6To7), - (8, migrateSchema7To8) + (8, migrateSchema7To8), + (9, migrateSchema8To9) ] data CodebaseVersionStatus diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema8To9.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema8To9.hs new file mode 100644 index 000000000..b2b74f1bc --- /dev/null +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Migrations/MigrateSchema8To9.hs @@ -0,0 +1,11 @@ +module Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema8To9 (migrateSchema8To9) where + +import qualified U.Codebase.Sqlite.Queries as Q +import qualified Unison.Sqlite as Sqlite + +-- | Recreates the name lookup tables because the primary key was missing the root hash id. +migrateSchema8To9 :: Sqlite.Transaction () +migrateSchema8To9 = do + Q.expectSchemaVersion 8 + Q.fixScopedNameLookupTables + Q.setSchemaVersion 9 diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index 5e6b8305b..94c6ee73f 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -83,6 +83,7 @@ library Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema5To6 Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema6To7 Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema7To8 + Unison.Codebase.SqliteCodebase.Migrations.MigrateSchema8To9 Unison.Codebase.SqliteCodebase.Operations Unison.Codebase.SqliteCodebase.Paths Unison.Codebase.SqliteCodebase.SyncEphemeral From 9b4b580628cf287d8cbe69b246c6384fd751387a Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 13 Mar 2023 14:11:39 -0400 Subject: [PATCH 459/467] add failing test demonstrating #3861 --- .../transcripts/pattern-match-coverage.md | 19 +++++++ .../pattern-match-coverage.output.md | 49 +++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/unison-src/transcripts/pattern-match-coverage.md b/unison-src/transcripts/pattern-match-coverage.md index a07253c85..88d3fe822 100644 --- a/unison-src/transcripts/pattern-match-coverage.md +++ b/unison-src/transcripts/pattern-match-coverage.md @@ -324,3 +324,22 @@ withV : Unit withV = match evil () with x -> () ``` + +```unison +unique type SomeType = A +``` + +```ucm +.> add +``` + +```unison +unique type R = R SomeType + +get x = match x with + R y -> y +``` + +```unison +unique type R = { someType : SomeType } +``` diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index de86cbd44..6251638f0 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -665,3 +665,52 @@ withV = match evil () with ``` +```unison +unique type SomeType = A +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type SomeType + +``` +```ucm +.> add + + ⍟ I've added these definitions: + + unique type SomeType + +``` +```unison +unique type R = R SomeType + +get x = match x with + R y -> y +``` + +```ucm + + UnknownDecl: + data type + reference = SomeType + +``` + + + +🛑 + +The transcript failed due to an error in the stanza above. The error is: + + + UnknownDecl: + data type + reference = SomeType + From b9b4dd88d08a5b50490acdd8a30b3b9be6045990 Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Mon, 13 Mar 2023 14:17:04 -0400 Subject: [PATCH 460/467] Fix #3861 --- parser-typechecker/src/Unison/FileParsers.hs | 5 +-- .../pattern-match-coverage.output.md | 35 ++++++++++++------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/parser-typechecker/src/Unison/FileParsers.hs b/parser-typechecker/src/Unison/FileParsers.hs index 678141e27..cb432e730 100644 --- a/parser-typechecker/src/Unison/FileParsers.hs +++ b/parser-typechecker/src/Unison/FileParsers.hs @@ -96,7 +96,6 @@ resolveNames :: (Term v, TDNRMap v, TL.TypeLookup v Ann) resolveNames typeLookupf preexistingNames uf = do let tm = UF.typecheckingTerm uf - deps = Term.dependencies tm possibleDeps = [ (Name.toText name, Var.name v, r) | (name, r) <- Rel.toList (Names.terms preexistingNames), @@ -104,9 +103,7 @@ resolveNames typeLookupf preexistingNames uf = do name `Name.endsWithReverseSegments` List.NonEmpty.toList (Name.reverseSegments (Name.unsafeFromVar v)) ] possibleRefs = Referent.toReference . view _3 <$> possibleDeps - tl <- - lift . lift . fmap (UF.declsToTypeLookup uf <>) $ - typeLookupf (deps <> Set.fromList possibleRefs) + tl <- lift . lift $ fmap (UF.declsToTypeLookup uf <>) (typeLookupf (UF.dependencies uf <> Set.fromList possibleRefs)) -- For populating the TDNR environment, we pick definitions -- from the namespace and from the local file whose full name -- has a suffix that equals one of the free variables in the file. diff --git a/unison-src/transcripts/pattern-match-coverage.output.md b/unison-src/transcripts/pattern-match-coverage.output.md index 6251638f0..e7c76c900 100644 --- a/unison-src/transcripts/pattern-match-coverage.output.md +++ b/unison-src/transcripts/pattern-match-coverage.output.md @@ -697,20 +697,31 @@ get x = match x with ```ucm - UnknownDecl: - data type - reference = SomeType + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type R + get : R -> SomeType ``` +```unison +unique type R = { someType : SomeType } +``` +```ucm + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + unique type R + R.someType : R -> SomeType + R.someType.modify : (SomeType ->{g} SomeType) -> R ->{g} R + R.someType.set : SomeType -> R -> R -🛑 - -The transcript failed due to an error in the stanza above. The error is: - - - UnknownDecl: - data type - reference = SomeType - +``` From 3572bd36959f7aca535904ce50965da8942a534f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ru=CC=81nar?= Date: Mon, 13 Mar 2023 14:35:29 -0400 Subject: [PATCH 461/467] Allow destructuring bind at beginning of do/lambda --- .../src/Unison/Syntax/TermPrinter.hs | 8 +- unison-src/transcripts-round-trip/main.md | 43 ++++++ .../transcripts-round-trip/main.output.md | 122 +++++++++++++++++- .../transcripts/bug-strange-closure.output.md | 5 +- 4 files changed, 173 insertions(+), 5 deletions(-) diff --git a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs index 70cf05ef4..417c12ee1 100644 --- a/parser-typechecker/src/Unison/Syntax/TermPrinter.hs +++ b/parser-typechecker/src/Unison/Syntax/TermPrinter.hs @@ -293,6 +293,10 @@ pretty0 px <- pretty0 (ac 0 Block im doc) x pure . paren (p >= 3) $ fmt S.ControlKeyword "do" `PP.hang` px + | Match' _ _ <- x -> do + px <- pretty0 (ac 0 Block im doc) x + pure . paren (p >= 3) $ + fmt S.ControlKeyword "do" `PP.hang` px | otherwise -> do px <- pretty0 (ac 10 Normal im doc) x pure . paren (p >= 11 || isBlock x && p >= 3) $ @@ -354,7 +358,7 @@ pretty0 -- blah -- See `isDestructuringBind` definition. Match' scrutinee cs@[MatchCase pat guard (AbsN' vs body)] - | p < 1 && isDestructuringBind scrutinee cs -> do + | p <= 2 && isDestructuringBind scrutinee cs -> do n <- getPPE let letIntro = case bc of Block -> id @@ -514,6 +518,7 @@ pretty0 let hang = case body of Delay' (Lets' _ _) -> PP.softHang Lets' _ _ -> PP.softHang + Match' _ _ -> PP.softHang _ -> PP.hang pure . paren (p >= 3) $ PP.group (varList vs <> fmt S.ControlKeyword " ->") `hang` prettyBody @@ -937,6 +942,7 @@ prettyBinding0 a@AmbientContext {imports = im, docContext = doc} v term = -- Special case for 'let being on the same line let hang = case body' of Delay' (Lets' _ _) -> PP.softHang + Delay' (Match' _ _) -> PP.softHang _ -> PP.hang pure PrettyBinding diff --git a/unison-src/transcripts-round-trip/main.md b/unison-src/transcripts-round-trip/main.md index 5ce3e625b..4ba440c97 100644 --- a/unison-src/transcripts-round-trip/main.md +++ b/unison-src/transcripts-round-trip/main.md @@ -547,3 +547,46 @@ test3 = foreach [1, 2, 3] do x -> do .> load scratch.u ``` +# Destructuring bind in delay or lambda + +Regression test for https://github.com/unisonweb/unison/issues/3710 + +```unison:hide +d1 = do + (a,b) = (1,2) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d2 = let + (a,b) = (1,2) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d3 x = let + (a,b) = (1,x) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d4 x = do + (a,b) = (1,x) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d5 x = match x with + Some x -> x + None -> bug "oops" +``` + +```ucm +.> add +.> edit d1 d2 d3 d4 d5 +.> undo +``` + +```ucm +.> load scratch.u +``` diff --git a/unison-src/transcripts-round-trip/main.output.md b/unison-src/transcripts-round-trip/main.output.md index 9949e9384..24c4115bc 100644 --- a/unison-src/transcripts-round-trip/main.output.md +++ b/unison-src/transcripts-round-trip/main.output.md @@ -1002,12 +1002,13 @@ foo = let foo : 'Nat foo = go x = - '(match (a -> a) x with + do + match (a -> a) x with SomethingUnusuallyLong lijaefliejalfijelfj aefilaeifhlei liaehjffeafijij | lijaefliejalfijelfj == aefilaeifhlei -> 0 | lijaefliejalfijelfj == liaehjffeafijij -> 1 - _ -> 2) + _ -> 2 go (SomethingUnusuallyLong "one" "two" "three") You can edit them there, then do `update` to replace the @@ -1639,3 +1640,120 @@ test3 = foreach [1, 2, 3] do x -> do test3 : () ``` +# Destructuring bind in delay or lambda + +Regression test for https://github.com/unisonweb/unison/issues/3710 + +```unison +d1 = do + (a,b) = (1,2) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d2 = let + (a,b) = (1,2) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d3 x = let + (a,b) = (1,x) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d4 x = do + (a,b) = (1,x) + (c,d) = (3,4) + (e,f) = (5,6) + (a,b,c,d,e,f) + +d5 x = match x with + Some x -> x + None -> bug "oops" +``` + +```ucm +.> add + + ⍟ I've added these definitions: + + d1 : '(Nat, Nat, Nat, Nat, Nat, Nat) + d2 : (Nat, Nat, Nat, Nat, Nat, Nat) + d3 : x -> (Nat, x, Nat, Nat, Nat, Nat) + d4 : x -> () -> (Nat, x, Nat, Nat, Nat, Nat) + d5 : Optional a -> a + +.> edit d1 d2 d3 d4 d5 + + ☝️ + + I added these definitions to the top of + /Users/runar/work/unison/scratch.u + + d1 : '(Nat, Nat, Nat, Nat, Nat, Nat) + d1 = do + (a, b) = (1, 2) + (c, d) = (3, 4) + (e, f) = (5, 6) + (a, b, c, d, e, f) + + d2 : (Nat, Nat, Nat, Nat, Nat, Nat) + d2 = + (a, b) = (1, 2) + (c, d) = (3, 4) + (e, f) = (5, 6) + (a, b, c, d, e, f) + + d3 : x -> (Nat, x, Nat, Nat, Nat, Nat) + d3 x = + (a, b) = (1, x) + (c, d) = (3, 4) + (e, f) = (5, 6) + (a, b, c, d, e, f) + + d4 : x -> () -> (Nat, x, Nat, Nat, Nat, Nat) + d4 x = do + (a, b) = (1, x) + (c, d) = (3, 4) + (e, f) = (5, 6) + (a, b, c, d, e, f) + + d5 : Optional a -> a + d5 = cases + Some x -> x + None -> bug "oops" + + You can edit them there, then do `update` to replace the + definitions currently in this namespace. + +.> undo + + Here are the changes I undid + + Added definitions: + + 1. d1 : '(Nat, Nat, Nat, Nat, Nat, Nat) + 2. d2 : (Nat, Nat, Nat, Nat, Nat, Nat) + 3. d3 : x -> (Nat, x, Nat, Nat, Nat, Nat) + 4. d4 : x -> () -> (Nat, x, Nat, Nat, Nat, Nat) + 5. d5 : Optional a -> a + +``` +```ucm +.> load scratch.u + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⍟ These new definitions are ok to `add`: + + d1 : '(Nat, Nat, Nat, Nat, Nat, Nat) + d2 : (Nat, Nat, Nat, Nat, Nat, Nat) + d3 : x -> (Nat, x, Nat, Nat, Nat, Nat) + d4 : x -> '(Nat, x, Nat, Nat, Nat, Nat) + d5 : Optional a -> a + +``` diff --git a/unison-src/transcripts/bug-strange-closure.output.md b/unison-src/transcripts/bug-strange-closure.output.md index d4b723282..495a2d57b 100644 --- a/unison-src/transcripts/bug-strange-closure.output.md +++ b/unison-src/transcripts/bug-strange-closure.output.md @@ -2669,9 +2669,10 @@ rendered = Pretty.get (docFormatConsole doc.guide) (Eval (Term.Term (Any - ('(match 1 with + (do + match 1 with 1 -> "hi" - _ -> "goodbye")))))))), + _ -> "goodbye"))))))), Lit () (Right (Plain "\n")), Lit () (Right (Plain "\n")), Indent From 81290d8eb4db1b82ca9ee884657defe361280814 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Mon, 13 Mar 2023 14:49:42 -0600 Subject: [PATCH 462/467] Add `Md5` builtin to `crypto.HashAlgorithm` Expose Haskell's implementation like the existing crypto built-ins, and add it to the test transcripts. --- CONTRIBUTORS.markdown | 1 + parser-typechecker/src/Unison/Builtin.hs | 2 +- .../src/Unison/Runtime/Builtin.hs | 1 + .../all-base-hashes.output.md | 1371 +++++++++-------- unison-src/transcripts-using-base/hashing.md | 23 + .../transcripts-using-base/hashing.output.md | 127 +- unison-src/transcripts/alias-many.output.md | 895 +++++------ .../transcripts/builtins-merge.output.md | 2 +- .../transcripts/emptyCodebase.output.md | 4 +- unison-src/transcripts/merges.output.md | 12 +- .../transcripts/move-namespace.output.md | 28 +- .../transcripts/name-selection.output.md | 741 ++++----- unison-src/transcripts/reflog.output.md | 10 +- unison-src/transcripts/squash.output.md | 20 +- 14 files changed, 1660 insertions(+), 1577 deletions(-) diff --git a/CONTRIBUTORS.markdown b/CONTRIBUTORS.markdown index 93b64b1fc..8b90b4e64 100644 --- a/CONTRIBUTORS.markdown +++ b/CONTRIBUTORS.markdown @@ -74,3 +74,4 @@ The format for this list: name, GitHub handle * Vlad Posmangiu Luchian (@cstml) * Andrii Uvarov (@unorsk) * Mario Bašić (@mabasic) +* Chris Krycho (@chriskrycho) diff --git a/parser-typechecker/src/Unison/Builtin.hs b/parser-typechecker/src/Unison/Builtin.hs index a2cad148b..a7a901a3a 100644 --- a/parser-typechecker/src/Unison/Builtin.hs +++ b/parser-typechecker/src/Unison/Builtin.hs @@ -762,7 +762,7 @@ hashBuiltins = B "crypto.hmac" $ forall1 "a" (\a -> hashAlgo --> bytes --> a --> bytes), B "crypto.hmacBytes" $ hashAlgo --> bytes --> bytes --> bytes ] - ++ map h ["Sha3_512", "Sha3_256", "Sha2_512", "Sha2_256", "Sha1", "Blake2b_512", "Blake2b_256", "Blake2s_256"] + ++ map h ["Sha3_512", "Sha3_256", "Sha2_512", "Sha2_256", "Sha1", "Blake2b_512", "Blake2b_256", "Blake2s_256", "Md5"] where hashAlgo = Type.ref () Type.hashAlgorithmRef h name = B ("crypto.HashAlgorithm." <> name) hashAlgo diff --git a/parser-typechecker/src/Unison/Runtime/Builtin.hs b/parser-typechecker/src/Unison/Runtime/Builtin.hs index 92e33a38b..61fea0fb2 100644 --- a/parser-typechecker/src/Unison/Runtime/Builtin.hs +++ b/parser-typechecker/src/Unison/Runtime/Builtin.hs @@ -2633,6 +2633,7 @@ declareForeigns = do declareHashAlgorithm "Blake2b_512" Hash.Blake2b_512 declareHashAlgorithm "Blake2b_256" Hash.Blake2b_256 declareHashAlgorithm "Blake2s_256" Hash.Blake2s_256 + declareHashAlgorithm "Md5" Hash.MD5 declareForeign Untracked "crypto.hashBytes" boxBoxDirect . mkForeign $ \(HashAlgorithm _ alg, b :: Bytes.Bytes) -> diff --git a/unison-src/transcripts-using-base/all-base-hashes.output.md b/unison-src/transcripts-using-base/all-base-hashes.output.md index 1af0e709f..5761891ba 100644 --- a/unison-src/transcripts-using-base/all-base-hashes.output.md +++ b/unison-src/transcripts-using-base/all-base-hashes.output.md @@ -412,466 +412,469 @@ This transcript is intended to make visible accidental changes to the hashing al 126. -- ##crypto.HashAlgorithm.Blake2s_256 builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 127. -- ##crypto.HashAlgorithm.Sha1 + 127. -- ##crypto.HashAlgorithm.Md5 + builtin.crypto.HashAlgorithm.Md5 : HashAlgorithm + + 128. -- ##crypto.HashAlgorithm.Sha1 builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm - 128. -- ##crypto.HashAlgorithm.Sha2_256 + 129. -- ##crypto.HashAlgorithm.Sha2_256 builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 129. -- ##crypto.HashAlgorithm.Sha2_512 + 130. -- ##crypto.HashAlgorithm.Sha2_512 builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 130. -- ##crypto.HashAlgorithm.Sha3_256 + 131. -- ##crypto.HashAlgorithm.Sha3_256 builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 131. -- ##crypto.HashAlgorithm.Sha3_512 + 132. -- ##crypto.HashAlgorithm.Sha3_512 builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 132. -- ##crypto.hashBytes + 133. -- ##crypto.hashBytes builtin.crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 133. -- ##crypto.hmac + 134. -- ##crypto.hmac builtin.crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 134. -- ##crypto.hmacBytes + 135. -- ##crypto.hmacBytes builtin.crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 135. -- ##Debug.toText + 136. -- ##Debug.toText builtin.Debug.toText : a -> Optional (Either Text Text) - 136. -- ##Debug.trace + 137. -- ##Debug.trace builtin.Debug.trace : Text -> a -> () - 137. -- ##Debug.watch + 138. -- ##Debug.watch builtin.Debug.watch : Text -> a -> a - 138. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8 + 139. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8 unique type builtin.Doc - 139. -- #baiqeiovdrs4ju0grn5q5akq64k4kuhgifqno52smkkttqg31jkgm3qa9o3ohe54fgpiigd1tj0an7rfveopfg622sjj9v9g44n27go + 140. -- #baiqeiovdrs4ju0grn5q5akq64k4kuhgifqno52smkkttqg31jkgm3qa9o3ohe54fgpiigd1tj0an7rfveopfg622sjj9v9g44n27go builtin.Doc.++ : Doc2 -> Doc2 -> Doc2 - 140. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#0 + 141. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#0 builtin.Doc.Blob : Text -> Doc - 141. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#4 + 142. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#4 builtin.Doc.Evaluate : Link.Term -> Doc - 142. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#5 + 143. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#5 builtin.Doc.Join : [Doc] -> Doc - 143. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#1 + 144. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#1 builtin.Doc.Link : Link -> Doc - 144. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#3 + 145. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#3 builtin.Doc.Signature : Link.Term -> Doc - 145. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#2 + 146. -- #p65rcethk26an850aaaceojremfu054hqllhoip1mt9s22584j9r62o08qo9t0pri7ssgu9m7f0rfp4nujhulgbmo41tkgl182quhd8#2 builtin.Doc.Source : Link -> Doc - 146. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0 + 147. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0 unique type builtin.Doc2 - 147. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#27 + 148. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#27 builtin.Doc2.Anchor : Text -> Doc2 -> Doc2 - 148. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#11 + 149. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#11 builtin.Doc2.Aside : Doc2 -> Doc2 - 149. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#15 + 150. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#15 builtin.Doc2.Blankline : Doc2 - 150. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#10 + 151. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#10 builtin.Doc2.Blockquote : Doc2 -> Doc2 - 151. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#7 + 152. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#7 builtin.Doc2.Bold : Doc2 -> Doc2 - 152. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#21 + 153. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#21 builtin.Doc2.BulletedList : [Doc2] -> Doc2 - 153. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#3 + 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#3 builtin.Doc2.Callout : Optional Doc2 -> Doc2 -> Doc2 - 154. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#6 + 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#6 builtin.Doc2.Code : Doc2 -> Doc2 - 155. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#25 + 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#25 builtin.Doc2.CodeBlock : Text -> Doc2 -> Doc2 - 156. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#24 + 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#24 builtin.Doc2.Column : [Doc2] -> Doc2 - 157. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#0 + 158. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#0 builtin.Doc2.Folded : Boolean -> Doc2 -> Doc2 -> Doc2 - 158. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68 + 159. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68 unique type builtin.Doc2.FrontMatter - 159. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68#0 + 160. -- #h3gajooii4tsdseghcbcsq4qq7c33mtb71u5npg35b06mgv7v654g0n55gpq212umfmq7nvi11o28m1v13r5fto5g8ium3ee4qk1i68#0 builtin.Doc2.FrontMatter.FrontMatter : [(Text, Text)] -> FrontMatter - 160. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#12 + 161. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#12 builtin.Doc2.Group : Doc2 -> Doc2 - 161. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#14 + 162. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#14 builtin.Doc2.Image : Doc2 -> Doc2 -> Optional Doc2 -> Doc2 - 162. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#8 + 163. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#8 builtin.Doc2.Italic : Doc2 -> Doc2 - 163. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 + 164. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#22 builtin.Doc2.Join : [Doc2] -> Doc2 - 164. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto + 165. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto unique type builtin.Doc2.LaTeXInline - 165. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto#0 + 166. -- #lpf7g5c2ct61mci2okedmug8o0i2j0rhpealc05r2musapmn15cina6dsqdvis234evvb2bo09l2p8v5qhh0me7gi1j37nqqp47qvto#0 builtin.Doc2.LaTeXInline.LaTeXInline : Text -> LaTeXInline - 166. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 + 167. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#16 builtin.Doc2.Linebreak : Doc2 - 167. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 + 168. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0 unique type builtin.Doc2.MediaSource - 168. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 + 169. -- #ut0tds116gr0soc9p6nroaalqlq423u1mao3p4jjultjmok3vbck69la7rs26duptji5v5hscijpek4hotu4krbfah8np3sntr87gb0#0 builtin.Doc2.MediaSource.MediaSource : Text -> Optional Text -> MediaSource - 169. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so + 170. -- #f7s1m2rs7ldj4idrcirtdqohsmc6n719e6cdqtgrhdkcrbm7971uvug6mvkrcc32qhdpo1og4oqin4rbmb2346m47ni24k5m3bpp3so builtin.Doc2.MediaSource.mimeType : MediaSource -> Optional Text - 170. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg + 171. -- #rncdj545f93f7nfrneabp6jlrjag766vr2n18al8u2a78ju5v746agg62r4ob8u6ue8eeac6nbg8apeii6qfasgfv2q2ap3h4sk1tdg builtin.Doc2.MediaSource.mimeType.modify : (Optional Text ->{g} Optional Text) -> MediaSource ->{g} MediaSource - 171. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 + 172. -- #54dl203thl9540r2jec546pishtg1b1ecb8vl6rqlbgf4h2rk04mrkdkqo4be82m8d3t2d0ef3gidjsn2r9u8ko7c9kvtavbqflim88 builtin.Doc2.MediaSource.mimeType.set : Optional Text -> MediaSource -> MediaSource - 172. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg + 173. -- #77l9vc6k6miu7pobamoasrpdm455ddgprgvfpg2di6liigijg70f4t3ppmpbs3j12kp93eep7u0e5r1bdq0niou0v85lo4aa5kek8mg builtin.Doc2.MediaSource.sourceUrl : MediaSource -> Text - 173. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 + 174. -- #laoh1nhllsb9vf0reilmbmjutdei2b0vs0vse1s8j148imfi1m9uu4l17iqdt9r5575dap8jnlq6r48kdn6ob70iroso75erqfc74e0 builtin.Doc2.MediaSource.sourceUrl.modify : (Text ->{g} Text) -> MediaSource ->{g} MediaSource - 174. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo + 175. -- #eb0dl30fc5k80vb0fna187vmag5ta1rgik40s1shlkng8stvvkt2gglecit8ajjd8vmfrtg8ki8ft3ife8rrqlcoit5161ekg6vhcfo builtin.Doc2.MediaSource.sourceUrl.set : Text -> MediaSource -> MediaSource - 175. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 + 176. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#2 builtin.Doc2.NamedLink : Doc2 -> Doc2 -> Doc2 - 176. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 + 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#4 builtin.Doc2.NumberedList : Nat -> [Doc2] -> Doc2 - 177. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 + 178. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#20 builtin.Doc2.Paragraph : [Doc2] -> Doc2 - 178. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 + 179. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#13 builtin.Doc2.Section : Doc2 -> [Doc2] -> Doc2 - 179. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 + 180. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#17 builtin.Doc2.SectionBreak : Doc2 - 180. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 + 181. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#5 builtin.Doc2.Special : SpecialForm -> Doc2 - 181. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 + 182. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0 unique type builtin.Doc2.SpecialForm - 182. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 + 183. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#4 builtin.Doc2.SpecialForm.Embed : Any -> SpecialForm - 183. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 + 184. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#5 builtin.Doc2.SpecialForm.EmbedInline : Any -> SpecialForm - 184. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 + 185. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#9 builtin.Doc2.SpecialForm.Eval : Doc2.Term -> SpecialForm - 185. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 + 186. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#10 builtin.Doc2.SpecialForm.EvalInline : Doc2.Term -> SpecialForm - 186. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 + 187. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#0 builtin.Doc2.SpecialForm.Example : Nat -> Doc2.Term -> SpecialForm - 187. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 + 188. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#1 builtin.Doc2.SpecialForm.ExampleBlock : Nat -> Doc2.Term -> SpecialForm - 188. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 + 189. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#7 builtin.Doc2.SpecialForm.FoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 189. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 + 190. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#3 builtin.Doc2.SpecialForm.Link : Either Type Doc2.Term -> SpecialForm - 190. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 + 191. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#2 builtin.Doc2.SpecialForm.Signature : [Doc2.Term] -> SpecialForm - 191. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 + 192. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#8 builtin.Doc2.SpecialForm.SignatureInline : Doc2.Term -> SpecialForm - 192. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 + 193. -- #e46kdnv67raqhc4m3jnitkh3o9seq3q5mtlqnvobjlqnnd2tk7nui54b6grui7eql62fne4fo3ndetmeb23oj5es85habha5f6saoi0#6 builtin.Doc2.SpecialForm.Source : [( Either Type Doc2.Term, [Doc2.Term])] -> SpecialForm - 193. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 + 194. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#9 builtin.Doc2.Strikethrough : Doc2 -> Doc2 - 194. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 + 195. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#26 builtin.Doc2.Style : Text -> Doc2 -> Doc2 - 195. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg + 196. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg unique type builtin.Doc2.Svg - 196. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg#0 + 197. -- #sv2cta4p4th10h7tpurvr0t6s3cbahlevvmpadk01v32e39kse8aicdvfsm2dbk6ltc68ht788jvkfhk6ol2mch7eubngtug019e8fg#0 builtin.Doc2.Svg.Svg : Text -> Svg - 197. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 + 198. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#18 builtin.Doc2.Table : [[Doc2]] -> Doc2 - 198. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg + 199. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg unique type builtin.Doc2.Term - 199. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 + 200. -- #tu2du1k0lrp6iddor1aotdhdgn1j2b86r22tes3o3hka0bv4b4otlbimj88ttrdnbuacokk768k4e54795of8gnosopjirl4jm42g28 builtin.Doc2.term : '{g} a -> Doc2.Term - 200. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 + 201. -- #s0an21vospbdlsbddiskuvt3ngbf00n78sip2o1mnp4jgp16i7sursbm14bf8ap7osphqbis2lduep3i29b7diu8sf03f8tlqd7rgcg#0 builtin.Doc2.Term.Term : Any -> Doc2.Term - 201. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 + 202. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#1 builtin.Doc2.Tooltip : Doc2 -> Doc2 -> Doc2 - 202. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 + 203. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#23 builtin.Doc2.UntitledSection : [Doc2] -> Doc2 - 203. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 + 204. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0 unique type builtin.Doc2.Video - 204. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 + 205. -- #46er7fsgre91rer0mpk6vhaa2vie19i0piubvtnfmt3vq7odcjfr6tlf0mc57q4jnij9rkolpekjd6dpqdotn41guk9lp9qioa88m58 builtin.Doc2.Video.config : Video -> [(Text, Text)] - 205. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g + 206. -- #vld47vp37855gceko81jj00j5t0mf5p137ub57094585aq3jfevq0ob03fot9d73p97r2pj0alel9e6a7lqcc7mue0ogefshg991e6g builtin.Doc2.Video.config.modify : ([(Text, Text)] ->{g} [(Text, Text)]) -> Video ->{g} Video - 206. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 + 207. -- #ll9hiqi1s63ragrv9ul3ouu2rvpjkok4gdmgqs6cl8j4fgdmqlgikc5lseoe94e9fvrughjfetlcsn7gc5ed8prtnljfo5j6r1vveq8 builtin.Doc2.Video.config.set : [(Text, Text)] -> Video -> Video - 207. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o + 208. -- #a454aldsi00l8kh10bhi6d4phtdr9ht0es6apr05jert6oo4vstm5cdr4ee2k0srted1urqgvkrcoihjvmus6tph92v628f3lr9b92o builtin.Doc2.Video.sources : Video -> [MediaSource] - 208. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo + 209. -- #nm77894uq9g3kv5mo7ubuptpimt53jml7jt825lr83gu41tqcfpg2krcesn7p5aaea107su7brg2gm8vn1l0mabpfnpbcdi4onlatvo builtin.Doc2.Video.sources.modify : ([MediaSource] ->{g} [MediaSource]) -> Video ->{g} Video - 209. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 + 210. -- #5r0bgv3t666s4lh274mvtk13jqu1doc26ki2k8t2rpophrq2hjran1qodeobf3trlnniarjehr1rgl6scn6mhqpmcokdafja3b54jt0 builtin.Doc2.Video.sources.set : [MediaSource] -> Video -> Video - 210. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 + 211. -- #794fndq1941e2khqv5uh7fmk9es2g4fkp8pr48objgs6blc1pqsdt2ab4o79noril2l7s70iu2eimn1smpd8t40j4g18btian8a2pt0#0 builtin.Doc2.Video.Video : [MediaSource] -> [(Text, Text)] -> Video - 211. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 + 212. -- #ej86si0ur1lsjade71dojr25phk9bbom9rdks6dltolos5tjivakujcriqe02npba53n9gd7tkh8bmv08ttjb9t35lq2ch5heshqcs0#19 builtin.Doc2.Word : Text -> Doc2 - 212. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 + 213. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8 structural type builtin.Either a b - 213. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 + 214. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#1 builtin.Either.Left : a -> Either a b - 214. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g + 215. -- #u3cen22u7p8dfj0nc45j0pg4lskqjjisflm3jq0957756d23lq53tf27vg37g6jnddh8o70grvotcvrfc1fnpog0rlfsvfvjrk1s94g builtin.Either.mapRight : (a ->{g} b) -> Either e a ->{g} Either e b - 215. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 + 216. -- #0o7mf021foma9acqdaibmlh1jidlijq08uf7f5se9tssttqs546pfunjpk6s31mqoq8s2o1natede8hkk6he45l95fibglidikt44v8#0 builtin.Either.Right : b -> Either a b - 216. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 217. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability builtin.Exception structural ability Exception - 217. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 218. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 builtin.Exception.raise, Exception.raise : Failure ->{Exception} x - 218. -- ##Float + 219. -- ##Float builtin type builtin.Float - 219. -- ##Float.* + 220. -- ##Float.* builtin.Float.* : Float -> Float -> Float - 220. -- ##Float.+ + 221. -- ##Float.+ builtin.Float.+ : Float -> Float -> Float - 221. -- ##Float.- + 222. -- ##Float.- builtin.Float.- : Float -> Float -> Float - 222. -- ##Float./ + 223. -- ##Float./ builtin.Float./ : Float -> Float -> Float - 223. -- ##Float.abs + 224. -- ##Float.abs builtin.Float.abs : Float -> Float - 224. -- ##Float.acos + 225. -- ##Float.acos builtin.Float.acos : Float -> Float - 225. -- ##Float.acosh + 226. -- ##Float.acosh builtin.Float.acosh : Float -> Float - 226. -- ##Float.asin + 227. -- ##Float.asin builtin.Float.asin : Float -> Float - 227. -- ##Float.asinh + 228. -- ##Float.asinh builtin.Float.asinh : Float -> Float - 228. -- ##Float.atan + 229. -- ##Float.atan builtin.Float.atan : Float -> Float - 229. -- ##Float.atan2 + 230. -- ##Float.atan2 builtin.Float.atan2 : Float -> Float -> Float - 230. -- ##Float.atanh + 231. -- ##Float.atanh builtin.Float.atanh : Float -> Float - 231. -- ##Float.ceiling + 232. -- ##Float.ceiling builtin.Float.ceiling : Float -> Int - 232. -- ##Float.cos + 233. -- ##Float.cos builtin.Float.cos : Float -> Float - 233. -- ##Float.cosh + 234. -- ##Float.cosh builtin.Float.cosh : Float -> Float - 234. -- ##Float.== + 235. -- ##Float.== builtin.Float.eq : Float -> Float -> Boolean - 235. -- ##Float.exp + 236. -- ##Float.exp builtin.Float.exp : Float -> Float - 236. -- ##Float.floor + 237. -- ##Float.floor builtin.Float.floor : Float -> Int - 237. -- ##Float.fromRepresentation + 238. -- ##Float.fromRepresentation builtin.Float.fromRepresentation : Nat -> Float - 238. -- ##Float.fromText + 239. -- ##Float.fromText builtin.Float.fromText : Text -> Optional Float - 239. -- ##Float.> + 240. -- ##Float.> builtin.Float.gt : Float -> Float -> Boolean - 240. -- ##Float.>= + 241. -- ##Float.>= builtin.Float.gteq : Float -> Float -> Boolean - 241. -- ##Float.log + 242. -- ##Float.log builtin.Float.log : Float -> Float - 242. -- ##Float.logBase + 243. -- ##Float.logBase builtin.Float.logBase : Float -> Float -> Float - 243. -- ##Float.< + 244. -- ##Float.< builtin.Float.lt : Float -> Float -> Boolean - 244. -- ##Float.<= + 245. -- ##Float.<= builtin.Float.lteq : Float -> Float -> Boolean - 245. -- ##Float.max + 246. -- ##Float.max builtin.Float.max : Float -> Float -> Float - 246. -- ##Float.min + 247. -- ##Float.min builtin.Float.min : Float -> Float -> Float - 247. -- ##Float.pow + 248. -- ##Float.pow builtin.Float.pow : Float -> Float -> Float - 248. -- ##Float.round + 249. -- ##Float.round builtin.Float.round : Float -> Int - 249. -- ##Float.sin + 250. -- ##Float.sin builtin.Float.sin : Float -> Float - 250. -- ##Float.sinh + 251. -- ##Float.sinh builtin.Float.sinh : Float -> Float - 251. -- ##Float.sqrt + 252. -- ##Float.sqrt builtin.Float.sqrt : Float -> Float - 252. -- ##Float.tan + 253. -- ##Float.tan builtin.Float.tan : Float -> Float - 253. -- ##Float.tanh + 254. -- ##Float.tanh builtin.Float.tanh : Float -> Float - 254. -- ##Float.toRepresentation + 255. -- ##Float.toRepresentation builtin.Float.toRepresentation : Float -> Nat - 255. -- ##Float.toText + 256. -- ##Float.toText builtin.Float.toText : Float -> Text - 256. -- ##Float.truncate + 257. -- ##Float.truncate builtin.Float.truncate : Float -> Int - 257. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 + 258. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8 unique type builtin.GUID - 258. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 + 259. -- #hqectlr3gt02r6r984b3627eg5bq3d82lab5q18e3ql09u1ka8dblf5k50ae0q0d8gk87udqd7b6767q86gogdt8ghpdiq77gk6blr8#0 builtin.GUID.GUID : Bytes -> GUID - 259. -- ##Handle.toText + 260. -- ##Handle.toText builtin.Handle.toText : Handle -> Text - 260. -- ##ImmutableArray + 261. -- ##ImmutableArray builtin type builtin.ImmutableArray - 261. -- ##ImmutableArray.copyTo! + 262. -- ##ImmutableArray.copyTo! builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray a @@ -879,18 +882,18 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 262. -- ##ImmutableArray.read + 263. -- ##ImmutableArray.read builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 263. -- ##ImmutableArray.size + 264. -- ##ImmutableArray.size builtin.ImmutableArray.size : ImmutableArray a -> Nat - 264. -- ##ImmutableByteArray + 265. -- ##ImmutableByteArray builtin type builtin.ImmutableByteArray - 265. -- ##ImmutableByteArray.copyTo! + 266. -- ##ImmutableByteArray.copyTo! builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -898,867 +901,867 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 266. -- ##ImmutableByteArray.read16be + 267. -- ##ImmutableByteArray.read16be builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 267. -- ##ImmutableByteArray.read24be + 268. -- ##ImmutableByteArray.read24be builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 268. -- ##ImmutableByteArray.read32be + 269. -- ##ImmutableByteArray.read32be builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 269. -- ##ImmutableByteArray.read40be + 270. -- ##ImmutableByteArray.read40be builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 270. -- ##ImmutableByteArray.read64be + 271. -- ##ImmutableByteArray.read64be builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 271. -- ##ImmutableByteArray.read8 + 272. -- ##ImmutableByteArray.read8 builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 272. -- ##ImmutableByteArray.size + 273. -- ##ImmutableByteArray.size builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 273. -- ##Int + 274. -- ##Int builtin type builtin.Int - 274. -- ##Int.* + 275. -- ##Int.* builtin.Int.* : Int -> Int -> Int - 275. -- ##Int.+ + 276. -- ##Int.+ builtin.Int.+ : Int -> Int -> Int - 276. -- ##Int.- + 277. -- ##Int.- builtin.Int.- : Int -> Int -> Int - 277. -- ##Int./ + 278. -- ##Int./ builtin.Int./ : Int -> Int -> Int - 278. -- ##Int.and + 279. -- ##Int.and builtin.Int.and : Int -> Int -> Int - 279. -- ##Int.complement + 280. -- ##Int.complement builtin.Int.complement : Int -> Int - 280. -- ##Int.== + 281. -- ##Int.== builtin.Int.eq : Int -> Int -> Boolean - 281. -- ##Int.fromRepresentation + 282. -- ##Int.fromRepresentation builtin.Int.fromRepresentation : Nat -> Int - 282. -- ##Int.fromText + 283. -- ##Int.fromText builtin.Int.fromText : Text -> Optional Int - 283. -- ##Int.> + 284. -- ##Int.> builtin.Int.gt : Int -> Int -> Boolean - 284. -- ##Int.>= + 285. -- ##Int.>= builtin.Int.gteq : Int -> Int -> Boolean - 285. -- ##Int.increment + 286. -- ##Int.increment builtin.Int.increment : Int -> Int - 286. -- ##Int.isEven + 287. -- ##Int.isEven builtin.Int.isEven : Int -> Boolean - 287. -- ##Int.isOdd + 288. -- ##Int.isOdd builtin.Int.isOdd : Int -> Boolean - 288. -- ##Int.leadingZeros + 289. -- ##Int.leadingZeros builtin.Int.leadingZeros : Int -> Nat - 289. -- ##Int.< + 290. -- ##Int.< builtin.Int.lt : Int -> Int -> Boolean - 290. -- ##Int.<= + 291. -- ##Int.<= builtin.Int.lteq : Int -> Int -> Boolean - 291. -- ##Int.mod + 292. -- ##Int.mod builtin.Int.mod : Int -> Int -> Int - 292. -- ##Int.negate + 293. -- ##Int.negate builtin.Int.negate : Int -> Int - 293. -- ##Int.or + 294. -- ##Int.or builtin.Int.or : Int -> Int -> Int - 294. -- ##Int.popCount + 295. -- ##Int.popCount builtin.Int.popCount : Int -> Nat - 295. -- ##Int.pow + 296. -- ##Int.pow builtin.Int.pow : Int -> Nat -> Int - 296. -- ##Int.shiftLeft + 297. -- ##Int.shiftLeft builtin.Int.shiftLeft : Int -> Nat -> Int - 297. -- ##Int.shiftRight + 298. -- ##Int.shiftRight builtin.Int.shiftRight : Int -> Nat -> Int - 298. -- ##Int.signum + 299. -- ##Int.signum builtin.Int.signum : Int -> Int - 299. -- ##Int.toFloat + 300. -- ##Int.toFloat builtin.Int.toFloat : Int -> Float - 300. -- ##Int.toRepresentation + 301. -- ##Int.toRepresentation builtin.Int.toRepresentation : Int -> Nat - 301. -- ##Int.toText + 302. -- ##Int.toText builtin.Int.toText : Int -> Text - 302. -- ##Int.trailingZeros + 303. -- ##Int.trailingZeros builtin.Int.trailingZeros : Int -> Nat - 303. -- ##Int.truncate0 + 304. -- ##Int.truncate0 builtin.Int.truncate0 : Int -> Nat - 304. -- ##Int.xor + 305. -- ##Int.xor builtin.Int.xor : Int -> Int -> Int - 305. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 + 306. -- #s6ijmhqkkaus51chjgahogc7sdrqj9t66i599le2k7ts6fkl216f997hbses3mqk6a21vaj3cm1mertbldn0g503jt522vfo4rfv720 unique type builtin.io2.ArithmeticFailure - 306. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag + 307. -- #6dtvam7msqc64dimm8p0d8ehdf0330o4qbd2fdafb11jj1c2rg4ke3jdcmbgo6s4pf2jgm0vb76jeavv4ba6ht71t74p963a1miekag unique type builtin.io2.ArrayFailure - 307. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 + 308. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98 unique type builtin.io2.BufferMode - 308. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 + 309. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#2 builtin.io2.BufferMode.BlockBuffering : BufferMode - 309. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 + 310. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#1 builtin.io2.BufferMode.LineBuffering : BufferMode - 310. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 + 311. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#0 builtin.io2.BufferMode.NoBuffering : BufferMode - 311. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 + 312. -- #dc6n5ebu839ik3b6ohmnqm6p0cifn7o94em1g41mjp4ae0gmv3b4rupba499lbasfrp4bqce9u4hd6518unlbg8vk993c0q6rigos98#3 builtin.io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 312. -- ##Clock.internals.monotonic.v1 + 313. -- ##Clock.internals.monotonic.v1 builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 313. -- ##Clock.internals.nsec.v1 + 314. -- ##Clock.internals.nsec.v1 builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 314. -- ##Clock.internals.processCPUTime.v1 + 315. -- ##Clock.internals.processCPUTime.v1 builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 315. -- ##Clock.internals.realtime.v1 + 316. -- ##Clock.internals.realtime.v1 builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 316. -- ##Clock.internals.sec.v1 + 317. -- ##Clock.internals.sec.v1 builtin.io2.Clock.internals.sec : TimeSpec -> Int - 317. -- ##Clock.internals.threadCPUTime.v1 + 318. -- ##Clock.internals.threadCPUTime.v1 builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 318. -- ##TimeSpec + 319. -- ##TimeSpec builtin type builtin.io2.Clock.internals.TimeSpec - 319. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 + 320. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8 unique type builtin.io2.Failure - 320. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 + 321. -- #r29dja8j9dmjjp45trccchaata8eo1h6d6haar1eai74pq1jt4m7u3ldhlq79f7phfo57eq4bau39vqotl2h63k7ff1m5sj5o9ajuf8#0 builtin.io2.Failure.Failure : Type -> Text -> Any -> Failure - 321. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 + 322. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8 unique type builtin.io2.FileMode - 322. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 + 323. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#2 builtin.io2.FileMode.Append : FileMode - 323. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 + 324. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#0 builtin.io2.FileMode.Read : FileMode - 324. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 + 325. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#3 builtin.io2.FileMode.ReadWrite : FileMode - 325. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 + 326. -- #jhnlob35huv3rr7jg6aa4gtd8okhprla7gvlq8io429qita8vj7k696n9jvp4b8ct9i2pc1jodb8ap2bipqtgp138epdgfcth7vqvt8#1 builtin.io2.FileMode.Write : FileMode - 326. -- ##Handle + 327. -- ##Handle builtin type builtin.io2.Handle - 327. -- ##IO + 328. -- ##IO builtin type builtin.io2.IO - 328. -- ##IO.array + 329. -- ##IO.array builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 329. -- ##IO.arrayOf + 330. -- ##IO.arrayOf builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 330. -- ##IO.bytearray + 331. -- ##IO.bytearray builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 331. -- ##IO.bytearrayOf + 332. -- ##IO.bytearrayOf builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 332. -- ##IO.clientSocket.impl.v3 + 333. -- ##IO.clientSocket.impl.v3 builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 333. -- ##IO.closeFile.impl.v3 + 334. -- ##IO.closeFile.impl.v3 builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 334. -- ##IO.closeSocket.impl.v3 + 335. -- ##IO.closeSocket.impl.v3 builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 335. -- ##IO.createDirectory.impl.v3 + 336. -- ##IO.createDirectory.impl.v3 builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 336. -- ##IO.createTempDirectory.impl.v3 + 337. -- ##IO.createTempDirectory.impl.v3 builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 337. -- ##IO.delay.impl.v3 + 338. -- ##IO.delay.impl.v3 builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 338. -- ##IO.directoryContents.impl.v3 + 339. -- ##IO.directoryContents.impl.v3 builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 339. -- ##IO.fileExists.impl.v3 + 340. -- ##IO.fileExists.impl.v3 builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 340. -- ##IO.forkComp.v2 + 341. -- ##IO.forkComp.v2 builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 341. -- ##IO.getArgs.impl.v1 + 342. -- ##IO.getArgs.impl.v1 builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 342. -- ##IO.getBuffering.impl.v3 + 343. -- ##IO.getBuffering.impl.v3 builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 343. -- ##IO.getBytes.impl.v3 + 344. -- ##IO.getBytes.impl.v3 builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 344. -- ##IO.getChar.impl.v1 + 345. -- ##IO.getChar.impl.v1 builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 345. -- ##IO.getCurrentDirectory.impl.v3 + 346. -- ##IO.getCurrentDirectory.impl.v3 builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 346. -- ##IO.getEcho.impl.v1 + 347. -- ##IO.getEcho.impl.v1 builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 347. -- ##IO.getEnv.impl.v1 + 348. -- ##IO.getEnv.impl.v1 builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 348. -- ##IO.getFileSize.impl.v3 + 349. -- ##IO.getFileSize.impl.v3 builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 349. -- ##IO.getFileTimestamp.impl.v3 + 350. -- ##IO.getFileTimestamp.impl.v3 builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 350. -- ##IO.getLine.impl.v1 + 351. -- ##IO.getLine.impl.v1 builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 351. -- ##IO.getSomeBytes.impl.v1 + 352. -- ##IO.getSomeBytes.impl.v1 builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 352. -- ##IO.getTempDirectory.impl.v3 + 353. -- ##IO.getTempDirectory.impl.v3 builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 353. -- ##IO.handlePosition.impl.v3 + 354. -- ##IO.handlePosition.impl.v3 builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 354. -- ##IO.isDirectory.impl.v3 + 355. -- ##IO.isDirectory.impl.v3 builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 355. -- ##IO.isFileEOF.impl.v3 + 356. -- ##IO.isFileEOF.impl.v3 builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 356. -- ##IO.isFileOpen.impl.v3 + 357. -- ##IO.isFileOpen.impl.v3 builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 357. -- ##IO.isSeekable.impl.v3 + 358. -- ##IO.isSeekable.impl.v3 builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 358. -- ##IO.kill.impl.v3 + 359. -- ##IO.kill.impl.v3 builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 359. -- ##IO.listen.impl.v3 + 360. -- ##IO.listen.impl.v3 builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 360. -- ##IO.openFile.impl.v3 + 361. -- ##IO.openFile.impl.v3 builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 361. -- ##IO.process.call + 362. -- ##IO.process.call builtin.io2.IO.process.call : Text -> [Text] ->{IO} Nat - 362. -- ##IO.process.exitCode + 363. -- ##IO.process.exitCode builtin.io2.IO.process.exitCode : ProcessHandle ->{IO} Optional Nat - 363. -- ##IO.process.kill + 364. -- ##IO.process.kill builtin.io2.IO.process.kill : ProcessHandle ->{IO} () - 364. -- ##IO.process.start + 365. -- ##IO.process.start builtin.io2.IO.process.start : Text -> [Text] ->{IO} (Handle, Handle, Handle, ProcessHandle) - 365. -- ##IO.process.wait + 366. -- ##IO.process.wait builtin.io2.IO.process.wait : ProcessHandle ->{IO} Nat - 366. -- ##IO.putBytes.impl.v3 + 367. -- ##IO.putBytes.impl.v3 builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 367. -- ##IO.ready.impl.v1 + 368. -- ##IO.ready.impl.v1 builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 368. -- ##IO.ref + 369. -- ##IO.ref builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 369. -- ##IO.removeDirectory.impl.v3 + 370. -- ##IO.removeDirectory.impl.v3 builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 370. -- ##IO.removeFile.impl.v3 + 371. -- ##IO.removeFile.impl.v3 builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 371. -- ##IO.renameDirectory.impl.v3 + 372. -- ##IO.renameDirectory.impl.v3 builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 372. -- ##IO.renameFile.impl.v3 + 373. -- ##IO.renameFile.impl.v3 builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 373. -- ##IO.seekHandle.impl.v3 + 374. -- ##IO.seekHandle.impl.v3 builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 374. -- ##IO.serverSocket.impl.v3 + 375. -- ##IO.serverSocket.impl.v3 builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 375. -- ##IO.setBuffering.impl.v3 + 376. -- ##IO.setBuffering.impl.v3 builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 376. -- ##IO.setCurrentDirectory.impl.v3 + 377. -- ##IO.setCurrentDirectory.impl.v3 builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 377. -- ##IO.setEcho.impl.v1 + 378. -- ##IO.setEcho.impl.v1 builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 378. -- ##IO.socketAccept.impl.v3 + 379. -- ##IO.socketAccept.impl.v3 builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 379. -- ##IO.socketPort.impl.v3 + 380. -- ##IO.socketPort.impl.v3 builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 380. -- ##IO.socketReceive.impl.v3 + 381. -- ##IO.socketReceive.impl.v3 builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 381. -- ##IO.socketSend.impl.v3 + 382. -- ##IO.socketSend.impl.v3 builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 382. -- ##IO.stdHandle + 383. -- ##IO.stdHandle builtin.io2.IO.stdHandle : StdHandle -> Handle - 383. -- ##IO.systemTime.impl.v3 + 384. -- ##IO.systemTime.impl.v3 builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 384. -- ##IO.systemTimeMicroseconds.v1 + 385. -- ##IO.systemTimeMicroseconds.v1 builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 385. -- ##IO.tryEval + 386. -- ##IO.tryEval builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 386. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 + 387. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0 unique type builtin.io2.IOError - 387. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 + 388. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#0 builtin.io2.IOError.AlreadyExists : IOError - 388. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 + 389. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#4 builtin.io2.IOError.EOF : IOError - 389. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 + 390. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#5 builtin.io2.IOError.IllegalOperation : IOError - 390. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 + 391. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#1 builtin.io2.IOError.NoSuchThing : IOError - 391. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 + 392. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#6 builtin.io2.IOError.PermissionDenied : IOError - 392. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 + 393. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#2 builtin.io2.IOError.ResourceBusy : IOError - 393. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 + 394. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#3 builtin.io2.IOError.ResourceExhausted : IOError - 394. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 + 395. -- #h4smnou0l3fg4dn92g2r88j0imfvufjerkgbuscvvmaprv12l22nk6sff3c12edlikb2vfg3vfdj4b23a09q4lvtk75ckbe4lsmtuc0#7 builtin.io2.IOError.UserError : IOError - 395. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g + 396. -- #6ivk1e38hh0l9gcl8fn4mhf8bmak3qaji36vevg5e1n16ju5i4cl9u5gmqi7u16b907rd98gd60pouma892efbqt2ri58tmu99hp77g unique type builtin.io2.IOFailure - 396. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg + 397. -- #574pvphqahl981k517dtrqtq812m05h3hj6t2bt9sn3pknenfik1krscfdb6r66nf1sm7g3r1r56k0c6ob7vg4opfq4gihi8njbnhsg unique type builtin.io2.MiscFailure - 397. -- ##MVar + 398. -- ##MVar builtin type builtin.io2.MVar - 398. -- ##MVar.isEmpty + 399. -- ##MVar.isEmpty builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 399. -- ##MVar.new + 400. -- ##MVar.new builtin.io2.MVar.new : a ->{IO} MVar a - 400. -- ##MVar.newEmpty.v2 + 401. -- ##MVar.newEmpty.v2 builtin.io2.MVar.newEmpty : '{IO} MVar a - 401. -- ##MVar.put.impl.v3 + 402. -- ##MVar.put.impl.v3 builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 402. -- ##MVar.read.impl.v3 + 403. -- ##MVar.read.impl.v3 builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 403. -- ##MVar.swap.impl.v3 + 404. -- ##MVar.swap.impl.v3 builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 404. -- ##MVar.take.impl.v3 + 405. -- ##MVar.take.impl.v3 builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 405. -- ##MVar.tryPut.impl.v3 + 406. -- ##MVar.tryPut.impl.v3 builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 406. -- ##MVar.tryRead.impl.v3 + 407. -- ##MVar.tryRead.impl.v3 builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 407. -- ##MVar.tryTake + 408. -- ##MVar.tryTake builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 408. -- ##ProcessHandle + 409. -- ##ProcessHandle builtin type builtin.io2.ProcessHandle - 409. -- ##Promise + 410. -- ##Promise builtin type builtin.io2.Promise - 410. -- ##Promise.new + 411. -- ##Promise.new builtin.io2.Promise.new : '{IO} Promise a - 411. -- ##Promise.read + 412. -- ##Promise.read builtin.io2.Promise.read : Promise a ->{IO} a - 412. -- ##Promise.tryRead + 413. -- ##Promise.tryRead builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 413. -- ##Promise.write + 414. -- ##Promise.write builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 414. -- ##Ref.cas + 415. -- ##Ref.cas builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 415. -- ##Ref.readForCas + 416. -- ##Ref.readForCas builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 416. -- ##Ref.Ticket + 417. -- ##Ref.Ticket builtin type builtin.io2.Ref.Ticket - 417. -- ##Ref.Ticket.read + 418. -- ##Ref.Ticket.read builtin.io2.Ref.Ticket.read : Ticket a -> a - 418. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 + 419. -- #vph2eas3lf2gi259f3khlrspml3id2l8u0ru07kb5fd833h238jk4iauju0b6decth9i3nao5jkf5eej1e1kovgmu5tghhh8jq3i7p8 unique type builtin.io2.RuntimeFailure - 419. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 + 420. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40 unique type builtin.io2.SeekMode - 420. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 + 421. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#0 builtin.io2.SeekMode.AbsoluteSeek : SeekMode - 421. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 + 422. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#1 builtin.io2.SeekMode.RelativeSeek : SeekMode - 422. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 + 423. -- #1bca3hq98sfgr6a4onuon1tsda69cdjggq8pkmlsfola6492dbrih5up6dv18ptfbqeocm9q6parf64pj773p7p19qe76238o4trc40#2 builtin.io2.SeekMode.SeekFromEnd : SeekMode - 423. -- ##Socket + 424. -- ##Socket builtin type builtin.io2.Socket - 424. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 + 425. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8 unique type builtin.io2.StdHandle - 425. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 + 426. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#2 builtin.io2.StdHandle.StdErr : StdHandle - 426. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 + 427. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#0 builtin.io2.StdHandle.StdIn : StdHandle - 427. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 + 428. -- #121tku5rfh21t247v1cakhd6ir44fakkqsm799rrfp5qcjdls4nvdu4r3nco80stdd86tdo2hhh0ulcpoaofnrnkjun04kqnfmjqio8#1 builtin.io2.StdHandle.StdOut : StdHandle - 428. -- ##STM + 429. -- ##STM builtin type builtin.io2.STM - 429. -- ##STM.atomically + 430. -- ##STM.atomically builtin.io2.STM.atomically : '{STM} a ->{IO} a - 430. -- ##STM.retry + 431. -- ##STM.retry builtin.io2.STM.retry : '{STM} a - 431. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g + 432. -- #cggbdfff21ac5uedf4qvn4to83clinvhsovrila35u7f7e73g4l6hoj8pjmjnk713a8luhnn4bi1j9ai1nl0can1un66hvg230eog9g unique type builtin.io2.STMFailure - 432. -- ##ThreadId + 433. -- ##ThreadId builtin type builtin.io2.ThreadId - 433. -- #ggh649864d9bfnk90n7kgtj7dflddc4kn8osu7u7mub8p7l8biid8dgtungj4u005h7karbgupfpum9jp94spks3ma1sgh39bhirv38 + 434. -- #ggh649864d9bfnk90n7kgtj7dflddc4kn8osu7u7mub8p7l8biid8dgtungj4u005h7karbgupfpum9jp94spks3ma1sgh39bhirv38 unique type builtin.io2.ThreadKilledFailure - 434. -- ##Tls + 435. -- ##Tls builtin type builtin.io2.Tls - 435. -- ##Tls.Cipher + 436. -- ##Tls.Cipher builtin type builtin.io2.Tls.Cipher - 436. -- ##Tls.ClientConfig + 437. -- ##Tls.ClientConfig builtin type builtin.io2.Tls.ClientConfig - 437. -- ##Tls.ClientConfig.certificates.set + 438. -- ##Tls.ClientConfig.certificates.set builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 438. -- ##TLS.ClientConfig.ciphers.set + 439. -- ##TLS.ClientConfig.ciphers.set builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 439. -- ##Tls.ClientConfig.default + 440. -- ##Tls.ClientConfig.default builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 440. -- ##Tls.ClientConfig.versions.set + 441. -- ##Tls.ClientConfig.versions.set builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 441. -- ##Tls.decodeCert.impl.v3 + 442. -- ##Tls.decodeCert.impl.v3 builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 442. -- ##Tls.decodePrivateKey + 443. -- ##Tls.decodePrivateKey builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 443. -- ##Tls.encodeCert + 444. -- ##Tls.encodeCert builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 444. -- ##Tls.encodePrivateKey + 445. -- ##Tls.encodePrivateKey builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 445. -- ##Tls.handshake.impl.v3 + 446. -- ##Tls.handshake.impl.v3 builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 446. -- ##Tls.newClient.impl.v3 + 447. -- ##Tls.newClient.impl.v3 builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 447. -- ##Tls.newServer.impl.v3 + 448. -- ##Tls.newServer.impl.v3 builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 448. -- ##Tls.PrivateKey + 449. -- ##Tls.PrivateKey builtin type builtin.io2.Tls.PrivateKey - 449. -- ##Tls.receive.impl.v3 + 450. -- ##Tls.receive.impl.v3 builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 450. -- ##Tls.send.impl.v3 + 451. -- ##Tls.send.impl.v3 builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 451. -- ##Tls.ServerConfig + 452. -- ##Tls.ServerConfig builtin type builtin.io2.Tls.ServerConfig - 452. -- ##Tls.ServerConfig.certificates.set + 453. -- ##Tls.ServerConfig.certificates.set builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 453. -- ##Tls.ServerConfig.ciphers.set + 454. -- ##Tls.ServerConfig.ciphers.set builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 454. -- ##Tls.ServerConfig.default + 455. -- ##Tls.ServerConfig.default builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 455. -- ##Tls.ServerConfig.versions.set + 456. -- ##Tls.ServerConfig.versions.set builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 456. -- ##Tls.SignedCert + 457. -- ##Tls.SignedCert builtin type builtin.io2.Tls.SignedCert - 457. -- ##Tls.terminate.impl.v3 + 458. -- ##Tls.terminate.impl.v3 builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 458. -- ##Tls.Version + 459. -- ##Tls.Version builtin type builtin.io2.Tls.Version - 459. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 + 460. -- #r3gag1btclr8iclbdt68irgt8n1d1vf7agv5umke3dgdbl11acj6easav6gtihanrjnct18om07638rne9ej06u2bkv2v4l36knm2l0 unique type builtin.io2.TlsFailure - 460. -- ##TVar + 461. -- ##TVar builtin type builtin.io2.TVar - 461. -- ##TVar.new + 462. -- ##TVar.new builtin.io2.TVar.new : a ->{STM} TVar a - 462. -- ##TVar.newIO + 463. -- ##TVar.newIO builtin.io2.TVar.newIO : a ->{IO} TVar a - 463. -- ##TVar.read + 464. -- ##TVar.read builtin.io2.TVar.read : TVar a ->{STM} a - 464. -- ##TVar.readIO + 465. -- ##TVar.readIO builtin.io2.TVar.readIO : TVar a ->{IO} a - 465. -- ##TVar.swap + 466. -- ##TVar.swap builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 466. -- ##TVar.write + 467. -- ##TVar.write builtin.io2.TVar.write : TVar a -> a ->{STM} () - 467. -- ##validateSandboxed + 468. -- ##validateSandboxed builtin.io2.validateSandboxed : [Link.Term] -> a -> Boolean - 468. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 + 469. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8 unique type builtin.IsPropagated - 469. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 + 470. -- #c23jofurcegj93796o0karmkcm6baifupiuu1rtkniu74avn6a4r1n66ga5rml5di7easkgn4iak800u3tnb6kfisbrv6tcfgkb13a8#0 builtin.IsPropagated.IsPropagated : IsPropagated - 470. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 + 471. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0 unique type builtin.IsTest - 471. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 + 472. -- #q6snodsh7i7u6k7gtqj73tt7nv6htjofs5f37vg2v3dsfk6hau71fs5mcv0hq3lqg111fsvoi92mngm08850aftfgh65uka9mhqvft0#0 builtin.IsTest.IsTest : IsTest - 472. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g + 473. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g unique type builtin.License - 473. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 + 474. -- #knhl4mlkqf0mt877flahlbas2ufb7bub8f11vi9ihh9uf7r6jqaglk7rm6912q1vml50866ddl0qfa4o6d7o0gomchaoae24m0u2nk8 builtin.License.copyrightHolders : License -> [CopyrightHolder] - 474. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo + 475. -- #ucpi54l843bf1osaejl1cnn0jt3o89fak5c0120k8256in3m80ik836hnite0osl12m91utnpnt5n7pgm3oe1rv4r1hk8ai4033agvo builtin.License.copyrightHolders.modify : ([CopyrightHolder] ->{g} [CopyrightHolder]) -> License ->{g} License - 475. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro + 476. -- #9hbbfn61d2odn8jvtj5da9n1e9decsrheg6chg73uf94oituv3750b9hd6vp3ljhi54dkp5uqfg57j66i39bstfd8ivgav4p3si39ro builtin.License.copyrightHolders.set : [CopyrightHolder] -> License -> License - 476. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 + 477. -- #68haromionghg6cvojngjrgc7t0ob658nkk8b20fpho6k6ltjtf6rfmr4ia1omige97hk34lu21qsj933vl1dkpbna7evbjfkh71r9g#0 builtin.License.License : [CopyrightHolder] -> [Year] -> LicenseType -> License - 477. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g + 478. -- #aqi4h1bfq2rjnrrfanf4nut8jd1elkkc00u1tn0rmt9ocsrds8i8pha7q9cihvbiq7edpg21iqnfornimae2gad0ab8ih0bksjnoi4g builtin.License.licenseType : License -> LicenseType - 478. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo + 479. -- #1rm8kpbv278t9tqj4jfssl8q3cn4hgu1mti7bp8lhcr5h7qmojujmt9de4c31p42to8mtav61u98oad3oen8q9im20sacs69psjpugo builtin.License.licenseType.modify : (LicenseType ->{g} LicenseType) -> License ->{g} License - 479. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o + 480. -- #dv9jsg0ksrlp3g0uftvkutpa8matt039o7dhat9airnkto2b703mgoi5t412hdi95pdhp9g01luga13ihmp52nk6bgh788gts6elv2o builtin.License.licenseType.set : LicenseType -> License -> License - 480. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig + 481. -- #fh5qbeba2hg5c5k9uppi71rfghj8df37p4cg3hk23b9pv0hpm67ok807f05t368rn6v99v7kvf7cp984v8ipkjr1j1h095g6nd9jtig builtin.License.years : License -> [Year] - 481. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 + 482. -- #2samr066hti71pf0fkvb4niemm7j3amvaap3sk1dqpihqp9g8f8lknhhmjq9atai6j5kcs4huvfokvpm15ebefmfggr4hd2cetf7co0 builtin.License.years.modify : ([Year] ->{g} [Year]) -> License ->{g} License - 482. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo + 483. -- #g3ap8lg6974au4meb2hl49k1k6f048det9uckmics3bkt9s571921ksqfdsch63k2pk3fij8pn697svniakkrueddh8nkflnmjk9ffo builtin.License.years.set : [Year] -> License -> License - 483. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 + 484. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0 unique type builtin.LicenseType - 484. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 + 485. -- #uj652rrb45urfnojgt1ssqoji7iiibu27uhrc1sfl68lm54hbr7r1dpgppsv0pvf0oile2uk2h2gn1h4vgng30fga66idihhen14qc0#0 builtin.LicenseType.LicenseType : Doc -> LicenseType - 485. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 + 486. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0 unique type builtin.Link - 486. -- ##Link.Term + 487. -- ##Link.Term builtin type builtin.Link.Term - 487. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 + 488. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#0 builtin.Link.Term : Link.Term -> Link - 488. -- ##Link.Term.toText + 489. -- ##Link.Term.toText builtin.Link.Term.toText : Link.Term -> Text - 489. -- ##Link.Type + 490. -- ##Link.Type builtin type builtin.Link.Type - 490. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 + 491. -- #f4b37niu61dc517c32h3os36ig34fgnt7inaaoqdbecmscchthi14gdo0vj3eee1ru746ibvl9vnmm1pglrv3125qnhsbc0i1tqtic0#1 builtin.Link.Type : Type -> Link - 491. -- ##Sequence + 492. -- ##Sequence builtin type builtin.List - 492. -- ##List.++ + 493. -- ##List.++ builtin.List.++ : [a] -> [a] -> [a] - 493. -- ##List.cons + 494. -- ##List.cons builtin.List.+:, builtin.List.cons : a -> [a] -> [a] - 494. -- ##List.snoc + 495. -- ##List.snoc builtin.List.:+, builtin.List.snoc : [a] -> a -> [a] - 495. -- ##List.at + 496. -- ##List.at builtin.List.at : Nat -> [a] -> Optional a - 496. -- ##List.cons + 497. -- ##List.cons builtin.List.cons, builtin.List.+: : a -> [a] -> [a] - 497. -- ##List.drop + 498. -- ##List.drop builtin.List.drop : Nat -> [a] -> [a] - 498. -- ##List.empty + 499. -- ##List.empty builtin.List.empty : [a] - 499. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 + 500. -- #a8ia0nqfghkpj4dt0t5gsk96tsfv6kg1k2cf7d7sb83tkqosebfiib2bkhjq48tc2v8ld94gf9o3hvc42pf6j49q75k0br395qavli0 builtin.List.map : (a ->{e} b) -> [a] ->{e} [b] - 500. -- ##List.size + 501. -- ##List.size builtin.List.size : [a] -> Nat - 501. -- ##List.snoc + 502. -- ##List.snoc builtin.List.snoc, builtin.List.:+ : [a] -> a -> [a] - 502. -- ##List.take + 503. -- ##List.take builtin.List.take : Nat -> [a] -> [a] - 503. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g + 504. -- #cb9e3iosob3e4q0v96ifmserg27samv1lvi4dh0l0l19phvct4vbbvv19abngneb77b02h8cefr1o3ad8gnm3cn6mjgsub97gjlte8g builtin.metadata.isPropagated : IsPropagated - 504. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko + 505. -- #lkpne3jg56pmqegv4jba6b5nnjg86qtfllnlmtvijql5lsf89rfu6tgb1s9ic0gsqs5si0v9agmj90lk0bhihbovd5o5ve023g4ocko builtin.metadata.isTest : IsTest - 505. -- ##MutableArray + 506. -- ##MutableArray builtin type builtin.MutableArray - 506. -- ##MutableArray.copyTo! + 507. -- ##MutableArray.copyTo! builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a @@ -1766,34 +1769,34 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 507. -- ##MutableArray.freeze + 508. -- ##MutableArray.freeze builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 508. -- ##MutableArray.freeze! + 509. -- ##MutableArray.freeze! builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 509. -- ##MutableArray.read + 510. -- ##MutableArray.read builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 510. -- ##MutableArray.size + 511. -- ##MutableArray.size builtin.MutableArray.size : MutableArray g a -> Nat - 511. -- ##MutableArray.write + 512. -- ##MutableArray.write builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 512. -- ##MutableByteArray + 513. -- ##MutableByteArray builtin type builtin.MutableByteArray - 513. -- ##MutableByteArray.copyTo! + 514. -- ##MutableByteArray.copyTo! builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g @@ -1801,688 +1804,688 @@ This transcript is intended to make visible accidental changes to the hashing al -> Nat ->{g, Exception} () - 514. -- ##MutableByteArray.freeze + 515. -- ##MutableByteArray.freeze builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 515. -- ##MutableByteArray.freeze! + 516. -- ##MutableByteArray.freeze! builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 516. -- ##MutableByteArray.read16be + 517. -- ##MutableByteArray.read16be builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 517. -- ##MutableByteArray.read24be + 518. -- ##MutableByteArray.read24be builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 518. -- ##MutableByteArray.read32be + 519. -- ##MutableByteArray.read32be builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 519. -- ##MutableByteArray.read40be + 520. -- ##MutableByteArray.read40be builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 520. -- ##MutableByteArray.read64be + 521. -- ##MutableByteArray.read64be builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 521. -- ##MutableByteArray.read8 + 522. -- ##MutableByteArray.read8 builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 522. -- ##MutableByteArray.size + 523. -- ##MutableByteArray.size builtin.MutableByteArray.size : MutableByteArray g -> Nat - 523. -- ##MutableByteArray.write16be + 524. -- ##MutableByteArray.write16be builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 524. -- ##MutableByteArray.write32be + 525. -- ##MutableByteArray.write32be builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 525. -- ##MutableByteArray.write64be + 526. -- ##MutableByteArray.write64be builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 526. -- ##MutableByteArray.write8 + 527. -- ##MutableByteArray.write8 builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 527. -- ##Nat + 528. -- ##Nat builtin type builtin.Nat - 528. -- ##Nat.* + 529. -- ##Nat.* builtin.Nat.* : Nat -> Nat -> Nat - 529. -- ##Nat.+ + 530. -- ##Nat.+ builtin.Nat.+ : Nat -> Nat -> Nat - 530. -- ##Nat./ + 531. -- ##Nat./ builtin.Nat./ : Nat -> Nat -> Nat - 531. -- ##Nat.and + 532. -- ##Nat.and builtin.Nat.and : Nat -> Nat -> Nat - 532. -- ##Nat.complement + 533. -- ##Nat.complement builtin.Nat.complement : Nat -> Nat - 533. -- ##Nat.drop + 534. -- ##Nat.drop builtin.Nat.drop : Nat -> Nat -> Nat - 534. -- ##Nat.== + 535. -- ##Nat.== builtin.Nat.eq : Nat -> Nat -> Boolean - 535. -- ##Nat.fromText + 536. -- ##Nat.fromText builtin.Nat.fromText : Text -> Optional Nat - 536. -- ##Nat.> + 537. -- ##Nat.> builtin.Nat.gt : Nat -> Nat -> Boolean - 537. -- ##Nat.>= + 538. -- ##Nat.>= builtin.Nat.gteq : Nat -> Nat -> Boolean - 538. -- ##Nat.increment + 539. -- ##Nat.increment builtin.Nat.increment : Nat -> Nat - 539. -- ##Nat.isEven + 540. -- ##Nat.isEven builtin.Nat.isEven : Nat -> Boolean - 540. -- ##Nat.isOdd + 541. -- ##Nat.isOdd builtin.Nat.isOdd : Nat -> Boolean - 541. -- ##Nat.leadingZeros + 542. -- ##Nat.leadingZeros builtin.Nat.leadingZeros : Nat -> Nat - 542. -- ##Nat.< + 543. -- ##Nat.< builtin.Nat.lt : Nat -> Nat -> Boolean - 543. -- ##Nat.<= + 544. -- ##Nat.<= builtin.Nat.lteq : Nat -> Nat -> Boolean - 544. -- ##Nat.mod + 545. -- ##Nat.mod builtin.Nat.mod : Nat -> Nat -> Nat - 545. -- ##Nat.or + 546. -- ##Nat.or builtin.Nat.or : Nat -> Nat -> Nat - 546. -- ##Nat.popCount + 547. -- ##Nat.popCount builtin.Nat.popCount : Nat -> Nat - 547. -- ##Nat.pow + 548. -- ##Nat.pow builtin.Nat.pow : Nat -> Nat -> Nat - 548. -- ##Nat.shiftLeft + 549. -- ##Nat.shiftLeft builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 549. -- ##Nat.shiftRight + 550. -- ##Nat.shiftRight builtin.Nat.shiftRight : Nat -> Nat -> Nat - 550. -- ##Nat.sub + 551. -- ##Nat.sub builtin.Nat.sub : Nat -> Nat -> Int - 551. -- ##Nat.toFloat + 552. -- ##Nat.toFloat builtin.Nat.toFloat : Nat -> Float - 552. -- ##Nat.toInt + 553. -- ##Nat.toInt builtin.Nat.toInt : Nat -> Int - 553. -- ##Nat.toText + 554. -- ##Nat.toText builtin.Nat.toText : Nat -> Text - 554. -- ##Nat.trailingZeros + 555. -- ##Nat.trailingZeros builtin.Nat.trailingZeros : Nat -> Nat - 555. -- ##Nat.xor + 556. -- ##Nat.xor builtin.Nat.xor : Nat -> Nat -> Nat - 556. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg + 557. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg structural type builtin.Optional a - 557. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 + 558. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#1 builtin.Optional.None : Optional a - 558. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 + 559. -- #nirp5os0q69o4e1u9p3t6mmq6l6otluefi3ksm7dhm0diidjvkkgl8o9bvnflbj0sanuvdusf34f1qrins3ktcaglpcqv9oums2slsg#0 builtin.Optional.Some : a -> Optional a - 559. -- ##Pattern + 560. -- ##Pattern builtin type builtin.Pattern - 560. -- ##Pattern.capture + 561. -- ##Pattern.capture builtin.Pattern.capture : Pattern a -> Pattern a - 561. -- ##Pattern.isMatch + 562. -- ##Pattern.isMatch builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 562. -- ##Pattern.join + 563. -- ##Pattern.join builtin.Pattern.join : [Pattern a] -> Pattern a - 563. -- ##Pattern.many + 564. -- ##Pattern.many builtin.Pattern.many : Pattern a -> Pattern a - 564. -- ##Pattern.or + 565. -- ##Pattern.or builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 565. -- ##Pattern.replicate + 566. -- ##Pattern.replicate builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 566. -- ##Pattern.run + 567. -- ##Pattern.run builtin.Pattern.run : Pattern a -> a -> Optional ([a], a) - 567. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg + 568. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg structural type builtin.Pretty txt - 568. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 + 569. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8 unique type builtin.Pretty.Annotated w txt - 569. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 + 570. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#1 builtin.Pretty.Annotated.Append : w -> [Annotated w txt] -> Annotated w txt - 570. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 + 571. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#6 builtin.Pretty.Annotated.Empty : Annotated w txt - 571. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 + 572. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#4 builtin.Pretty.Annotated.Group : w -> Annotated w txt -> Annotated w txt - 572. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 + 573. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#3 builtin.Pretty.Annotated.Indent : w -> Annotated w txt -> Annotated w txt -> Annotated w txt -> Annotated w txt - 573. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 + 574. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#7 builtin.Pretty.Annotated.Lit : w -> txt -> Annotated w txt - 574. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 + 575. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#2 builtin.Pretty.Annotated.OrElse : w -> Annotated w txt -> Annotated w txt -> Annotated w txt - 575. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 + 576. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#0 builtin.Pretty.Annotated.Table : w -> [[Annotated w txt]] -> Annotated w txt - 576. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 + 577. -- #fqfaur9v9v4fks5d0c74ouitpjp121c3fbu2l9t05km8otjcj43gk453vu668pg54rte6qmh4v3uao6vbfpntrtaq057jgni1jk8fj8#5 builtin.Pretty.Annotated.Wrap : w -> Annotated w txt -> Annotated w txt - 577. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg + 578. -- #svdhl4ogs0m1pe7ihtq5q9td72mg41tmndqif4kktbtv4p8e1ciapaj8kvflfbm876llbh60tlkefpi0v0bra8hl7mfgnpscimeqtdg builtin.Pretty.append : Pretty txt -> Pretty txt -> Pretty txt - 578. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 + 579. -- #sonptakf85a3uklev4rq0pub00k56jdpaop4tcd9bmk0gmjjij5t16sf1knspku2hbp0uikiflbo0dtjv1i6r3t2rpjh86vo1rlaer8 builtin.Pretty.empty : Pretty txt - 579. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo + 580. -- #mlpplm1bhqkcif5j09204uuvfll7qte95msb0skjfd30nmei005kiich1ao39gm2j8687s14qvf5llu6i1a6fvt4vdmbp99jlfundfo builtin.Pretty.get : Pretty txt -> Annotated () txt - 580. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 + 581. -- #d9m2k9igi4b50cp7v5tlp3o7dot6r41rbbbsc2a4iqae3hc2a7fceh83l1n3nuotfnn7nrgt40s1kfbcnl89qcqieih125gsafk2d00 builtin.Pretty.group : Pretty txt -> Pretty txt - 581. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno + 582. -- #p6rkh0u8gfko2fpqdje6h8cain3qakom06a28rh4ccsjsnbagmmv6gadccg4t380c4nnetq9si7bkkvbh44it4lrfvfvcn4usps1uno builtin.Pretty.indent : Pretty txt -> Pretty txt -> Pretty txt - 582. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug + 583. -- #f59sgojafl5so8ei4vgdpqflqcpsgovpcea73509k5qm1jb8vkeojsfsavhn64gmfpd52uo631ejqu0oj2a6t6k8jcu282lbqjou7ug builtin.Pretty.indent' : Pretty txt -> Pretty txt -> Pretty txt -> Pretty txt - 583. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo + 584. -- #hpntja4i04u36vijdesobh75pubru68jf1fhgi49jl3nf6kall1so8hfc0bq0pm8r9kopgskiigdl04hqelklsdrdjndq5on9hsjgmo builtin.Pretty.join : [Pretty txt] -> Pretty txt - 584. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 + 585. -- #jtn2i6bg3gargdp2rbk08jfd327htap62brih8phdfm2m4d6ib9cu0o2k5vrh7f4jik99eufu4hi0114akgd1oiivi8p1pa9m2fvjv0 builtin.Pretty.lit : txt -> Pretty txt - 585. -- #kfgfekabh7tiprb6ljjkf4qa5puqp6bbpe1oiqv9r39taljs8ahtb518mpcmec3plesvpssn3bpgvq3e7d71giot6lb2j7mbk23dtqo + 586. -- #kfgfekabh7tiprb6ljjkf4qa5puqp6bbpe1oiqv9r39taljs8ahtb518mpcmec3plesvpssn3bpgvq3e7d71giot6lb2j7mbk23dtqo builtin.Pretty.map : (txt ->{g} txt2) -> Pretty txt ->{g} Pretty txt2 - 586. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 + 587. -- #5rfcm6mlv2njfa8l9slkjp1q2q5r6m1vkp084run6pd632cf02mcpoh2bo3kuqf3uqbb5nh2drf37u51lpf16m5u415tcuk18djnr60 builtin.Pretty.orElse : Pretty txt -> Pretty txt -> Pretty txt - 587. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 + 588. -- #cbo8de57n17pgc5iic1741jeiunhvhfcfd7gt79vd6516u64aplasdodqoouejbgovhge2le5jb6rje923fcrllhtu01t29cdrssgbg#0 builtin.Pretty.Pretty : Annotated () txt -> Pretty txt - 588. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g + 589. -- #qg050nfl4eeeiarp5mvun3j15h3qpgo31a01o03mql8rrrpht3o6h6htov9ghm7cikkbjejgu4vd9v3h1idp0hanol93pqpqiq8rg3g builtin.Pretty.sepBy : Pretty txt -> [Pretty txt] -> Pretty txt - 589. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro + 590. -- #ev99k0kpivu29vfl7k8pf5n55fnnelq78ul7jqjrk946i1ckvrs5lmrji3l2avhd02mljspdbfspcn26phaqkug6p7rocbbf94uhcro builtin.Pretty.table : [[Pretty txt]] -> Pretty txt - 590. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 + 591. -- #7c4jq9udglq9n7pfemqmc7qrks18r80t9dgjefpi78aerb1vo8cakc3fv843dg3h60ihbo75u0jrmbhqk0och8be2am98v3mu5f6v10 builtin.Pretty.wrap : Pretty txt -> Pretty txt - 591. -- ##Ref + 592. -- ##Ref builtin type builtin.Ref - 592. -- ##Ref.read + 593. -- ##Ref.read builtin.Ref.read : Ref g a ->{g} a - 593. -- ##Ref.write + 594. -- ##Ref.write builtin.Ref.write : Ref g a -> a ->{g} () - 594. -- ##Effect + 595. -- ##Effect builtin type builtin.Request - 595. -- ##Scope + 596. -- ##Scope builtin type builtin.Scope - 596. -- ##Scope.array + 597. -- ##Scope.array builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 597. -- ##Scope.arrayOf + 598. -- ##Scope.arrayOf builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 598. -- ##Scope.bytearray + 599. -- ##Scope.bytearray builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 599. -- ##Scope.bytearrayOf + 600. -- ##Scope.bytearrayOf builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 600. -- ##Scope.ref + 601. -- ##Scope.ref builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 601. -- ##Scope.run + 602. -- ##Scope.run builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 602. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 + 603. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320 structural type builtin.SeqView a b - 603. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 + 604. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#0 builtin.SeqView.VElem : a -> b -> SeqView a b - 604. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 + 605. -- #6uigas14aqgd889s036hq9ssrlo22pju41009m0rktetcrbm97qniljjc1rv1u661r4f63oq6pupoevghs8a2hupvlbi6qi4ntn9320#1 builtin.SeqView.VEmpty : SeqView a b - 605. -- ##Socket.toText + 606. -- ##Socket.toText builtin.Socket.toText : Socket -> Text - 606. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo + 607. -- #pfp0ajb4v2mb9tspp29v53dkacb76aa1t5kbk1dl0q354cjcg4egdpmvtr5d6t818ucon9eubf6r1vdvh926fgk8otvbkvbpn90levo builtin.syntax.docAside : Doc2 -> Doc2 - 607. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 + 608. -- #mvov9qf78ctohefjbmrgs8ussspo5juhf75pee4ikkg8asuos72unn4pjn3fdel8471soj2vaskd5ls103pb6nb8qf75sjn4igs7v48 builtin.syntax.docBlockquote : Doc2 -> Doc2 - 608. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 + 609. -- #cg64hg7dag89u80104kit2p40rhmo1k6h1j8obfhjolpogs705bt6hc92ct6rfj8h74m3ioug14u9pm1s7qqpmjda2srjojhi01nvf0 builtin.syntax.docBold : Doc2 -> Doc2 - 609. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg + 610. -- #3qd5kt9gjiggrb871al82n11jccedl3kb5p8ffemr703frn38tqajkett30fg7hef5orh7vl0obp3lap9qq2po3ufcnu4k3bik81rlg builtin.syntax.docBulletedList : [Doc2] -> Doc2 - 610. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 + 611. -- #el0rph43k5qg25qg20o5jdjukuful041r87v92tcb2339om0hp9u6vqtrcrfkvgj78hrpo2o1l39bbg1oier87pvgkli0lkgalgpo90 builtin.syntax.docCallout : Optional Doc2 -> Doc2 -> Doc2 - 611. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo + 612. -- #7jij106qpusbsbpqhmtgrk59qo8ss9e77rtrc1h9hbpnbab8sq717fe6hppmhhds9smqbv3k2q0irjgoe4mogatlp9e4k25kopt6rgo builtin.syntax.docCode : Doc2 -> Doc2 - 612. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 + 613. -- #3paq4qqrk028tati33723c4aqi7ebgnjln12avbnf7eu8h8sflg0frlehb4lni4ru0pcfg9ftsurq3pb2q11cfebeki51vom697l7h0 builtin.syntax.docCodeBlock : Text -> Text -> Doc2 - 613. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 + 614. -- #1of955s8tqa74vu0ve863p8dn2mncc2anmms54aj084pkbdcpml6ckvs0qb4defi0df3b1e8inp29p60ac93hf2u7to0je4op9fum40 builtin.syntax.docColumn : [Doc2] -> Doc2 - 614. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 + 615. -- #ukv56cjchfao07qb08l7iimd2mmv09s5glmtljo5b71leaijtja04obd0u1hsr38itjnv85f7jvd37nr654bl4lfn4msr1one0hi4s0 builtin.syntax.docEmbedAnnotation : tm -> Doc2.Term - 615. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg + 616. -- #uccvv8mn62ne8iqppsnpgbquqmhk4hk3n4tg7p6kttr20gov4698tu18jmmvdcs7ab455q7kklhb4uv1mtei4vbvq4qmbtbu1dbagmg builtin.syntax.docEmbedAnnotations : tms -> tms - 616. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 + 617. -- #h53vvsbp1eflh5n41fepa5dana1ucfjbk8qc95kf4ht12svn304hc4fv431hiejspdr84oul4gmd3s65neil759q0hmjjrr8ottc6v0 builtin.syntax.docEmbedSignatureLink : '{g} t -> Doc2.Term - 617. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao + 618. -- #dvjs6ebt2ej6funsr6rv351aqe5eqt8pcbte5hpqossikbnqrblhhnve55pdg896s4e6dvd6m3us0151ejegfg1fi8kbfd7soa31dao builtin.syntax.docEmbedTermLink : '{g} t -> Either a Doc2.Term - 618. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 + 619. -- #7t98ois54isfkh31uefvdg4bg302s5q3sun4hfh0mqnosk4ded353jp0p2ij6b22vnvlcbipcv2jb91suh6qc33i7uqlfuto9f0r4n8 builtin.syntax.docEmbedTypeLink : typ -> Either typ b - 619. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg + 620. -- #r26nnrb8inld7nstp0rj4sbh7ldbibo3s6ld4hmii114i8fglrvij0a1jgj70u51it80s5vgj5dvu9oi5gqmr2n7j341tg8285mpesg builtin.syntax.docEval : 'a -> Doc2 - 620. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g + 621. -- #ojecdd8rnla7dqqop5a43u8kl12149l24452thb0ljkb99ivh6n2evg3g43dj6unlbsmbuvj5g9js5hvsi9f13lt22uqkueioe1vi9g builtin.syntax.docEvalInline : 'a -> Doc2 - 621. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 + 622. -- #lecedgertb8tj69o0f2bqeso83hl454am6cjp708epen78s5gtr0ljcc6agopns65lnm3du36dr4m4qu9rp8rtjvtcpg359bpbnfcm0 builtin.syntax.docExample : Nat -> '{g} t -> Doc2 - 622. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 + 623. -- #m4ini2v12rc468iflsee87m1qrm52b257e3blah4pcblqo2np3k6ad50bt5gkjob3qrct3jbihjd6i02t7la9oh3cft1d0483lf1pq0 builtin.syntax.docExampleBlock : Nat -> '{g} t -> Doc2 - 623. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 + 624. -- #pomj7lft70jnnuk5job0pstih2mosva1oee4tediqbkhnm54tjqnfe6qs1mqt8os1ehg9ksgenb6veub2ngdpb1qat400vn0bj3fju0 builtin.syntax.docFoldedSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 624. -- #inrar1e9lnt58n0ru88v05a9d9d0la94m7ok5l6i7pr3pg4lapc9vegr542ffog1kl7pfqhmltr53of3qkci8nnrt8gig93qsnggisg + 625. -- #inrar1e9lnt58n0ru88v05a9d9d0la94m7ok5l6i7pr3pg4lapc9vegr542ffog1kl7pfqhmltr53of3qkci8nnrt8gig93qsnggisg builtin.syntax.docFormatConsole : Doc2 -> Pretty (Either SpecialForm ConsoleText) - 625. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 + 626. -- #99qvifgs3u7nof50jbp5lhrf8cab0qiujr1tque2b7hfj56r39o8ot2fafhafuphoraddl1j142k994e22g5v2rhq98flc0954t5918 builtin.syntax.docGroup : Doc2 -> Doc2 - 626. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 + 627. -- #gsratvk7mo273bqhivdv06f9rog2cj48u7ci0jp6ubt5oidf8cq0rjilimkas5801inbbsjcedh61jl40i3en1qu6r9vfe684ad6r08 builtin.syntax.docItalic : Doc2 -> Doc2 - 627. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 + 628. -- #piohhscvm6lgpk6vfg91u2ndmlfv81nnkspihom77ucr4dev6s22rk2n9hp38nifh5p8vt7jfvep85vudpvlg2tt99e9s2qfjv5oau8 builtin.syntax.docJoin : [Doc2] -> Doc2 - 628. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 + 629. -- #hjdqcolihf4obmnfoakl2t5hs1e39hpmpo9ijvc37fqgejog1ii7fpd4q2fe2rkm62tf81unmqlbud8uh63vaa9feaekg5a7uo3nq00 builtin.syntax.docLink : Either Type Doc2.Term -> Doc2 - 629. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo + 630. -- #iv6urr76b0ohvr22qa6d05e7e01cd0re77g8c98cm0bqo0im345fotsevqnhk1igtutkrrqm562gtltofvku5mh0i87ru8tdf0i53bo builtin.syntax.docNamedLink : Doc2 -> Doc2 -> Doc2 - 630. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 + 631. -- #b5dvn0bqj3rc1rkmlep5f6cd6n3vp247hqku8lqndena5ocgcoae18iuq3985finagr919re4fvji011ved0g21i6o0je2jn8f7k1p0 builtin.syntax.docNumberedList : Nat -> [Doc2] -> Doc2 - 631. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 + 632. -- #fs8mho20fqj31ch5kpn8flm4geomotov7fb5ct8mtnh52ladorgp22vder3jgt1mr0u710e6s9gn4u36c9sp19vitvq1r0adtm3t1c0 builtin.syntax.docParagraph : [Doc2] -> Doc2 - 632. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso + 633. -- #6dvkai3hc122e2h2h8c3jnijink5m20e27i640qvnt6smefpp2vna1rq4gbmulhb46tdabmkb5hsjeiuo4adtsutg4iu1vfmqhlueso builtin.syntax.docSection : Doc2 -> [Doc2] -> Doc2 - 633. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 + 634. -- #n0idf1bdrq5vgpk4pj9db5demk1es4jsnpodfoajftehvqjelsi0h5j2domdllq2peltdek4ptaqfpl4o8l6jpmqhcom9vq107ivdu0 builtin.syntax.docSignature : [Doc2.Term] -> Doc2 - 634. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 + 635. -- #git1povkck9jrptdmmpqrv1g17ptbq9hr17l52l8477ijk4cia24tr7cj36v1o22mvtk00qoo5jt4bs4e79sl3eh6is8ubh8aoc1pu0 builtin.syntax.docSignatureInline : Doc2.Term -> Doc2 - 635. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 + 636. -- #47agivvofl1jegbqpdg0eeed72mdj29d623e4kdei0l10mhgckif7q2pd968ggribregcknra9u43mhehr1q86n0t4vbe4eestnu9l8 builtin.syntax.docSource : [( Either Type Doc2.Term, [Doc2.Term])] -> Doc2 - 636. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 + 637. -- #n6uk5tc4d8ipbga8boelh51ro24paveca9fijm1nkn3tlfddqludmlppb2ps8807v2kuou1a262sa59764mdhug2va69q4sls5jli10 builtin.syntax.docSourceElement : link -> annotations -> (link, annotations) - 637. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag + 638. -- #nurq288b5rfp1f5keccleh51ojgcpd2rp7cane6ftquf7gidtamffb8tr1r5h6luk1nsrqomn1k4as4kcpaskjjv35rnvoous457sag builtin.syntax.docStrikethrough : Doc2 -> Doc2 - 638. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g + 639. -- #4ns2amu2njhvb5mtdvh3v7oljjb5ammnb41us4ekpbhb337b6mo2a4q0790cmrusko7omphtfdsaust2fn49hr5acl40ef8fkb9556g builtin.syntax.docTable : [[Doc2]] -> Doc2 - 639. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo + 640. -- #i77kddfr68gbjt3767a091dtnqff9beltojh93md8peo28t59c6modeccsfd2tnrtmd75fa7dn0ie21kcv4me098q91h4ftg9eau5fo builtin.syntax.docTooltip : Doc2 -> Doc2 -> Doc2 - 640. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 + 641. -- #r0hdacbk2orcb2ate3uhd7ht05hmfa8643slm3u63nb3jaaim533up04lgt0pq97is43v2spkqble7mtu8f63hgcc0k2tb2jhpr2b68 builtin.syntax.docTransclude : d -> d - 641. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 + 642. -- #0nptdh40ngakd2rh92bl573a7vbdjcj2kc8rai39v8bb9dfpbj90i7nob381usjsott41c3cpo2m2q095fm0k0r68e8mrda135qa1k0 builtin.syntax.docUntitledSection : [Doc2] -> Doc2 - 642. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo + 643. -- #krjm78blt08v52c52l4ubsnfidcrs0h6010j2v2h9ud38mgm6jj4vuqn4okp4g75039o7u78sbg6ghforucbfdf94f8am9kvt6875jo builtin.syntax.docVerbatim : Doc2 -> Doc2 - 643. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 + 644. -- #c14vgd4g1tkumf4jjd9vcoos1olb3f4gbc3hketf5l8h3i0efk8igbinh6gn018tr5075uo5nv1elva6tki6ofo3pdafidrkv9m0ot0 builtin.syntax.docWord : Text -> Doc2 - 644. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 + 645. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0 unique type builtin.Test.Result - 645. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 + 646. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#0 builtin.Test.Result.Fail : Text -> Result - 646. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 + 647. -- #aql7qk3iud6vs4cvu43aimopoosgk0fnipibdkc3so13adencmibgfn0u5c01r0adei55nkl3ttsjhl8gbj7tr4gnpj63g64ftbq6s0#1 builtin.Test.Result.Ok : Text -> Result - 647. -- ##Text + 648. -- ##Text builtin type builtin.Text - 648. -- ##Text.!= + 649. -- ##Text.!= builtin.Text.!= : Text -> Text -> Boolean - 649. -- ##Text.++ + 650. -- ##Text.++ builtin.Text.++ : Text -> Text -> Text - 650. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do + 651. -- #nv11qo7s2lqirk3qb44jkm3q3fb6i3mn72ji2c52eubh3kufrdumanblh2bnql1o24efdhmue0v21gd7d1p5ec9j6iqrmekas0183do builtin.Text.alignLeftWith : Nat -> Char -> Text -> Text - 651. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg + 652. -- #ebeq250fdoigvu89fneb4c24f8f18eotc8kocdmosn4ri9shoeeg7ofkejts6clm5c6bifce66qtr0vpfkrhuup2en3khous41hp8rg builtin.Text.alignRightWith : Nat -> Char -> Text -> Text - 652. -- ##Text.drop + 653. -- ##Text.drop builtin.Text.drop : Nat -> Text -> Text - 653. -- ##Text.empty + 654. -- ##Text.empty builtin.Text.empty : Text - 654. -- ##Text.== + 655. -- ##Text.== builtin.Text.eq : Text -> Text -> Boolean - 655. -- ##Text.fromCharList + 656. -- ##Text.fromCharList builtin.Text.fromCharList : [Char] -> Text - 656. -- ##Text.fromUtf8.impl.v3 + 657. -- ##Text.fromUtf8.impl.v3 builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 657. -- ##Text.> + 658. -- ##Text.> builtin.Text.gt : Text -> Text -> Boolean - 658. -- ##Text.>= + 659. -- ##Text.>= builtin.Text.gteq : Text -> Text -> Boolean - 659. -- ##Text.< + 660. -- ##Text.< builtin.Text.lt : Text -> Text -> Boolean - 660. -- ##Text.<= + 661. -- ##Text.<= builtin.Text.lteq : Text -> Text -> Boolean - 661. -- ##Text.patterns.anyChar + 662. -- ##Text.patterns.anyChar builtin.Text.patterns.anyChar : Pattern Text - 662. -- ##Text.patterns.char + 663. -- ##Text.patterns.char builtin.Text.patterns.char : Class -> Pattern Text - 663. -- ##Text.patterns.charIn + 664. -- ##Text.patterns.charIn builtin.Text.patterns.charIn : [Char] -> Pattern Text - 664. -- ##Text.patterns.charRange + 665. -- ##Text.patterns.charRange builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 665. -- ##Text.patterns.digit + 666. -- ##Text.patterns.digit builtin.Text.patterns.digit : Pattern Text - 666. -- ##Text.patterns.eof + 667. -- ##Text.patterns.eof builtin.Text.patterns.eof : Pattern Text - 667. -- ##Text.patterns.letter + 668. -- ##Text.patterns.letter builtin.Text.patterns.letter : Pattern Text - 668. -- ##Text.patterns.literal + 669. -- ##Text.patterns.literal builtin.Text.patterns.literal : Text -> Pattern Text - 669. -- ##Text.patterns.notCharIn + 670. -- ##Text.patterns.notCharIn builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 670. -- ##Text.patterns.notCharRange + 671. -- ##Text.patterns.notCharRange builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 671. -- ##Text.patterns.punctuation + 672. -- ##Text.patterns.punctuation builtin.Text.patterns.punctuation : Pattern Text - 672. -- ##Text.patterns.space + 673. -- ##Text.patterns.space builtin.Text.patterns.space : Pattern Text - 673. -- ##Text.repeat + 674. -- ##Text.repeat builtin.Text.repeat : Nat -> Text -> Text - 674. -- ##Text.reverse + 675. -- ##Text.reverse builtin.Text.reverse : Text -> Text - 675. -- ##Text.size + 676. -- ##Text.size builtin.Text.size : Text -> Nat - 676. -- ##Text.take + 677. -- ##Text.take builtin.Text.take : Nat -> Text -> Text - 677. -- ##Text.toCharList + 678. -- ##Text.toCharList builtin.Text.toCharList : Text -> [Char] - 678. -- ##Text.toLowercase + 679. -- ##Text.toLowercase builtin.Text.toLowercase : Text -> Text - 679. -- ##Text.toUppercase + 680. -- ##Text.toUppercase builtin.Text.toUppercase : Text -> Text - 680. -- ##Text.toUtf8 + 681. -- ##Text.toUtf8 builtin.Text.toUtf8 : Text -> Bytes - 681. -- ##Text.uncons + 682. -- ##Text.uncons builtin.Text.uncons : Text -> Optional (Char, Text) - 682. -- ##Text.unsnoc + 683. -- ##Text.unsnoc builtin.Text.unsnoc : Text -> Optional (Text, Char) - 683. -- ##ThreadId.toText + 684. -- ##ThreadId.toText builtin.ThreadId.toText : ThreadId -> Text - 684. -- ##todo + 685. -- ##todo builtin.todo : a -> b - 685. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 + 686. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8 structural type builtin.Tuple a b - 686. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 + 687. -- #2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8#0 builtin.Tuple.Cons : a -> b -> Tuple a b - 687. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g + 688. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g structural type builtin.Unit - 688. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 + 689. -- #00nv2kob8fp11qdkr750rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7j3qcq0g#0 builtin.Unit.Unit : () - 689. -- ##Universal.< + 690. -- ##Universal.< builtin.Universal.< : a -> a -> Boolean - 690. -- ##Universal.<= + 691. -- ##Universal.<= builtin.Universal.<= : a -> a -> Boolean - 691. -- ##Universal.== + 692. -- ##Universal.== builtin.Universal.== : a -> a -> Boolean - 692. -- ##Universal.> + 693. -- ##Universal.> builtin.Universal.> : a -> a -> Boolean - 693. -- ##Universal.>= + 694. -- ##Universal.>= builtin.Universal.>= : a -> a -> Boolean - 694. -- ##Universal.compare + 695. -- ##Universal.compare builtin.Universal.compare : a -> a -> Int - 695. -- ##Universal.murmurHash + 696. -- ##Universal.murmurHash builtin.Universal.murmurHash : a -> Nat - 696. -- ##unsafe.coerceAbilities + 697. -- ##unsafe.coerceAbilities builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 697. -- ##Value + 698. -- ##Value builtin type builtin.Value - 698. -- ##Value.dependencies + 699. -- ##Value.dependencies builtin.Value.dependencies : Value -> [Link.Term] - 699. -- ##Value.deserialize + 700. -- ##Value.deserialize builtin.Value.deserialize : Bytes -> Either Text Value - 700. -- ##Value.load + 701. -- ##Value.load builtin.Value.load : Value ->{IO} Either [Link.Term] a - 701. -- ##Value.serialize + 702. -- ##Value.serialize builtin.Value.serialize : Value -> Bytes - 702. -- ##Value.value + 703. -- ##Value.value builtin.Value.value : a -> Value - 703. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo + 704. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo unique type builtin.Year - 704. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 + 705. -- #dem6aglnj8cppfrnq9qipl7geo5pim3auo9cmv1rhh5la9edalj19sspbpm1pd4vh0plokdh6qfo48gs034dqlg0s7j9fhr9p9ndtpo#0 builtin.Year.Year : Nat -> Year - 705. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 + 706. -- #k0rcrut9836hr3sevkivq4n2o3t540hllesila69b16gr5fcqe0i6aepqhv2qmso6h22lbipbp3fto0oc8o73l1lvf6vpifi01gmhg8 cache : [(Link.Term, Code)] ->{IO, Exception} () - 706. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 + 707. -- #okolgrio28p1mbl1bfjfs9qtsr1m9upblcm3ul872gcir6epkcbq619vk5bdq1fnr371nelsof6jsp8469g4j6f0gg3007p79o4kf18 check : Text -> Boolean ->{Stream Result} () - 707. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 + 708. -- #je42vk6rsefjlup01e1fmmdssf5i3ba9l6aka3bipggetfm8o4i8d1q5d7hddggu5jure1bu5ot8aq5in31to4788ctrtpb44ri83r8 checks : [Boolean] -> [Result] - 708. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o + 709. -- #barg6v1n15ea1qhp80i77gjjq3vu1noc67q2jkv9n6n5v0c9djup70ltauujgpfe0kuo8ckd20gc9kutngdpb8d22rubtb5rjldrb3o clientSocket : Text -> Text ->{IO, Exception} Socket - 709. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 + 710. -- #lg7i12ido0jr43ovdbhhv2enpk5ar869leouri5qhrivinde93nl86s2rgshubtfhlogbe310k3rluotscmus9moo1tvpn0nmp1efv8 closeFile : Handle ->{IO, Exception} () - 710. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 + 711. -- #4e6qn65v05l32n380lpf536u4llnp6f6tvvt13hvo0bhqeh3f3i8bquekc120c8h59gld1mf02ok0sje7037ipg1fsu97fqrm01oi00 closeSocket : Socket ->{IO, Exception} () - 711. -- #2cl9ivrimnadurkum2blduls21kcihu89oasj2efmi03s1vfm433pi6c4k1d2a3obpmf2orm3c9lfgffnlhuc6ktaa98a1ccdhfueqo + 712. -- #2cl9ivrimnadurkum2blduls21kcihu89oasj2efmi03s1vfm433pi6c4k1d2a3obpmf2orm3c9lfgffnlhuc6ktaa98a1ccdhfueqo Code.transitiveDeps : Link.Term ->{IO} [(Link.Term, Code)] - 712. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo + 713. -- #sfud7h76up0cofgk61b7tf8rhdlugfmg44lksnpglfes1b8po26si7betka39r9j8dpgueorjdrb1i7v4g62m5bci1e971eqi8dblmo compose : ∀ o g1 i1 g i. (i1 ->{g1} o) -> (i ->{g} i1) -> i ->{g1, g} o - 713. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano + 714. -- #b0tsob9a3fegn5dkb57jh15smd7ho2qo78st6qngpa7a8hc88mccl7vhido41o4otokv5l8hjdj3nabtkmpni5ikeatd44agmqbhano compose2 : ∀ o g2 i2 g1 g i i1. (i2 ->{g2} o) -> (i1 ->{g1} i ->{g} i2) @@ -2490,7 +2493,7 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g2, g1, g} o - 714. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg + 715. -- #m632ocgh2rougfejkddsso3vfpf4dmg1f8bhf0k6sha4g4aqfmbeuct3eo0je6dv9utterfvotjdu32p0kojuo9fj4qkp2g1bt464eg compose3 : ∀ o g3 i3 g2 g1 g i i1 i2. (i3 ->{g3} o) -> (i2 ->{g2} i1 ->{g1} i ->{g} i3) @@ -2499,318 +2502,318 @@ This transcript is intended to make visible accidental changes to the hashing al -> i ->{g3, g2, g1, g} o - 715. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo + 716. -- #ilkeid6l866bmq90d2v1ilqp9dsjo6ucmf8udgrokq3nr3mo9skl2vao2mo7ish136as52rsf19u9v3jkmd85bl08gnmamo4e5v2fqo contains : Text -> Text -> Boolean - 716. -- #pen6v1vcqdsg5ar8ajio0baiujthquamelbqd00p66amfjftk2o3stod4n81snc3hb9sc4fmnitf6ada0n5sfqfroi8sv1nbn7rnq48 + 717. -- #pen6v1vcqdsg5ar8ajio0baiujthquamelbqd00p66amfjftk2o3stod4n81snc3hb9sc4fmnitf6ada0n5sfqfroi8sv1nbn7rnq48 crawl : [(Link.Term, Code)] -> [Link.Term] ->{IO} [(Link.Term, Code)] - 717. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 + 718. -- #o0qn048fk7tjb8e7d54vq5mg9egr5kophb9pcm0to4aj0kf39mv76c6olsm27vj309d7nhjh4nps7098fpvqe8j5cfg01ghf3bnju90 createTempDirectory : Text ->{IO, Exception} Text - 718. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g + 719. -- #4858f4krb9l4ot1hml21j48lp3bcvbo8b9unlk33b9a3ovu1jrbr1k56pnfhffkiu1bht2ovh0i82nn5jnoc5s5ru85qvua0m2ol43g decodeCert : Bytes ->{Exception} SignedCert - 719. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 + 720. -- #ihbmfc4r7o3391jocjm6v4mojpp3hvt84ivqigrmp34vb5l3d7mmdlvh3hkrtebi812npso7rqo203a59pbs7r2g78ig6jvsv0nva38 delay : Nat ->{IO, Exception} () - 720. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg + 721. -- #dsen29k7605pkfquesnaphhmlm3pjkfgm7m2oc90m53gqvob4l39p4g3id3pirl8emg5tcdmr81ctl3lk1enm52mldlfmlh1i85rjbg directoryContents : Text ->{IO, Exception} [Text] - 721. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 + 722. -- #b22tpqhkq6kvt27dcsddnbfci2bcqutvhmumdven9c5psiilboq2mb8v9ekihtkl6mkartd5ml5u75u84v850n29l91de63lkg3ud38 Either.isLeft : Either a b -> Boolean - 722. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 + 723. -- #i1ec3csomb1pegm9r7ppabunabb7cq1t6bb6cvqtt72nd01jot7gde2mak288cbml910abbtho0smsbq17b2r33j599b0vuv7je04j8 Either.mapLeft : (i ->{g} o) -> Either i b ->{g} Either o b - 723. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg + 724. -- #f765l0pa2tb9ieciivum76s7bp8rdjr8j7i635jjenj9tacgba9eeomur4vv3uuh4kem1pggpmrn61a1e3im9g90okcm13r192f7alg Either.raiseMessage : v -> Either Text b ->{Exception} b - 724. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg + 725. -- #9hifem8o2e1g7tdh4om9kfo98ifr60gfmdp8ci58djn17epm1b4m6idli8b373bsrg487n87n4l50ksq76avlrbh9q2jpobkk18ucvg evalTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO, Exception} ([Result], a) - 725. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng + 726. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng structural ability Exception structural ability builtin.Exception - 726. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 + 727. -- #t20uuuiil07o22les8gv4sji7ju5esevloamnja3bjkrh2f250lgitv6595l6hlc2q64c1om0hhjqgter28dtnibb0dkr2j7e3ss530 Exception.catch : '{g, Exception} a ->{g} Either Failure a - 727. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 + 728. -- #hbhvk2e00l6o7qhn8e7p6dc36bjl7ljm0gn2df5clidlrdoufsig1gt5pjhg72kl67folgg2b892kh9jc1oh0l79h4p8dqhcf1tkde0 Exception.failure : Text -> a -> Failure - 728. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 + 729. -- #4n0fgs00hpsj3paqnm9bfm4nbt9cbrin3hl88i992m9tjiq1ik7eq72asu4hcg885uti36tbnj5rudt56eahhnut1nobofg86pk1bng#0 Exception.raise, builtin.Exception.raise : Failure ->{Exception} x - 729. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 + 730. -- #5mqjoauctm02dlqdc10cc66relu40997d6o1u8fj7vv7g0i2mtacjc83afqhuekll1gkqr9vv4lq7aenanq4kf53kcce4l1srr6ip08 Exception.reraise : Either Failure a ->{Exception} a - 730. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 + 731. -- #1f774ia7im9i0cfp7l5a1g9tkvnd4m2940ga3buaf4ekd43dr1289vknghjjvi4qtevh7s61p5s573gpli51qh7e0i5pj9ggmeb69d0 Exception.toEither : '{ε, Exception} a ->{ε} Either Failure a - 731. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 + 732. -- #li2h4hncbgmfi5scuah06rtdt8rjcipiv2t95hos15ol63usv78ti3vng7o9862a70906rum7nrrs9qd9q8iqu1rdcfe292r0al7n38 Exception.toEither.handler : Request {Exception} a -> Either Failure a - 732. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 + 733. -- #5fi0ep8mufag822f18ukaffakrmm3ddg8a83dkj4gh2ks4e2c60sk9s8pmk92p69bvkcflql3rgoalp8ruth7fapqrks3kbmdl61b00 Exception.unsafeRun! : '{g, Exception} a ->{g} a - 733. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro + 734. -- #qdcih6h4dmf9a2tn2ndvn0br9ef41ubhcniadou1m6ro641gm2tn79m6boh5sr4q271oiui6ehbdqe53r0gobdeagotkjr67kieq3ro expect : Text -> (a -> a -> Boolean) -> a -> a ->{Stream Result} () - 734. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg + 735. -- #ngmnbge6f7nkehkkhj6rkit60rp3qlt0vij33itch1el3ta2ukrit4gvpn2n0j0s43sj9af53kphgs0h2n65bnqcr9pmasud2r7klsg expectU : Text -> a -> a ->{Stream Result} () - 735. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo + 736. -- #f54plhut9f6mg77r1f033vubik89irq1eri79d5pd6mqi03rq9em99mc90plurvjnmvho73ssof5fvndgmcg4fgrpvuuil7hb5qmebo fail : Text -> b ->{Exception} c - 736. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo + 737. -- #mpe805fs330vqp5l5mg73deahken20dub4hrfvmuutfo97dikgagvimncfr6mfp1l24bjqes1m1dp11a3hop92u49b1fb45j8qs9hoo fileExists : Text ->{IO, Exception} Boolean - 737. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo + 738. -- #cft2pjc05jljtlefm4osg96k5t2look2ujq1tgg5hoc5i3fkkatt9pf79g2ka461kq8nbmsggrvo2675ocl599to9e8nre5oef4scdo fromB32 : Bytes ->{Exception} Bytes - 738. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 + 739. -- #13fpchr37ua0pr38ssr7j22pudmseuedf490aok18upagh0f00kg40guj9pgl916v9qurqrvu53f3lpsvi0s82hg3dtjacanrpjvs38 fromHex : Text -> Bytes - 739. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug + 740. -- #b36oslvh534s82lda0ghc5ql7p7nir0tknsluigulmpso22tjh62uiiq4lq9s3m97a2grkso0qofpb423p06olkkikrt4mfn15vpkug getBuffering : Handle ->{IO, Exception} BufferMode - 740. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g + 741. -- #9vijttgmba0ui9cshmhmmvgn6ve2e95t168766h2n6pkviddebiimgipic5dbg5lmiht12g6np8a7e06jpk03rnue3ln5mbo4prde0g getBytes : Handle -> Nat ->{IO, Exception} Bytes - 741. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 + 742. -- #c5oeqqglf28ungtq1im4fjdh317eeoba4537l1ntq3ob22v07rpgj9307udscbghlrior398hqm1ci099qmriim8cs975kocacsd9r0 getChar : Handle ->{IO, Exception} Char - 742. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo + 743. -- #j9jdo2pqvi4aktcfsb0n4ns1tk2be7dtckqdeedqp7n52oghsq82cgc1tv562rj1sf1abq2h0vta4uo6873cdbgrtrvd5cvollu3ovo getEcho : Handle ->{IO, Exception} Boolean - 743. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g + 744. -- #0hj09gufk8fs2hvr6qij6pie8bp0h6hmm6hpsi8d5fvl1fp1dbk6u8c9p6h4eu2hle6ctgpdbepo9vit5atllkodogn6r0csar9fn1g getLine : Handle ->{IO, Exception} Text - 744. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg + 745. -- #ck1nfg5fainelng0694jkdf9e06pmn60h7kvble1ff7hkc6jdgqtf7g5o3qevr7ic1bdhfn5n2rc3gde5bh6o9fpbit3ocs0av0scdg getSomeBytes : Handle -> Nat ->{IO, Exception} Bytes - 745. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno + 746. -- #bk29bjnrcuh55usf3vocm4j1aml161p6ila7t82cpr3ub9vu0g9lsg2mspmfuefc4ig0qtdqk7nds4t3f68jp6o77e0h4ltbitqjpno getTempDirectory : '{IO, Exception} Text - 746. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 + 747. -- #j8i534slc2rvakvmqcb6j28iatrh3d7btajai9qndutr0edi5aaoi2p5noditaococ4l104hdhhvjc5vr0rbcjoqrbng46fdeqtnf98 handlePosition : Handle ->{IO, Exception} Nat - 747. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 + 748. -- #bgf7sqs0h0p8bhm3t2ei8006oj1gjonvtkdejv2g9kar0kmvob9e88ceevdfh99jom9rs0hbalf1gut5juanudfcb8tpb1e9ta0vrm8 handshake : Tls ->{IO, Exception} () - 748. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio + 749. -- #128490j1tmitiu3vesv97sqspmefobg1am38vos9p0vt4s1bhki87l7kj4cctquffkp40eanmr9ummfglj9i7s25jrpb32ob5sf2tio hex : Bytes -> Text - 749. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 + 750. -- #ttjui80dbufvf3vgaddmcr065dpgl0rtp68i5cdht6tq4t2vk3i2vg60hi77rug368qijgijf8oui27te7o5oq0t0osm6dg65c080i0 id : a -> a - 750. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g + 751. -- #9qnapjbbdhcc2mjf1b0slm7mefu0idnj1bs4c5bckq42ruodftolnd193uehr31lc01air6d6b3j4ihurnks13n85h3r8rs16nqvj2g isDirectory : Text ->{IO, Exception} Boolean - 751. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 + 752. -- #vb1e252fqt0q63hpmtkq2bkg5is2n6thejofnev96040thle5o1ia8dtq7dc6v359gtoqugbqg5tb340aqovrfticb63jgei4ncq3j8 isFileEOF : Handle ->{IO, Exception} Boolean - 752. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 + 753. -- #ahkhlm9sd7arpevos99sqc90g7k5nn9bj5n0lhh82c1uva52ltv0295ugc123l17vd1orkng061e11knqjnmk087qjg3vug3rs6mv60 isFileOpen : Handle ->{IO, Exception} Boolean - 753. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 + 754. -- #2a11371klrv2i8726knma0l3g14on4m2ucihpg65cjj9k930aefg65ovvg0ak4uv3i9evtnu0a5249q3i8ugheqd65cnmgquc1a88n0 isNone : Optional a -> Boolean - 754. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 + 755. -- #ln4avnqpdk7813vsrrr414hg0smcmufrl1c7b87nb7nb0h9cogp6arqa7fbgd7rgolffmgue698ovvefo18j1k8g30t4hbp23onm3l8 isSeekable : Handle ->{IO, Exception} Boolean - 755. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio + 756. -- #gop2v9s6l24ii1v6bf1nks2h0h18pato0vbsf4u3el18s7mp1jfnp4c7fesdf9sunnlv5f5a9fjr1s952pte87mf63l1iqki9bp0mio List.all : (a ->{ε} Boolean) -> [a] ->{ε} Boolean - 756. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 + 757. -- #m2g5korqq5etr0qk1qrgjbaqktj4ks4bu9m3c4v3j9g8ktsd2e218nml6q8vo45bi3meb53csack40mle6clfrfep073e313b3jagt0 List.filter : (a ->{g} Boolean) -> [a] ->{g} [a] - 757. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o + 758. -- #8s836vq5jggucs6bj3bear30uhe6h9cskudjrdc772ghiec6ce2jqft09l1n05kd1n6chekrbgt0h8mkc9drgscjvgghacojm9e8c5o List.foldLeft : (b ->{g} a ->{g} b) -> b -> [a] ->{g} b - 758. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko + 759. -- #m5tlb5a0m4kp5b4m9oq9vhda9d7nhu2obn2lpmosal0ebij9gon4gkd1aq0b3b61jtsc1go0hi7b2sm2memtil55ijq32b2n0k39vko List.forEach : [a] -> (a ->{e} ()) ->{e} () - 759. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 + 760. -- #j9ve4ionu2sn7f814t0t4gc75objke2drgnfvvvb50v2f57ss0hlsa3ai5g5jsk2t4b8s37ocrtmte7nktfb2vjf8508ksvrc6llu30 listen : Socket ->{IO, Exception} () - 760. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 + 761. -- #s0f4et1o1ns8cmmvp3i0cm6cmmv5qaf99qm2q4jmgpciof6ntmuh3mpr4epns3ocskn8raacbvm30ovvj2b6arv0ff7iks31rannbf0 loadCodeBytes : Bytes ->{Exception} Code - 761. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g + 762. -- #gvaed1m07qihc9c216125sur1q9a7i5ita44qnevongg4jrbd8k2plsqhdur45nn6h3drn6lc3iidp1b208ht8s73fg2711l76c7j4g loadSelfContained : Text ->{IO, Exception} a - 762. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 + 763. -- #g1hqlq27e3stamnnfp6q178pleeml9sbo2d6scj2ikubocane5cvf8ctausoqrgj9co9h56ttgt179sgktc0bei2r37dmtj51jg0ou8 loadValueBytes : Bytes ->{IO, Exception} ([(Link.Term, Code)], Value) - 763. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 + 764. -- #tlllu51stumo77vi2e5m0e8m05qletfbr3nea3d84dcgh66dq4s3bt7kdbf8mpdqh16mmnoh11kr3n43m8b5g4pf95l9gfbhhok1h20 MVar.put : MVar i -> i ->{IO, Exception} () - 764. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o + 765. -- #3b7lp7s9m31mcvh73nh4gfj1kal6onrmppf35esvmma4jsg7bbm7a8tsrfcb4te88f03r97dkf7n1f2kcc6o7ng4vurp95svfj2fg7o MVar.read : MVar o ->{IO, Exception} o - 765. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg + 766. -- #be8m7lsjnf31u87pt5rvn04c9ellhbm3p56jgapbp8k7qp0v3mm7beh81luoifp17681l0ldjj46gthmmu32lkn0jnejr3tedjotntg MVar.swap : MVar o -> o ->{IO, Exception} o - 766. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 + 767. -- #c2qb0ca2dj3rronbp4slj3ph56p0iopaos7ib37hjunpkl1rcl1gp820dpg8qflhvt9cm2l1bfm40rkdslce2sr6f0oru5lr5cl5nu0 MVar.take : MVar o ->{IO, Exception} o - 767. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 + 768. -- #ht0k9hb3k1cnjsgmtu9klivo074a2uro4csh63m1sqr2483rkojlj7abcf0jfmssbfig98i6is1osr2djoqubg3bp6articvq9o8090 newClient : ClientConfig -> Socket ->{IO, Exception} Tls - 768. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 + 769. -- #coeloqmjin6lais8u6j0plh5f1601lpcue4ejfcute46opams4vsbkplqj6jg6af0uecjie3mbclv40b3jumghsf09aavvucrc0d148 newServer : ServerConfig -> Socket ->{IO, Exception} Tls - 769. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 + 770. -- #ocvo5mvs8fghsf715tt4mhpj1pu8e8r7pq9nue63ut0ol2vnv70k7t6tavtsljlmdib9lo3bt669qac94dk53ldcgtukvotvrlfkan0 openFile : Text -> FileMode ->{IO, Exception} Handle - 770. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 + 771. -- #c58qbcgd90d965dokk7bu82uehegkbe8jttm7lv4j0ohgi2qm3e3p4v1qfr8vc2dlsmsl9tv0v71kco8c18mneule0ntrhte4ks1090 printLine : Text ->{IO, Exception} () - 771. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 + 772. -- #dck7pb7qv05ol3b0o76l88a22bc7enl781ton5qbs2umvgsua3p16n22il02m29592oohsnbt3cr7hnlumpdhv2ibjp6iji9te4iot0 printText : Text ->{IO} Either Failure () - 772. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 + 773. -- #i9lm1g1j0p4qtakg164jdlgac409sgj1cb91k86k0c44ssajbluovuu7ptm5uc20sjgedjbak3iji8o859ek871ul51b8l30s4uf978 putBytes : Handle -> Bytes ->{IO, Exception} () - 773. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg + 774. -- #84j6ua3924v85vh2a581de7sd8pee1lqbp1ibvatvjtui9hvk36sv2riabu0v2r0s25p62ipnvv4aeadpg0u8m5ffqrc202i71caopg readFile : Text ->{IO, Exception} Bytes - 774. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o + 775. -- #pk003cv7lvidkbmsnne4mpt20254gh4hd7vvretnbk8na8bhr9fg9776rp8pt9srhiucrd1c7sjl006vmil9e78p40gdcir81ujil2o ready : Handle ->{IO, Exception} Boolean - 775. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 + 776. -- #unn7qak4qe0nbbpf62uesu0fe8i68o83l4o7f6jcblefbla53fef7a63ts28fh6ql81o5c04j44g7m5rq9aouo73dpeprbl5lka8170 receive : Tls ->{IO, Exception} Bytes - 776. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g + 777. -- #ugs4208vpm97jr2ecmr7l9h4e22r1ije6v379m4v6229c8o7hk669ba63bor4pe6n1bm24il87iq2d99sj78lt6n5eqa1fre0grn93g removeDirectory : Text ->{IO, Exception} () - 777. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 + 778. -- #6pia69u5u5rja1jk04v3i9ke24gf4b1t7vnaj0noogord6ekiqhf72qfkc1n08rd11f2cbkofni5rd5u7t1qkgslbi40hut35pfi1v0 renameDirectory : Text -> Text ->{IO, Exception} () - 778. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 + 779. -- #amtsq2jq1k75r309esfp800a8slelm4d3q9i1pq1qqs3pil13at916958sf9ucb4607kpktbnup7nc58ecoq8mcs01e2a03d08agn18 runTest : '{IO, TempDirs, Exception, Stream Result} a ->{IO} [Result] - 779. -- #b59q94bf9mrvv4gl8gqjd04dc3ahq373ka5esh4grtjupkm8ov7o7h0n56q2dg3ocdsreqvm973rlhs4etua1tbrsuabc398e5pvs0o + 780. -- #b59q94bf9mrvv4gl8gqjd04dc3ahq373ka5esh4grtjupkm8ov7o7h0n56q2dg3ocdsreqvm973rlhs4etua1tbrsuabc398e5pvs0o saveSelfContained : a -> Text ->{IO, Exception} () - 780. -- #f55p4o2hlhka9olk8a9dnan57o51605g4q26jtpsbkt0g652s322779sej71182ntb6lkh01gom3g26cmngqq7vtl7m7oovdi0koc70 + 781. -- #f55p4o2hlhka9olk8a9dnan57o51605g4q26jtpsbkt0g652s322779sej71182ntb6lkh01gom3g26cmngqq7vtl7m7oovdi0koc70 saveTestCase : Text -> (a -> Text) -> a ->{IO, Exception} () - 781. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco + 782. -- #v2otbk1e0e81d6ea9i3j1kivnfam6rk6earsjbjljv4mmrk1mgfals6jhfd74evor6al9mkb5gv8hf15f02807f0aa0hnsg9fas1qco seekHandle : Handle -> SeekMode -> Int ->{IO, Exception} () - 782. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 + 783. -- #a98jlos4rj2um55iksdin9p5djo6j70qmuitoe2ff3uvkefb8pqensorln5flr3pm8hkc0lqkchbd63cf9tl0kqnqu3i17kvqnm35g0 send : Tls -> Bytes ->{IO, Exception} () - 783. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 + 784. -- #qrdia2sc9vuoi7u3a4ukjk8lv0rlhn2i2bbin1adbhcuj79jn366dv3a8t52hpil0jtgkhhuiavibmdev63j5ndriod33rkktjekqv8 serverSocket : Optional Text -> Text ->{IO, Exception} Socket - 784. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao + 785. -- #3vft70875p42eao55rhb61siobuei4h0e9vlu4bbgucjo296c2vfjpucacovnu9538tvup5c7lo9123se8v4fe7m8q9aiqbkjpumkao setBuffering : Handle -> BufferMode ->{IO, Exception} () - 785. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao + 786. -- #erqshamlurgahpd4rroild36cc5e4rk56r38r53vcbg8cblr82c6gfji3um8f09ffgjlg58g7r32mtsbvjlcq4c65v0jn3va9888mao setEcho : Handle -> Boolean ->{IO, Exception} () - 786. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 + 787. -- #ugar51qqij4ur24frdi84eqdkvqa0fbsi4v6e2586hi3tai52ovtpm3f2dc9crnfv8pk0ppq6b5tv3utl4sl49n5aecorgkqddr7i38 snd : ∀ a a1. (a1, a) -> a - 787. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 + 788. -- #leoq6smeq8to5ej3314uuujmh6rfbcsdb9q8ah8h3ohg9jq5kftc93mq671o0qh2he9vqgd288k0ecea3h7eerpbgjt6a8p843tmon8 socketAccept : Socket ->{IO, Exception} Socket - 788. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 + 789. -- #s43jbp19k91qq704tidpue2vs2re1lh4mtv46rdmdnurkdndst7u0k712entcvip160vh9cilmpamikmflbprg5up0k6cl15b8tr5l0 socketPort : Socket ->{IO, Exception} Nat - 789. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 + 790. -- #3rp8h0dt7g60nrjdehuhqga9dmomti5rdqho7r1rm5rg5moet7kt3ieempo7c9urur752njachq6k48ggbic4ugbbv75jl2mfbk57a0 startsWith : Text -> Text -> Boolean - 790. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo + 791. -- #elsab3sc7p4c6bj73pgvklv0j7qu268rn5isv6micfp7ib8grjoustpqdq0pkd4a379mr5ijb8duu2q0n040osfurppp8pt8vaue2fo stdout : Handle - 791. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 + 792. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8 structural ability Stream a - 792. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 + 793. -- #2jl99er43tnksj8r8oveap5ger9uqlvj0u0ghfs0uqa7i6m45jk976n7a726jb7rtusjdu2p8hbbcgmoacvke7k5o3kdgoj57c3v2v8 Stream.collect : '{e, Stream a} r ->{e} ([a], r) - 793. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg + 794. -- #rnuje46fvuqa4a8sdgl9e250a2gcmhtsscr8bdonj2bduhrst38ur7dorv3ahr2ghf9cufkfit7ndh9qb9gspbfapcnn3sol0l2moqg Stream.collect.handler : Request {Stream a} r -> ([a], r) - 794. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 + 795. -- #rfi1v9429f9qluv533l2iba77aadttilrpmnhljfapfnfa6sru2nr8ibpqvib9nc4s4nb9s1as45upsfqfqe6ivqi2p82b2vd866it8#0 Stream.emit : a ->{Stream a} () - 795. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo + 796. -- #c70gf5m1blvh8tg4kvt1taee036fr7r22bbtqcupac5r5igs102nj077vdl0nimef94u951kfcl9a5hcevo01j04v9o6v3cpndq41bo Stream.toList : '{Stream a} r -> [a] - 796. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 + 797. -- #ul69cgsrsspjni8b0hqnt4kt4bk7sjtp6jvlhhofom7bemu9nb2kimm6tt1raigr7j86afgmnjnrfabn6a5l5v1t219uidiu22ueiv0 Stream.toList.handler : Request {Stream a} r -> [a] - 797. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 + 798. -- #58d8kfuq8sqbipa1aaijjhm28pa6a844h19mgg5s4a1h160etbulig21cm0pcnfla8fisqvrp80840g9luid5u8amvcc8sf46pd25h8 systemTime : '{IO, Exception} Nat - 798. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 + 799. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18 structural ability TempDirs - 799. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 + 800. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#0 TempDirs.newTempDir : Text ->{TempDirs} Text - 800. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 + 801. -- #11mhfqj6rts8lm3im7saf44tn3km5bboqtu1td0udnaiit4qqg6ar1ecmccosl6gufsnp6sug3vcmgapsc58sgj7dh7rg8msq2qkj18#1 TempDirs.removeDir : Text ->{TempDirs} () - 801. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go + 802. -- #natgur73q6b4c3tp5jcor0v1cdnplh0n3fhm4qvhg4v74u3e3ff1352shs1lveot83lj82qqbl78n40qi9a132fhkmaa6g5s1ja91go terminate : Tls ->{IO, Exception} () - 802. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 + 803. -- #i3pbnc98rbfug5dnnvpd4uahm2e5fld2fu0re9r305isffr1r43048h7ql6ojdbjcsvjr6h91s6i026na046ltg5ff59klla6e7vq98 testAutoClean : '{IO} [Result] - 803. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 + 804. -- #spepthutvs3p6je794h520665rh8abl36qg43i7ipvj0mtg5sb0sbemjp2vpu9j3feithk2ae0sdtcmb8afoglo9rnvl350380t21h0 Text.fromUtf8 : Bytes ->{Exception} Text - 804. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 + 805. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8 structural ability Throw e - 805. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 + 806. -- #32q9jqhmi8f08pec3hj0je4u7k52f9f1hdfsmn9ncg2kpki5da9dabigplvdcot3a00k7s5npc4n78psd6ojaumqjla259e9pqd4ov8#0 Throw.throw : e ->{Throw e} a - 806. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g + 807. -- #vri6fsnl704n6aqs346p6ijcbkcsv9875edr6b74enumrhbjiuon94ir4ufmrrn84k9b2jka4f05o16mcvsjrjav6gpskpiu4sknd1g uncurry : ∀ o g1 i g i1. (i1 ->{g} i ->{g1} o) -> (i1, i) ->{g1, g} o - 807. -- #rhak55ntto40n4utgv5o93jvlmv82lceb625slrt8tsmg74vin5bclf10vkl1sgpau3thqsa6guiihog74qoknlsqbuce5th60bu2eg + 808. -- #rhak55ntto40n4utgv5o93jvlmv82lceb625slrt8tsmg74vin5bclf10vkl1sgpau3thqsa6guiihog74qoknlsqbuce5th60bu2eg Value.transitiveDeps : Value ->{IO} [(Link.Term, Code)] - 808. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo + 809. -- #o5bg5el7ckak28ib98j5b6rt26bqbprpddd1brrg3s18qahhbbe3uohufjjnt5eenvtjg0hrvnvpra95jmdppqrovvmcfm1ih2k7guo void : x -> () - 809. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg + 810. -- #8ugamqlp7a4g0dmbcvipqfi8gnuuj23pjbdfbof11naiun1qf8otjcap80epaom2kl9fv5rhjaudt4558n38dovrc0lhipubqjgm8mg writeFile : Text -> Bytes ->{IO, Exception} () - 810. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 + 811. -- #lcmj2envm11lrflvvcl290lplhvbccv82utoej0lg0eomhmsf2vrv8af17k6if7ff98fp1b13rkseng3fng4stlr495c8dn3gn4k400 |> : a -> (a ->{g} t) ->{g} t diff --git a/unison-src/transcripts-using-base/hashing.md b/unison-src/transcripts-using-base/hashing.md index 123b5ae5a..fc6f64dc8 100644 --- a/unison-src/transcripts-using-base/hashing.md +++ b/unison-src/transcripts-using-base/hashing.md @@ -225,6 +225,29 @@ test> hmac_sha2_512.tests.ex2 = "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737" ``` +## MD5 tests + +Test vectors here pulled from [Wikipedia's writeup](https://en.wikipedia.org/wiki/MD5). + +```unison +ex alg input expected = checks [hashBytes alg (ascii input) == fromHex expected] + +test> md5.tests.ex1 = + ex Md5 + "" + "d41d8cd98f00b204e9800998ecf8427e" + +test> md5.tests.ex2 = + ex Md5 + "The quick brown fox jumps over the lazy dog" + "9e107d9d372bb6826bd81d3542a419d6" + +test> md5.tests.ex3 = + ex Md5 + "The quick brown fox jumps over the lazy dog." + "e4d909c290d0fb1ca068ffaddf22cbd0" +``` + ```ucm:hide .> add ``` diff --git a/unison-src/transcripts-using-base/hashing.output.md b/unison-src/transcripts-using-base/hashing.output.md index ab631472b..2db485884 100644 --- a/unison-src/transcripts-using-base/hashing.output.md +++ b/unison-src/transcripts-using-base/hashing.output.md @@ -124,14 +124,15 @@ And here's the full API: 3. HashAlgorithm.Blake2b_256 : HashAlgorithm 4. HashAlgorithm.Blake2b_512 : HashAlgorithm 5. HashAlgorithm.Blake2s_256 : HashAlgorithm - 6. HashAlgorithm.Sha1 : HashAlgorithm - 7. HashAlgorithm.Sha2_256 : HashAlgorithm - 8. HashAlgorithm.Sha2_512 : HashAlgorithm - 9. HashAlgorithm.Sha3_256 : HashAlgorithm - 10. HashAlgorithm.Sha3_512 : HashAlgorithm - 11. hashBytes : HashAlgorithm -> Bytes -> Bytes - 12. hmac : HashAlgorithm -> Bytes -> a -> Bytes - 13. hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes + 6. HashAlgorithm.Md5 : HashAlgorithm + 7. HashAlgorithm.Sha1 : HashAlgorithm + 8. HashAlgorithm.Sha2_256 : HashAlgorithm + 9. HashAlgorithm.Sha2_512 : HashAlgorithm + 10. HashAlgorithm.Sha3_256 : HashAlgorithm + 11. HashAlgorithm.Sha3_512 : HashAlgorithm + 12. hashBytes : HashAlgorithm -> Bytes -> Bytes + 13. hmac : HashAlgorithm -> Bytes -> a -> Bytes + 14. hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes .> cd . @@ -389,42 +390,94 @@ test> hmac_sha2_512.tests.ex2 = ✅ Passed Passed +``` +## MD5 tests + +Test vectors here pulled from [Wikipedia's writeup](https://en.wikipedia.org/wiki/MD5). + +```unison +ex alg input expected = checks [hashBytes alg (ascii input) == fromHex expected] + +test> md5.tests.ex1 = + ex Md5 + "" + "d41d8cd98f00b204e9800998ecf8427e" + +test> md5.tests.ex2 = + ex Md5 + "The quick brown fox jumps over the lazy dog" + "9e107d9d372bb6826bd81d3542a419d6" + +test> md5.tests.ex3 = + ex Md5 + "The quick brown fox jumps over the lazy dog." + "e4d909c290d0fb1ca068ffaddf22cbd0" +``` + +```ucm + + I found and typechecked these definitions in scratch.u. If you + do an `add` or `update`, here's how your codebase would + change: + + ⊡ Previously added definitions will be ignored: ex + + ⍟ These new definitions are ok to `add`: + + md5.tests.ex1 : [Result] + md5.tests.ex2 : [Result] + md5.tests.ex3 : [Result] + + Now evaluating any watch expressions (lines starting with + `>`)... Ctrl+C cancels. + + 4 | ex Md5 + + ✅ Passed Passed + + 9 | ex Md5 + + ✅ Passed Passed + + 14 | ex Md5 + + ✅ Passed Passed + ``` ```ucm .> test Cached test results (`help testcache` to learn more) - ◉ blake2b_512.tests.ex1 Passed - ◉ blake2b_512.tests.ex2 Passed - ◉ blake2b_512.tests.ex3 Passed - ◉ blake2s_256.tests.ex1 Passed - ◉ hmac_sha2_256.tests.ex1 Passed - ◉ hmac_sha2_256.tests.ex2 Passed - ◉ hmac_sha2_512.tests.ex1 Passed - ◉ hmac_sha2_512.tests.ex2 Passed - ◉ sha1.tests.ex1 Passed - ◉ sha1.tests.ex2 Passed - ◉ sha1.tests.ex3 Passed - ◉ sha1.tests.ex4 Passed - ◉ sha2_256.tests.ex1 Passed - ◉ sha2_256.tests.ex2 Passed - ◉ sha2_256.tests.ex3 Passed - ◉ sha2_256.tests.ex4 Passed - ◉ sha2_512.tests.ex1 Passed - ◉ sha2_512.tests.ex2 Passed - ◉ sha2_512.tests.ex3 Passed - ◉ sha2_512.tests.ex4 Passed - ◉ sha3_256.tests.ex1 Passed - ◉ sha3_256.tests.ex2 Passed - ◉ sha3_256.tests.ex3 Passed - ◉ sha3_256.tests.ex4 Passed - ◉ sha3_512.tests.ex1 Passed - ◉ sha3_512.tests.ex2 Passed - ◉ sha3_512.tests.ex3 Passed - ◉ sha3_512.tests.ex4 Passed + ◉ blake2b_512.tests.ex1 Passed + ◉ blake2b_512.tests.ex2 Passed + ◉ blake2b_512.tests.ex3 Passed + ◉ blake2s_256.tests.ex1 Passed + ◉ md5.tests.ex1 Passed + ◉ md5.tests.ex2 Passed + ◉ md5.tests.ex3 Passed + ◉ sha1.tests.ex1 Passed + ◉ sha1.tests.ex2 Passed + ◉ sha1.tests.ex3 Passed + ◉ sha1.tests.ex4 Passed + ◉ sha2_256.tests.ex1 Passed + ◉ sha2_256.tests.ex2 Passed + ◉ sha2_256.tests.ex3 Passed + ◉ sha2_256.tests.ex4 Passed + ◉ sha2_512.tests.ex1 Passed + ◉ sha2_512.tests.ex2 Passed + ◉ sha2_512.tests.ex3 Passed + ◉ sha2_512.tests.ex4 Passed + ◉ sha3_256.tests.ex1 Passed + ◉ sha3_256.tests.ex2 Passed + ◉ sha3_256.tests.ex3 Passed + ◉ sha3_256.tests.ex4 Passed + ◉ sha3_512.tests.ex1 Passed + ◉ sha3_512.tests.ex2 Passed + ◉ sha3_512.tests.ex3 Passed + ◉ sha3_512.tests.ex4 Passed - ✅ 28 test(s) passing + ✅ 27 test(s) passing Tip: Use view blake2b_512.tests.ex1 to view the source of a test. diff --git a/unison-src/transcripts/alias-many.output.md b/unison-src/transcripts/alias-many.output.md index 45cb2259b..75fa93d8d 100644 --- a/unison-src/transcripts/alias-many.output.md +++ b/unison-src/transcripts/alias-many.output.md @@ -96,598 +96,599 @@ Let's try it! 76. crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm 77. crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm 78. crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 79. crypto.HashAlgorithm.Sha1 : HashAlgorithm - 80. crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 81. crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 82. crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 83. crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 84. crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 85. crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 86. crypto.hmacBytes : HashAlgorithm + 79. crypto.HashAlgorithm.Md5 : HashAlgorithm + 80. crypto.HashAlgorithm.Sha1 : HashAlgorithm + 81. crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + 82. crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + 83. crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + 84. crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + 85. crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes + 86. crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes + 87. crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 87. Debug.toText : a -> Optional (Either Text Text) - 88. Debug.trace : Text -> a -> () - 89. Debug.watch : Text -> a -> a - 90. unique type Doc - 91. Doc.Blob : Text -> Doc - 92. Doc.Evaluate : Term -> Doc - 93. Doc.Join : [Doc] -> Doc - 94. Doc.Link : Link -> Doc - 95. Doc.Signature : Term -> Doc - 96. Doc.Source : Link -> Doc - 97. structural type Either a b - 98. Either.Left : a -> Either a b - 99. Either.Right : b -> Either a b - 100. structural ability Exception - 101. Exception.raise : Failure ->{Exception} x - 102. builtin type Float - 103. Float.* : Float -> Float -> Float - 104. Float.+ : Float -> Float -> Float - 105. Float.- : Float -> Float -> Float - 106. Float./ : Float -> Float -> Float - 107. Float.abs : Float -> Float - 108. Float.acos : Float -> Float - 109. Float.acosh : Float -> Float - 110. Float.asin : Float -> Float - 111. Float.asinh : Float -> Float - 112. Float.atan : Float -> Float - 113. Float.atan2 : Float -> Float -> Float - 114. Float.atanh : Float -> Float - 115. Float.ceiling : Float -> Int - 116. Float.cos : Float -> Float - 117. Float.cosh : Float -> Float - 118. Float.eq : Float -> Float -> Boolean - 119. Float.exp : Float -> Float - 120. Float.floor : Float -> Int - 121. Float.fromRepresentation : Nat -> Float - 122. Float.fromText : Text -> Optional Float - 123. Float.gt : Float -> Float -> Boolean - 124. Float.gteq : Float -> Float -> Boolean - 125. Float.log : Float -> Float - 126. Float.logBase : Float -> Float -> Float - 127. Float.lt : Float -> Float -> Boolean - 128. Float.lteq : Float -> Float -> Boolean - 129. Float.max : Float -> Float -> Float - 130. Float.min : Float -> Float -> Float - 131. Float.pow : Float -> Float -> Float - 132. Float.round : Float -> Int - 133. Float.sin : Float -> Float - 134. Float.sinh : Float -> Float - 135. Float.sqrt : Float -> Float - 136. Float.tan : Float -> Float - 137. Float.tanh : Float -> Float - 138. Float.toRepresentation : Float -> Nat - 139. Float.toText : Float -> Text - 140. Float.truncate : Float -> Int - 141. Handle.toText : Handle -> Text - 142. builtin type ImmutableArray - 143. ImmutableArray.copyTo! : MutableArray g a + 88. Debug.toText : a -> Optional (Either Text Text) + 89. Debug.trace : Text -> a -> () + 90. Debug.watch : Text -> a -> a + 91. unique type Doc + 92. Doc.Blob : Text -> Doc + 93. Doc.Evaluate : Term -> Doc + 94. Doc.Join : [Doc] -> Doc + 95. Doc.Link : Link -> Doc + 96. Doc.Signature : Term -> Doc + 97. Doc.Source : Link -> Doc + 98. structural type Either a b + 99. Either.Left : a -> Either a b + 100. Either.Right : b -> Either a b + 101. structural ability Exception + 102. Exception.raise : Failure ->{Exception} x + 103. builtin type Float + 104. Float.* : Float -> Float -> Float + 105. Float.+ : Float -> Float -> Float + 106. Float.- : Float -> Float -> Float + 107. Float./ : Float -> Float -> Float + 108. Float.abs : Float -> Float + 109. Float.acos : Float -> Float + 110. Float.acosh : Float -> Float + 111. Float.asin : Float -> Float + 112. Float.asinh : Float -> Float + 113. Float.atan : Float -> Float + 114. Float.atan2 : Float -> Float -> Float + 115. Float.atanh : Float -> Float + 116. Float.ceiling : Float -> Int + 117. Float.cos : Float -> Float + 118. Float.cosh : Float -> Float + 119. Float.eq : Float -> Float -> Boolean + 120. Float.exp : Float -> Float + 121. Float.floor : Float -> Int + 122. Float.fromRepresentation : Nat -> Float + 123. Float.fromText : Text -> Optional Float + 124. Float.gt : Float -> Float -> Boolean + 125. Float.gteq : Float -> Float -> Boolean + 126. Float.log : Float -> Float + 127. Float.logBase : Float -> Float -> Float + 128. Float.lt : Float -> Float -> Boolean + 129. Float.lteq : Float -> Float -> Boolean + 130. Float.max : Float -> Float -> Float + 131. Float.min : Float -> Float -> Float + 132. Float.pow : Float -> Float -> Float + 133. Float.round : Float -> Int + 134. Float.sin : Float -> Float + 135. Float.sinh : Float -> Float + 136. Float.sqrt : Float -> Float + 137. Float.tan : Float -> Float + 138. Float.tanh : Float -> Float + 139. Float.toRepresentation : Float -> Nat + 140. Float.toText : Float -> Text + 141. Float.truncate : Float -> Int + 142. Handle.toText : Handle -> Text + 143. builtin type ImmutableArray + 144. ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray a -> Nat -> Nat ->{g, Exception} () - 144. ImmutableArray.read : ImmutableArray a + 145. ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 145. ImmutableArray.size : ImmutableArray a -> Nat - 146. builtin type ImmutableByteArray - 147. ImmutableByteArray.copyTo! : MutableByteArray g + 146. ImmutableArray.size : ImmutableArray a -> Nat + 147. builtin type ImmutableByteArray + 148. ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray -> Nat -> Nat ->{g, Exception} () - 148. ImmutableByteArray.read16be : ImmutableByteArray + 149. ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 149. ImmutableByteArray.read24be : ImmutableByteArray + 150. ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 150. ImmutableByteArray.read32be : ImmutableByteArray + 151. ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 151. ImmutableByteArray.read40be : ImmutableByteArray + 152. ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 152. ImmutableByteArray.read64be : ImmutableByteArray + 153. ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 153. ImmutableByteArray.read8 : ImmutableByteArray + 154. ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 154. ImmutableByteArray.size : ImmutableByteArray -> Nat - 155. builtin type Int - 156. Int.* : Int -> Int -> Int - 157. Int.+ : Int -> Int -> Int - 158. Int.- : Int -> Int -> Int - 159. Int./ : Int -> Int -> Int - 160. Int.and : Int -> Int -> Int - 161. Int.complement : Int -> Int - 162. Int.eq : Int -> Int -> Boolean - 163. Int.fromRepresentation : Nat -> Int - 164. Int.fromText : Text -> Optional Int - 165. Int.gt : Int -> Int -> Boolean - 166. Int.gteq : Int -> Int -> Boolean - 167. Int.increment : Int -> Int - 168. Int.isEven : Int -> Boolean - 169. Int.isOdd : Int -> Boolean - 170. Int.leadingZeros : Int -> Nat - 171. Int.lt : Int -> Int -> Boolean - 172. Int.lteq : Int -> Int -> Boolean - 173. Int.mod : Int -> Int -> Int - 174. Int.negate : Int -> Int - 175. Int.or : Int -> Int -> Int - 176. Int.popCount : Int -> Nat - 177. Int.pow : Int -> Nat -> Int - 178. Int.shiftLeft : Int -> Nat -> Int - 179. Int.shiftRight : Int -> Nat -> Int - 180. Int.signum : Int -> Int - 181. Int.toFloat : Int -> Float - 182. Int.toRepresentation : Int -> Nat - 183. Int.toText : Int -> Text - 184. Int.trailingZeros : Int -> Nat - 185. Int.truncate0 : Int -> Nat - 186. Int.xor : Int -> Int -> Int - 187. unique type io2.ArithmeticFailure - 188. unique type io2.ArrayFailure - 189. unique type io2.BufferMode - 190. io2.BufferMode.BlockBuffering : BufferMode - 191. io2.BufferMode.LineBuffering : BufferMode - 192. io2.BufferMode.NoBuffering : BufferMode - 193. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode - 194. io2.Clock.internals.monotonic : '{IO} Either + 155. ImmutableByteArray.size : ImmutableByteArray -> Nat + 156. builtin type Int + 157. Int.* : Int -> Int -> Int + 158. Int.+ : Int -> Int -> Int + 159. Int.- : Int -> Int -> Int + 160. Int./ : Int -> Int -> Int + 161. Int.and : Int -> Int -> Int + 162. Int.complement : Int -> Int + 163. Int.eq : Int -> Int -> Boolean + 164. Int.fromRepresentation : Nat -> Int + 165. Int.fromText : Text -> Optional Int + 166. Int.gt : Int -> Int -> Boolean + 167. Int.gteq : Int -> Int -> Boolean + 168. Int.increment : Int -> Int + 169. Int.isEven : Int -> Boolean + 170. Int.isOdd : Int -> Boolean + 171. Int.leadingZeros : Int -> Nat + 172. Int.lt : Int -> Int -> Boolean + 173. Int.lteq : Int -> Int -> Boolean + 174. Int.mod : Int -> Int -> Int + 175. Int.negate : Int -> Int + 176. Int.or : Int -> Int -> Int + 177. Int.popCount : Int -> Nat + 178. Int.pow : Int -> Nat -> Int + 179. Int.shiftLeft : Int -> Nat -> Int + 180. Int.shiftRight : Int -> Nat -> Int + 181. Int.signum : Int -> Int + 182. Int.toFloat : Int -> Float + 183. Int.toRepresentation : Int -> Nat + 184. Int.toText : Int -> Text + 185. Int.trailingZeros : Int -> Nat + 186. Int.truncate0 : Int -> Nat + 187. Int.xor : Int -> Int -> Int + 188. unique type io2.ArithmeticFailure + 189. unique type io2.ArrayFailure + 190. unique type io2.BufferMode + 191. io2.BufferMode.BlockBuffering : BufferMode + 192. io2.BufferMode.LineBuffering : BufferMode + 193. io2.BufferMode.NoBuffering : BufferMode + 194. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode + 195. io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 195. io2.Clock.internals.nsec : TimeSpec -> Nat - 196. io2.Clock.internals.processCPUTime : '{IO} Either + 196. io2.Clock.internals.nsec : TimeSpec -> Nat + 197. io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 197. io2.Clock.internals.realtime : '{IO} Either + 198. io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 198. io2.Clock.internals.sec : TimeSpec -> Int - 199. io2.Clock.internals.threadCPUTime : '{IO} Either + 199. io2.Clock.internals.sec : TimeSpec -> Int + 200. io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 200. builtin type io2.Clock.internals.TimeSpec - 201. unique type io2.Failure - 202. io2.Failure.Failure : Type -> Text -> Any -> Failure - 203. unique type io2.FileMode - 204. io2.FileMode.Append : FileMode - 205. io2.FileMode.Read : FileMode - 206. io2.FileMode.ReadWrite : FileMode - 207. io2.FileMode.Write : FileMode - 208. builtin type io2.Handle - 209. builtin type io2.IO - 210. io2.IO.array : Nat ->{IO} MutableArray {IO} a - 211. io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 212. io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 213. io2.IO.bytearrayOf : Nat + 201. builtin type io2.Clock.internals.TimeSpec + 202. unique type io2.Failure + 203. io2.Failure.Failure : Type -> Text -> Any -> Failure + 204. unique type io2.FileMode + 205. io2.FileMode.Append : FileMode + 206. io2.FileMode.Read : FileMode + 207. io2.FileMode.ReadWrite : FileMode + 208. io2.FileMode.Write : FileMode + 209. builtin type io2.Handle + 210. builtin type io2.IO + 211. io2.IO.array : Nat ->{IO} MutableArray {IO} a + 212. io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a + 213. io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} + 214. io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 214. io2.IO.clientSocket.impl : Text + 215. io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 215. io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 216. io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 217. io2.IO.createDirectory.impl : Text + 216. io2.IO.closeFile.impl : Handle ->{IO} Either Failure () + 217. io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () + 218. io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 218. io2.IO.createTempDirectory.impl : Text + 219. io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 219. io2.IO.delay.impl : Nat ->{IO} Either Failure () - 220. io2.IO.directoryContents.impl : Text + 220. io2.IO.delay.impl : Nat ->{IO} Either Failure () + 221. io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 221. io2.IO.fileExists.impl : Text + 222. io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 222. io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 223. io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 224. io2.IO.getBuffering.impl : Handle + 223. io2.IO.forkComp : '{IO} a ->{IO} ThreadId + 224. io2.IO.getArgs.impl : '{IO} Either Failure [Text] + 225. io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 225. io2.IO.getBytes.impl : Handle + 226. io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 226. io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 227. io2.IO.getCurrentDirectory.impl : '{IO} Either + 227. io2.IO.getChar.impl : Handle ->{IO} Either Failure Char + 228. io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 228. io2.IO.getEcho.impl : Handle + 229. io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 229. io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 230. io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 231. io2.IO.getFileTimestamp.impl : Text + 230. io2.IO.getEnv.impl : Text ->{IO} Either Failure Text + 231. io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat + 232. io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 232. io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 233. io2.IO.getSomeBytes.impl : Handle + 233. io2.IO.getLine.impl : Handle ->{IO} Either Failure Text + 234. io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 234. io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 235. io2.IO.handlePosition.impl : Handle + 235. io2.IO.getTempDirectory.impl : '{IO} Either Failure Text + 236. io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 236. io2.IO.isDirectory.impl : Text + 237. io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 237. io2.IO.isFileEOF.impl : Handle + 238. io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 238. io2.IO.isFileOpen.impl : Handle + 239. io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 239. io2.IO.isSeekable.impl : Handle + 240. io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 240. io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 241. io2.IO.listen.impl : Socket ->{IO} Either Failure () - 242. io2.IO.openFile.impl : Text + 241. io2.IO.kill.impl : ThreadId ->{IO} Either Failure () + 242. io2.IO.listen.impl : Socket ->{IO} Either Failure () + 243. io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 243. io2.IO.process.call : Text -> [Text] ->{IO} Nat - 244. io2.IO.process.exitCode : ProcessHandle + 244. io2.IO.process.call : Text -> [Text] ->{IO} Nat + 245. io2.IO.process.exitCode : ProcessHandle ->{IO} Optional Nat - 245. io2.IO.process.kill : ProcessHandle ->{IO} () - 246. io2.IO.process.start : Text + 246. io2.IO.process.kill : ProcessHandle ->{IO} () + 247. io2.IO.process.start : Text -> [Text] ->{IO} ( Handle, Handle, Handle, ProcessHandle) - 247. io2.IO.process.wait : ProcessHandle ->{IO} Nat - 248. io2.IO.putBytes.impl : Handle + 248. io2.IO.process.wait : ProcessHandle ->{IO} Nat + 249. io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 249. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 250. io2.IO.ref : a ->{IO} Ref {IO} a - 251. io2.IO.removeDirectory.impl : Text + 250. io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean + 251. io2.IO.ref : a ->{IO} Ref {IO} a + 252. io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 252. io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 253. io2.IO.renameDirectory.impl : Text + 253. io2.IO.removeFile.impl : Text ->{IO} Either Failure () + 254. io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 254. io2.IO.renameFile.impl : Text + 255. io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 255. io2.IO.seekHandle.impl : Handle + 256. io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 256. io2.IO.serverSocket.impl : Optional Text + 257. io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 257. io2.IO.setBuffering.impl : Handle + 258. io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 258. io2.IO.setCurrentDirectory.impl : Text + 259. io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 259. io2.IO.setEcho.impl : Handle + 260. io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 260. io2.IO.socketAccept.impl : Socket + 261. io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 261. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 262. io2.IO.socketReceive.impl : Socket + 262. io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat + 263. io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 263. io2.IO.socketSend.impl : Socket + 264. io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 264. io2.IO.stdHandle : StdHandle -> Handle - 265. io2.IO.systemTime.impl : '{IO} Either Failure Nat - 266. io2.IO.systemTimeMicroseconds : '{IO} Int - 267. io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 268. unique type io2.IOError - 269. io2.IOError.AlreadyExists : IOError - 270. io2.IOError.EOF : IOError - 271. io2.IOError.IllegalOperation : IOError - 272. io2.IOError.NoSuchThing : IOError - 273. io2.IOError.PermissionDenied : IOError - 274. io2.IOError.ResourceBusy : IOError - 275. io2.IOError.ResourceExhausted : IOError - 276. io2.IOError.UserError : IOError - 277. unique type io2.IOFailure - 278. unique type io2.MiscFailure - 279. builtin type io2.MVar - 280. io2.MVar.isEmpty : MVar a ->{IO} Boolean - 281. io2.MVar.new : a ->{IO} MVar a - 282. io2.MVar.newEmpty : '{IO} MVar a - 283. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 284. io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 285. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 286. io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 287. io2.MVar.tryPut.impl : MVar a + 265. io2.IO.stdHandle : StdHandle -> Handle + 266. io2.IO.systemTime.impl : '{IO} Either Failure Nat + 267. io2.IO.systemTimeMicroseconds : '{IO} Int + 268. io2.IO.tryEval : '{IO} a ->{IO, Exception} a + 269. unique type io2.IOError + 270. io2.IOError.AlreadyExists : IOError + 271. io2.IOError.EOF : IOError + 272. io2.IOError.IllegalOperation : IOError + 273. io2.IOError.NoSuchThing : IOError + 274. io2.IOError.PermissionDenied : IOError + 275. io2.IOError.ResourceBusy : IOError + 276. io2.IOError.ResourceExhausted : IOError + 277. io2.IOError.UserError : IOError + 278. unique type io2.IOFailure + 279. unique type io2.MiscFailure + 280. builtin type io2.MVar + 281. io2.MVar.isEmpty : MVar a ->{IO} Boolean + 282. io2.MVar.new : a ->{IO} MVar a + 283. io2.MVar.newEmpty : '{IO} MVar a + 284. io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () + 285. io2.MVar.read.impl : MVar a ->{IO} Either Failure a + 286. io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a + 287. io2.MVar.take.impl : MVar a ->{IO} Either Failure a + 288. io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 288. io2.MVar.tryRead.impl : MVar a + 289. io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 289. io2.MVar.tryTake : MVar a ->{IO} Optional a - 290. builtin type io2.ProcessHandle - 291. builtin type io2.Promise - 292. io2.Promise.new : '{IO} Promise a - 293. io2.Promise.read : Promise a ->{IO} a - 294. io2.Promise.tryRead : Promise a ->{IO} Optional a - 295. io2.Promise.write : Promise a -> a ->{IO} Boolean - 296. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 297. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 298. builtin type io2.Ref.Ticket - 299. io2.Ref.Ticket.read : Ticket a -> a - 300. unique type io2.RuntimeFailure - 301. unique type io2.SeekMode - 302. io2.SeekMode.AbsoluteSeek : SeekMode - 303. io2.SeekMode.RelativeSeek : SeekMode - 304. io2.SeekMode.SeekFromEnd : SeekMode - 305. builtin type io2.Socket - 306. unique type io2.StdHandle - 307. io2.StdHandle.StdErr : StdHandle - 308. io2.StdHandle.StdIn : StdHandle - 309. io2.StdHandle.StdOut : StdHandle - 310. builtin type io2.STM - 311. io2.STM.atomically : '{STM} a ->{IO} a - 312. io2.STM.retry : '{STM} a - 313. unique type io2.STMFailure - 314. builtin type io2.ThreadId - 315. unique type io2.ThreadKilledFailure - 316. builtin type io2.Tls - 317. builtin type io2.Tls.Cipher - 318. builtin type io2.Tls.ClientConfig - 319. io2.Tls.ClientConfig.certificates.set : [SignedCert] + 290. io2.MVar.tryTake : MVar a ->{IO} Optional a + 291. builtin type io2.ProcessHandle + 292. builtin type io2.Promise + 293. io2.Promise.new : '{IO} Promise a + 294. io2.Promise.read : Promise a ->{IO} a + 295. io2.Promise.tryRead : Promise a ->{IO} Optional a + 296. io2.Promise.write : Promise a -> a ->{IO} Boolean + 297. io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean + 298. io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a + 299. builtin type io2.Ref.Ticket + 300. io2.Ref.Ticket.read : Ticket a -> a + 301. unique type io2.RuntimeFailure + 302. unique type io2.SeekMode + 303. io2.SeekMode.AbsoluteSeek : SeekMode + 304. io2.SeekMode.RelativeSeek : SeekMode + 305. io2.SeekMode.SeekFromEnd : SeekMode + 306. builtin type io2.Socket + 307. unique type io2.StdHandle + 308. io2.StdHandle.StdErr : StdHandle + 309. io2.StdHandle.StdIn : StdHandle + 310. io2.StdHandle.StdOut : StdHandle + 311. builtin type io2.STM + 312. io2.STM.atomically : '{STM} a ->{IO} a + 313. io2.STM.retry : '{STM} a + 314. unique type io2.STMFailure + 315. builtin type io2.ThreadId + 316. unique type io2.ThreadKilledFailure + 317. builtin type io2.Tls + 318. builtin type io2.Tls.Cipher + 319. builtin type io2.Tls.ClientConfig + 320. io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 320. io2.TLS.ClientConfig.ciphers.set : [Cipher] + 321. io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 321. io2.Tls.ClientConfig.default : Text + 322. io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 322. io2.Tls.ClientConfig.versions.set : [Version] + 323. io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 323. io2.Tls.decodeCert.impl : Bytes + 324. io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 324. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 325. io2.Tls.encodeCert : SignedCert -> Bytes - 326. io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 327. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 328. io2.Tls.newClient.impl : ClientConfig + 325. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] + 326. io2.Tls.encodeCert : SignedCert -> Bytes + 327. io2.Tls.encodePrivateKey : PrivateKey -> Bytes + 328. io2.Tls.handshake.impl : Tls ->{IO} Either Failure () + 329. io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 329. io2.Tls.newServer.impl : ServerConfig + 330. io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 330. builtin type io2.Tls.PrivateKey - 331. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 332. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 333. builtin type io2.Tls.ServerConfig - 334. io2.Tls.ServerConfig.certificates.set : [SignedCert] + 331. builtin type io2.Tls.PrivateKey + 332. io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes + 333. io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () + 334. builtin type io2.Tls.ServerConfig + 335. io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 335. io2.Tls.ServerConfig.ciphers.set : [Cipher] + 336. io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 336. io2.Tls.ServerConfig.default : [SignedCert] + 337. io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 337. io2.Tls.ServerConfig.versions.set : [Version] + 338. io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 338. builtin type io2.Tls.SignedCert - 339. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 340. builtin type io2.Tls.Version - 341. unique type io2.TlsFailure - 342. builtin type io2.TVar - 343. io2.TVar.new : a ->{STM} TVar a - 344. io2.TVar.newIO : a ->{IO} TVar a - 345. io2.TVar.read : TVar a ->{STM} a - 346. io2.TVar.readIO : TVar a ->{IO} a - 347. io2.TVar.swap : TVar a -> a ->{STM} a - 348. io2.TVar.write : TVar a -> a ->{STM} () - 349. io2.validateSandboxed : [Term] -> a -> Boolean - 350. unique type IsPropagated - 351. IsPropagated.IsPropagated : IsPropagated - 352. unique type IsTest - 353. IsTest.IsTest : IsTest - 354. unique type Link - 355. builtin type Link.Term - 356. Link.Term : Term -> Link - 357. Link.Term.toText : Term -> Text - 358. builtin type Link.Type - 359. Link.Type : Type -> Link - 360. builtin type List - 361. List.++ : [a] -> [a] -> [a] - 362. List.+: : a -> [a] -> [a] - 363. List.:+ : [a] -> a -> [a] - 364. List.at : Nat -> [a] -> Optional a - 365. List.cons : a -> [a] -> [a] - 366. List.drop : Nat -> [a] -> [a] - 367. List.empty : [a] - 368. List.size : [a] -> Nat - 369. List.snoc : [a] -> a -> [a] - 370. List.take : Nat -> [a] -> [a] - 371. metadata.isPropagated : IsPropagated - 372. metadata.isTest : IsTest - 373. builtin type MutableArray - 374. MutableArray.copyTo! : MutableArray g a + 339. builtin type io2.Tls.SignedCert + 340. io2.Tls.terminate.impl : Tls ->{IO} Either Failure () + 341. builtin type io2.Tls.Version + 342. unique type io2.TlsFailure + 343. builtin type io2.TVar + 344. io2.TVar.new : a ->{STM} TVar a + 345. io2.TVar.newIO : a ->{IO} TVar a + 346. io2.TVar.read : TVar a ->{STM} a + 347. io2.TVar.readIO : TVar a ->{IO} a + 348. io2.TVar.swap : TVar a -> a ->{STM} a + 349. io2.TVar.write : TVar a -> a ->{STM} () + 350. io2.validateSandboxed : [Term] -> a -> Boolean + 351. unique type IsPropagated + 352. IsPropagated.IsPropagated : IsPropagated + 353. unique type IsTest + 354. IsTest.IsTest : IsTest + 355. unique type Link + 356. builtin type Link.Term + 357. Link.Term : Term -> Link + 358. Link.Term.toText : Term -> Text + 359. builtin type Link.Type + 360. Link.Type : Type -> Link + 361. builtin type List + 362. List.++ : [a] -> [a] -> [a] + 363. List.+: : a -> [a] -> [a] + 364. List.:+ : [a] -> a -> [a] + 365. List.at : Nat -> [a] -> Optional a + 366. List.cons : a -> [a] -> [a] + 367. List.drop : Nat -> [a] -> [a] + 368. List.empty : [a] + 369. List.size : [a] -> Nat + 370. List.snoc : [a] -> a -> [a] + 371. List.take : Nat -> [a] -> [a] + 372. metadata.isPropagated : IsPropagated + 373. metadata.isTest : IsTest + 374. builtin type MutableArray + 375. MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray g a -> Nat -> Nat ->{g, Exception} () - 375. MutableArray.freeze : MutableArray g a + 376. MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 376. MutableArray.freeze! : MutableArray g a + 377. MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 377. MutableArray.read : MutableArray g a + 378. MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 378. MutableArray.size : MutableArray g a -> Nat - 379. MutableArray.write : MutableArray g a + 379. MutableArray.size : MutableArray g a -> Nat + 380. MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 380. builtin type MutableByteArray - 381. MutableByteArray.copyTo! : MutableByteArray g + 381. builtin type MutableByteArray + 382. MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 382. MutableByteArray.freeze : MutableByteArray g + 383. MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 383. MutableByteArray.freeze! : MutableByteArray g + 384. MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 384. MutableByteArray.read16be : MutableByteArray g + 385. MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 385. MutableByteArray.read24be : MutableByteArray g + 386. MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 386. MutableByteArray.read32be : MutableByteArray g + 387. MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 387. MutableByteArray.read40be : MutableByteArray g + 388. MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 388. MutableByteArray.read64be : MutableByteArray g + 389. MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 389. MutableByteArray.read8 : MutableByteArray g + 390. MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 390. MutableByteArray.size : MutableByteArray g -> Nat - 391. MutableByteArray.write16be : MutableByteArray g + 391. MutableByteArray.size : MutableByteArray g -> Nat + 392. MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 392. MutableByteArray.write32be : MutableByteArray g + 393. MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 393. MutableByteArray.write64be : MutableByteArray g + 394. MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 394. MutableByteArray.write8 : MutableByteArray g + 395. MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 395. builtin type Nat - 396. Nat.* : Nat -> Nat -> Nat - 397. Nat.+ : Nat -> Nat -> Nat - 398. Nat./ : Nat -> Nat -> Nat - 399. Nat.and : Nat -> Nat -> Nat - 400. Nat.complement : Nat -> Nat - 401. Nat.drop : Nat -> Nat -> Nat - 402. Nat.eq : Nat -> Nat -> Boolean - 403. Nat.fromText : Text -> Optional Nat - 404. Nat.gt : Nat -> Nat -> Boolean - 405. Nat.gteq : Nat -> Nat -> Boolean - 406. Nat.increment : Nat -> Nat - 407. Nat.isEven : Nat -> Boolean - 408. Nat.isOdd : Nat -> Boolean - 409. Nat.leadingZeros : Nat -> Nat - 410. Nat.lt : Nat -> Nat -> Boolean - 411. Nat.lteq : Nat -> Nat -> Boolean - 412. Nat.mod : Nat -> Nat -> Nat - 413. Nat.or : Nat -> Nat -> Nat - 414. Nat.popCount : Nat -> Nat - 415. Nat.pow : Nat -> Nat -> Nat - 416. Nat.shiftLeft : Nat -> Nat -> Nat - 417. Nat.shiftRight : Nat -> Nat -> Nat - 418. Nat.sub : Nat -> Nat -> Int - 419. Nat.toFloat : Nat -> Float - 420. Nat.toInt : Nat -> Int - 421. Nat.toText : Nat -> Text - 422. Nat.trailingZeros : Nat -> Nat - 423. Nat.xor : Nat -> Nat -> Nat - 424. structural type Optional a - 425. Optional.None : Optional a - 426. Optional.Some : a -> Optional a - 427. builtin type Pattern - 428. Pattern.capture : Pattern a -> Pattern a - 429. Pattern.isMatch : Pattern a -> a -> Boolean - 430. Pattern.join : [Pattern a] -> Pattern a - 431. Pattern.many : Pattern a -> Pattern a - 432. Pattern.or : Pattern a -> Pattern a -> Pattern a - 433. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 434. Pattern.run : Pattern a -> a -> Optional ([a], a) - 435. builtin type Ref - 436. Ref.read : Ref g a ->{g} a - 437. Ref.write : Ref g a -> a ->{g} () - 438. builtin type Request - 439. builtin type Scope - 440. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 441. Scope.arrayOf : a + 396. builtin type Nat + 397. Nat.* : Nat -> Nat -> Nat + 398. Nat.+ : Nat -> Nat -> Nat + 399. Nat./ : Nat -> Nat -> Nat + 400. Nat.and : Nat -> Nat -> Nat + 401. Nat.complement : Nat -> Nat + 402. Nat.drop : Nat -> Nat -> Nat + 403. Nat.eq : Nat -> Nat -> Boolean + 404. Nat.fromText : Text -> Optional Nat + 405. Nat.gt : Nat -> Nat -> Boolean + 406. Nat.gteq : Nat -> Nat -> Boolean + 407. Nat.increment : Nat -> Nat + 408. Nat.isEven : Nat -> Boolean + 409. Nat.isOdd : Nat -> Boolean + 410. Nat.leadingZeros : Nat -> Nat + 411. Nat.lt : Nat -> Nat -> Boolean + 412. Nat.lteq : Nat -> Nat -> Boolean + 413. Nat.mod : Nat -> Nat -> Nat + 414. Nat.or : Nat -> Nat -> Nat + 415. Nat.popCount : Nat -> Nat + 416. Nat.pow : Nat -> Nat -> Nat + 417. Nat.shiftLeft : Nat -> Nat -> Nat + 418. Nat.shiftRight : Nat -> Nat -> Nat + 419. Nat.sub : Nat -> Nat -> Int + 420. Nat.toFloat : Nat -> Float + 421. Nat.toInt : Nat -> Int + 422. Nat.toText : Nat -> Text + 423. Nat.trailingZeros : Nat -> Nat + 424. Nat.xor : Nat -> Nat -> Nat + 425. structural type Optional a + 426. Optional.None : Optional a + 427. Optional.Some : a -> Optional a + 428. builtin type Pattern + 429. Pattern.capture : Pattern a -> Pattern a + 430. Pattern.isMatch : Pattern a -> a -> Boolean + 431. Pattern.join : [Pattern a] -> Pattern a + 432. Pattern.many : Pattern a -> Pattern a + 433. Pattern.or : Pattern a -> Pattern a -> Pattern a + 434. Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a + 435. Pattern.run : Pattern a -> a -> Optional ([a], a) + 436. builtin type Ref + 437. Ref.read : Ref g a ->{g} a + 438. Ref.write : Ref g a -> a ->{g} () + 439. builtin type Request + 440. builtin type Scope + 441. Scope.array : Nat ->{Scope s} MutableArray (Scope s) a + 442. Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 442. Scope.bytearray : Nat + 443. Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 443. Scope.bytearrayOf : Nat + 444. Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 444. Scope.ref : a ->{Scope s} Ref {Scope s} a - 445. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 446. structural type SeqView a b - 447. SeqView.VElem : a -> b -> SeqView a b - 448. SeqView.VEmpty : SeqView a b - 449. Socket.toText : Socket -> Text - 450. unique type Test.Result - 451. Test.Result.Fail : Text -> Result - 452. Test.Result.Ok : Text -> Result - 453. builtin type Text - 454. Text.!= : Text -> Text -> Boolean - 455. Text.++ : Text -> Text -> Text - 456. Text.drop : Nat -> Text -> Text - 457. Text.empty : Text - 458. Text.eq : Text -> Text -> Boolean - 459. Text.fromCharList : [Char] -> Text - 460. Text.fromUtf8.impl : Bytes -> Either Failure Text - 461. Text.gt : Text -> Text -> Boolean - 462. Text.gteq : Text -> Text -> Boolean - 463. Text.lt : Text -> Text -> Boolean - 464. Text.lteq : Text -> Text -> Boolean - 465. Text.patterns.anyChar : Pattern Text - 466. Text.patterns.char : Class -> Pattern Text - 467. Text.patterns.charIn : [Char] -> Pattern Text - 468. Text.patterns.charRange : Char -> Char -> Pattern Text - 469. Text.patterns.digit : Pattern Text - 470. Text.patterns.eof : Pattern Text - 471. Text.patterns.letter : Pattern Text - 472. Text.patterns.literal : Text -> Pattern Text - 473. Text.patterns.notCharIn : [Char] -> Pattern Text - 474. Text.patterns.notCharRange : Char -> Char -> Pattern Text - 475. Text.patterns.punctuation : Pattern Text - 476. Text.patterns.space : Pattern Text - 477. Text.repeat : Nat -> Text -> Text - 478. Text.reverse : Text -> Text - 479. Text.size : Text -> Nat - 480. Text.take : Nat -> Text -> Text - 481. Text.toCharList : Text -> [Char] - 482. Text.toLowercase : Text -> Text - 483. Text.toUppercase : Text -> Text - 484. Text.toUtf8 : Text -> Bytes - 485. Text.uncons : Text -> Optional (Char, Text) - 486. Text.unsnoc : Text -> Optional (Text, Char) - 487. ThreadId.toText : ThreadId -> Text - 488. todo : a -> b - 489. structural type Tuple a b - 490. Tuple.Cons : a -> b -> Tuple a b - 491. structural type Unit - 492. Unit.Unit : () - 493. Universal.< : a -> a -> Boolean - 494. Universal.<= : a -> a -> Boolean - 495. Universal.== : a -> a -> Boolean - 496. Universal.> : a -> a -> Boolean - 497. Universal.>= : a -> a -> Boolean - 498. Universal.compare : a -> a -> Int - 499. Universal.murmurHash : a -> Nat - 500. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 501. builtin type Value - 502. Value.dependencies : Value -> [Term] - 503. Value.deserialize : Bytes -> Either Text Value - 504. Value.load : Value ->{IO} Either [Term] a - 505. Value.serialize : Value -> Bytes - 506. Value.value : a -> Value + 445. Scope.ref : a ->{Scope s} Ref {Scope s} a + 446. Scope.run : (∀ s. '{g, Scope s} r) ->{g} r + 447. structural type SeqView a b + 448. SeqView.VElem : a -> b -> SeqView a b + 449. SeqView.VEmpty : SeqView a b + 450. Socket.toText : Socket -> Text + 451. unique type Test.Result + 452. Test.Result.Fail : Text -> Result + 453. Test.Result.Ok : Text -> Result + 454. builtin type Text + 455. Text.!= : Text -> Text -> Boolean + 456. Text.++ : Text -> Text -> Text + 457. Text.drop : Nat -> Text -> Text + 458. Text.empty : Text + 459. Text.eq : Text -> Text -> Boolean + 460. Text.fromCharList : [Char] -> Text + 461. Text.fromUtf8.impl : Bytes -> Either Failure Text + 462. Text.gt : Text -> Text -> Boolean + 463. Text.gteq : Text -> Text -> Boolean + 464. Text.lt : Text -> Text -> Boolean + 465. Text.lteq : Text -> Text -> Boolean + 466. Text.patterns.anyChar : Pattern Text + 467. Text.patterns.char : Class -> Pattern Text + 468. Text.patterns.charIn : [Char] -> Pattern Text + 469. Text.patterns.charRange : Char -> Char -> Pattern Text + 470. Text.patterns.digit : Pattern Text + 471. Text.patterns.eof : Pattern Text + 472. Text.patterns.letter : Pattern Text + 473. Text.patterns.literal : Text -> Pattern Text + 474. Text.patterns.notCharIn : [Char] -> Pattern Text + 475. Text.patterns.notCharRange : Char -> Char -> Pattern Text + 476. Text.patterns.punctuation : Pattern Text + 477. Text.patterns.space : Pattern Text + 478. Text.repeat : Nat -> Text -> Text + 479. Text.reverse : Text -> Text + 480. Text.size : Text -> Nat + 481. Text.take : Nat -> Text -> Text + 482. Text.toCharList : Text -> [Char] + 483. Text.toLowercase : Text -> Text + 484. Text.toUppercase : Text -> Text + 485. Text.toUtf8 : Text -> Bytes + 486. Text.uncons : Text -> Optional (Char, Text) + 487. Text.unsnoc : Text -> Optional (Text, Char) + 488. ThreadId.toText : ThreadId -> Text + 489. todo : a -> b + 490. structural type Tuple a b + 491. Tuple.Cons : a -> b -> Tuple a b + 492. structural type Unit + 493. Unit.Unit : () + 494. Universal.< : a -> a -> Boolean + 495. Universal.<= : a -> a -> Boolean + 496. Universal.== : a -> a -> Boolean + 497. Universal.> : a -> a -> Boolean + 498. Universal.>= : a -> a -> Boolean + 499. Universal.compare : a -> a -> Int + 500. Universal.murmurHash : a -> Nat + 501. unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b + 502. builtin type Value + 503. Value.dependencies : Value -> [Term] + 504. Value.deserialize : Bytes -> Either Text Value + 505. Value.load : Value ->{IO} Either [Term] a + 506. Value.serialize : Value -> Bytes + 507. Value.value : a -> Value .builtin> alias.many 94-104 .mylib @@ -699,14 +700,14 @@ Let's try it! 1. structural type Either a b 2. structural ability Exception 3. builtin type Float - 4. Either.Left : a -> Either a b - 5. Doc.Link : Link -> Doc - 6. Either.Right : b -> Either a b - 7. Doc.Signature : Term -> Doc - 8. Doc.Source : Link -> Doc - 9. Exception.raise : Failure ->{Exception} x - 10. Float.* : Float -> Float -> Float - 11. Float.+ : Float -> Float -> Float + 4. Doc.Join : [Doc] -> Doc + 5. Either.Left : a -> Either a b + 6. Doc.Link : Link -> Doc + 7. Either.Right : b -> Either a b + 8. Doc.Signature : Term -> Doc + 9. Doc.Source : Link -> Doc + 10. Exception.raise : Failure ->{Exception} x + 11. Float.* : Float -> Float -> Float Tip: You can use `undo` or `reflog` to undo this change. @@ -766,17 +767,17 @@ I want to incorporate a few more from another namespace: .mylib> find - 1. Doc.Link : Link -> Doc - 2. Doc.Signature : Term -> Doc - 3. Doc.Source : Link -> Doc - 4. structural type Either a b - 5. Either.Left : a -> Either a b - 6. Either.Right : b -> Either a b - 7. structural ability Exception - 8. Exception.raise : Failure ->{Exception} x - 9. builtin type Float - 10. Float.* : Float -> Float -> Float - 11. Float.+ : Float -> Float -> Float + 1. Doc.Join : [Doc] -> Doc + 2. Doc.Link : Link -> Doc + 3. Doc.Signature : Term -> Doc + 4. Doc.Source : Link -> Doc + 5. structural type Either a b + 6. Either.Left : a -> Either a b + 7. Either.Right : b -> Either a b + 8. structural ability Exception + 9. Exception.raise : Failure ->{Exception} x + 10. builtin type Float + 11. Float.* : Float -> Float -> Float 12. List.adjacentPairs : [a] -> [(a, a)] 13. List.all : (a ->{g} Boolean) -> [a] ->{g} Boolean 14. List.any : (a ->{g} Boolean) -> [a] ->{g} Boolean diff --git a/unison-src/transcripts/builtins-merge.output.md b/unison-src/transcripts/builtins-merge.output.md index 3369e258b..feb39b578 100644 --- a/unison-src/transcripts/builtins-merge.output.md +++ b/unison-src/transcripts/builtins-merge.output.md @@ -73,7 +73,7 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace 62. Value (builtin type) 63. Value/ (5 terms) 64. bug (a -> b) - 65. crypto/ (12 terms, 1 type) + 65. crypto/ (13 terms, 1 type) 66. io2/ (131 terms, 32 types) 67. metadata/ (2 terms) 68. todo (a -> b) diff --git a/unison-src/transcripts/emptyCodebase.output.md b/unison-src/transcripts/emptyCodebase.output.md index 9db858af9..665a8192b 100644 --- a/unison-src/transcripts/emptyCodebase.output.md +++ b/unison-src/transcripts/emptyCodebase.output.md @@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge` .foo> ls - 1. builtin/ (440 terms, 66 types) + 1. builtin/ (441 terms, 66 types) ``` And for a limited time, you can get even more builtin goodies: @@ -35,7 +35,7 @@ And for a limited time, you can get even more builtin goodies: .foo> ls - 1. builtin/ (612 terms, 84 types) + 1. builtin/ (613 terms, 84 types) ``` More typically, you'd start out by pulling `base. diff --git a/unison-src/transcripts/merges.output.md b/unison-src/transcripts/merges.output.md index d65e99380..a23dd5541 100644 --- a/unison-src/transcripts/merges.output.md +++ b/unison-src/transcripts/merges.output.md @@ -113,13 +113,13 @@ it's still in the `history` of the parent namespace and can be resurrected at an Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #9k2k834edc + ⊙ 1. #nkba2hklaj - Deletes: feature1.y - ⊙ 2. #d9u1nnu62h + ⊙ 2. #5rvucutrqs + Adds / updates: @@ -130,26 +130,26 @@ it's still in the `history` of the parent namespace and can be resurrected at an Original name New name(s) feature1.y master.y - ⊙ 3. #8ir51a10kg + ⊙ 3. #s37mv81ocj + Adds / updates: feature1.y - ⊙ 4. #v03np1853n + ⊙ 4. #9lpfbm6ug1 > Moves: Original name New name x master.x - ⊙ 5. #1fnkqqd2ae + ⊙ 5. #i9jun1cl1a + Adds / updates: x - □ 6. #b3jsb4pjcl (start of history) + □ 6. #rcu3lukmgn (start of history) ``` To resurrect an old version of a namespace, you can learn its hash via the `history` command, then use `fork #namespacehash .newname`. diff --git a/unison-src/transcripts/move-namespace.output.md b/unison-src/transcripts/move-namespace.output.md index 9689c3d79..4018c58fd 100644 --- a/unison-src/transcripts/move-namespace.output.md +++ b/unison-src/transcripts/move-namespace.output.md @@ -269,7 +269,7 @@ I should be able to move the root into a sub-namespace .> ls - 1. root/ (617 terms, 85 types) + 1. root/ (618 terms, 85 types) .> history @@ -278,13 +278,13 @@ I should be able to move the root into a sub-namespace - □ 1. #j17hvtt1rm (start of history) + □ 1. #59k30lbgtv (start of history) ``` ```ucm .> ls .root.at.path - 1. builtin/ (612 terms, 84 types) + 1. builtin/ (613 terms, 84 types) 2. existing/ (1 term) 3. happy/ (3 terms, 1 type) 4. history/ (1 term) @@ -294,7 +294,7 @@ I should be able to move the root into a sub-namespace Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #epknijg4pk + ⊙ 1. #3fqubj2dfq - Deletes: @@ -305,7 +305,7 @@ I should be able to move the root into a sub-namespace Original name New name existing.a.termInA existing.b.termInA - ⊙ 2. #pmecta5so9 + ⊙ 2. #4oifqrjksd + Adds / updates: @@ -317,26 +317,26 @@ I should be able to move the root into a sub-namespace happy.b.termInA existing.a.termInA history.b.termInA existing.a.termInA - ⊙ 3. #lc7lsqgcmo + ⊙ 3. #vmtrlijaub + Adds / updates: existing.a.termInA existing.b.termInB - ⊙ 4. #j36gjaovv9 + ⊙ 4. #qp72kiv6qv > Moves: Original name New name history.a.termInA history.b.termInA - ⊙ 5. #domisg9f2n + ⊙ 5. #rgcqdg78el - Deletes: history.b.termInB - ⊙ 6. #69vk74hidq + ⊙ 6. #3ep162o7o5 + Adds / updates: @@ -347,13 +347,13 @@ I should be able to move the root into a sub-namespace Original name New name(s) happy.b.termInA history.a.termInA - ⊙ 7. #hslilthrkd + ⊙ 7. #icou0jar0d + Adds / updates: history.a.termInA history.b.termInB - ⊙ 8. #ap9o8u4m1a + ⊙ 8. #utbaohifbg > Moves: @@ -363,7 +363,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T2 happy.b.T.T2 happy.a.termInA happy.b.termInA - ⊙ 9. #tpka2u10nq + ⊙ 9. #3tgqm3g16k + Adds / updates: @@ -373,7 +373,7 @@ I should be able to move the root into a sub-namespace happy.a.T.T - ⊙ 10. #ebk6c1po2f + ⊙ 10. #5f0h338k67 + Adds / updates: @@ -385,7 +385,7 @@ I should be able to move the root into a sub-namespace ⠇ - ⊙ 11. #c5i2vql0hi + ⊙ 11. #u0kujjj8n2 ``` diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index 45438248d..44e94b095 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -308,139 +308,140 @@ d = c + 10 142. builtin.crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm 143. builtin.crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm 144. builtin.crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm - 145. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm - 146. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm - 147. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm - 148. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm - 149. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm - 150. builtin.Float.abs : Float + 145. builtin.crypto.HashAlgorithm.Md5 : HashAlgorithm + 146. builtin.crypto.HashAlgorithm.Sha1 : HashAlgorithm + 147. builtin.crypto.HashAlgorithm.Sha2_256 : HashAlgorithm + 148. builtin.crypto.HashAlgorithm.Sha2_512 : HashAlgorithm + 149. builtin.crypto.HashAlgorithm.Sha3_256 : HashAlgorithm + 150. builtin.crypto.HashAlgorithm.Sha3_512 : HashAlgorithm + 151. builtin.Float.abs : Float -> Float - 151. builtin.Float.acos : Float + 152. builtin.Float.acos : Float -> Float - 152. builtin.Float.acosh : Float + 153. builtin.Float.acosh : Float -> Float - 153. builtin.Char.Class.alphanumeric : Class - 154. builtin.Char.Class.and : Class + 154. builtin.Char.Class.alphanumeric : Class + 155. builtin.Char.Class.and : Class -> Class -> Class - 155. builtin.Int.and : Int + 156. builtin.Int.and : Int -> Int -> Int - 156. builtin.Nat.and : Nat + 157. builtin.Nat.and : Nat -> Nat -> Nat - 157. builtin.Char.Class.any : Class - 158. builtin.Text.patterns.anyChar : Pattern + 158. builtin.Char.Class.any : Class + 159. builtin.Text.patterns.anyChar : Pattern Text - 159. builtin.Char.Class.anyOf : [Char] + 160. builtin.Char.Class.anyOf : [Char] -> Class - 160. builtin.io2.IO.array : Nat + 161. builtin.io2.IO.array : Nat ->{IO} MutableArray {IO} a - 161. builtin.Scope.array : Nat + 162. builtin.Scope.array : Nat ->{Scope s} MutableArray (Scope s) a - 162. builtin.io2.IO.arrayOf : a + 163. builtin.io2.IO.arrayOf : a -> Nat ->{IO} MutableArray {IO} a - 163. builtin.Scope.arrayOf : a + 164. builtin.Scope.arrayOf : a -> Nat ->{Scope s} MutableArray (Scope s) a - 164. builtin.Float.asin : Float + 165. builtin.Float.asin : Float -> Float - 165. builtin.Float.asinh : Float + 166. builtin.Float.asinh : Float -> Float - 166. builtin.Bytes.at : Nat + 167. builtin.Bytes.at : Nat -> Bytes -> Optional Nat - 167. builtin.List.at : Nat + 168. builtin.List.at : Nat -> [a] -> Optional a - 168. builtin.Float.atan : Float + 169. builtin.Float.atan : Float -> Float - 169. builtin.Float.atan2 : Float + 170. builtin.Float.atan2 : Float -> Float -> Float - 170. builtin.Float.atanh : Float + 171. builtin.Float.atanh : Float -> Float - 171. builtin.io2.STM.atomically : '{STM} a + 172. builtin.io2.STM.atomically : '{STM} a ->{IO} a - 172. builtin.bug : a -> b - 173. builtin.io2.IO.bytearray : Nat + 173. builtin.bug : a -> b + 174. builtin.io2.IO.bytearray : Nat ->{IO} MutableByteArray {IO} - 174. builtin.Scope.bytearray : Nat + 175. builtin.Scope.bytearray : Nat ->{Scope s} MutableByteArray (Scope s) - 175. builtin.io2.IO.bytearrayOf : Nat + 176. builtin.io2.IO.bytearrayOf : Nat -> Nat ->{IO} MutableByteArray {IO} - 176. builtin.Scope.bytearrayOf : Nat + 177. builtin.Scope.bytearrayOf : Nat -> Nat ->{Scope s} MutableByteArray (Scope s) - 177. ┌ c#gjmq673r1v : Nat - 178. └ long.name.but.shortest.suffixification : Nat - 179. builtin.Code.cache_ : [( Term, + 178. ┌ c#gjmq673r1v : Nat + 179. └ long.name.but.shortest.suffixification : Nat + 180. builtin.Code.cache_ : [( Term, Code)] ->{IO} [Term] - 180. builtin.io2.IO.process.call : Text + 181. builtin.io2.IO.process.call : Text -> [Text] ->{IO} Nat - 181. builtin.Pattern.capture : Pattern + 182. builtin.Pattern.capture : Pattern a -> Pattern a - 182. builtin.io2.Ref.cas : Ref + 183. builtin.io2.Ref.cas : Ref {IO} a -> Ticket a -> a ->{IO} Boolean - 183. builtin.Float.ceiling : Float + 184. builtin.Float.ceiling : Float -> Int - 184. builtin.Text.patterns.char : Class + 185. builtin.Text.patterns.char : Class -> Pattern Text - 185. builtin.Text.patterns.charIn : [Char] + 186. builtin.Text.patterns.charIn : [Char] -> Pattern Text - 186. builtin.Text.patterns.charRange : Char + 187. builtin.Text.patterns.charRange : Char -> Char -> Pattern Text - 187. builtin.unsafe.coerceAbilities : (a + 188. builtin.unsafe.coerceAbilities : (a ->{e1} b) -> a ->{e2} b - 188. builtin.Universal.compare : a + 189. builtin.Universal.compare : a -> a -> Int - 189. builtin.Int.complement : Int + 190. builtin.Int.complement : Int -> Int - 190. builtin.Nat.complement : Nat + 191. builtin.Nat.complement : Nat -> Nat - 191. builtin.Bytes.gzip.compress : Bytes + 192. builtin.Bytes.gzip.compress : Bytes -> Bytes - 192. builtin.Bytes.zlib.compress : Bytes + 193. builtin.Bytes.zlib.compress : Bytes -> Bytes - 193. builtin.Char.Class.control : Class - 194. builtin.ImmutableArray.copyTo! : MutableArray + 194. builtin.Char.Class.control : Class + 195. builtin.ImmutableArray.copyTo! : MutableArray g a -> Nat -> ImmutableArray @@ -449,7 +450,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 195. builtin.ImmutableByteArray.copyTo! : MutableByteArray + 196. builtin.ImmutableByteArray.copyTo! : MutableByteArray g -> Nat -> ImmutableByteArray @@ -457,7 +458,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 196. builtin.MutableArray.copyTo! : MutableArray + 197. builtin.MutableArray.copyTo! : MutableArray g a -> Nat -> MutableArray @@ -466,7 +467,7 @@ d = c + 10 -> Nat ->{g, Exception} () - 197. builtin.MutableByteArray.copyTo! : MutableByteArray + 198. builtin.MutableByteArray.copyTo! : MutableByteArray g -> Nat -> MutableByteArray @@ -475,979 +476,979 @@ d = c + 10 -> Nat ->{g, Exception} () - 198. builtin.Float.cos : Float + 199. builtin.Float.cos : Float -> Float - 199. builtin.Float.cosh : Float + 200. builtin.Float.cosh : Float -> Float - 200. builtin.Bytes.decodeNat16be : Bytes + 201. builtin.Bytes.decodeNat16be : Bytes -> Optional ( Nat, Bytes) - 201. builtin.Bytes.decodeNat16le : Bytes + 202. builtin.Bytes.decodeNat16le : Bytes -> Optional ( Nat, Bytes) - 202. builtin.Bytes.decodeNat32be : Bytes + 203. builtin.Bytes.decodeNat32be : Bytes -> Optional ( Nat, Bytes) - 203. builtin.Bytes.decodeNat32le : Bytes + 204. builtin.Bytes.decodeNat32le : Bytes -> Optional ( Nat, Bytes) - 204. builtin.Bytes.decodeNat64be : Bytes + 205. builtin.Bytes.decodeNat64be : Bytes -> Optional ( Nat, Bytes) - 205. builtin.Bytes.decodeNat64le : Bytes + 206. builtin.Bytes.decodeNat64le : Bytes -> Optional ( Nat, Bytes) - 206. builtin.io2.Tls.decodePrivateKey : Bytes + 207. builtin.io2.Tls.decodePrivateKey : Bytes -> [PrivateKey] - 207. builtin.Bytes.gzip.decompress : Bytes + 208. builtin.Bytes.gzip.decompress : Bytes -> Either Text Bytes - 208. builtin.Bytes.zlib.decompress : Bytes + 209. builtin.Bytes.zlib.decompress : Bytes -> Either Text Bytes - 209. builtin.io2.Tls.ClientConfig.default : Text + 210. builtin.io2.Tls.ClientConfig.default : Text -> Bytes -> ClientConfig - 210. builtin.io2.Tls.ServerConfig.default : [SignedCert] + 211. builtin.io2.Tls.ServerConfig.default : [SignedCert] -> PrivateKey -> ServerConfig - 211. builtin.Code.dependencies : Code + 212. builtin.Code.dependencies : Code -> [Term] - 212. builtin.Value.dependencies : Value + 213. builtin.Value.dependencies : Value -> [Term] - 213. builtin.Code.deserialize : Bytes + 214. builtin.Code.deserialize : Bytes -> Either Text Code - 214. builtin.Value.deserialize : Bytes + 215. builtin.Value.deserialize : Bytes -> Either Text Value - 215. builtin.Text.patterns.digit : Pattern + 216. builtin.Text.patterns.digit : Pattern Text - 216. builtin.Code.display : Text + 217. builtin.Code.display : Text -> Code -> Text - 217. builtin.Bytes.drop : Nat + 218. builtin.Bytes.drop : Nat -> Bytes -> Bytes - 218. builtin.List.drop : Nat + 219. builtin.List.drop : Nat -> [a] -> [a] - 219. builtin.Nat.drop : Nat + 220. builtin.Nat.drop : Nat -> Nat -> Nat - 220. builtin.Text.drop : Nat + 221. builtin.Text.drop : Nat -> Text -> Text - 221. builtin.Bytes.empty : Bytes - 222. builtin.List.empty : [a] - 223. builtin.Text.empty : Text - 224. builtin.io2.Tls.encodeCert : SignedCert + 222. builtin.Bytes.empty : Bytes + 223. builtin.List.empty : [a] + 224. builtin.Text.empty : Text + 225. builtin.io2.Tls.encodeCert : SignedCert -> Bytes - 225. builtin.Bytes.encodeNat16be : Nat + 226. builtin.Bytes.encodeNat16be : Nat -> Bytes - 226. builtin.Bytes.encodeNat16le : Nat + 227. builtin.Bytes.encodeNat16le : Nat -> Bytes - 227. builtin.Bytes.encodeNat32be : Nat + 228. builtin.Bytes.encodeNat32be : Nat -> Bytes - 228. builtin.Bytes.encodeNat32le : Nat + 229. builtin.Bytes.encodeNat32le : Nat -> Bytes - 229. builtin.Bytes.encodeNat64be : Nat + 230. builtin.Bytes.encodeNat64be : Nat -> Bytes - 230. builtin.Bytes.encodeNat64le : Nat + 231. builtin.Bytes.encodeNat64le : Nat -> Bytes - 231. builtin.io2.Tls.encodePrivateKey : PrivateKey + 232. builtin.io2.Tls.encodePrivateKey : PrivateKey -> Bytes - 232. builtin.Text.patterns.eof : Pattern + 233. builtin.Text.patterns.eof : Pattern Text - 233. builtin.Float.eq : Float + 234. builtin.Float.eq : Float -> Float -> Boolean - 234. builtin.Int.eq : Int + 235. builtin.Int.eq : Int -> Int -> Boolean - 235. builtin.Nat.eq : Nat + 236. builtin.Nat.eq : Nat -> Nat -> Boolean - 236. builtin.Text.eq : Text + 237. builtin.Text.eq : Text -> Text -> Boolean - 237. builtin.io2.IO.process.exitCode : ProcessHandle + 238. builtin.io2.IO.process.exitCode : ProcessHandle ->{IO} Optional Nat - 238. builtin.Float.exp : Float + 239. builtin.Float.exp : Float -> Float - 239. builtin.Bytes.flatten : Bytes + 240. builtin.Bytes.flatten : Bytes -> Bytes - 240. builtin.Float.floor : Float + 241. builtin.Float.floor : Float -> Int - 241. builtin.io2.IO.forkComp : '{IO} a + 242. builtin.io2.IO.forkComp : '{IO} a ->{IO} ThreadId - 242. builtin.MutableArray.freeze : MutableArray + 243. builtin.MutableArray.freeze : MutableArray g a -> Nat -> Nat ->{g} ImmutableArray a - 243. builtin.MutableByteArray.freeze : MutableByteArray + 244. builtin.MutableByteArray.freeze : MutableByteArray g -> Nat -> Nat ->{g} ImmutableByteArray - 244. builtin.MutableArray.freeze! : MutableArray + 245. builtin.MutableArray.freeze! : MutableArray g a ->{g} ImmutableArray a - 245. builtin.MutableByteArray.freeze! : MutableByteArray + 246. builtin.MutableByteArray.freeze! : MutableByteArray g ->{g} ImmutableByteArray - 246. builtin.Bytes.fromBase16 : Bytes + 247. builtin.Bytes.fromBase16 : Bytes -> Either Text Bytes - 247. builtin.Bytes.fromBase32 : Bytes + 248. builtin.Bytes.fromBase32 : Bytes -> Either Text Bytes - 248. builtin.Bytes.fromBase64 : Bytes + 249. builtin.Bytes.fromBase64 : Bytes -> Either Text Bytes - 249. builtin.Bytes.fromBase64UrlUnpadded : Bytes + 250. builtin.Bytes.fromBase64UrlUnpadded : Bytes -> Either Text Bytes - 250. builtin.Text.fromCharList : [Char] + 251. builtin.Text.fromCharList : [Char] -> Text - 251. builtin.Bytes.fromList : [Nat] + 252. builtin.Bytes.fromList : [Nat] -> Bytes - 252. builtin.Char.fromNat : Nat + 253. builtin.Char.fromNat : Nat -> Char - 253. builtin.Float.fromRepresentation : Nat + 254. builtin.Float.fromRepresentation : Nat -> Float - 254. builtin.Int.fromRepresentation : Nat + 255. builtin.Int.fromRepresentation : Nat -> Int - 255. builtin.Float.fromText : Text + 256. builtin.Float.fromText : Text -> Optional Float - 256. builtin.Int.fromText : Text + 257. builtin.Int.fromText : Text -> Optional Int - 257. builtin.Nat.fromText : Text + 258. builtin.Nat.fromText : Text -> Optional Nat - 258. builtin.Float.gt : Float + 259. builtin.Float.gt : Float -> Float -> Boolean - 259. builtin.Int.gt : Int + 260. builtin.Int.gt : Int -> Int -> Boolean - 260. builtin.Nat.gt : Nat + 261. builtin.Nat.gt : Nat -> Nat -> Boolean - 261. builtin.Text.gt : Text + 262. builtin.Text.gt : Text -> Text -> Boolean - 262. builtin.Float.gteq : Float + 263. builtin.Float.gteq : Float -> Float -> Boolean - 263. builtin.Int.gteq : Int + 264. builtin.Int.gteq : Int -> Int -> Boolean - 264. builtin.Nat.gteq : Nat + 265. builtin.Nat.gteq : Nat -> Nat -> Boolean - 265. builtin.Text.gteq : Text + 266. builtin.Text.gteq : Text -> Text -> Boolean - 266. builtin.crypto.hash : HashAlgorithm + 267. builtin.crypto.hash : HashAlgorithm -> a -> Bytes - 267. builtin.crypto.hashBytes : HashAlgorithm + 268. builtin.crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes - 268. builtin.crypto.hmac : HashAlgorithm + 269. builtin.crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes - 269. builtin.crypto.hmacBytes : HashAlgorithm + 270. builtin.crypto.hmacBytes : HashAlgorithm -> Bytes -> Bytes -> Bytes - 270. builtin.io2.IO.clientSocket.impl : Text + 271. builtin.io2.IO.clientSocket.impl : Text -> Text ->{IO} Either Failure Socket - 271. builtin.io2.IO.closeFile.impl : Handle + 272. builtin.io2.IO.closeFile.impl : Handle ->{IO} Either Failure () - 272. builtin.io2.IO.closeSocket.impl : Socket + 273. builtin.io2.IO.closeSocket.impl : Socket ->{IO} Either Failure () - 273. builtin.io2.IO.createDirectory.impl : Text + 274. builtin.io2.IO.createDirectory.impl : Text ->{IO} Either Failure () - 274. builtin.io2.IO.createTempDirectory.impl : Text + 275. builtin.io2.IO.createTempDirectory.impl : Text ->{IO} Either Failure Text - 275. builtin.io2.Tls.decodeCert.impl : Bytes + 276. builtin.io2.Tls.decodeCert.impl : Bytes -> Either Failure SignedCert - 276. builtin.io2.IO.delay.impl : Nat + 277. builtin.io2.IO.delay.impl : Nat ->{IO} Either Failure () - 277. builtin.io2.IO.directoryContents.impl : Text + 278. builtin.io2.IO.directoryContents.impl : Text ->{IO} Either Failure [Text] - 278. builtin.io2.IO.fileExists.impl : Text + 279. builtin.io2.IO.fileExists.impl : Text ->{IO} Either Failure Boolean - 279. builtin.Text.fromUtf8.impl : Bytes + 280. builtin.Text.fromUtf8.impl : Bytes -> Either Failure Text - 280. builtin.io2.IO.getArgs.impl : '{IO} Either + 281. builtin.io2.IO.getArgs.impl : '{IO} Either Failure [Text] - 281. builtin.io2.IO.getBuffering.impl : Handle + 282. builtin.io2.IO.getBuffering.impl : Handle ->{IO} Either Failure BufferMode - 282. builtin.io2.IO.getBytes.impl : Handle + 283. builtin.io2.IO.getBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 283. builtin.io2.IO.getChar.impl : Handle + 284. builtin.io2.IO.getChar.impl : Handle ->{IO} Either Failure Char - 284. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either + 285. builtin.io2.IO.getCurrentDirectory.impl : '{IO} Either Failure Text - 285. builtin.io2.IO.getEcho.impl : Handle + 286. builtin.io2.IO.getEcho.impl : Handle ->{IO} Either Failure Boolean - 286. builtin.io2.IO.getEnv.impl : Text + 287. builtin.io2.IO.getEnv.impl : Text ->{IO} Either Failure Text - 287. builtin.io2.IO.getFileSize.impl : Text + 288. builtin.io2.IO.getFileSize.impl : Text ->{IO} Either Failure Nat - 288. builtin.io2.IO.getFileTimestamp.impl : Text + 289. builtin.io2.IO.getFileTimestamp.impl : Text ->{IO} Either Failure Nat - 289. builtin.io2.IO.getLine.impl : Handle + 290. builtin.io2.IO.getLine.impl : Handle ->{IO} Either Failure Text - 290. builtin.io2.IO.getSomeBytes.impl : Handle + 291. builtin.io2.IO.getSomeBytes.impl : Handle -> Nat ->{IO} Either Failure Bytes - 291. builtin.io2.IO.getTempDirectory.impl : '{IO} Either + 292. builtin.io2.IO.getTempDirectory.impl : '{IO} Either Failure Text - 292. builtin.io2.IO.handlePosition.impl : Handle + 293. builtin.io2.IO.handlePosition.impl : Handle ->{IO} Either Failure Nat - 293. builtin.io2.Tls.handshake.impl : Tls + 294. builtin.io2.Tls.handshake.impl : Tls ->{IO} Either Failure () - 294. builtin.io2.IO.isDirectory.impl : Text + 295. builtin.io2.IO.isDirectory.impl : Text ->{IO} Either Failure Boolean - 295. builtin.io2.IO.isFileEOF.impl : Handle + 296. builtin.io2.IO.isFileEOF.impl : Handle ->{IO} Either Failure Boolean - 296. builtin.io2.IO.isFileOpen.impl : Handle + 297. builtin.io2.IO.isFileOpen.impl : Handle ->{IO} Either Failure Boolean - 297. builtin.io2.IO.isSeekable.impl : Handle + 298. builtin.io2.IO.isSeekable.impl : Handle ->{IO} Either Failure Boolean - 298. builtin.io2.IO.kill.impl : ThreadId + 299. builtin.io2.IO.kill.impl : ThreadId ->{IO} Either Failure () - 299. builtin.io2.IO.listen.impl : Socket + 300. builtin.io2.IO.listen.impl : Socket ->{IO} Either Failure () - 300. builtin.io2.Tls.newClient.impl : ClientConfig + 301. builtin.io2.Tls.newClient.impl : ClientConfig -> Socket ->{IO} Either Failure Tls - 301. builtin.io2.Tls.newServer.impl : ServerConfig + 302. builtin.io2.Tls.newServer.impl : ServerConfig -> Socket ->{IO} Either Failure Tls - 302. builtin.io2.IO.openFile.impl : Text + 303. builtin.io2.IO.openFile.impl : Text -> FileMode ->{IO} Either Failure Handle - 303. builtin.io2.MVar.put.impl : MVar a + 304. builtin.io2.MVar.put.impl : MVar a -> a ->{IO} Either Failure () - 304. builtin.io2.IO.putBytes.impl : Handle + 305. builtin.io2.IO.putBytes.impl : Handle -> Bytes ->{IO} Either Failure () - 305. builtin.io2.MVar.read.impl : MVar a + 306. builtin.io2.MVar.read.impl : MVar a ->{IO} Either Failure a - 306. builtin.io2.IO.ready.impl : Handle + 307. builtin.io2.IO.ready.impl : Handle ->{IO} Either Failure Boolean - 307. builtin.io2.Tls.receive.impl : Tls + 308. builtin.io2.Tls.receive.impl : Tls ->{IO} Either Failure Bytes - 308. builtin.io2.IO.removeDirectory.impl : Text + 309. builtin.io2.IO.removeDirectory.impl : Text ->{IO} Either Failure () - 309. builtin.io2.IO.removeFile.impl : Text + 310. builtin.io2.IO.removeFile.impl : Text ->{IO} Either Failure () - 310. builtin.io2.IO.renameDirectory.impl : Text + 311. builtin.io2.IO.renameDirectory.impl : Text -> Text ->{IO} Either Failure () - 311. builtin.io2.IO.renameFile.impl : Text + 312. builtin.io2.IO.renameFile.impl : Text -> Text ->{IO} Either Failure () - 312. builtin.io2.IO.seekHandle.impl : Handle + 313. builtin.io2.IO.seekHandle.impl : Handle -> SeekMode -> Int ->{IO} Either Failure () - 313. builtin.io2.Tls.send.impl : Tls + 314. builtin.io2.Tls.send.impl : Tls -> Bytes ->{IO} Either Failure () - 314. builtin.io2.IO.serverSocket.impl : Optional + 315. builtin.io2.IO.serverSocket.impl : Optional Text -> Text ->{IO} Either Failure Socket - 315. builtin.io2.IO.setBuffering.impl : Handle + 316. builtin.io2.IO.setBuffering.impl : Handle -> BufferMode ->{IO} Either Failure () - 316. builtin.io2.IO.setCurrentDirectory.impl : Text + 317. builtin.io2.IO.setCurrentDirectory.impl : Text ->{IO} Either Failure () - 317. builtin.io2.IO.setEcho.impl : Handle + 318. builtin.io2.IO.setEcho.impl : Handle -> Boolean ->{IO} Either Failure () - 318. builtin.io2.IO.socketAccept.impl : Socket + 319. builtin.io2.IO.socketAccept.impl : Socket ->{IO} Either Failure Socket - 319. builtin.io2.IO.socketPort.impl : Socket + 320. builtin.io2.IO.socketPort.impl : Socket ->{IO} Either Failure Nat - 320. builtin.io2.IO.socketReceive.impl : Socket + 321. builtin.io2.IO.socketReceive.impl : Socket -> Nat ->{IO} Either Failure Bytes - 321. builtin.io2.IO.socketSend.impl : Socket + 322. builtin.io2.IO.socketSend.impl : Socket -> Bytes ->{IO} Either Failure () - 322. builtin.io2.MVar.swap.impl : MVar a + 323. builtin.io2.MVar.swap.impl : MVar a -> a ->{IO} Either Failure a - 323. builtin.io2.IO.systemTime.impl : '{IO} Either + 324. builtin.io2.IO.systemTime.impl : '{IO} Either Failure Nat - 324. builtin.io2.MVar.take.impl : MVar a + 325. builtin.io2.MVar.take.impl : MVar a ->{IO} Either Failure a - 325. builtin.io2.Tls.terminate.impl : Tls + 326. builtin.io2.Tls.terminate.impl : Tls ->{IO} Either Failure () - 326. builtin.io2.MVar.tryPut.impl : MVar a + 327. builtin.io2.MVar.tryPut.impl : MVar a -> a ->{IO} Either Failure Boolean - 327. builtin.io2.MVar.tryRead.impl : MVar a + 328. builtin.io2.MVar.tryRead.impl : MVar a ->{IO} Either Failure (Optional a) - 328. builtin.Int.increment : Int + 329. builtin.Int.increment : Int -> Int - 329. builtin.Nat.increment : Nat + 330. builtin.Nat.increment : Nat -> Nat - 330. builtin.Char.Class.is : Class + 331. builtin.Char.Class.is : Class -> Char -> Boolean - 331. builtin.io2.MVar.isEmpty : MVar a + 332. builtin.io2.MVar.isEmpty : MVar a ->{IO} Boolean - 332. builtin.Int.isEven : Int + 333. builtin.Int.isEven : Int -> Boolean - 333. builtin.Nat.isEven : Nat + 334. builtin.Nat.isEven : Nat -> Boolean - 334. builtin.Pattern.isMatch : Pattern + 335. builtin.Pattern.isMatch : Pattern a -> a -> Boolean - 335. builtin.Code.isMissing : Term + 336. builtin.Code.isMissing : Term ->{IO} Boolean - 336. builtin.Int.isOdd : Int + 337. builtin.Int.isOdd : Int -> Boolean - 337. builtin.Nat.isOdd : Nat + 338. builtin.Nat.isOdd : Nat -> Boolean - 338. builtin.metadata.isPropagated : IsPropagated - 339. builtin.metadata.isTest : IsTest - 340. builtin.Pattern.join : [Pattern + 339. builtin.metadata.isPropagated : IsPropagated + 340. builtin.metadata.isTest : IsTest + 341. builtin.Pattern.join : [Pattern a] -> Pattern a - 341. builtin.io2.IO.process.kill : ProcessHandle + 342. builtin.io2.IO.process.kill : ProcessHandle ->{IO} () - 342. builtin.Int.leadingZeros : Int + 343. builtin.Int.leadingZeros : Int -> Nat - 343. builtin.Nat.leadingZeros : Nat + 344. builtin.Nat.leadingZeros : Nat -> Nat - 344. builtin.Char.Class.letter : Class - 345. builtin.Text.patterns.letter : Pattern + 345. builtin.Char.Class.letter : Class + 346. builtin.Text.patterns.letter : Pattern Text - 346. builtin.Text.patterns.literal : Text + 347. builtin.Text.patterns.literal : Text -> Pattern Text - 347. builtin.Value.load : Value + 348. builtin.Value.load : Value ->{IO} Either [Term] a - 348. builtin.Float.log : Float + 349. builtin.Float.log : Float -> Float - 349. builtin.Float.logBase : Float + 350. builtin.Float.logBase : Float -> Float -> Float - 350. builtin.Code.lookup : Term + 351. builtin.Code.lookup : Term ->{IO} Optional Code - 351. builtin.Char.Class.lower : Class - 352. builtin.Float.lt : Float + 352. builtin.Char.Class.lower : Class + 353. builtin.Float.lt : Float -> Float -> Boolean - 353. builtin.Int.lt : Int + 354. builtin.Int.lt : Int -> Int -> Boolean - 354. builtin.Nat.lt : Nat + 355. builtin.Nat.lt : Nat -> Nat -> Boolean - 355. builtin.Text.lt : Text + 356. builtin.Text.lt : Text -> Text -> Boolean - 356. builtin.Float.lteq : Float + 357. builtin.Float.lteq : Float -> Float -> Boolean - 357. builtin.Int.lteq : Int + 358. builtin.Int.lteq : Int -> Int -> Boolean - 358. builtin.Nat.lteq : Nat + 359. builtin.Nat.lteq : Nat -> Nat -> Boolean - 359. builtin.Text.lteq : Text + 360. builtin.Text.lteq : Text -> Text -> Boolean - 360. builtin.Pattern.many : Pattern + 361. builtin.Pattern.many : Pattern a -> Pattern a - 361. builtin.Char.Class.mark : Class - 362. builtin.Float.max : Float + 362. builtin.Char.Class.mark : Class + 363. builtin.Float.max : Float -> Float -> Float - 363. builtin.Float.min : Float + 364. builtin.Float.min : Float -> Float -> Float - 364. builtin.Int.mod : Int + 365. builtin.Int.mod : Int -> Int -> Int - 365. builtin.Nat.mod : Nat + 366. builtin.Nat.mod : Nat -> Nat -> Nat - 366. builtin.io2.Clock.internals.monotonic : '{IO} Either + 367. builtin.io2.Clock.internals.monotonic : '{IO} Either Failure TimeSpec - 367. builtin.Universal.murmurHash : a + 368. builtin.Universal.murmurHash : a -> Nat - 368. builtin.Int.negate : Int + 369. builtin.Int.negate : Int -> Int - 369. builtin.io2.MVar.new : a + 370. builtin.io2.MVar.new : a ->{IO} MVar a - 370. builtin.io2.Promise.new : '{IO} Promise + 371. builtin.io2.Promise.new : '{IO} Promise a - 371. builtin.io2.TVar.new : a + 372. builtin.io2.TVar.new : a ->{STM} TVar a - 372. builtin.io2.MVar.newEmpty : '{IO} MVar + 373. builtin.io2.MVar.newEmpty : '{IO} MVar a - 373. builtin.io2.TVar.newIO : a + 374. builtin.io2.TVar.newIO : a ->{IO} TVar a - 374. builtin.Boolean.not : Boolean + 375. builtin.Boolean.not : Boolean -> Boolean - 375. builtin.Char.Class.not : Class + 376. builtin.Char.Class.not : Class -> Class - 376. builtin.Text.patterns.notCharIn : [Char] + 377. builtin.Text.patterns.notCharIn : [Char] -> Pattern Text - 377. builtin.Text.patterns.notCharRange : Char + 378. builtin.Text.patterns.notCharRange : Char -> Char -> Pattern Text - 378. builtin.io2.Clock.internals.nsec : TimeSpec + 379. builtin.io2.Clock.internals.nsec : TimeSpec -> Nat - 379. builtin.Char.Class.number : Class - 380. builtin.Char.Class.or : Class + 380. builtin.Char.Class.number : Class + 381. builtin.Char.Class.or : Class -> Class -> Class - 381. builtin.Int.or : Int + 382. builtin.Int.or : Int -> Int -> Int - 382. builtin.Nat.or : Nat + 383. builtin.Nat.or : Nat -> Nat -> Nat - 383. builtin.Pattern.or : Pattern + 384. builtin.Pattern.or : Pattern a -> Pattern a -> Pattern a - 384. builtin.Int.popCount : Int + 385. builtin.Int.popCount : Int -> Nat - 385. builtin.Nat.popCount : Nat + 386. builtin.Nat.popCount : Nat -> Nat - 386. builtin.Float.pow : Float + 387. builtin.Float.pow : Float -> Float -> Float - 387. builtin.Int.pow : Int + 388. builtin.Int.pow : Int -> Nat -> Int - 388. builtin.Nat.pow : Nat + 389. builtin.Nat.pow : Nat -> Nat -> Nat - 389. builtin.Char.Class.printable : Class - 390. builtin.io2.Clock.internals.processCPUTime : '{IO} Either + 390. builtin.Char.Class.printable : Class + 391. builtin.io2.Clock.internals.processCPUTime : '{IO} Either Failure TimeSpec - 391. builtin.Char.Class.punctuation : Class - 392. builtin.Text.patterns.punctuation : Pattern + 392. builtin.Char.Class.punctuation : Class + 393. builtin.Text.patterns.punctuation : Pattern Text - 393. builtin.Char.Class.range : Char + 394. builtin.Char.Class.range : Char -> Char -> Class - 394. builtin.ImmutableArray.read : ImmutableArray + 395. builtin.ImmutableArray.read : ImmutableArray a -> Nat ->{Exception} a - 395. builtin.MutableArray.read : MutableArray + 396. builtin.MutableArray.read : MutableArray g a -> Nat ->{g, Exception} a - 396. builtin.io2.Promise.read : Promise + 397. builtin.io2.Promise.read : Promise a ->{IO} a - 397. builtin.Ref.read : Ref g a + 398. builtin.Ref.read : Ref g a ->{g} a - 398. builtin.io2.TVar.read : TVar a + 399. builtin.io2.TVar.read : TVar a ->{STM} a - 399. builtin.io2.Ref.Ticket.read : Ticket + 400. builtin.io2.Ref.Ticket.read : Ticket a -> a - 400. builtin.ImmutableByteArray.read16be : ImmutableByteArray + 401. builtin.ImmutableByteArray.read16be : ImmutableByteArray -> Nat ->{Exception} Nat - 401. builtin.MutableByteArray.read16be : MutableByteArray + 402. builtin.MutableByteArray.read16be : MutableByteArray g -> Nat ->{g, Exception} Nat - 402. builtin.ImmutableByteArray.read24be : ImmutableByteArray + 403. builtin.ImmutableByteArray.read24be : ImmutableByteArray -> Nat ->{Exception} Nat - 403. builtin.MutableByteArray.read24be : MutableByteArray + 404. builtin.MutableByteArray.read24be : MutableByteArray g -> Nat ->{g, Exception} Nat - 404. builtin.ImmutableByteArray.read32be : ImmutableByteArray + 405. builtin.ImmutableByteArray.read32be : ImmutableByteArray -> Nat ->{Exception} Nat - 405. builtin.MutableByteArray.read32be : MutableByteArray + 406. builtin.MutableByteArray.read32be : MutableByteArray g -> Nat ->{g, Exception} Nat - 406. builtin.ImmutableByteArray.read40be : ImmutableByteArray + 407. builtin.ImmutableByteArray.read40be : ImmutableByteArray -> Nat ->{Exception} Nat - 407. builtin.MutableByteArray.read40be : MutableByteArray + 408. builtin.MutableByteArray.read40be : MutableByteArray g -> Nat ->{g, Exception} Nat - 408. builtin.ImmutableByteArray.read64be : ImmutableByteArray + 409. builtin.ImmutableByteArray.read64be : ImmutableByteArray -> Nat ->{Exception} Nat - 409. builtin.MutableByteArray.read64be : MutableByteArray + 410. builtin.MutableByteArray.read64be : MutableByteArray g -> Nat ->{g, Exception} Nat - 410. builtin.ImmutableByteArray.read8 : ImmutableByteArray + 411. builtin.ImmutableByteArray.read8 : ImmutableByteArray -> Nat ->{Exception} Nat - 411. builtin.MutableByteArray.read8 : MutableByteArray + 412. builtin.MutableByteArray.read8 : MutableByteArray g -> Nat ->{g, Exception} Nat - 412. builtin.io2.Ref.readForCas : Ref + 413. builtin.io2.Ref.readForCas : Ref {IO} a ->{IO} Ticket a - 413. builtin.io2.TVar.readIO : TVar a + 414. builtin.io2.TVar.readIO : TVar a ->{IO} a - 414. builtin.io2.Clock.internals.realtime : '{IO} Either + 415. builtin.io2.Clock.internals.realtime : '{IO} Either Failure TimeSpec - 415. builtin.io2.IO.ref : a + 416. builtin.io2.IO.ref : a ->{IO} Ref {IO} a - 416. builtin.Scope.ref : a + 417. builtin.Scope.ref : a ->{Scope s} Ref {Scope s} a - 417. builtin.Text.repeat : Nat + 418. builtin.Text.repeat : Nat -> Text -> Text - 418. builtin.Pattern.replicate : Nat + 419. builtin.Pattern.replicate : Nat -> Nat -> Pattern a -> Pattern a - 419. builtin.io2.STM.retry : '{STM} a - 420. builtin.Text.reverse : Text + 420. builtin.io2.STM.retry : '{STM} a + 421. builtin.Text.reverse : Text -> Text - 421. builtin.Float.round : Float + 422. builtin.Float.round : Float -> Int - 422. builtin.Pattern.run : Pattern + 423. builtin.Pattern.run : Pattern a -> a -> Optional ( [a], a) - 423. builtin.Scope.run : (∀ s. + 424. builtin.Scope.run : (∀ s. '{g, Scope s} r) ->{g} r - 424. builtin.io2.Clock.internals.sec : TimeSpec + 425. builtin.io2.Clock.internals.sec : TimeSpec -> Int - 425. builtin.Char.Class.separator : Class - 426. builtin.Code.serialize : Code + 426. builtin.Char.Class.separator : Class + 427. builtin.Code.serialize : Code -> Bytes - 427. builtin.Value.serialize : Value + 428. builtin.Value.serialize : Value -> Bytes - 428. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] + 429. builtin.io2.Tls.ClientConfig.certificates.set : [SignedCert] -> ClientConfig -> ClientConfig - 429. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] + 430. builtin.io2.Tls.ServerConfig.certificates.set : [SignedCert] -> ServerConfig -> ServerConfig - 430. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] + 431. builtin.io2.TLS.ClientConfig.ciphers.set : [Cipher] -> ClientConfig -> ClientConfig - 431. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] + 432. builtin.io2.Tls.ServerConfig.ciphers.set : [Cipher] -> ServerConfig -> ServerConfig - 432. builtin.io2.Tls.ClientConfig.versions.set : [Version] + 433. builtin.io2.Tls.ClientConfig.versions.set : [Version] -> ClientConfig -> ClientConfig - 433. builtin.io2.Tls.ServerConfig.versions.set : [Version] + 434. builtin.io2.Tls.ServerConfig.versions.set : [Version] -> ServerConfig -> ServerConfig - 434. builtin.Int.shiftLeft : Int + 435. builtin.Int.shiftLeft : Int -> Nat -> Int - 435. builtin.Nat.shiftLeft : Nat + 436. builtin.Nat.shiftLeft : Nat -> Nat -> Nat - 436. builtin.Int.shiftRight : Int + 437. builtin.Int.shiftRight : Int -> Nat -> Int - 437. builtin.Nat.shiftRight : Nat + 438. builtin.Nat.shiftRight : Nat -> Nat -> Nat - 438. builtin.Int.signum : Int + 439. builtin.Int.signum : Int -> Int - 439. builtin.Float.sin : Float + 440. builtin.Float.sin : Float -> Float - 440. builtin.Float.sinh : Float + 441. builtin.Float.sinh : Float -> Float - 441. builtin.Bytes.size : Bytes + 442. builtin.Bytes.size : Bytes -> Nat - 442. builtin.ImmutableArray.size : ImmutableArray + 443. builtin.ImmutableArray.size : ImmutableArray a -> Nat - 443. builtin.ImmutableByteArray.size : ImmutableByteArray + 444. builtin.ImmutableByteArray.size : ImmutableByteArray -> Nat - 444. builtin.List.size : [a] + 445. builtin.List.size : [a] -> Nat - 445. builtin.MutableArray.size : MutableArray + 446. builtin.MutableArray.size : MutableArray g a -> Nat - 446. builtin.MutableByteArray.size : MutableByteArray + 447. builtin.MutableByteArray.size : MutableByteArray g -> Nat - 447. builtin.Text.size : Text + 448. builtin.Text.size : Text -> Nat - 448. builtin.Text.patterns.space : Pattern + 449. builtin.Text.patterns.space : Pattern Text - 449. builtin.Float.sqrt : Float + 450. builtin.Float.sqrt : Float -> Float - 450. builtin.io2.IO.process.start : Text + 451. builtin.io2.IO.process.start : Text -> [Text] ->{IO} ( Handle, Handle, Handle, ProcessHandle) - 451. builtin.io2.IO.stdHandle : StdHandle + 452. builtin.io2.IO.stdHandle : StdHandle -> Handle - 452. builtin.Nat.sub : Nat + 453. builtin.Nat.sub : Nat -> Nat -> Int - 453. builtin.io2.TVar.swap : TVar a + 454. builtin.io2.TVar.swap : TVar a -> a ->{STM} a - 454. builtin.Char.Class.symbol : Class - 455. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int - 456. builtin.Bytes.take : Nat + 455. builtin.Char.Class.symbol : Class + 456. builtin.io2.IO.systemTimeMicroseconds : '{IO} Int + 457. builtin.Bytes.take : Nat -> Bytes -> Bytes - 457. builtin.List.take : Nat + 458. builtin.List.take : Nat -> [a] -> [a] - 458. builtin.Text.take : Nat + 459. builtin.Text.take : Nat -> Text -> Text - 459. builtin.Float.tan : Float + 460. builtin.Float.tan : Float -> Float - 460. builtin.Float.tanh : Float + 461. builtin.Float.tanh : Float -> Float - 461. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either + 462. builtin.io2.Clock.internals.threadCPUTime : '{IO} Either Failure TimeSpec - 462. builtin.Bytes.toBase16 : Bytes + 463. builtin.Bytes.toBase16 : Bytes -> Bytes - 463. builtin.Bytes.toBase32 : Bytes + 464. builtin.Bytes.toBase32 : Bytes -> Bytes - 464. builtin.Bytes.toBase64 : Bytes + 465. builtin.Bytes.toBase64 : Bytes -> Bytes - 465. builtin.Bytes.toBase64UrlUnpadded : Bytes + 466. builtin.Bytes.toBase64UrlUnpadded : Bytes -> Bytes - 466. builtin.Text.toCharList : Text + 467. builtin.Text.toCharList : Text -> [Char] - 467. builtin.Int.toFloat : Int + 468. builtin.Int.toFloat : Int -> Float - 468. builtin.Nat.toFloat : Nat + 469. builtin.Nat.toFloat : Nat -> Float - 469. builtin.Nat.toInt : Nat + 470. builtin.Nat.toInt : Nat -> Int - 470. builtin.Bytes.toList : Bytes + 471. builtin.Bytes.toList : Bytes -> [Nat] - 471. builtin.Text.toLowercase : Text + 472. builtin.Text.toLowercase : Text -> Text - 472. builtin.Char.toNat : Char + 473. builtin.Char.toNat : Char -> Nat - 473. builtin.Float.toRepresentation : Float + 474. builtin.Float.toRepresentation : Float -> Nat - 474. builtin.Int.toRepresentation : Int + 475. builtin.Int.toRepresentation : Int -> Nat - 475. builtin.Char.toText : Char + 476. builtin.Char.toText : Char -> Text - 476. builtin.Debug.toText : a + 477. builtin.Debug.toText : a -> Optional (Either Text Text) - 477. builtin.Float.toText : Float + 478. builtin.Float.toText : Float -> Text - 478. builtin.Handle.toText : Handle + 479. builtin.Handle.toText : Handle -> Text - 479. builtin.Int.toText : Int + 480. builtin.Int.toText : Int -> Text - 480. builtin.Nat.toText : Nat + 481. builtin.Nat.toText : Nat -> Text - 481. builtin.Socket.toText : Socket + 482. builtin.Socket.toText : Socket -> Text - 482. builtin.Link.Term.toText : Term + 483. builtin.Link.Term.toText : Term -> Text - 483. builtin.ThreadId.toText : ThreadId + 484. builtin.ThreadId.toText : ThreadId -> Text - 484. builtin.Text.toUppercase : Text + 485. builtin.Text.toUppercase : Text -> Text - 485. builtin.Text.toUtf8 : Text + 486. builtin.Text.toUtf8 : Text -> Bytes - 486. builtin.todo : a -> b - 487. builtin.Debug.trace : Text + 487. builtin.todo : a -> b + 488. builtin.Debug.trace : Text -> a -> () - 488. builtin.Int.trailingZeros : Int + 489. builtin.Int.trailingZeros : Int -> Nat - 489. builtin.Nat.trailingZeros : Nat + 490. builtin.Nat.trailingZeros : Nat -> Nat - 490. builtin.Float.truncate : Float + 491. builtin.Float.truncate : Float -> Int - 491. builtin.Int.truncate0 : Int + 492. builtin.Int.truncate0 : Int -> Nat - 492. builtin.io2.IO.tryEval : '{IO} a + 493. builtin.io2.IO.tryEval : '{IO} a ->{IO, Exception} a - 493. builtin.io2.Promise.tryRead : Promise + 494. builtin.io2.Promise.tryRead : Promise a ->{IO} Optional a - 494. builtin.io2.MVar.tryTake : MVar a + 495. builtin.io2.MVar.tryTake : MVar a ->{IO} Optional a - 495. builtin.Text.uncons : Text + 496. builtin.Text.uncons : Text -> Optional ( Char, Text) - 496. builtin.Any.unsafeExtract : Any + 497. builtin.Any.unsafeExtract : Any -> a - 497. builtin.Text.unsnoc : Text + 498. builtin.Text.unsnoc : Text -> Optional ( Text, Char) - 498. builtin.Char.Class.upper : Class - 499. builtin.Code.validate : [( Term, + 499. builtin.Char.Class.upper : Class + 500. builtin.Code.validate : [( Term, Code)] ->{IO} Optional Failure - 500. builtin.io2.validateSandboxed : [Term] + 501. builtin.io2.validateSandboxed : [Term] -> a -> Boolean - 501. builtin.Value.value : a + 502. builtin.Value.value : a -> Value - 502. builtin.io2.IO.process.wait : ProcessHandle + 503. builtin.io2.IO.process.wait : ProcessHandle ->{IO} Nat - 503. builtin.Debug.watch : Text + 504. builtin.Debug.watch : Text -> a -> a - 504. builtin.Char.Class.whitespace : Class - 505. builtin.MutableArray.write : MutableArray + 505. builtin.Char.Class.whitespace : Class + 506. builtin.MutableArray.write : MutableArray g a -> Nat -> a ->{g, Exception} () - 506. builtin.io2.Promise.write : Promise + 507. builtin.io2.Promise.write : Promise a -> a ->{IO} Boolean - 507. builtin.Ref.write : Ref g a + 508. builtin.Ref.write : Ref g a -> a ->{g} () - 508. builtin.io2.TVar.write : TVar a + 509. builtin.io2.TVar.write : TVar a -> a ->{STM} () - 509. builtin.MutableByteArray.write16be : MutableByteArray + 510. builtin.MutableByteArray.write16be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 510. builtin.MutableByteArray.write32be : MutableByteArray + 511. builtin.MutableByteArray.write32be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 511. builtin.MutableByteArray.write64be : MutableByteArray + 512. builtin.MutableByteArray.write64be : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 512. builtin.MutableByteArray.write8 : MutableByteArray + 513. builtin.MutableByteArray.write8 : MutableByteArray g -> Nat -> Nat ->{g, Exception} () - 513. builtin.Int.xor : Int + 514. builtin.Int.xor : Int -> Int -> Int - 514. builtin.Nat.xor : Nat + 515. builtin.Nat.xor : Nat -> Nat -> Nat diff --git a/unison-src/transcripts/reflog.output.md b/unison-src/transcripts/reflog.output.md index 08122c3cc..ee84f1c01 100644 --- a/unison-src/transcripts/reflog.output.md +++ b/unison-src/transcripts/reflog.output.md @@ -59,17 +59,17 @@ y = 2 most recent, along with the command that got us there. Try: `fork 2 .old` - `fork #30tl6rkfqn .old` to make an old namespace + `fork #upgj8h6ju3 .old` to make an old namespace accessible again, - `reset-root #30tl6rkfqn` to reset the root namespace and + `reset-root #upgj8h6ju3` to reset the root namespace and its history to that of the specified namespace. When Root Hash Action - 1. now #4t4aoo9vnt add - 2. now #30tl6rkfqn add - 3. now #mfof2amrm2 builtins.merge + 1. now #58jmfch7o7 add + 2. now #upgj8h6ju3 add + 3. now #acegso70di builtins.merge 4. #sg60bvjo91 history starts here Tip: Use `diff.namespace 1 7` to compare namespaces between diff --git a/unison-src/transcripts/squash.output.md b/unison-src/transcripts/squash.output.md index 1989efba6..fb6206977 100644 --- a/unison-src/transcripts/squash.output.md +++ b/unison-src/transcripts/squash.output.md @@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins - □ 1. #uqucjk22if (start of history) + □ 1. #l6nvab7prj (start of history) .> fork builtin builtin2 @@ -42,21 +42,21 @@ Now suppose we `fork` a copy of builtin, then rename `Nat.+` to `frobnicate`, th Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #2g254tkpvt + ⊙ 1. #la42o8m5tq > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #s54qi5ddk7 + ⊙ 2. #fqkpt5ogt2 > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #uqucjk22if (start of history) + □ 3. #l6nvab7prj (start of history) ``` If we merge that back into `builtin`, we get that same chain of history: @@ -71,21 +71,21 @@ If we merge that back into `builtin`, we get that same chain of history: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #2g254tkpvt + ⊙ 1. #la42o8m5tq > Moves: Original name New name Nat.frobnicate Nat.+ - ⊙ 2. #s54qi5ddk7 + ⊙ 2. #fqkpt5ogt2 > Moves: Original name New name Nat.+ Nat.frobnicate - □ 3. #uqucjk22if (start of history) + □ 3. #l6nvab7prj (start of history) ``` Let's try again, but using a `merge.squash` (or just `squash`) instead. The history will be unchanged: @@ -106,7 +106,7 @@ Let's try again, but using a `merge.squash` (or just `squash`) instead. The hist - □ 1. #uqucjk22if (start of history) + □ 1. #l6nvab7prj (start of history) ``` The churn that happened in `mybuiltin` namespace ended up back in the same spot, so the squash merge of that namespace with our original namespace had no effect. @@ -485,13 +485,13 @@ This checks to see that squashing correctly preserves deletions: Note: The most recent namespace hash is immediately below this message. - ⊙ 1. #9ootvo2tgi + ⊙ 1. #ae3oc8cikb - Deletes: Nat.* Nat.+ - □ 2. #uqucjk22if (start of history) + □ 2. #l6nvab7prj (start of history) ``` Notice that `Nat.+` and `Nat.*` are deleted by the squash, and we see them deleted in one atomic step in the history. From c430aaa34a9b2bab93c3b582fd96f307f18d08b9 Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 15 Mar 2023 09:32:22 -0600 Subject: [PATCH 463/467] Port Codebase.getDeclType to be in Sqlite.Transaction (#3866) --- .../src/Unison/Codebase/SqliteCodebase.hs | 5 +---- parser-typechecker/src/Unison/Codebase/Type.hs | 2 +- unison-share-api/src/Unison/Server/Backend.hs | 18 +++++++++++------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs index aef5dd3b3..1ee0e2de6 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase.hs @@ -350,10 +350,7 @@ sqliteCodebase debugName root localOrRemote lockOption migrationStrategy action { getTerm, getTypeOfTermImpl, getTypeDeclaration, - getDeclType = - \r -> - withConn \conn -> - Sqlite.runReadOnlyTransaction conn \run -> run (getDeclType r), + getDeclType, putTerm, putTermComponent, putTypeDeclaration, diff --git a/parser-typechecker/src/Unison/Codebase/Type.hs b/parser-typechecker/src/Unison/Codebase/Type.hs index 429671106..dcaa675c1 100644 --- a/parser-typechecker/src/Unison/Codebase/Type.hs +++ b/parser-typechecker/src/Unison/Codebase/Type.hs @@ -60,7 +60,7 @@ data Codebase m v a = Codebase -- semantics of 'putTypeDeclaration'. getTypeDeclaration :: Reference.Id -> Sqlite.Transaction (Maybe (Decl v a)), -- | Get the type of a given decl. - getDeclType :: V2.Reference -> m CT.ConstructorType, + getDeclType :: V2.Reference -> Sqlite.Transaction CT.ConstructorType, -- | Enqueue the put of a user-defined term (with its type) into the codebase, if it doesn't already exist. The -- implementation may choose to delay the put until all of the term's (and its type's) references are stored as -- well. diff --git a/unison-share-api/src/Unison/Server/Backend.hs b/unison-share-api/src/Unison/Server/Backend.hs index 504d5db9b..dffb01b91 100644 --- a/unison-share-api/src/Unison/Server/Backend.hs +++ b/unison-share-api/src/Unison/Server/Backend.hs @@ -215,8 +215,10 @@ prettyNamesForBranch root = namesForBranch root <&> \(_, n, _) -> n shallowPPE :: (MonadIO m) => Codebase m v a -> V2Branch.Branch m -> m PPE.PrettyPrintEnv shallowPPE codebase b = do - hashLength <- Codebase.runTransaction codebase Codebase.hashLength - names <- shallowNames codebase b + (hashLength, names) <- Codebase.runTransaction codebase do + hl <- Codebase.hashLength + names <- shallowNames codebase b + pure (hl, names) pure $ PPED.suffixifiedPPE . PPED.fromNamesDecl hashLength $ NamesWithHistory names mempty -- | A 'Names' which only includes mappings for things _directly_ accessible from the branch. @@ -224,7 +226,7 @@ shallowPPE codebase b = do -- I.e. names in nested children are omitted. -- This should probably live elsewhere, but the package dependency graph makes it hard to find -- a good place. -shallowNames :: forall m v a. (Monad m) => Codebase m v a -> V2Branch.Branch m -> m Names +shallowNames :: forall m v a. (Monad m) => Codebase m v a -> V2Branch.Branch m -> Sqlite.Transaction Names shallowNames codebase b = do newTerms <- V2Branch.terms b @@ -412,8 +414,10 @@ termListEntry :: ExactName NameSegment V2Referent.Referent -> m (TermEntry Symbol Ann) termListEntry codebase branch (ExactName nameSegment ref) = do - v1Referent <- Cv.referent2to1 (Codebase.getDeclType codebase) ref - ot <- Codebase.runTransaction codebase (loadReferentType codebase v1Referent) + ot <- Codebase.runTransaction codebase $ do + v1Referent <- Cv.referent2to1 (Codebase.getDeclType codebase) ref + ot <- loadReferentType codebase v1Referent + pure (ot) tag <- getTermTag codebase ref ot pure $ TermEntry @@ -433,7 +437,7 @@ termListEntry codebase branch (ExactName nameSegment ref) = do & (> 1) getTermTag :: - (Monad m, Var v) => + (Var v, MonadIO m) => Codebase m v a -> V2Referent.Referent -> Maybe (Type v Ann) -> @@ -452,7 +456,7 @@ getTermTag codebase r sig = do Nothing -> False constructorType <- case r of V2Referent.Ref {} -> pure Nothing - V2Referent.Con ref _ -> Just <$> Codebase.getDeclType codebase ref + V2Referent.Con ref _ -> Just <$> Codebase.runTransaction codebase (Codebase.getDeclType codebase ref) pure $ if | isDoc -> Doc From ac37e76fabf3edc91ca6518e947eb09f1457252e Mon Sep 17 00:00:00 2001 From: Travis Staton Date: Wed, 15 Mar 2023 14:09:38 -0400 Subject: [PATCH 464/467] update nix flake - bump nixpkgs - bump ormolu to 0.5.0.1 - ensure hls is linked to ormolu 0.5.0.1 - add package outputs and do some organization --- flake.lock | 6 +- flake.nix | 166 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 108 insertions(+), 64 deletions(-) diff --git a/flake.lock b/flake.lock index dacae008c..86a86d8b7 100644 --- a/flake.lock +++ b/flake.lock @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1674781052, - "narHash": "sha256-nseKFXRvmZ+BDAeWQtsiad+5MnvI/M2Ak9iAWzooWBw=", + "lastModified": 1678703398, + "narHash": "sha256-Y1mW3dBsoWLHpYm+UIHb5VZ7rx024NNHaF16oZBx++o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cc4bb87f5457ba06af9ae57ee4328a49ce674b1b", + "rev": "67f26c1cfc5d5783628231e776a81c1ade623e0b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 5b7888fde..23bd49214 100644 --- a/flake.nix +++ b/flake.nix @@ -8,70 +8,23 @@ outputs = { self, flake-utils, nixpkgs }: let + ghc-version = "8107"; systemAttrs = flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages."${system}".extend self.overlay; - - mystack = pkgs.symlinkJoin { - name = "stack"; - paths = [ pkgs.stack ]; - buildInputs = [ pkgs.makeWrapper ]; - postBuild = let - flags = [ "--no-nix" "--system-ghc" "--no-install-ghc" ]; - add-flags = - "--add-flags '${pkgs.lib.concatStringsSep " " flags}'"; - in '' - wrapProgram "$out/bin/stack" ${add-flags} - ''; - }; ghc-version = "8107"; ghc = pkgs.haskell.packages."ghc${ghc-version}"; - make-ormolu = p: - p.callHackageDirect { - pkg = "ormolu"; - ver = "0.4.0.0"; - sha256 = "0r8jb8lpaxx7wxnvxiynx2dkrfibfl8nxnjl5n4vwy0az166bbnd"; - } { - ghc-lib-parser = - pkgs.haskellPackages.ghc-lib-parser_9_2_5_20221107; - Cabal = pkgs.haskellPackages.Cabal_3_6_3_0; - }; - myhls = let - hp = pkgs.haskellPackages.extend hp-override; - hp-override = final: prev: { - hls-floskell-plugin = - pkgs.haskell.lib.dontCheck prev.hls-floskell-plugin; - hls-rename-plugin = - pkgs.haskell.lib.dontCheck prev.hls-rename-plugin; - haskell-language-server = - pkgs.haskell.lib.overrideCabal prev.haskell-language-server - (drv: { - configureFlags = drv.configureFlags ++ [ - "-f-brittany" - "-f-fourmolu" - "-f-floskell" - "-f-stylishhaskell" - "-f-hlint" - ]; - }); - ormolu = make-ormolu final; - }; - in pkgs.haskell-language-server.override { - haskellPackages = hp; - dynamic = true; - supportedGhcVersions = [ ghc-version ]; - }; - myormolu = make-ormolu pkgs.haskellPackages; - nativePackages = pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Cocoa ]); + nativePackages = pkgs.lib.optionals pkgs.stdenv.isDarwin + (with pkgs.darwin.apple_sdk.frameworks; [ Cocoa ]); unison-env = pkgs.mkShell { - packages = with pkgs; [ - mystack - (haskell.compiler."ghc${ghc-version}".override { - useLLVM = pkgs.stdenv.isAarch64; - }) - myormolu - myhls + packages = let exports = self.packages."${system}"; + in with pkgs; + [ + exports.stack + exports.hls + exports.ormolu + exports.ghc pkg-config zlib ] ++ nativePackages; @@ -94,12 +47,103 @@ pkgs = pkgs; - devShell = unison-env; + devShells.default = unison-env; - packages = { }; + packages = { + hls = pkgs.unison-hls; + hls-call-hierarchy-plugin = ghc.hls-call-hierarchy-plugin; + ormolu = pkgs.ormolu; + ghc = pkgs.haskell.compiler."ghc${ghc-version}".override { + useLLVM = pkgs.stdenv.isAarch64; + }; + stack = pkgs.unison-stack; + devShell = self.devShells."${system}".default; - defaultPackage = self.packages."${system}".unison-env; + }; + + defaultPackage = self.packages."${system}".devShell; }); - topLevelAttrs = { overlay = final: prev: { }; }; + topLevelAttrs = { + overlay = final: prev: { + ormolu = prev.haskell.lib.justStaticExecutables + final.haskell.packages."ghc${ghc-version}".ormolu; + haskell = with prev.haskell.lib; + prev.haskell // { + packages = prev.haskell.packages // { + "ghc${ghc-version}" = prev.haskell.packages.ghc8107.extend + (hfinal: hprev: { + mkDerivation = drv: + hprev.mkDerivation (drv // { + doCheck = false; + doHaddock = false; + doBenchmark = false; + enableLibraryProfiling = false; + enableExecutableProfiling = false; + }); + aeson = hfinal.aeson_2_1_1_0; + lens-aeson = hfinal.lens-aeson_1_2_2; + Cabal = hfinal.Cabal_3_6_3_0; + ormolu = hfinal.ormolu_0_5_0_1; + ghc-lib-parser = hfinal.ghc-lib-parser_9_2_5_20221107; + # avoid deprecated version https://github.com/Avi-D-coder/implicit-hie/issues/50 + implicit-hie = hfinal.callHackageDirect { + pkg = "implicit-hie"; + ver = "0.1.4.0"; + sha256 = + "15qy9vwm8vbnyv47vh6kd50m09vc4vhqbbrhf8gdifrvlxhad69l"; + } { }; + haskell-language-server = let + p = prev.haskell.lib.overrideCabal + hprev.haskell-language-server (drv: { + # undo terrible nixpkgs hacks + buildDepends = + prev.lib.filter (x: x != hprev.hls-brittany-plugin) + drv.buildDepends; + configureFlags = drv.configureFlags ++ [ + "-f-brittany" + "-f-fourmolu" + "-f-floskell" + "-f-stylishhaskell" + "-f-hlint" + ]; + }); + in p.overrideScope (lfinal: lprev: { + # undo all of the horrible overrideScope in + # nixpkgs configuration files + ormolu = hfinal.ormolu; + ghc-lib-parser = hfinal.ghc-lib-parser; + ghc-lib-parser-ex = hfinal.ghc-lib-parser-ex; + ghc-paths = hfinal.ghc-paths; + aeson = hfinal.aeson; + lsp-types = hfinal.lsp-types; + # null out some dependencies that we drop with cabal flags + hls-fourmolu-plugin = null; + hls-floskell-plugin = null; + hls-brittany-plugin = hfinal.hls-brittany-plugin; + hls-stylish-haskell-plugin = null; + hls-hlint-plugin = null; + }); + }); + }; + }; + unison-hls = final.haskell-language-server.override { + haskellPackages = final.haskell.packages."ghc${ghc-version}"; + dynamic = true; + supportedGhcVersions = [ ghc-version ]; + }; + unison-stack = prev.symlinkJoin { + name = "stack"; + paths = [ final.stack ]; + buildInputs = [ final.makeWrapper ]; + postBuild = let + flags = [ "--no-nix" "--system-ghc" "--no-install-ghc" ]; + add-flags = + "--add-flags '${prev.lib.concatStringsSep " " flags}'"; + in '' + wrapProgram "$out/bin/stack" ${add-flags} + ''; + }; + }; + }; in systemAttrs // topLevelAttrs; } From 9fad68fc8ff4209f6f7f55bcf8af116d54a065ab Mon Sep 17 00:00:00 2001 From: Doug Baldwin Date: Thu, 16 Mar 2023 18:46:37 +0800 Subject: [PATCH 465/467] Update lspconfig documentation --- docs/language-server.markdown | 59 +++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/docs/language-server.markdown b/docs/language-server.markdown index 13020efdb..063cf8d56 100644 --- a/docs/language-server.markdown +++ b/docs/language-server.markdown @@ -67,10 +67,65 @@ Configuration for [coc-nvim](https://github.com/neoclide/coc.nvim), enter the fo } ``` -For [lspconfig](https://github.com/neovim/nvim-lspconfig), you can use the following setup function: +For [lspconfig](https://github.com/neovim/nvim-lspconfig) with optional autocomplete [nvim-cmp](https://github.com/hrsh7th/nvim-cmp), +you can use the following setup function(s): ```lua -require('lspconfig').unison.setup({}) +-- This function is for configuring a buffer when an LSP is attached +local on_attach = function(client, bufnr) + -- Always show the signcolumn, otherwise it would shift the text each time + -- diagnostics appear/become resolved + vim.o.signcolumn = 'yes' + + -- Update the cursor hover location every 1/4 of a second + vim.o.updatetime = 250 + + -- Disable appending of the error text at the offending line + vim.diagnostic.config({virtual_text=false}) + + -- Enable a floating window containing the error text when hovering over an error + vim.api.nvim_create_autocmd("CursorHold", { + buffer = bufnr, + callback = function() + local opts = { + focusable = false, + close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" }, + border = 'rounded', + source = 'always', + prefix = ' ', + scope = 'cursor', + } + vim.diagnostic.open_float(nil, opts) + end + }) + + -- This setting is to display hover information about the symbol under the cursor + vim.keymap.set('n', 'K', vim.lsp.buf.hover) + +end + +-- Setup the Unison LSP +require('lspconfig')['unison'].setup{ + on_attach = on_attach, +} +``` + +```lua +-- This is NVim Autocompletion support +local cmp = require 'cmp' + +-- This function sets up autocompletion +cmp.setup { + + -- This mapping affects the autocompletion choices menu + mapping = cmp.mapping.preset.insert(), + + -- This table names the sources for autocompletion + sources = { + { name = 'nvim_lsp' }, + }, +} + ``` Note that you'll need to start UCM _before_ you try connecting to it in your editor or your editor might give up. From ce973ecf47dc793f4b7eefce5258e1e1d6f6968b Mon Sep 17 00:00:00 2001 From: Doug Baldwin Date: Thu, 16 Mar 2023 19:13:25 +0800 Subject: [PATCH 466/467] Include LSP autocomplete plugin --- docs/language-server.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/language-server.markdown b/docs/language-server.markdown index 063cf8d56..00e3ed72f 100644 --- a/docs/language-server.markdown +++ b/docs/language-server.markdown @@ -67,8 +67,8 @@ Configuration for [coc-nvim](https://github.com/neoclide/coc.nvim), enter the fo } ``` -For [lspconfig](https://github.com/neovim/nvim-lspconfig) with optional autocomplete [nvim-cmp](https://github.com/hrsh7th/nvim-cmp), -you can use the following setup function(s): +For [lspconfig](https://github.com/neovim/nvim-lspconfig) with optional autocomplete [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) for LSP +[cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp), you can use the following setup function(s): ```lua -- This function is for configuring a buffer when an LSP is attached From 437864dcde91e29b186bed09c72944019dddf10d Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Tue, 21 Mar 2023 16:08:11 -0600 Subject: [PATCH 467/467] Handle several more errors (#3877) --- unison-cli/src/Unison/LSP/FileAnalysis.hs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/unison-cli/src/Unison/LSP/FileAnalysis.hs b/unison-cli/src/Unison/LSP/FileAnalysis.hs index 18b58bfc7..87a9b71e4 100644 --- a/unison-cli/src/Unison/LSP/FileAnalysis.hs +++ b/unison-cli/src/Unison/LSP/FileAnalysis.hs @@ -240,9 +240,25 @@ analyseNotes fileUri ppe src notes = do -- still have valid diagnostics. TypeError.Other e@(Context.ErrorNote {cause}) -> case cause of Context.PatternArityMismatch loc _typ _numArgs -> singleRange loc - _ -> do - Debug.debugM Debug.LSP "No Diagnostic configured for type error: " e - empty + Context.HandlerOfUnexpectedType loc _typ -> singleRange loc + Context.TypeMismatch {} -> shouldHaveBeenHandled e + Context.IllFormedType {} -> shouldHaveBeenHandled e + Context.UnknownSymbol loc _ -> singleRange loc + Context.UnknownTerm loc _ _ _ -> singleRange loc + Context.AbilityCheckFailure {} -> shouldHaveBeenHandled e + Context.AbilityEqFailure {} -> shouldHaveBeenHandled e + Context.EffectConstructorWrongArgCount {} -> shouldHaveBeenHandled e + Context.MalformedEffectBind {} -> shouldHaveBeenHandled e + Context.DuplicateDefinitions {} -> shouldHaveBeenHandled e + Context.UnguardedLetRecCycle {} -> shouldHaveBeenHandled e + Context.ConcatPatternWithoutConstantLength loc _ -> singleRange loc + Context.DataEffectMismatch _ _ decl -> singleRange $ DD.annotation decl + Context.UncoveredPatterns loc _ -> singleRange loc + Context.RedundantPattern loc -> singleRange loc + Context.InaccessiblePattern loc -> singleRange loc + shouldHaveBeenHandled e = do + Debug.debugM Debug.LSP "This diagnostic should have been handled by a previous case but was not" e + empty diags = noteDiagnostic currentPath note ranges -- Sort on match accuracy first, then name. codeActions <- case cause of