mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-19 06:17:33 +03:00
Merge branch 'trunk' into topic/abilities-fixes
This commit is contained in:
commit
e25c6ea34a
@ -31,6 +31,7 @@ import qualified Text.Regex.TDFA as RE
|
||||
import qualified Unison.ConstructorType as CT
|
||||
import Unison.Codebase.CodeLookup ( CodeLookup(..) )
|
||||
import qualified Unison.Builtin.Decls as DD
|
||||
import qualified Unison.Builtin.Terms as TD
|
||||
import qualified Unison.DataDeclaration as DD
|
||||
import Unison.Parser ( Ann(..) )
|
||||
import qualified Unison.Reference as R
|
||||
@ -59,7 +60,9 @@ names0 = Names3.names0 terms types where
|
||||
Rel.fromList [ (Name.fromVar vc, Referent.Con (R.DerivedId r) cid ct)
|
||||
| (ct, (_,(r,decl))) <- ((CT.Data,) <$> builtinDataDecls @Symbol) <>
|
||||
((CT.Effect,) . (second . second) DD.toDataDecl <$> builtinEffectDecls)
|
||||
, ((_,vc,_), cid) <- DD.constructors' decl `zip` [0..]]
|
||||
, ((_,vc,_), cid) <- DD.constructors' decl `zip` [0..]] <>
|
||||
Rel.fromList [ (Name.fromVar v, Referent.Ref (R.DerivedId i))
|
||||
| (v,i) <- Map.toList $ TD.builtinTermsRef @Symbol Intrinsic]
|
||||
types = Rel.fromList builtinTypes <>
|
||||
Rel.fromList [ (Name.fromVar v, R.DerivedId r)
|
||||
| (v,(r,_)) <- builtinDataDecls @Symbol ] <>
|
||||
@ -167,6 +170,8 @@ builtinTypesSrc =
|
||||
, B' "Value" CT.Data
|
||||
, B' "Any" CT.Data
|
||||
, B' "crypto.HashAlgorithm" CT.Data
|
||||
, B' "IOFailure" CT.Data, Rename' "IOFailure" "io2.IOFailure"
|
||||
, B' "TlsFailure" CT.Data, Rename' "TlsFailure" "io2.TlsFailure"
|
||||
, B' "Tls" CT.Data, Rename' "Tls" "io2.Tls"
|
||||
, B' "Tls.ClientConfig" CT.Data, Rename' "Tls.ClientConfig" "io2.Tls.ClientConfig"
|
||||
, B' "Tls.ServerConfig" CT.Data, Rename' "Tls.ServerConfig" "io2.Tls.ServerConfig"
|
||||
@ -390,7 +395,7 @@ builtinsSrc =
|
||||
, B "Text.toCharList" $ text --> list char
|
||||
, B "Text.fromCharList" $ list char --> text
|
||||
, B "Text.toUtf8" $ text --> bytes
|
||||
, B "Text.fromUtf8.v2" $ bytes --> eithert failure text
|
||||
, B "Text.fromUtf8.v3" $ bytes --> eithert failure text
|
||||
, B "Char.toNat" $ char --> nat
|
||||
, B "Char.fromNat" $ nat --> char
|
||||
|
||||
@ -504,45 +509,45 @@ hashBuiltins =
|
||||
|
||||
ioBuiltins :: Var v => [(Text, Type v)]
|
||||
ioBuiltins =
|
||||
[ ("IO.openFile.v2", text --> fmode --> iof handle)
|
||||
, ("IO.closeFile.v2", handle --> iof unit)
|
||||
, ("IO.isFileEOF.v2", handle --> iof boolean)
|
||||
, ("IO.isFileOpen.v2", handle --> iof boolean)
|
||||
, ("IO.isSeekable.v2", handle --> iof boolean)
|
||||
, ("IO.seekHandle.v2", handle --> smode --> int --> iof unit)
|
||||
, ("IO.handlePosition.v2", handle --> iof int)
|
||||
, ("IO.getBuffering.v2", handle --> iof bmode)
|
||||
, ("IO.setBuffering.v2", handle --> bmode --> iof unit)
|
||||
, ("IO.getBytes.v2", handle --> nat --> iof bytes)
|
||||
, ("IO.putBytes.v2", handle --> bytes --> iof unit)
|
||||
, ("IO.systemTime.v2", unit --> iof nat)
|
||||
, ("IO.getTempDirectory.v2", unit --> iof text)
|
||||
[ ("IO.openFile.v3", text --> fmode --> iof handle)
|
||||
, ("IO.closeFile.v3", handle --> iof unit)
|
||||
, ("IO.isFileEOF.v3", handle --> iof boolean)
|
||||
, ("IO.isFileOpen.v3", handle --> iof boolean)
|
||||
, ("IO.isSeekable.v3", handle --> iof boolean)
|
||||
, ("IO.seekHandle.v3", handle --> smode --> int --> iof unit)
|
||||
, ("IO.handlePosition.v3", handle --> iof nat)
|
||||
, ("IO.getBuffering.v3", handle --> iof bmode)
|
||||
, ("IO.setBuffering.v3", handle --> bmode --> iof unit)
|
||||
, ("IO.getBytes.v3", handle --> nat --> iof bytes)
|
||||
, ("IO.putBytes.v3", handle --> bytes --> iof unit)
|
||||
, ("IO.systemTime.v3", unit --> iof nat)
|
||||
, ("IO.getTempDirectory.v3", unit --> iof text)
|
||||
, ("IO.createTempDirectory", text --> iof text)
|
||||
, ("IO.getCurrentDirectory.v2", unit --> iof text)
|
||||
, ("IO.setCurrentDirectory.v2", text --> iof unit)
|
||||
, ("IO.fileExists.v2", text --> iof boolean)
|
||||
, ("IO.isDirectory.v2", text --> iof boolean)
|
||||
, ("IO.createDirectory.v2", text --> iof unit)
|
||||
, ("IO.removeDirectory.v2", text --> iof unit)
|
||||
, ("IO.renameDirectory.v2", text --> text --> iof unit)
|
||||
, ("IO.removeFile.v2", text --> iof unit)
|
||||
, ("IO.renameFile.v2", text --> text --> iof unit)
|
||||
, ("IO.getFileTimestamp.v2", text --> iof nat)
|
||||
, ("IO.getFileSize.v2", text --> iof nat)
|
||||
, ("IO.serverSocket.v2", optionalt text --> text --> iof socket)
|
||||
, ("IO.listen.v2", socket --> iof unit)
|
||||
, ("IO.clientSocket.v2", text --> text --> iof socket)
|
||||
, ("IO.closeSocket.v2", socket --> iof unit)
|
||||
, ("IO.getCurrentDirectory.v3", unit --> iof text)
|
||||
, ("IO.setCurrentDirectory.v3", text --> iof unit)
|
||||
, ("IO.fileExists.v3", text --> iof boolean)
|
||||
, ("IO.isDirectory.v3", text --> iof boolean)
|
||||
, ("IO.createDirectory.v3", text --> iof unit)
|
||||
, ("IO.removeDirectory.v3", text --> iof unit)
|
||||
, ("IO.renameDirectory.v3", text --> text --> iof unit)
|
||||
, ("IO.removeFile.v3", text --> iof unit)
|
||||
, ("IO.renameFile.v3", text --> text --> iof unit)
|
||||
, ("IO.getFileTimestamp.v3", text --> iof nat)
|
||||
, ("IO.getFileSize.v3", text --> iof nat)
|
||||
, ("IO.serverSocket.v3", optionalt text --> text --> iof socket)
|
||||
, ("IO.listen.v3", socket --> iof unit)
|
||||
, ("IO.clientSocket.v3", text --> text --> iof socket)
|
||||
, ("IO.closeSocket.v3", socket --> iof unit)
|
||||
, ("IO.socketPort", socket --> iof nat)
|
||||
, ("IO.socketAccept.v2", socket --> iof socket)
|
||||
, ("IO.socketSend.v2", socket --> bytes --> iof unit)
|
||||
, ("IO.socketReceive.v2", socket --> nat --> iof bytes)
|
||||
, ("IO.socketAccept.v3", socket --> iof socket)
|
||||
, ("IO.socketSend.v3", socket --> bytes --> iof unit)
|
||||
, ("IO.socketReceive.v3", socket --> nat --> iof bytes)
|
||||
, ("IO.forkComp.v2"
|
||||
, forall1 "a" $ \a -> (unit --> io a) --> io threadId)
|
||||
, ("IO.stdHandle", stdhandle --> handle)
|
||||
|
||||
, ("IO.delay.v2", nat --> iof unit)
|
||||
, ("IO.kill.v2", threadId --> iof unit)
|
||||
, ("IO.delay.v3", nat --> iof unit)
|
||||
, ("IO.kill.v3", threadId --> iof unit)
|
||||
, ("Tls.newClient", tlsClientConfig --> socket --> iof tls)
|
||||
, ("Tls.newServer", tlsServerConfig --> socket --> iof tls)
|
||||
, ("Tls.handshake", tls --> iof unit)
|
||||
@ -555,12 +560,12 @@ ioBuiltins =
|
||||
, ("Tls.terminate", tls --> iof unit)
|
||||
, ("Tls.ClientConfig.default", text --> bytes --> tlsClientConfig)
|
||||
, ("Tls.ServerConfig.default", list tlsSignedCert --> tlsPrivateKey --> tlsServerConfig)
|
||||
, ("tls.ClientConfig.ciphers.set", list tlsCipher --> tlsClientConfig --> tlsClientConfig)
|
||||
, ("tls.ServerConfig.ciphers.set", list tlsCipher --> tlsServerConfig --> tlsServerConfig)
|
||||
, ("TLS.ClientConfig.ciphers.set", list tlsCipher --> tlsClientConfig --> tlsClientConfig)
|
||||
, ("Tls.ServerConfig.ciphers.set", list tlsCipher --> tlsServerConfig --> tlsServerConfig)
|
||||
, ("Tls.ClientConfig.certificates.set", list tlsSignedCert --> tlsClientConfig --> tlsClientConfig)
|
||||
, ("Tls.ServerConfig.certificates.set", list tlsSignedCert --> tlsServerConfig --> tlsServerConfig)
|
||||
, ("tls.ClientConfig.versions.set", list tlsVersion --> tlsClientConfig --> tlsClientConfig)
|
||||
, ("tls.ServerConfig.versions.set", list tlsVersion --> tlsServerConfig --> tlsServerConfig)
|
||||
, ("Tls.ClientConfig.versions.set", list tlsVersion --> tlsClientConfig --> tlsClientConfig)
|
||||
, ("Tls.ServerConfig.versions.set", list tlsVersion --> tlsServerConfig --> tlsServerConfig)
|
||||
|
||||
]
|
||||
|
||||
@ -568,13 +573,13 @@ mvarBuiltins :: forall v. Var v => [(Text, Type v)]
|
||||
mvarBuiltins =
|
||||
[ ("MVar.new", forall1 "a" $ \a -> a --> io (mvar a))
|
||||
, ("MVar.newEmpty.v2", forall1 "a" $ \a -> unit --> io (mvar a))
|
||||
, ("MVar.take.v2", forall1 "a" $ \a -> mvar a --> iof a)
|
||||
, ("MVar.take.v3", forall1 "a" $ \a -> mvar a --> iof a)
|
||||
, ("MVar.tryTake", forall1 "a" $ \a -> mvar a --> io (optionalt a))
|
||||
, ("MVar.put.v2", forall1 "a" $ \a -> mvar a --> a --> iof unit)
|
||||
, ("MVar.put.v3", forall1 "a" $ \a -> mvar a --> a --> iof unit)
|
||||
, ("MVar.tryPut", forall1 "a" $ \a -> mvar a --> a --> io boolean)
|
||||
, ("MVar.swap.v2", forall1 "a" $ \a -> mvar a --> a --> iof a)
|
||||
, ("MVar.swap.v3", forall1 "a" $ \a -> mvar a --> a --> iof a)
|
||||
, ("MVar.isEmpty", forall1 "a" $ \a -> mvar a --> io boolean)
|
||||
, ("MVar.read.v2", forall1 "a" $ \a -> mvar a --> iof a)
|
||||
, ("MVar.read.v3", forall1 "a" $ \a -> mvar a --> iof a)
|
||||
, ("MVar.tryRead", forall1 "a" $ \a -> mvar a --> io (optionalt a))
|
||||
]
|
||||
where
|
||||
|
@ -41,6 +41,9 @@ optionalRef = lookupDeclRef "Optional"
|
||||
eitherRef = lookupDeclRef "Either"
|
||||
|
||||
testResultRef, linkRef, docRef, ioErrorRef, stdHandleRef, failureRef, tlsSignedCertRef, tlsPrivateKeyRef :: Reference
|
||||
isPropagatedRef, isTestRef :: Reference
|
||||
isPropagatedRef = lookupDeclRef "IsPropagated"
|
||||
isTestRef = lookupDeclRef "IsTest"
|
||||
testResultRef = lookupDeclRef "Test.Result"
|
||||
linkRef = lookupDeclRef "Link"
|
||||
docRef = lookupDeclRef "Doc"
|
||||
@ -67,6 +70,9 @@ constructorId ref name = do
|
||||
elemIndex name $ DD.constructorNames dd
|
||||
|
||||
okConstructorId, failConstructorId, docBlobId, docLinkId, docSignatureId, docSourceId, docEvaluateId, docJoinId, linkTermId, linkTypeId :: ConstructorId
|
||||
isPropagatedConstructorId, isTestConstructorId :: ConstructorId
|
||||
Just isPropagatedConstructorId = constructorId isPropagatedRef "IsPropagated.IsPropagated"
|
||||
Just isTestConstructorId = constructorId isTestRef "IsTest.IsTest"
|
||||
Just okConstructorId = constructorId testResultRef "Test.Result.Ok"
|
||||
Just failConstructorId = constructorId testResultRef "Test.Result.Fail"
|
||||
Just docBlobId = constructorId docRef "Doc.Blob"
|
||||
@ -96,6 +102,8 @@ builtinDataDecls = rs1 ++ rs
|
||||
, (v "Optional" , opt)
|
||||
, (v "Either" , eith)
|
||||
, (v "Test.Result" , tr)
|
||||
, (v "IsPropagated" , isPropagated)
|
||||
, (v "IsTest" , isTest)
|
||||
, (v "Doc" , doc)
|
||||
, (v "io2.FileMode" , fmode)
|
||||
, (v "io2.BufferMode" , bmode)
|
||||
@ -105,6 +113,7 @@ builtinDataDecls = rs1 ++ rs
|
||||
, (v "io2.StdHandle" , stdhnd)
|
||||
, (v "io2.Failure" , failure)
|
||||
, (v "io2.TlsFailure" , tlsFailure)
|
||||
, (v "io2.IOFailure" , ioFailure)
|
||||
] of Right a -> a; Left e -> error $ "builtinDataDecls: " <> show e
|
||||
[(_, linkRef, _)] = rs1
|
||||
v = Var.named
|
||||
@ -156,6 +165,18 @@ builtinDataDecls = rs1 ++ rs
|
||||
(var "b" `arr` Type.apps' (var "Either") [var "a", var "b"])
|
||||
)
|
||||
]
|
||||
isTest =
|
||||
DataDeclaration
|
||||
(Unique "e6dca08b40458b03ca1660cfbdaecaa7279b42d18257898b5fd1c34596aac36f")
|
||||
()
|
||||
[]
|
||||
[((), v "IsTest.IsTest", var "IsTest")]
|
||||
isPropagated =
|
||||
DataDeclaration
|
||||
(Unique "b28d929d0a73d2c18eac86341a3bb9399f8550c11b5f35eabb2751e6803ccc20")
|
||||
()
|
||||
[]
|
||||
[((), v "IsPropagated.IsPropagated", var "IsPropagated")]
|
||||
fmode = DataDeclaration
|
||||
(Unique "3c11ba4f0a5d8fedd427b476cdd2d7673197d11e")
|
||||
()
|
||||
@ -200,13 +221,15 @@ builtinDataDecls = rs1 ++ rs
|
||||
(Unique "52ad89274a358b9c802792aa05915e25ac83205f7885395cc6c6c988bc5ec69a1")
|
||||
()
|
||||
[]
|
||||
[ ((), v "io2.Failure.Failure", Type.typeLink () `arr` (Type.text () `arr` var "io2.Failure"))
|
||||
[ ((), v "io2.Failure.Failure", Type.typeLink () `arr` (Type.text () `arr` (Type.any () `arr` var "io2.Failure")))
|
||||
]
|
||||
tlsFailure = DataDeclaration
|
||||
(Unique "df5ba835130b227ab83d02d1feff5402455a732d613b51dee32230d2f2d067c6")
|
||||
()
|
||||
|
||||
tlsFailure = DataDeclaration (Unique "df5ba835130b227ab83d02d1feff5402455a732d613b51dee32230d2f2d067c6")()[]
|
||||
[]
|
||||
|
||||
ioFailure = DataDeclaration (Unique "009cb00e78cac9e47485cc3633c7a363939f63866ea07ab330346a2121d69a83")()[]
|
||||
[]
|
||||
|
||||
stdhnd = DataDeclaration
|
||||
(Unique "67bf7a8e517cbb1e9f42bc078e35498212d3be3c")
|
||||
()
|
||||
|
36
parser-typechecker/src/Unison/Builtin/Terms.hs
Normal file
36
parser-typechecker/src/Unison/Builtin/Terms.hs
Normal file
@ -0,0 +1,36 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
module Unison.Builtin.Terms where
|
||||
|
||||
import Data.Map (Map)
|
||||
import qualified Data.Map as Map
|
||||
import Data.Text (Text)
|
||||
import qualified Unison.Builtin.Decls as Decls
|
||||
import qualified Unison.Reference as Reference
|
||||
import Unison.Term (Term)
|
||||
import qualified Unison.Term as Term
|
||||
import Unison.Type (Type)
|
||||
import qualified Unison.Type as Type
|
||||
import Unison.Var (Var)
|
||||
import qualified Unison.Var as Var
|
||||
|
||||
builtinTermsSrc :: Var v => a -> [(v, Term v a, Type v a)]
|
||||
builtinTermsSrc a =
|
||||
[ ( v "metadata.isPropagated",
|
||||
Term.constructor a Decls.isPropagatedRef Decls.isPropagatedConstructorId,
|
||||
Type.ref a Decls.isPropagatedRef
|
||||
),
|
||||
( v "metadata.isTest",
|
||||
Term.constructor a Decls.isTestRef Decls.isTestConstructorId,
|
||||
Type.ref a Decls.isTestRef
|
||||
)
|
||||
]
|
||||
|
||||
v :: Var v => Text -> v
|
||||
v = Var.named
|
||||
|
||||
builtinTermsRef :: Var v => a -> Map v Reference.Id
|
||||
builtinTermsRef a = fmap fst . Term.hashComponents . Map.fromList
|
||||
. fmap (\(v, tm, _tp) -> (v, tm))
|
||||
$ builtinTermsSrc a
|
@ -11,13 +11,13 @@ import qualified Data.Map as Map
|
||||
import qualified Data.Set as Set
|
||||
import qualified Unison.ABT as ABT
|
||||
import qualified Unison.Builtin as Builtin
|
||||
import qualified Unison.Builtin.Terms as Builtin
|
||||
import Unison.Codebase.Branch ( Branch )
|
||||
import qualified Unison.Codebase.Branch as Branch
|
||||
import qualified Unison.Codebase.CodeLookup as CL
|
||||
import qualified Unison.Codebase.Reflog as Reflog
|
||||
import Unison.Codebase.SyncMode ( SyncMode )
|
||||
import qualified Unison.DataDeclaration as DD
|
||||
import qualified Unison.Names2 as Names
|
||||
import Unison.Reference ( Reference )
|
||||
import qualified Unison.Reference as Reference
|
||||
import qualified Unison.Referent as Referent
|
||||
@ -31,7 +31,6 @@ import qualified Unison.Util.Relation as Rel
|
||||
import qualified Unison.Util.Set as Set
|
||||
import qualified Unison.Var as Var
|
||||
import Unison.Var ( Var )
|
||||
import qualified Unison.Runtime.IOSource as IOSource
|
||||
import Unison.Symbol ( Symbol )
|
||||
import Unison.DataDeclaration (Decl)
|
||||
import Unison.Term (Term)
|
||||
@ -98,16 +97,13 @@ data GetRootBranchError
|
||||
|
||||
data SyncFileCodebaseResult = SyncOk | UnknownDestinationRootBranch Branch.Hash | NotFastForward
|
||||
|
||||
bootstrapNames :: Names.Names0
|
||||
bootstrapNames =
|
||||
Builtin.names0 <> UF.typecheckedToNames0 IOSource.typecheckedFile
|
||||
|
||||
-- | Write all of the builtins types into the codebase and create empty namespace
|
||||
initializeCodebase :: forall m. Monad m => Codebase m Symbol Parser.Ann -> m ()
|
||||
initializeCodebase c = do
|
||||
let uf = (UF.typecheckedUnisonFile (Map.fromList Builtin.builtinDataDecls)
|
||||
(Map.fromList Builtin.builtinEffectDecls)
|
||||
mempty mempty)
|
||||
[Builtin.builtinTermsSrc Parser.Intrinsic]
|
||||
mempty)
|
||||
addDefsToCodebase c uf
|
||||
putRootBranch c (Branch.one Branch.empty0)
|
||||
|
||||
|
@ -18,6 +18,7 @@ import qualified Unison.Builtin as B
|
||||
|
||||
import qualified Crypto.Random as Random
|
||||
import Control.Monad.Except ( runExceptT )
|
||||
import qualified Control.Monad.State as State
|
||||
import qualified Data.Configurator as Config
|
||||
import Data.Configurator.Types ( Config )
|
||||
import qualified Data.Map as Map
|
||||
@ -92,78 +93,80 @@ commandLine
|
||||
-> Free (Command IO i v) a
|
||||
-> IO a
|
||||
commandLine config awaitInput setBranchRef rt notifyUser notifyNumbered loadSource codebase rngGen branchCache =
|
||||
Free.foldWithIndex go
|
||||
flip State.evalStateT 0 . Free.fold go
|
||||
where
|
||||
go :: forall x . Int -> Command IO i v x -> IO x
|
||||
go i x = case x of
|
||||
go :: forall x . Command IO i v x -> State.StateT Int IO x
|
||||
go x = case x of
|
||||
-- Wait until we get either user input or a unison file update
|
||||
Eval m -> m
|
||||
Input -> awaitInput
|
||||
Notify output -> notifyUser output
|
||||
NotifyNumbered output -> notifyNumbered output
|
||||
Eval m -> lift $ m
|
||||
Input -> lift $ awaitInput
|
||||
Notify output -> lift $ notifyUser output
|
||||
NotifyNumbered output -> lift $ notifyNumbered output
|
||||
ConfigLookup name ->
|
||||
Config.lookup config name
|
||||
LoadSource sourcePath -> loadSource sourcePath
|
||||
lift $ Config.lookup config name
|
||||
LoadSource sourcePath -> lift $ loadSource sourcePath
|
||||
|
||||
Typecheck ambient names sourceName source -> do
|
||||
-- todo: if guids are being shown to users,
|
||||
-- not ideal to generate new guid every time
|
||||
rng <- rngGen i
|
||||
i <- State.get
|
||||
State.modify' (+1)
|
||||
rng <- lift $ rngGen i
|
||||
let namegen = Parser.uniqueBase32Namegen rng
|
||||
env = Parser.ParsingEnv namegen names
|
||||
typecheck ambient codebase env sourceName source
|
||||
TypecheckFile file ambient -> typecheck' ambient codebase file
|
||||
Evaluate ppe unisonFile -> evalUnisonFile ppe unisonFile
|
||||
Evaluate1 ppe term -> eval1 ppe term
|
||||
LoadLocalRootBranch -> either (const Branch.empty) id <$> Codebase.getRootBranch codebase
|
||||
LoadLocalBranch h -> fromMaybe Branch.empty <$> Codebase.getBranchForHash codebase h
|
||||
SyncLocalRootBranch branch -> do
|
||||
lift $ typecheck ambient codebase env sourceName source
|
||||
TypecheckFile file ambient -> lift $ typecheck' ambient codebase file
|
||||
Evaluate ppe unisonFile -> lift $ evalUnisonFile ppe unisonFile
|
||||
Evaluate1 ppe term -> lift $ eval1 ppe term
|
||||
LoadLocalRootBranch -> lift $ either (const Branch.empty) id <$> Codebase.getRootBranch codebase
|
||||
LoadLocalBranch h -> lift $ fromMaybe Branch.empty <$> Codebase.getBranchForHash codebase h
|
||||
SyncLocalRootBranch branch -> lift $ do
|
||||
setBranchRef branch
|
||||
Codebase.putRootBranch codebase branch
|
||||
ViewRemoteBranch ns ->
|
||||
runExceptT $ Git.viewRemoteBranch branchCache ns
|
||||
lift $ runExceptT $ Git.viewRemoteBranch branchCache ns
|
||||
ImportRemoteBranch ns syncMode ->
|
||||
runExceptT $ Git.importRemoteBranch codebase branchCache ns syncMode
|
||||
lift $ runExceptT $ Git.importRemoteBranch codebase branchCache ns syncMode
|
||||
SyncRemoteRootBranch repo branch syncMode ->
|
||||
runExceptT $ Git.pushGitRootBranch codebase branchCache branch repo syncMode
|
||||
LoadTerm r -> Codebase.getTerm codebase r
|
||||
LoadType r -> Codebase.getTypeDeclaration codebase r
|
||||
LoadTypeOfTerm r -> Codebase.getTypeOfTerm codebase r
|
||||
PutTerm r tm tp -> Codebase.putTerm codebase r tm tp
|
||||
PutDecl r decl -> Codebase.putTypeDeclaration codebase r decl
|
||||
PutWatch kind r e -> Codebase.putWatch codebase kind r e
|
||||
LoadWatches kind rs -> catMaybes <$> traverse go (toList rs) where
|
||||
lift $ runExceptT $ Git.pushGitRootBranch codebase branchCache branch repo syncMode
|
||||
LoadTerm r -> lift $ Codebase.getTerm codebase r
|
||||
LoadType r -> lift $ Codebase.getTypeDeclaration codebase r
|
||||
LoadTypeOfTerm r -> lift $ Codebase.getTypeOfTerm codebase r
|
||||
PutTerm r tm tp -> lift $ Codebase.putTerm codebase r tm tp
|
||||
PutDecl r decl -> lift $ Codebase.putTypeDeclaration codebase r decl
|
||||
PutWatch kind r e -> lift $ Codebase.putWatch codebase kind r e
|
||||
LoadWatches kind rs -> lift $ catMaybes <$> traverse go (toList rs) where
|
||||
go (Reference.Builtin _) = pure Nothing
|
||||
go r@(Reference.DerivedId rid) =
|
||||
fmap (r,) <$> Codebase.getWatch codebase kind rid
|
||||
IsTerm r -> Codebase.isTerm codebase r
|
||||
IsType r -> Codebase.isType codebase r
|
||||
GetDependents r -> Codebase.dependents codebase r
|
||||
AddDefsToCodebase unisonFile -> Codebase.addDefsToCodebase codebase unisonFile
|
||||
GetTermsOfType ty -> Codebase.termsOfType codebase ty
|
||||
GetTermsMentioningType ty -> Codebase.termsMentioningType codebase ty
|
||||
CodebaseHashLength -> Codebase.hashLength codebase
|
||||
IsTerm r -> lift $ Codebase.isTerm codebase r
|
||||
IsType r -> lift $ Codebase.isType codebase r
|
||||
GetDependents r -> lift $ Codebase.dependents codebase r
|
||||
AddDefsToCodebase unisonFile -> lift $ Codebase.addDefsToCodebase codebase unisonFile
|
||||
GetTermsOfType ty -> lift $ Codebase.termsOfType codebase ty
|
||||
GetTermsMentioningType ty -> lift $ Codebase.termsMentioningType codebase ty
|
||||
CodebaseHashLength -> lift $ Codebase.hashLength codebase
|
||||
-- all builtin and derived type references
|
||||
TypeReferencesByShortHash sh -> do
|
||||
fromCodebase <- Codebase.typeReferencesByPrefix codebase sh
|
||||
fromCodebase <- lift $ Codebase.typeReferencesByPrefix codebase sh
|
||||
let fromBuiltins = Set.filter (\r -> sh == Reference.toShortHash r)
|
||||
$ B.intrinsicTypeReferences
|
||||
pure (fromBuiltins <> Set.map Reference.DerivedId fromCodebase)
|
||||
-- all builtin and derived term references
|
||||
TermReferencesByShortHash sh -> do
|
||||
fromCodebase <- Codebase.termReferencesByPrefix codebase sh
|
||||
fromCodebase <- lift $ Codebase.termReferencesByPrefix codebase sh
|
||||
let fromBuiltins = Set.filter (\r -> sh == Reference.toShortHash r)
|
||||
$ B.intrinsicTermReferences
|
||||
pure (fromBuiltins <> Set.map Reference.DerivedId fromCodebase)
|
||||
-- all builtin and derived term references & type constructors
|
||||
TermReferentsByShortHash sh -> do
|
||||
fromCodebase <- Codebase.termReferentsByPrefix codebase sh
|
||||
fromCodebase <- lift $ Codebase.termReferentsByPrefix codebase sh
|
||||
let fromBuiltins = Set.map Referent.Ref
|
||||
. Set.filter (\r -> sh == Reference.toShortHash r)
|
||||
$ B.intrinsicTermReferences
|
||||
pure (fromBuiltins <> Set.map (fmap Reference.DerivedId) fromCodebase)
|
||||
BranchHashLength -> Codebase.branchHashLength codebase
|
||||
BranchHashesByPrefix h -> Codebase.branchHashesByPrefix codebase h
|
||||
BranchHashLength -> lift $ Codebase.branchHashLength codebase
|
||||
BranchHashesByPrefix h -> lift $ Codebase.branchHashesByPrefix codebase h
|
||||
ParseType names (src, _) -> pure $
|
||||
Parsers.parseType (Text.unpack src) (Parser.ParsingEnv mempty names)
|
||||
RuntimeMain -> pure $ Runtime.mainType rt
|
||||
@ -175,9 +178,9 @@ commandLine config awaitInput setBranchRef rt notifyUser notifyNumbered loadSour
|
||||
-- pure $ Branch.append b0 b
|
||||
|
||||
Execute ppe uf ->
|
||||
evalUnisonFile ppe uf
|
||||
AppendToReflog reason old new -> Codebase.appendReflog codebase reason old new
|
||||
LoadReflog -> Codebase.getReflog codebase
|
||||
lift $ evalUnisonFile ppe uf
|
||||
AppendToReflog reason old new -> lift $ Codebase.appendReflog codebase reason old new
|
||||
LoadReflog -> lift $ Codebase.getReflog codebase
|
||||
CreateAuthorInfo t -> AuthorInfo.createAuthorInfo Parser.External t
|
||||
|
||||
eval1 :: PPE.PrettyPrintEnv -> Term v Ann -> _
|
||||
|
@ -118,6 +118,7 @@ import Unison.LabeledDependency (LabeledDependency)
|
||||
import Unison.Term (Term)
|
||||
import Unison.Type (Type)
|
||||
import qualified Unison.Builtin as Builtin
|
||||
import qualified Unison.Builtin.Terms as Builtin
|
||||
import Unison.NameSegment (NameSegment(..))
|
||||
import qualified Unison.NameSegment as NameSegment
|
||||
import Unison.Codebase.ShortBranchHash (ShortBranchHash)
|
||||
@ -370,11 +371,9 @@ loop = do
|
||||
(misses', hits) <- hqNameQuery [from]
|
||||
let tpRefs = Set.fromList $ typeReferences hits
|
||||
tmRefs = Set.fromList $ termReferences hits
|
||||
tmMisses = misses'
|
||||
<> (HQ'.toHQ . SR.termName <$> termResults hits)
|
||||
tpMisses = misses'
|
||||
<> (HQ'.toHQ . SR.typeName <$> typeResults hits)
|
||||
misses = if isTerm then tpMisses else tmMisses
|
||||
misses = Set.difference (Set.fromList misses') if isTerm
|
||||
then Set.fromList $ HQ'.toHQ . SR.termName <$> termResults hits
|
||||
else Set.fromList $ HQ'.toHQ . SR.typeName <$> typeResults hits
|
||||
go :: Reference -> Action m (Either Event Input) v ()
|
||||
go fr = do
|
||||
let termPatch =
|
||||
@ -390,8 +389,8 @@ loop = do
|
||||
(const (if isTerm then termPatch else typePatch)))
|
||||
-- Say something
|
||||
success
|
||||
unless (null misses) $
|
||||
respond $ SearchTermsNotFound misses
|
||||
unless (Set.null misses) $
|
||||
respond $ SearchTermsNotFound (Set.toList misses)
|
||||
traverse_ go (if isTerm then tmRefs else tpRefs)
|
||||
branchExists dest _x = respond $ BranchAlreadyExists dest
|
||||
branchExistsSplit = branchExists . Path.unsplit'
|
||||
@ -1628,8 +1627,8 @@ loop = do
|
||||
e <- eval $ Execute ppe unisonFile
|
||||
|
||||
case e of
|
||||
Left e -> respond $ EvaluationFailure e
|
||||
Right _ -> pure () -- TODO
|
||||
Left e -> respond $ EvaluationFailure e
|
||||
Right _ -> pure () -- TODO
|
||||
|
||||
IOTestI main -> do
|
||||
testType <- eval RuntimeTest
|
||||
@ -1661,7 +1660,7 @@ loop = do
|
||||
tm' <- eval $ Evaluate1 ppe tm
|
||||
case tm' of
|
||||
Left e -> respond (EvaluationFailure e)
|
||||
Right tm' ->
|
||||
Right tm' ->
|
||||
respond $ TestResults Output.NewlyComputed ppe True True (oks [(ref, tm')]) (fails [(ref, tm')])
|
||||
_ -> respond $ NoMainFunction "main" ppe [testType]
|
||||
_ -> respond $ NoMainFunction "main" ppe [testType]
|
||||
@ -1675,7 +1674,8 @@ loop = do
|
||||
-- added again.
|
||||
let uf = UF.typecheckedUnisonFile (Map.fromList Builtin.builtinDataDecls)
|
||||
(Map.fromList Builtin.builtinEffectDecls)
|
||||
mempty mempty
|
||||
[Builtin.builtinTermsSrc Intrinsic]
|
||||
mempty
|
||||
eval $ AddDefsToCodebase uf
|
||||
-- add the names; note, there are more names than definitions
|
||||
-- due to builtin terms; so we don't just reuse `uf` above.
|
||||
@ -1689,7 +1689,8 @@ loop = do
|
||||
-- added again.
|
||||
let uf = UF.typecheckedUnisonFile (Map.fromList Builtin.builtinDataDecls)
|
||||
(Map.fromList Builtin.builtinEffectDecls)
|
||||
mempty mempty
|
||||
[Builtin.builtinTermsSrc Intrinsic]
|
||||
mempty
|
||||
eval $ AddDefsToCodebase uf
|
||||
-- these have not neceesarily been added yet
|
||||
eval $ AddDefsToCodebase IOSource.typecheckedFile'
|
||||
|
@ -29,7 +29,8 @@ import Unison.Symbol
|
||||
import qualified Unison.Runtime.Stack as Closure
|
||||
import Unison.Runtime.Stack (Closure)
|
||||
import Unison.Runtime.Foreign
|
||||
( Foreign(Wrap), HashAlgorithm(..), Failure(..))
|
||||
( Foreign(Wrap), HashAlgorithm(..), pattern Failure)
|
||||
import qualified Unison.Runtime.Foreign as F
|
||||
import Unison.Runtime.Foreign.Function
|
||||
import Unison.Runtime.IOSource
|
||||
|
||||
@ -75,7 +76,8 @@ import Network.TLS as TLS
|
||||
import Network.TLS.Extra.Cipher as Cipher
|
||||
|
||||
import System.IO as SYS
|
||||
( openFile
|
||||
( IOMode(..)
|
||||
, openFile
|
||||
, hClose
|
||||
, hGetBuffering
|
||||
, hSetBuffering
|
||||
@ -117,6 +119,8 @@ import qualified GHC.Conc as STM
|
||||
|
||||
import GHC.IO (IO(IO))
|
||||
|
||||
type Failure = F.Failure Closure
|
||||
|
||||
freshes :: Var v => Int -> [v]
|
||||
freshes = freshes' mempty
|
||||
|
||||
@ -855,9 +859,6 @@ inBxIomr arg1 arg2 fm result cont instr
|
||||
-- All of these functions will take a Var named result containing the
|
||||
-- result of the foreign call
|
||||
--
|
||||
outInt :: forall v. Var v => v -> ANormal v
|
||||
outInt i = TCon Ty.intRef 0 [i]
|
||||
|
||||
outMaybe :: forall v. Var v => v -> v -> ANormal v
|
||||
outMaybe maybe result =
|
||||
TMatch result . MatchSum $ mapFromList
|
||||
@ -964,14 +965,6 @@ unitToEFBox = inUnit unit result
|
||||
$ outIoFailBox stack1 stack2 fail result
|
||||
where (unit, stack1, stack2, fail, result) = fresh5
|
||||
|
||||
-- a -> Int
|
||||
boxToInt :: ForeignOp
|
||||
boxToInt = inBx arg result
|
||||
$ outInt result
|
||||
where
|
||||
(arg, result) = fresh2
|
||||
|
||||
-- a -> IOMode -> Either Failure b
|
||||
boxIomrToEFBox :: ForeignOp
|
||||
boxIomrToEFBox = inBxIomr arg1 arg2 enum result
|
||||
$ outIoFailBox stack1 stack2 fail result
|
||||
@ -1306,9 +1299,12 @@ mkForeignIOF f = mkForeign $ \a -> tryIOE (f a)
|
||||
tryIOE :: IO a -> IO (Either Failure a)
|
||||
tryIOE = fmap handleIOE . try
|
||||
handleIOE :: Either IOException a -> Either Failure a
|
||||
handleIOE (Left e) = Left $ traceShow e $ Failure ioFailureReference (pack (show e))
|
||||
handleIOE (Left e) = Left $ Failure ioFailureReference (pack (show e)) unitValue
|
||||
handleIOE (Right a) = Right a
|
||||
|
||||
unitValue :: Closure
|
||||
unitValue = Closure.Enum Ty.unitRef 0
|
||||
|
||||
mkForeignTls
|
||||
:: forall a r.(ForeignConvention a, ForeignConvention r)
|
||||
=> (a -> IO r) -> ForeignFunc
|
||||
@ -1318,40 +1314,48 @@ mkForeignTls f = mkForeign $ \a -> fmap flatten (tryIO2 (tryIO1 (f a)))
|
||||
tryIO1 = try
|
||||
tryIO2 :: IO (Either TLS.TLSException r) -> IO (Either IOException (Either TLS.TLSException r))
|
||||
tryIO2 = try
|
||||
flatten :: Either IOException (Either TLS.TLSException r) -> Either Failure r
|
||||
flatten (Left e) = Left (Failure ioFailureReference (pack (show e)))
|
||||
flatten (Right (Left e)) = Left (Failure tlsFailureReference (pack (show e)))
|
||||
flatten :: Either IOException (Either TLS.TLSException r) -> Either (Failure ) r
|
||||
flatten (Left e) = Left (Failure ioFailureReference (pack (show e)) unitValue)
|
||||
flatten (Right (Left e)) = Left (Failure tlsFailureReference (pack (show e)) (unitValue))
|
||||
flatten (Right (Right a)) = Right a
|
||||
|
||||
declareForeigns :: Var v => FDecl v ()
|
||||
declareForeigns = do
|
||||
declareForeign "IO.openFile.v3" boxIomrToEFBox $
|
||||
mkForeignIOF $ \(fnameText :: Text, n :: Int) ->
|
||||
let fname = (unpack fnameText)
|
||||
mode = case n of
|
||||
0 -> ReadMode
|
||||
1 -> WriteMode
|
||||
2 -> AppendMode
|
||||
_ -> ReadWriteMode
|
||||
in openFile fname mode
|
||||
|
||||
declareForeign "IO.openFile.v2" boxIomrToEFBox $ mkForeignIOF (uncurry openFile)
|
||||
declareForeign "IO.closeFile.v2" boxToEF0 $ mkForeignIOF hClose
|
||||
declareForeign "IO.isFileEOF.v2" boxToEFBool $ mkForeignIOF hIsEOF
|
||||
declareForeign "IO.isFileOpen.v2" boxToEFBool $ mkForeignIOF hIsOpen
|
||||
declareForeign "IO.isSeekable.v2" boxToEFBool $ mkForeignIOF hIsSeekable
|
||||
declareForeign "IO.closeFile.v3" boxToEF0 $ mkForeignIOF hClose
|
||||
declareForeign "IO.isFileEOF.v3" boxToEFBool $ mkForeignIOF hIsEOF
|
||||
declareForeign "IO.isFileOpen.v3" boxToEFBool $ mkForeignIOF hIsOpen
|
||||
declareForeign "IO.isSeekable.v3" boxToEFBool $ mkForeignIOF hIsSeekable
|
||||
|
||||
declareForeign "IO.seekHandle.v2" seek'handle
|
||||
declareForeign "IO.seekHandle.v3" seek'handle
|
||||
. mkForeignIOF $ \(h,sm,n) -> hSeek h sm (fromIntegral (n :: Int))
|
||||
|
||||
declareForeign "IO.handlePosition.v2" boxToInt
|
||||
declareForeign "IO.handlePosition.v3" boxToEFNat
|
||||
-- TODO: truncating integer
|
||||
. mkForeignIOF $ \h -> fromInteger @Word64 <$> hTell h
|
||||
|
||||
declareForeign "IO.getBuffering.v2" get'buffering
|
||||
declareForeign "IO.getBuffering.v3" get'buffering
|
||||
$ mkForeignIOF hGetBuffering
|
||||
|
||||
declareForeign "IO.setBuffering.v2" boxBoxToEF0
|
||||
declareForeign "IO.setBuffering.v3" boxBoxToEF0
|
||||
. mkForeignIOF $ uncurry hSetBuffering
|
||||
|
||||
declareForeign "IO.getBytes.v2" boxNatToEFBox . mkForeignIOF $ \(h,n) -> Bytes.fromArray <$> hGet h n
|
||||
declareForeign "IO.getBytes.v3" boxNatToEFBox . mkForeignIOF $ \(h,n) -> Bytes.fromArray <$> hGet h n
|
||||
|
||||
declareForeign "IO.putBytes.v2" boxBoxToEFBox . mkForeignIOF $ \(h,bs) -> hPut h (Bytes.toArray bs)
|
||||
declareForeign "IO.systemTime.v2" unitToEFNat
|
||||
declareForeign "IO.putBytes.v3" boxBoxToEFBox . mkForeignIOF $ \(h,bs) -> hPut h (Bytes.toArray bs)
|
||||
declareForeign "IO.systemTime.v3" unitToEFNat
|
||||
$ mkForeignIOF $ \() -> getPOSIXTime
|
||||
|
||||
declareForeign "IO.getTempDirectory.v2" unitToEFBox
|
||||
declareForeign "IO.getTempDirectory.v3" unitToEFBox
|
||||
$ mkForeignIOF $ \() -> getTemporaryDirectory
|
||||
|
||||
declareForeign "IO.createTempDirectory" boxToEFBox
|
||||
@ -1359,41 +1363,41 @@ declareForeigns = do
|
||||
temp <- getTemporaryDirectory
|
||||
createTempDirectory temp prefix
|
||||
|
||||
declareForeign "IO.getCurrentDirectory.v2" direct
|
||||
declareForeign "IO.getCurrentDirectory.v3" direct
|
||||
. mkForeignIOF $ \() -> getCurrentDirectory
|
||||
|
||||
declareForeign "IO.setCurrentDirectory.v2" boxToEF0
|
||||
declareForeign "IO.setCurrentDirectory.v3" boxToEF0
|
||||
$ mkForeignIOF setCurrentDirectory
|
||||
|
||||
declareForeign "IO.fileExists.v2" boxToEFBool
|
||||
declareForeign "IO.fileExists.v3" boxToEFBool
|
||||
$ mkForeignIOF doesPathExist
|
||||
|
||||
declareForeign "IO.isDirectory.v2" boxToEFBool
|
||||
declareForeign "IO.isDirectory.v3" boxToEFBool
|
||||
$ mkForeignIOF doesDirectoryExist
|
||||
|
||||
declareForeign "IO.createDirectory.v2" boxToEF0
|
||||
declareForeign "IO.createDirectory.v3" boxToEF0
|
||||
$ mkForeignIOF $ createDirectoryIfMissing True
|
||||
|
||||
declareForeign "IO.removeDirectory.v2" boxToEF0
|
||||
declareForeign "IO.removeDirectory.v3" boxToEF0
|
||||
$ mkForeignIOF removeDirectoryRecursive
|
||||
|
||||
declareForeign "IO.renameDirectory.v2" boxBoxToEF0
|
||||
declareForeign "IO.renameDirectory.v3" boxBoxToEF0
|
||||
$ mkForeignIOF $ uncurry renameDirectory
|
||||
|
||||
declareForeign "IO.removeFile.v2" boxToEF0
|
||||
declareForeign "IO.removeFile.v3" boxToEF0
|
||||
$ mkForeignIOF removeFile
|
||||
|
||||
declareForeign "IO.renameFile.v2" boxBoxToEF0
|
||||
declareForeign "IO.renameFile.v3" boxBoxToEF0
|
||||
$ mkForeignIOF $ uncurry renameFile
|
||||
|
||||
declareForeign "IO.getFileTimestamp.v2" boxToEFNat
|
||||
declareForeign "IO.getFileTimestamp.v3" boxToEFNat
|
||||
. mkForeignIOF $ fmap utcTimeToPOSIXSeconds . getModificationTime
|
||||
|
||||
declareForeign "IO.getFileSize.v2" boxToEFNat
|
||||
declareForeign "IO.getFileSize.v3" boxToEFNat
|
||||
-- TODO: truncating integer
|
||||
. mkForeignIOF $ \fp -> fromInteger @Word64 <$> getFileSize fp
|
||||
|
||||
declareForeign "IO.serverSocket.v2" maybeBoxToEFBox
|
||||
declareForeign "IO.serverSocket.v3" maybeBoxToEFBox
|
||||
. mkForeignIOF $ \(mhst :: Maybe Text
|
||||
, port) ->
|
||||
fst <$> SYS.bindSock (hostPreference mhst) port
|
||||
@ -1403,28 +1407,28 @@ declareForeigns = do
|
||||
n <- SYS.socketPort handle
|
||||
return (fromIntegral n :: Word64)
|
||||
|
||||
declareForeign "IO.listen.v2" boxToEF0
|
||||
declareForeign "IO.listen.v3" boxToEF0
|
||||
. mkForeignIOF $ \sk -> SYS.listenSock sk 2
|
||||
|
||||
declareForeign "IO.clientSocket.v2" boxBoxToEFBox
|
||||
declareForeign "IO.clientSocket.v3" boxBoxToEFBox
|
||||
. mkForeignIOF $ fmap fst . uncurry SYS.connectSock
|
||||
|
||||
declareForeign "IO.closeSocket.v2" boxToEF0
|
||||
declareForeign "IO.closeSocket.v3" boxToEF0
|
||||
$ mkForeignIOF SYS.closeSock
|
||||
|
||||
declareForeign "IO.socketAccept.v2" boxToEFBox
|
||||
declareForeign "IO.socketAccept.v3" boxToEFBox
|
||||
. mkForeignIOF $ fmap fst . SYS.accept
|
||||
|
||||
declareForeign "IO.socketSend.v2" boxBoxToEF0
|
||||
declareForeign "IO.socketSend.v3" boxBoxToEF0
|
||||
. mkForeignIOF $ \(sk,bs) -> SYS.send sk (Bytes.toArray bs)
|
||||
|
||||
declareForeign "IO.socketReceive.v2" boxNatToEFBox
|
||||
declareForeign "IO.socketReceive.v3" boxNatToEFBox
|
||||
. mkForeignIOF $ \(hs,n) ->
|
||||
maybe Bytes.empty Bytes.fromArray <$> SYS.recv hs n
|
||||
|
||||
declareForeign "IO.kill.v2" boxTo0 $ mkForeignIOF killThread
|
||||
declareForeign "IO.kill.v3" boxTo0 $ mkForeignIOF killThread
|
||||
|
||||
declareForeign "IO.delay.v2" natToUnit $ mkForeignIOF threadDelay
|
||||
declareForeign "IO.delay.v3" natToUnit $ mkForeignIOF threadDelay
|
||||
|
||||
declareForeign "IO.stdHandle" standard'handle
|
||||
. mkForeign $ \(n :: Int) -> case n of
|
||||
@ -1439,25 +1443,25 @@ declareForeigns = do
|
||||
declareForeign "MVar.newEmpty.v2" unitDirect
|
||||
. mkForeign $ \() -> newEmptyMVar @Closure
|
||||
|
||||
declareForeign "MVar.take.v2" boxToEFBox
|
||||
declareForeign "MVar.take.v3" boxToEFBox
|
||||
. mkForeignIOF $ \(mv :: MVar Closure) -> takeMVar mv
|
||||
|
||||
declareForeign "MVar.tryTake" boxToMaybeBox
|
||||
. mkForeign $ \(mv :: MVar Closure) -> tryTakeMVar mv
|
||||
|
||||
declareForeign "MVar.put.v2" boxBoxToEF0
|
||||
declareForeign "MVar.put.v3" boxBoxToEF0
|
||||
. mkForeignIOF $ \(mv :: MVar Closure, x) -> putMVar mv x
|
||||
|
||||
declareForeign "MVar.tryPut" boxBoxToEFBool
|
||||
. mkForeign $ \(mv :: MVar Closure, x) -> tryPutMVar mv x
|
||||
|
||||
declareForeign "MVar.swap.v2" boxBoxToEFBox
|
||||
declareForeign "MVar.swap.v3" boxBoxToEFBox
|
||||
. mkForeignIOF $ \(mv :: MVar Closure, x) -> swapMVar mv x
|
||||
|
||||
declareForeign "MVar.isEmpty" boxToBool
|
||||
. mkForeign $ \(mv :: MVar Closure) -> isEmptyMVar mv
|
||||
|
||||
declareForeign "MVar.read.v2" boxBoxToEFBox
|
||||
declareForeign "MVar.read.v3" boxBoxToEFBox
|
||||
. mkForeignIOF $ \(mv :: MVar Closure) -> readMVar mv
|
||||
|
||||
declareForeign "MVar.tryRead" boxToMaybeBox
|
||||
@ -1466,8 +1470,8 @@ declareForeigns = do
|
||||
declareForeign "Text.toUtf8" boxDirect . mkForeign
|
||||
$ pure . Bytes.fromArray . encodeUtf8
|
||||
|
||||
declareForeign "Text.fromUtf8.v2" boxToEFBox . mkForeign
|
||||
$ pure . mapLeft (Failure ioFailureReference . pack . show) . decodeUtf8' . Bytes.toArray
|
||||
declareForeign "Text.fromUtf8.v3" boxToEFBox . mkForeign
|
||||
$ pure . mapLeft (\t -> Failure ioFailureReference (pack ( show t)) unitValue) . decodeUtf8' . Bytes.toArray
|
||||
|
||||
declareForeign "Tls.ClientConfig.default" boxBoxDirect . mkForeign
|
||||
$ \(hostName::Text, serverId:: Bytes.Bytes) ->
|
||||
@ -1546,7 +1550,7 @@ declareForeigns = do
|
||||
\(tls :: TLS.Context,
|
||||
bytes :: Bytes.Bytes) -> TLS.sendData tls (Bytes.toLazyByteString bytes)
|
||||
|
||||
let wrapFailure t = Failure tlsFailureReference (pack t)
|
||||
let wrapFailure t = Failure tlsFailureReference (pack t) unitValue
|
||||
decoded :: Bytes.Bytes -> Either String PEM
|
||||
decoded bytes = fmap head $ pemParseLBS $ Bytes.toLazyByteString bytes
|
||||
asCert :: PEM -> Either String X.SignedCertificate
|
||||
|
@ -106,7 +106,7 @@ data HashAlgorithm where
|
||||
|
||||
newtype Tls = Tls TLS.Context
|
||||
|
||||
data Failure = Failure Reference Text -- todo: Failure a = Failure Reference Text (Any a)
|
||||
data Failure a = Failure Reference Text a
|
||||
|
||||
instance BuiltinForeign HashAlgorithm where foreignRef = Tagged Ty.hashAlgorithmRef
|
||||
|
||||
|
@ -258,13 +258,15 @@ instance (ForeignConvention a, ForeignConvention b)
|
||||
(ustk, bstk) <- writeForeign ustk bstk y
|
||||
writeForeign ustk bstk x
|
||||
|
||||
instance ForeignConvention Failure 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
|
||||
pure (us, bs, Failure typeref message)
|
||||
(us,bs,any) <- readForeign us bs ustk bstk
|
||||
pure (us, bs, Failure typeref message any)
|
||||
|
||||
writeForeign ustk bstk (Failure typeref message) = do
|
||||
writeForeign ustk bstk (Failure typeref message any) = do
|
||||
(ustk, bstk) <- writeForeign ustk bstk any
|
||||
(ustk, bstk) <- writeForeign ustk bstk message
|
||||
writeTypeLink ustk bstk typeref
|
||||
|
||||
|
@ -145,6 +145,10 @@ decomposePattern
|
||||
:: Var v
|
||||
=> Reference -> Int -> Int -> P.Pattern v
|
||||
-> [[P.Pattern v]]
|
||||
decomposePattern rf0 t _ (P.Boolean _ b)
|
||||
| rf0 == Rf.booleanRef
|
||||
, t == if b then 1 else 0
|
||||
= [[]]
|
||||
decomposePattern rf0 t nfields p@(P.Constructor _ rf u ps)
|
||||
| t == u
|
||||
, rf0 == rf
|
||||
|
@ -1747,6 +1747,10 @@ abilityCheck' ambient0 requested0 = go ambient0 requested0 where
|
||||
Just amb -> do
|
||||
subtype amb r `orElse` die1
|
||||
go ambient rs
|
||||
-- Corner case where a unification caused `r` to expand to a
|
||||
-- list of effects. This whole function should be restructured
|
||||
-- such that this can go in a better spot.
|
||||
Nothing | Type.Effects' es <- r -> go ambient (es ++ rs)
|
||||
-- 2b. If no:
|
||||
Nothing -> case r of
|
||||
-- It's an unsolved existential, instantiate it to all of ambient
|
||||
|
@ -15,7 +15,7 @@ import qualified Unison.Test.Codebase.Path as Path
|
||||
import qualified Unison.Test.ColorText as ColorText
|
||||
import qualified Unison.Test.DataDeclaration as DataDeclaration
|
||||
import qualified Unison.Test.FileParser as FileParser
|
||||
import qualified Unison.Test.Git as Git
|
||||
-- import qualified Unison.Test.Git as Git
|
||||
import qualified Unison.Test.Lexer as Lexer
|
||||
import qualified Unison.Test.IO as TestIO
|
||||
import qualified Unison.Test.Range as Range
|
||||
@ -66,7 +66,7 @@ test rt = tests
|
||||
, Typechecker.test
|
||||
, UriParser.test
|
||||
, Context.test
|
||||
, Git.test
|
||||
-- , Git.test
|
||||
, TestIO.test
|
||||
, Name.test
|
||||
, VersionParser.test
|
||||
|
@ -153,7 +153,7 @@ resultTest rt uf filepath = do
|
||||
tm' = Term.letRec' False bindings watchResult
|
||||
-- note . show $ tm'
|
||||
-- note . show $ Term.amap (const ()) tm
|
||||
expect $ tm' == Term.amap (const ()) tm
|
||||
expectEqual tm' (Term.amap (const ()) tm)
|
||||
Left e -> crash $ show e
|
||||
else pure ()
|
||||
|
||||
|
@ -55,6 +55,7 @@ library
|
||||
exposed-modules:
|
||||
Unison.Builtin
|
||||
Unison.Builtin.Decls
|
||||
Unison.Builtin.Terms
|
||||
Unison.Codecs
|
||||
Unison.Codebase
|
||||
Unison.Codebase.Branch
|
||||
|
@ -26,6 +26,12 @@ extra-deps:
|
||||
- sandi-0.5@sha256:b278d072ca717706ea38f9bd646e023f7f2576a778fb43565b434f93638849aa,3010
|
||||
- strings-1.1@sha256:0285dec4c8ab262359342b3e5ef1eb567074669461b9b38404f1cb870c881c5c,1617
|
||||
- ListLike-4.7.3
|
||||
# remove these when stackage upgrades containers
|
||||
- containers-0.6.4.1
|
||||
- text-1.2.4.1
|
||||
- binary-0.8.8.0
|
||||
- parsec-3.1.14.0
|
||||
- Cabal-3.2.1.0
|
||||
|
||||
ghc-options:
|
||||
# All packages
|
||||
|
@ -265,6 +265,9 @@ valueRef = Reference.Builtin "Value"
|
||||
anyRef :: Reference
|
||||
anyRef = Reference.Builtin "Any"
|
||||
|
||||
any :: Ord v => a -> Type v a
|
||||
any a = ref a anyRef
|
||||
|
||||
builtin :: Ord v => a -> Text -> Type v a
|
||||
builtin a = ref a . Reference.Builtin
|
||||
|
||||
|
@ -72,7 +72,7 @@ autoCleaned.handler _ =
|
||||
Left _ -> handle k dir with go dirs
|
||||
|
||||
{ TempDirs.removeDir dir -> k } ->
|
||||
handle k (removeDirectory dir) with go (filter (d -> not (d == dir)) dirs)
|
||||
handle k (removeDirectory dir) with go (filter (d -> not (d == dir)) dirs)
|
||||
|
||||
go []
|
||||
|
||||
@ -134,7 +134,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO, TempDirs} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
```
|
||||
|
||||
@ -157,13 +157,13 @@ testAutoClean _ =
|
||||
dir
|
||||
|
||||
match evalTest go with
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
(results, Right dir) ->
|
||||
match isDirectory dir with
|
||||
Right b -> if b
|
||||
then results :+ (Fail "our temporary directory should no longer exist")
|
||||
else results :+ (Ok "our temporary directory should no longer exist")
|
||||
Left (Failure _ t) -> results :+ (Fail t)
|
||||
Left (Failure _ t _) -> results :+ (Fail t)
|
||||
```
|
||||
|
||||
```ucm
|
||||
@ -249,18 +249,19 @@ testSeek : '{io2.IO} [Result]
|
||||
testSeek _ =
|
||||
test = 'let
|
||||
tempDir = toException (newTempDir "seek")
|
||||
emit (Ok "seeked")
|
||||
fooFile = tempDir ++ "/foo"
|
||||
handle1 = toException (openFile fooFile FileMode.Write)
|
||||
handle1 = toException (openFile fooFile FileMode.Append)
|
||||
putBytes handle1 (toUtf8 "12345678")
|
||||
closeFile handle1
|
||||
|
||||
handle3 = toException (openFile fooFile FileMode.Read)
|
||||
check "readable file should be seekable" (toException (isSeekable handle3))
|
||||
check "shouldn't be the EOF" (not (toException (isFileEOF handle3)))
|
||||
expectU "we should be at position 0" +0 (toException (handlePosition handle3))
|
||||
expectU "we should be at position 0" 0 (toException (handlePosition handle3))
|
||||
|
||||
toException (seekHandle handle3 AbsoluteSeek +1)
|
||||
expectU "we should be at position 1" +1 (toException (handlePosition handle3))
|
||||
expectU "we should be at position 1" 1 (toException (handlePosition handle3))
|
||||
bytes3a = toException (getBytes handle3 1000)
|
||||
text3a = toException (Text.fromUtf8 bytes3a)
|
||||
expectU "should be able to read our temporary file after seeking" "2345678" text3a
|
||||
@ -272,25 +273,24 @@ testAppend : '{io2.IO} [Result]
|
||||
testAppend _ =
|
||||
test = 'let
|
||||
tempDir = toException (newTempDir "openFile")
|
||||
|
||||
fooFile = tempDir ++ "/foo"
|
||||
handle1 = toException (openFile fooFile FileMode.Write)
|
||||
putBytes handle1 (toUtf8 "test1")
|
||||
closeFile handle1
|
||||
toException (putBytes handle1 (toUtf8 "test1"))
|
||||
toException (closeFile handle1)
|
||||
|
||||
handle2 = toException (openFile fooFile FileMode.Append)
|
||||
putBytes handle2 (toUtf8 "test2")
|
||||
expectU "we should be at position 4" +4 (toException (handlePosition handle2))
|
||||
check "which is the EOF" (toException (isFileEOF handle2))
|
||||
closeFile handle2
|
||||
toException (putBytes handle2 (toUtf8 "test2"))
|
||||
toException (closeFile handle2)
|
||||
|
||||
handle3 = toException (openFile fooFile FileMode.Read)
|
||||
bytes3 = toException (getBytes handle3 1000)
|
||||
text3 = toException (Text.fromUtf8 bytes3)
|
||||
|
||||
expectU "should be able to read our temporary file" "test1test2" text3
|
||||
|
||||
closeFile handle3
|
||||
|
||||
|
||||
runTest test
|
||||
```
|
||||
```ucm
|
||||
|
@ -67,7 +67,7 @@ autoCleaned.handler _ =
|
||||
Left _ -> handle k dir with go dirs
|
||||
|
||||
{ TempDirs.removeDir dir -> k } ->
|
||||
handle k (removeDirectory dir) with go (filter (d -> not (d == dir)) dirs)
|
||||
handle k (removeDirectory dir) with go (filter (d -> not (d == dir)) dirs)
|
||||
|
||||
go []
|
||||
|
||||
@ -129,7 +129,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO, TempDirs} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
```
|
||||
|
||||
@ -148,13 +148,13 @@ testAutoClean _ =
|
||||
dir
|
||||
|
||||
match evalTest go with
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
(results, Right dir) ->
|
||||
match isDirectory dir with
|
||||
Right b -> if b
|
||||
then results :+ (Fail "our temporary directory should no longer exist")
|
||||
else results :+ (Ok "our temporary directory should no longer exist")
|
||||
Left (Failure _ t) -> results :+ (Fail t)
|
||||
Left (Failure _ t _) -> results :+ (Fail t)
|
||||
```
|
||||
|
||||
```ucm
|
||||
@ -322,18 +322,19 @@ testSeek : '{io2.IO} [Result]
|
||||
testSeek _ =
|
||||
test = 'let
|
||||
tempDir = toException (newTempDir "seek")
|
||||
emit (Ok "seeked")
|
||||
fooFile = tempDir ++ "/foo"
|
||||
handle1 = toException (openFile fooFile FileMode.Write)
|
||||
handle1 = toException (openFile fooFile FileMode.Append)
|
||||
putBytes handle1 (toUtf8 "12345678")
|
||||
closeFile handle1
|
||||
|
||||
handle3 = toException (openFile fooFile FileMode.Read)
|
||||
check "readable file should be seekable" (toException (isSeekable handle3))
|
||||
check "shouldn't be the EOF" (not (toException (isFileEOF handle3)))
|
||||
expectU "we should be at position 0" +0 (toException (handlePosition handle3))
|
||||
expectU "we should be at position 0" 0 (toException (handlePosition handle3))
|
||||
|
||||
toException (seekHandle handle3 AbsoluteSeek +1)
|
||||
expectU "we should be at position 1" +1 (toException (handlePosition handle3))
|
||||
expectU "we should be at position 1" 1 (toException (handlePosition handle3))
|
||||
bytes3a = toException (getBytes handle3 1000)
|
||||
text3a = toException (Text.fromUtf8 bytes3a)
|
||||
expectU "should be able to read our temporary file after seeking" "2345678" text3a
|
||||
@ -345,25 +346,24 @@ testAppend : '{io2.IO} [Result]
|
||||
testAppend _ =
|
||||
test = 'let
|
||||
tempDir = toException (newTempDir "openFile")
|
||||
|
||||
fooFile = tempDir ++ "/foo"
|
||||
handle1 = toException (openFile fooFile FileMode.Write)
|
||||
putBytes handle1 (toUtf8 "test1")
|
||||
closeFile handle1
|
||||
toException (putBytes handle1 (toUtf8 "test1"))
|
||||
toException (closeFile handle1)
|
||||
|
||||
handle2 = toException (openFile fooFile FileMode.Append)
|
||||
putBytes handle2 (toUtf8 "test2")
|
||||
expectU "we should be at position 4" +4 (toException (handlePosition handle2))
|
||||
check "which is the EOF" (toException (isFileEOF handle2))
|
||||
closeFile handle2
|
||||
toException (putBytes handle2 (toUtf8 "test2"))
|
||||
toException (closeFile handle2)
|
||||
|
||||
handle3 = toException (openFile fooFile FileMode.Read)
|
||||
bytes3 = toException (getBytes handle3 1000)
|
||||
text3 = toException (Text.fromUtf8 bytes3)
|
||||
|
||||
expectU "should be able to read our temporary file" "test1test2" text3
|
||||
|
||||
closeFile handle3
|
||||
|
||||
|
||||
runTest test
|
||||
```
|
||||
|
||||
@ -391,10 +391,14 @@ testAppend _ =
|
||||
|
||||
New test results:
|
||||
|
||||
◉ testSeek seeked
|
||||
◉ testSeek readable file should be seekable
|
||||
◉ testSeek shouldn't be the EOF
|
||||
◉ testSeek we should be at position 0
|
||||
◉ testSeek we should be at position 1
|
||||
◉ testSeek should be able to read our temporary file after seeking
|
||||
|
||||
✅ 2 test(s) passing
|
||||
✅ 6 test(s) passing
|
||||
|
||||
Tip: Use view testSeek to view the source of a test.
|
||||
|
||||
@ -402,7 +406,11 @@ testAppend _ =
|
||||
|
||||
New test results:
|
||||
|
||||
😶 No tests available.
|
||||
◉ testAppend should be able to read our temporary file
|
||||
|
||||
✅ 1 test(s) passing
|
||||
|
||||
Tip: Use view testAppend to view the source of a test.
|
||||
|
||||
```
|
||||
### SystemTime
|
||||
|
@ -71,7 +71,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
|
||||
--
|
||||
@ -193,7 +193,7 @@ serverThread portVar toSend = 'let
|
||||
toException (closeSocket sock')
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
clientThread : MVar Nat -> MVar Text -> '{io2.IO}()
|
||||
@ -206,7 +206,7 @@ clientThread portVar resultVar = 'let
|
||||
toException (MVar.put resultVar msg)
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
testTcpConnect : '{io2.IO}[Result]
|
||||
|
@ -65,7 +65,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
|
||||
--
|
||||
@ -216,7 +216,7 @@ serverThread portVar toSend = 'let
|
||||
toException (closeSocket sock')
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
clientThread : MVar Nat -> MVar Text -> '{io2.IO}()
|
||||
@ -229,7 +229,7 @@ clientThread portVar resultVar = 'let
|
||||
toException (MVar.put resultVar msg)
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
testTcpConnect : '{io2.IO}[Result]
|
||||
|
@ -69,7 +69,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
|
||||
--
|
||||
@ -127,7 +127,7 @@ thread1 mv = 'let
|
||||
toException (put mv (increment x))
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ sendingThread toSend mv = 'let
|
||||
toException (put mv (increment toSend))
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ receivingThread recv send = 'let
|
||||
toException (put send (toText recvd))
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
testTwoThreads: '{io2.IO}[Result]
|
||||
|
@ -63,7 +63,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
|
||||
--
|
||||
@ -125,7 +125,7 @@ thread1 mv = 'let
|
||||
toException (put mv (increment x))
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
|
||||
@ -183,7 +183,7 @@ sendingThread toSend mv = 'let
|
||||
toException (put mv (increment toSend))
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ receivingThread recv send = 'let
|
||||
toException (put send (toText recvd))
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch t ()
|
||||
Left (Failure _ t _) -> watch t ()
|
||||
_ -> ()
|
||||
|
||||
testTwoThreads: '{io2.IO}[Result]
|
||||
|
@ -89,7 +89,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
|
||||
--
|
||||
@ -127,7 +127,7 @@ First lets make sure we can load our cert and private key
|
||||
|
||||
```unison
|
||||
test> match (decodeCert (toUtf8 self_signed_cert_pem) with
|
||||
Left (Failure _ t) -> [Fail t]
|
||||
Left (Failure _ t _) -> [Fail t]
|
||||
Right _ -> [Ok "succesfully decoded self_signed_pem"]
|
||||
|
||||
```
|
||||
@ -183,7 +183,7 @@ serverThread portVar toSend = 'let
|
||||
closeSocket sock' |> toException
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch ("error in server: " ++ t) ()
|
||||
Left (Failure _ t _) -> watch ("error in server: " ++ t) ()
|
||||
_ -> watch "server finished" ()
|
||||
|
||||
testClient : Optional SignedCert -> Text -> MVar Nat -> '{io2.IO, Exception Failure} Text
|
||||
@ -239,7 +239,7 @@ testCAReject _ =
|
||||
checkError : Either Failure a -> Result
|
||||
checkError = cases
|
||||
Right _ -> Fail "expected a handshake exception"
|
||||
Left (Failure _ t) ->
|
||||
Left (Failure _ t _) ->
|
||||
if contains "UnknownCa" t && contains "HandshakeFailed" t then Ok "correctly rejected self-signed cert" else
|
||||
Fail ("expected UnknownCa, got: " ++ t)
|
||||
|
||||
@ -263,8 +263,7 @@ testCNReject _ =
|
||||
checkError : Either Failure a -> Result
|
||||
checkError = cases
|
||||
Right _ -> Fail "expected a handshake exception"
|
||||
Left (Failure _ t) ->
|
||||
if contains "NameMismatch" t && contains "HandshakeFailed" t then Ok "correctly rejected self-signed cert" else
|
||||
Left (Failure _ t _) -> if contains "NameMismatch" t && contains "HandshakeFailed" t then Ok "correctly rejected self-signed cert" else
|
||||
Fail ("expected UnknownCa, got: " ++ t)
|
||||
|
||||
test _ =
|
||||
@ -278,11 +277,8 @@ testCNReject _ =
|
||||
|
||||
|
||||
runTest test
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> io.test testConnectSelfSigned
|
||||
|
@ -83,7 +83,7 @@ evalTest a = handle
|
||||
runTest: '{Stream Result, Exception Failure, io2.IO} a -> [Result]
|
||||
runTest t = match evalTest t with
|
||||
(results, Right _) -> results
|
||||
(results, Left (Failure _ t)) -> results :+ (Fail t)
|
||||
(results, Left (Failure _ t _)) -> results :+ (Fail t)
|
||||
|
||||
|
||||
--
|
||||
@ -117,7 +117,7 @@ First lets make sure we can load our cert and private key
|
||||
|
||||
```unison
|
||||
test> match (decodeCert (toUtf8 self_signed_cert_pem) with
|
||||
Left (Failure _ t) -> [Fail t]
|
||||
Left (Failure _ t _) -> [Fail t]
|
||||
Right _ -> [Ok "succesfully decoded self_signed_pem"]
|
||||
|
||||
```
|
||||
@ -130,7 +130,7 @@ test> match (decodeCert (toUtf8 self_signed_cert_pem) with
|
||||
|
||||
⍟ These new definitions are ok to `add`:
|
||||
|
||||
test.ckc3ihvvem (Unison bug, unknown term)
|
||||
test.ko630itb5m (Unison bug, unknown term)
|
||||
|
||||
Now evaluating any watch expressions (lines starting with
|
||||
`>`)... Ctrl+C cancels.
|
||||
@ -191,7 +191,7 @@ serverThread portVar toSend = 'let
|
||||
closeSocket sock' |> toException
|
||||
|
||||
match (toEither go) with
|
||||
Left (Failure _ t) -> watch ("error in server: " ++ t) ()
|
||||
Left (Failure _ t _) -> watch ("error in server: " ++ t) ()
|
||||
_ -> watch "server finished" ()
|
||||
|
||||
testClient : Optional SignedCert -> Text -> MVar Nat -> '{io2.IO, Exception Failure} Text
|
||||
@ -247,7 +247,7 @@ testCAReject _ =
|
||||
checkError : Either Failure a -> Result
|
||||
checkError = cases
|
||||
Right _ -> Fail "expected a handshake exception"
|
||||
Left (Failure _ t) ->
|
||||
Left (Failure _ t _) ->
|
||||
if contains "UnknownCa" t && contains "HandshakeFailed" t then Ok "correctly rejected self-signed cert" else
|
||||
Fail ("expected UnknownCa, got: " ++ t)
|
||||
|
||||
@ -271,8 +271,7 @@ testCNReject _ =
|
||||
checkError : Either Failure a -> Result
|
||||
checkError = cases
|
||||
Right _ -> Fail "expected a handshake exception"
|
||||
Left (Failure _ t) ->
|
||||
if contains "NameMismatch" t && contains "HandshakeFailed" t then Ok "correctly rejected self-signed cert" else
|
||||
Left (Failure _ t _) -> if contains "NameMismatch" t && contains "HandshakeFailed" t then Ok "correctly rejected self-signed cert" else
|
||||
Fail ("expected UnknownCa, got: " ++ t)
|
||||
|
||||
test _ =
|
||||
@ -286,8 +285,6 @@ testCNReject _ =
|
||||
|
||||
|
||||
runTest test
|
||||
|
||||
|
||||
```
|
||||
|
||||
```ucm
|
||||
|
@ -54,6 +54,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 (drop 1 greek_bytes) with
|
||||
Left (Failure _ t) -> t
|
||||
Left (Failure _ t _) -> t
|
||||
|
||||
```
|
||||
|
@ -90,7 +90,7 @@ test> checkRoundTrip greek
|
||||
|
||||
checkRoundTrip : Text -> [Result]
|
||||
greek : Text
|
||||
test.kqfpde2g5a (Unison bug, unknown term)
|
||||
test.nm3cmq1utb (Unison bug, unknown term)
|
||||
|
||||
Now evaluating any watch expressions (lines starting with
|
||||
`>`)... Ctrl+C cancels.
|
||||
@ -108,7 +108,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 (drop 1 greek_bytes) with
|
||||
Left (Failure _ t) -> t
|
||||
Left (Failure _ t _) -> t
|
||||
|
||||
```
|
||||
|
||||
|
10
unison-src/tests/fix1779.u
Normal file
10
unison-src/tests/fix1779.u
Normal file
@ -0,0 +1,10 @@
|
||||
unique ability S a where
|
||||
s : a
|
||||
|
||||
unique type R g = R ('{g} ())
|
||||
|
||||
run : '{S (R g), g} ()
|
||||
run _ = todo ()
|
||||
|
||||
run' : '{S (R {})} ()
|
||||
run' = run
|
@ -19,10 +19,30 @@ pat7 x y = cases
|
||||
(p1, _) | p1 == 9 -> (x + y : Nat, p1)
|
||||
(p1, _) | true -> (0, p1)
|
||||
|
||||
bpat = cases
|
||||
false -> 0
|
||||
true -> 1
|
||||
|
||||
npat = cases
|
||||
0 -> 1
|
||||
_ -> 0
|
||||
|
||||
ipat = cases
|
||||
+1 -> -1
|
||||
-1 -> +1
|
||||
_ -> +0
|
||||
|
||||
> (pat1 0 1 (2, 3),
|
||||
pat2 0 1 "hi",
|
||||
pat3 0 1 (2, 3),
|
||||
pat4 0 1 (2, 3),
|
||||
pat5 0 1 (3, 2),
|
||||
pat6 1 2 (3, 4),
|
||||
pat7 1 2 (20, 10))
|
||||
pat7 1 2 (20, 10),
|
||||
bpat false,
|
||||
bpat true,
|
||||
npat 0,
|
||||
npat 33,
|
||||
ipat +1,
|
||||
ipat -1,
|
||||
ipat -33)
|
||||
|
@ -4,4 +4,11 @@
|
||||
(0, 1, 2),
|
||||
(0, 1, 2),
|
||||
(3, 3),
|
||||
(0, 20))
|
||||
(0, 20),
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
-1,
|
||||
+1,
|
||||
+0)
|
||||
|
@ -128,271 +128,280 @@ Let's try it!
|
||||
108. Int.trailingZeros : Int -> Nat
|
||||
109. Int.truncate0 : Int -> Nat
|
||||
110. Int.xor : Int -> Int -> Int
|
||||
111. unique type Link
|
||||
112. builtin type Link.Term
|
||||
113. Link.Term : Term -> Link
|
||||
114. builtin type Link.Type
|
||||
115. Link.Type : Type -> Link
|
||||
116. builtin type List
|
||||
117. List.++ : [a] -> [a] -> [a]
|
||||
118. List.+: : a -> [a] -> [a]
|
||||
119. List.:+ : [a] -> a -> [a]
|
||||
120. List.at : Nat -> [a] -> Optional a
|
||||
121. List.cons : a -> [a] -> [a]
|
||||
122. List.drop : Nat -> [a] -> [a]
|
||||
123. List.empty : [a]
|
||||
124. List.size : [a] -> Nat
|
||||
125. List.snoc : [a] -> a -> [a]
|
||||
126. List.take : Nat -> [a] -> [a]
|
||||
127. builtin type Nat
|
||||
128. Nat.* : Nat -> Nat -> Nat
|
||||
129. Nat.+ : Nat -> Nat -> Nat
|
||||
130. Nat./ : Nat -> Nat -> Nat
|
||||
131. Nat.and : Nat -> Nat -> Nat
|
||||
132. Nat.complement : Nat -> Nat
|
||||
133. Nat.drop : Nat -> Nat -> Nat
|
||||
134. Nat.eq : Nat -> Nat -> Boolean
|
||||
135. Nat.fromText : Text -> Optional Nat
|
||||
136. Nat.gt : Nat -> Nat -> Boolean
|
||||
137. Nat.gteq : Nat -> Nat -> Boolean
|
||||
138. Nat.increment : Nat -> Nat
|
||||
139. Nat.isEven : Nat -> Boolean
|
||||
140. Nat.isOdd : Nat -> Boolean
|
||||
141. Nat.leadingZeros : Nat -> Nat
|
||||
142. Nat.lt : Nat -> Nat -> Boolean
|
||||
143. Nat.lteq : Nat -> Nat -> Boolean
|
||||
144. Nat.mod : Nat -> Nat -> Nat
|
||||
145. Nat.or : Nat -> Nat -> Nat
|
||||
146. Nat.popCount : Nat -> Nat
|
||||
147. Nat.pow : Nat -> Nat -> Nat
|
||||
148. Nat.shiftLeft : Nat -> Nat -> Nat
|
||||
149. Nat.shiftRight : Nat -> Nat -> Nat
|
||||
150. Nat.sub : Nat -> Nat -> Int
|
||||
151. Nat.toFloat : Nat -> Float
|
||||
152. Nat.toInt : Nat -> Int
|
||||
153. Nat.toText : Nat -> Text
|
||||
154. Nat.trailingZeros : Nat -> Nat
|
||||
155. Nat.xor : Nat -> Nat -> Nat
|
||||
156. type Optional a
|
||||
157. Optional.None : Optional a
|
||||
158. Optional.Some : a -> Optional a
|
||||
159. builtin type Request
|
||||
160. type SeqView a b
|
||||
161. SeqView.VElem : a -> b -> SeqView a b
|
||||
162. SeqView.VEmpty : SeqView a b
|
||||
163. unique type Test.Result
|
||||
164. Test.Result.Fail : Text -> Result
|
||||
165. Test.Result.Ok : Text -> Result
|
||||
166. builtin type Text
|
||||
167. Text.!= : Text -> Text -> Boolean
|
||||
168. Text.++ : Text -> Text -> Text
|
||||
169. Text.drop : Nat -> Text -> Text
|
||||
170. Text.empty : Text
|
||||
171. Text.eq : Text -> Text -> Boolean
|
||||
172. Text.fromCharList : [Char] -> Text
|
||||
173. Text.fromUtf8 : Bytes -> Either Failure Text
|
||||
174. Text.gt : Text -> Text -> Boolean
|
||||
175. Text.gteq : Text -> Text -> Boolean
|
||||
176. Text.lt : Text -> Text -> Boolean
|
||||
177. Text.lteq : Text -> Text -> Boolean
|
||||
178. Text.size : Text -> Nat
|
||||
179. Text.take : Nat -> Text -> Text
|
||||
180. Text.toCharList : Text -> [Char]
|
||||
181. Text.toUtf8 : Text -> Bytes
|
||||
182. Text.uncons : Text -> Optional (Char, Text)
|
||||
183. Text.unsnoc : Text -> Optional (Text, Char)
|
||||
184. type Tuple a b
|
||||
185. Tuple.Cons : a -> b -> Tuple a b
|
||||
186. type Unit
|
||||
187. Unit.Unit : ()
|
||||
188. Universal.< : a -> a -> Boolean
|
||||
189. Universal.<= : a -> a -> Boolean
|
||||
190. Universal.== : a -> a -> Boolean
|
||||
191. Universal.> : a -> a -> Boolean
|
||||
192. Universal.>= : a -> a -> Boolean
|
||||
193. Universal.compare : a -> a -> Int
|
||||
194. builtin type Value
|
||||
195. Value.dependencies : Value -> [Term]
|
||||
196. Value.deserialize : Bytes -> Either Text Value
|
||||
197. Value.load : Value ->{IO} Either [Term] a
|
||||
198. Value.serialize : Value -> Bytes
|
||||
199. Value.value : a -> Value
|
||||
200. bug : a -> b
|
||||
201. builtin type crypto.HashAlgorithm
|
||||
202. crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm
|
||||
203. crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm
|
||||
204. crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm
|
||||
205. crypto.HashAlgorithm.Sha2_256 : HashAlgorithm
|
||||
206. crypto.HashAlgorithm.Sha2_512 : HashAlgorithm
|
||||
207. crypto.HashAlgorithm.Sha3_256 : HashAlgorithm
|
||||
208. crypto.HashAlgorithm.Sha3_512 : HashAlgorithm
|
||||
209. crypto.hash : HashAlgorithm -> a -> Bytes
|
||||
210. crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes
|
||||
211. crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes
|
||||
212. crypto.hmacBytes : HashAlgorithm
|
||||
111. unique type IsPropagated
|
||||
112. IsPropagated.IsPropagated : IsPropagated
|
||||
113. unique type IsTest
|
||||
114. IsTest.IsTest : IsTest
|
||||
115. unique type Link
|
||||
116. builtin type Link.Term
|
||||
117. Link.Term : Term -> Link
|
||||
118. builtin type Link.Type
|
||||
119. Link.Type : Type -> Link
|
||||
120. builtin type List
|
||||
121. List.++ : [a] -> [a] -> [a]
|
||||
122. List.+: : a -> [a] -> [a]
|
||||
123. List.:+ : [a] -> a -> [a]
|
||||
124. List.at : Nat -> [a] -> Optional a
|
||||
125. List.cons : a -> [a] -> [a]
|
||||
126. List.drop : Nat -> [a] -> [a]
|
||||
127. List.empty : [a]
|
||||
128. List.size : [a] -> Nat
|
||||
129. List.snoc : [a] -> a -> [a]
|
||||
130. List.take : Nat -> [a] -> [a]
|
||||
131. builtin type Nat
|
||||
132. Nat.* : Nat -> Nat -> Nat
|
||||
133. Nat.+ : Nat -> Nat -> Nat
|
||||
134. Nat./ : Nat -> Nat -> Nat
|
||||
135. Nat.and : Nat -> Nat -> Nat
|
||||
136. Nat.complement : Nat -> Nat
|
||||
137. Nat.drop : Nat -> Nat -> Nat
|
||||
138. Nat.eq : Nat -> Nat -> Boolean
|
||||
139. Nat.fromText : Text -> Optional Nat
|
||||
140. Nat.gt : Nat -> Nat -> Boolean
|
||||
141. Nat.gteq : Nat -> Nat -> Boolean
|
||||
142. Nat.increment : Nat -> Nat
|
||||
143. Nat.isEven : Nat -> Boolean
|
||||
144. Nat.isOdd : Nat -> Boolean
|
||||
145. Nat.leadingZeros : Nat -> Nat
|
||||
146. Nat.lt : Nat -> Nat -> Boolean
|
||||
147. Nat.lteq : Nat -> Nat -> Boolean
|
||||
148. Nat.mod : Nat -> Nat -> Nat
|
||||
149. Nat.or : Nat -> Nat -> Nat
|
||||
150. Nat.popCount : Nat -> Nat
|
||||
151. Nat.pow : Nat -> Nat -> Nat
|
||||
152. Nat.shiftLeft : Nat -> Nat -> Nat
|
||||
153. Nat.shiftRight : Nat -> Nat -> Nat
|
||||
154. Nat.sub : Nat -> Nat -> Int
|
||||
155. Nat.toFloat : Nat -> Float
|
||||
156. Nat.toInt : Nat -> Int
|
||||
157. Nat.toText : Nat -> Text
|
||||
158. Nat.trailingZeros : Nat -> Nat
|
||||
159. Nat.xor : Nat -> Nat -> Nat
|
||||
160. type Optional a
|
||||
161. Optional.None : Optional a
|
||||
162. Optional.Some : a -> Optional a
|
||||
163. builtin type Request
|
||||
164. type SeqView a b
|
||||
165. SeqView.VElem : a -> b -> SeqView a b
|
||||
166. SeqView.VEmpty : SeqView a b
|
||||
167. unique type Test.Result
|
||||
168. Test.Result.Fail : Text -> Result
|
||||
169. Test.Result.Ok : Text -> Result
|
||||
170. builtin type Text
|
||||
171. Text.!= : Text -> Text -> Boolean
|
||||
172. Text.++ : Text -> Text -> Text
|
||||
173. Text.drop : Nat -> Text -> Text
|
||||
174. Text.empty : Text
|
||||
175. Text.eq : Text -> Text -> Boolean
|
||||
176. Text.fromCharList : [Char] -> Text
|
||||
177. Text.fromUtf8 : Bytes -> Either Failure Text
|
||||
178. Text.gt : Text -> Text -> Boolean
|
||||
179. Text.gteq : Text -> Text -> Boolean
|
||||
180. Text.lt : Text -> Text -> Boolean
|
||||
181. Text.lteq : Text -> Text -> Boolean
|
||||
182. Text.size : Text -> Nat
|
||||
183. Text.take : Nat -> Text -> Text
|
||||
184. Text.toCharList : Text -> [Char]
|
||||
185. Text.toUtf8 : Text -> Bytes
|
||||
186. Text.uncons : Text -> Optional (Char, Text)
|
||||
187. Text.unsnoc : Text -> Optional (Text, Char)
|
||||
188. type Tuple a b
|
||||
189. Tuple.Cons : a -> b -> Tuple a b
|
||||
190. type Unit
|
||||
191. Unit.Unit : ()
|
||||
192. Universal.< : a -> a -> Boolean
|
||||
193. Universal.<= : a -> a -> Boolean
|
||||
194. Universal.== : a -> a -> Boolean
|
||||
195. Universal.> : a -> a -> Boolean
|
||||
196. Universal.>= : a -> a -> Boolean
|
||||
197. Universal.compare : a -> a -> Int
|
||||
198. builtin type Value
|
||||
199. Value.dependencies : Value -> [Term]
|
||||
200. Value.deserialize : Bytes -> Either Text Value
|
||||
201. Value.load : Value ->{IO} Either [Term] a
|
||||
202. Value.serialize : Value -> Bytes
|
||||
203. Value.value : a -> Value
|
||||
204. bug : a -> b
|
||||
205. builtin type crypto.HashAlgorithm
|
||||
206. crypto.HashAlgorithm.Blake2b_256 : HashAlgorithm
|
||||
207. crypto.HashAlgorithm.Blake2b_512 : HashAlgorithm
|
||||
208. crypto.HashAlgorithm.Blake2s_256 : HashAlgorithm
|
||||
209. crypto.HashAlgorithm.Sha2_256 : HashAlgorithm
|
||||
210. crypto.HashAlgorithm.Sha2_512 : HashAlgorithm
|
||||
211. crypto.HashAlgorithm.Sha3_256 : HashAlgorithm
|
||||
212. crypto.HashAlgorithm.Sha3_512 : HashAlgorithm
|
||||
213. crypto.hash : HashAlgorithm -> a -> Bytes
|
||||
214. crypto.hashBytes : HashAlgorithm -> Bytes -> Bytes
|
||||
215. crypto.hmac : HashAlgorithm -> Bytes -> a -> Bytes
|
||||
216. crypto.hmacBytes : HashAlgorithm
|
||||
-> Bytes
|
||||
-> Bytes
|
||||
-> Bytes
|
||||
213. unique type io2.BufferMode
|
||||
214. io2.BufferMode.BlockBuffering : BufferMode
|
||||
215. io2.BufferMode.LineBuffering : BufferMode
|
||||
216. io2.BufferMode.NoBuffering : BufferMode
|
||||
217. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode
|
||||
218. unique type io2.Failure
|
||||
219. io2.Failure.Failure : Type -> Text -> Failure
|
||||
220. unique type io2.FileMode
|
||||
221. io2.FileMode.Append : FileMode
|
||||
222. io2.FileMode.Read : FileMode
|
||||
223. io2.FileMode.ReadWrite : FileMode
|
||||
224. io2.FileMode.Write : FileMode
|
||||
225. builtin type io2.Handle
|
||||
226. builtin type io2.IO
|
||||
227. io2.IO.clientSocket : Text
|
||||
217. unique type io2.BufferMode
|
||||
218. io2.BufferMode.BlockBuffering : BufferMode
|
||||
219. io2.BufferMode.LineBuffering : BufferMode
|
||||
220. io2.BufferMode.NoBuffering : BufferMode
|
||||
221. io2.BufferMode.SizedBlockBuffering : Nat -> BufferMode
|
||||
222. unique type io2.Failure
|
||||
223. io2.Failure.Failure : Type -> Text -> Any -> Failure
|
||||
224. unique type io2.FileMode
|
||||
225. io2.FileMode.Append : FileMode
|
||||
226. io2.FileMode.Read : FileMode
|
||||
227. io2.FileMode.ReadWrite : FileMode
|
||||
228. io2.FileMode.Write : FileMode
|
||||
229. builtin type io2.Handle
|
||||
230. builtin type io2.IO
|
||||
231. io2.IO.clientSocket : Text
|
||||
-> Text
|
||||
->{IO} Either Failure Socket
|
||||
228. io2.IO.closeFile : Handle ->{IO} Either Failure ()
|
||||
229. io2.IO.closeSocket : Socket ->{IO} Either Failure ()
|
||||
230. io2.IO.createDirectory : Text ->{IO} Either Failure ()
|
||||
231. io2.IO.createTempDirectory : Text
|
||||
232. io2.IO.closeFile : Handle ->{IO} Either Failure ()
|
||||
233. io2.IO.closeSocket : Socket ->{IO} Either Failure ()
|
||||
234. io2.IO.createDirectory : Text ->{IO} Either Failure ()
|
||||
235. io2.IO.createTempDirectory : Text
|
||||
->{IO} Either Failure Text
|
||||
232. io2.IO.delay : Nat ->{IO} Either Failure ()
|
||||
233. io2.IO.fileExists : Text ->{IO} Either Failure Boolean
|
||||
234. io2.IO.forkComp : '{IO} a ->{IO} ThreadId
|
||||
235. io2.IO.getBuffering : Handle
|
||||
236. io2.IO.delay : Nat ->{IO} Either Failure ()
|
||||
237. io2.IO.fileExists : Text ->{IO} Either Failure Boolean
|
||||
238. io2.IO.forkComp : '{IO} a ->{IO} ThreadId
|
||||
239. io2.IO.getBuffering : Handle
|
||||
->{IO} Either Failure BufferMode
|
||||
236. io2.IO.getBytes : Handle
|
||||
240. io2.IO.getBytes : Handle
|
||||
-> Nat
|
||||
->{IO} Either Failure Bytes
|
||||
237. io2.IO.getCurrentDirectory : '{IO} Either Failure Text
|
||||
238. io2.IO.getFileSize : Text ->{IO} Either Failure Nat
|
||||
239. io2.IO.getFileTimestamp : Text ->{IO} Either Failure Nat
|
||||
240. io2.IO.getTempDirectory : '{IO} Either Failure Text
|
||||
241. io2.IO.handlePosition : Handle ->{IO} Either Failure Int
|
||||
242. io2.IO.isDirectory : Text ->{IO} Either Failure Boolean
|
||||
243. io2.IO.isFileEOF : Handle ->{IO} Either Failure Boolean
|
||||
244. io2.IO.isFileOpen : Handle ->{IO} Either Failure Boolean
|
||||
245. io2.IO.isSeekable : Handle ->{IO} Either Failure Boolean
|
||||
246. io2.IO.kill : ThreadId ->{IO} Either Failure ()
|
||||
247. io2.IO.listen : Socket ->{IO} Either Failure ()
|
||||
248. io2.IO.openFile : Text
|
||||
241. io2.IO.getCurrentDirectory : '{IO} Either Failure Text
|
||||
242. io2.IO.getFileSize : Text ->{IO} Either Failure Nat
|
||||
243. io2.IO.getFileTimestamp : Text ->{IO} Either Failure Nat
|
||||
244. io2.IO.getTempDirectory : '{IO} Either Failure Text
|
||||
245. io2.IO.handlePosition : Handle ->{IO} Either Failure Nat
|
||||
246. io2.IO.isDirectory : Text ->{IO} Either Failure Boolean
|
||||
247. io2.IO.isFileEOF : Handle ->{IO} Either Failure Boolean
|
||||
248. io2.IO.isFileOpen : Handle ->{IO} Either Failure Boolean
|
||||
249. io2.IO.isSeekable : Handle ->{IO} Either Failure Boolean
|
||||
250. io2.IO.kill : ThreadId ->{IO} Either Failure ()
|
||||
251. io2.IO.listen : Socket ->{IO} Either Failure ()
|
||||
252. io2.IO.openFile : Text
|
||||
-> FileMode
|
||||
->{IO} Either Failure Handle
|
||||
249. io2.IO.putBytes : Handle
|
||||
253. io2.IO.putBytes : Handle
|
||||
-> Bytes
|
||||
->{IO} Either Failure ()
|
||||
250. io2.IO.removeDirectory : Text ->{IO} Either Failure ()
|
||||
251. io2.IO.removeFile : Text ->{IO} Either Failure ()
|
||||
252. io2.IO.renameDirectory : Text
|
||||
254. io2.IO.removeDirectory : Text ->{IO} Either Failure ()
|
||||
255. io2.IO.removeFile : Text ->{IO} Either Failure ()
|
||||
256. io2.IO.renameDirectory : Text
|
||||
-> Text
|
||||
->{IO} Either Failure ()
|
||||
253. io2.IO.renameFile : Text -> Text ->{IO} Either Failure ()
|
||||
254. io2.IO.seekHandle : Handle
|
||||
257. io2.IO.renameFile : Text -> Text ->{IO} Either Failure ()
|
||||
258. io2.IO.seekHandle : Handle
|
||||
-> SeekMode
|
||||
-> Int
|
||||
->{IO} Either Failure ()
|
||||
255. io2.IO.serverSocket : Optional Text
|
||||
259. io2.IO.serverSocket : Optional Text
|
||||
-> Text
|
||||
->{IO} Either Failure Socket
|
||||
256. io2.IO.setBuffering : Handle
|
||||
260. io2.IO.setBuffering : Handle
|
||||
-> BufferMode
|
||||
->{IO} Either Failure ()
|
||||
257. io2.IO.setCurrentDirectory : Text
|
||||
261. io2.IO.setCurrentDirectory : Text
|
||||
->{IO} Either Failure ()
|
||||
258. io2.IO.socketAccept : Socket ->{IO} Either Failure Socket
|
||||
259. io2.IO.socketPort : Socket ->{IO} Either Failure Nat
|
||||
260. io2.IO.socketReceive : Socket
|
||||
262. io2.IO.socketAccept : Socket ->{IO} Either Failure Socket
|
||||
263. io2.IO.socketPort : Socket ->{IO} Either Failure Nat
|
||||
264. io2.IO.socketReceive : Socket
|
||||
-> Nat
|
||||
->{IO} Either Failure Bytes
|
||||
261. io2.IO.socketSend : Socket
|
||||
265. io2.IO.socketSend : Socket
|
||||
-> Bytes
|
||||
->{IO} Either Failure ()
|
||||
262. io2.IO.stdHandle : StdHandle -> Handle
|
||||
263. io2.IO.systemTime : '{IO} Either Failure Nat
|
||||
264. unique type io2.IOError
|
||||
265. io2.IOError.AlreadyExists : IOError
|
||||
266. io2.IOError.EOF : IOError
|
||||
267. io2.IOError.IllegalOperation : IOError
|
||||
268. io2.IOError.NoSuchThing : IOError
|
||||
269. io2.IOError.PermissionDenied : IOError
|
||||
270. io2.IOError.ResourceBusy : IOError
|
||||
271. io2.IOError.ResourceExhausted : IOError
|
||||
272. io2.IOError.UserError : IOError
|
||||
273. builtin type io2.MVar
|
||||
274. io2.MVar.isEmpty : MVar a ->{IO} Boolean
|
||||
275. io2.MVar.new : a ->{IO} MVar a
|
||||
276. io2.MVar.newEmpty : '{IO} MVar a
|
||||
277. io2.MVar.put : MVar a -> a ->{IO} Either Failure ()
|
||||
278. io2.MVar.read : MVar a ->{IO} Either Failure a
|
||||
279. io2.MVar.swap : MVar a -> a ->{IO} Either Failure a
|
||||
280. io2.MVar.take : MVar a ->{IO} Either Failure a
|
||||
281. io2.MVar.tryPut : MVar a -> a ->{IO} Boolean
|
||||
282. io2.MVar.tryRead : MVar a ->{IO} Optional a
|
||||
283. io2.MVar.tryTake : MVar a ->{IO} Optional a
|
||||
284. builtin type io2.STM
|
||||
285. io2.STM.atomically : '{STM} a ->{IO} a
|
||||
286. io2.STM.retry : '{STM} a
|
||||
287. unique type io2.SeekMode
|
||||
288. io2.SeekMode.AbsoluteSeek : SeekMode
|
||||
289. io2.SeekMode.RelativeSeek : SeekMode
|
||||
290. io2.SeekMode.SeekFromEnd : SeekMode
|
||||
291. builtin type io2.Socket
|
||||
292. unique type io2.StdHandle
|
||||
293. io2.StdHandle.StdErr : StdHandle
|
||||
294. io2.StdHandle.StdIn : StdHandle
|
||||
295. io2.StdHandle.StdOut : StdHandle
|
||||
296. builtin type io2.TVar
|
||||
297. io2.TVar.new : a ->{STM} TVar a
|
||||
298. io2.TVar.newIO : a ->{IO} TVar a
|
||||
299. io2.TVar.read : TVar a ->{STM} a
|
||||
300. io2.TVar.readIO : TVar a ->{IO} a
|
||||
301. io2.TVar.swap : TVar a -> a ->{STM} a
|
||||
302. io2.TVar.write : TVar a -> a ->{STM} ()
|
||||
303. builtin type io2.ThreadId
|
||||
304. builtin type io2.Tls
|
||||
305. builtin type io2.Tls.ClientConfig
|
||||
306. io2.Tls.ClientConfig.certificates.set : [SignedCert]
|
||||
266. io2.IO.stdHandle : StdHandle -> Handle
|
||||
267. io2.IO.systemTime : '{IO} Either Failure Nat
|
||||
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. builtin type io2.IOFailure##IOFailure
|
||||
278. unique type io2.IOFailure#gro
|
||||
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 : MVar a -> a ->{IO} Either Failure ()
|
||||
284. io2.MVar.read : MVar a ->{IO} Either Failure a
|
||||
285. io2.MVar.swap : MVar a -> a ->{IO} Either Failure a
|
||||
286. io2.MVar.take : MVar a ->{IO} Either Failure a
|
||||
287. io2.MVar.tryPut : MVar a -> a ->{IO} Boolean
|
||||
288. io2.MVar.tryRead : MVar a ->{IO} Optional a
|
||||
289. io2.MVar.tryTake : MVar a ->{IO} Optional a
|
||||
290. builtin type io2.STM
|
||||
291. io2.STM.atomically : '{STM} a ->{IO} a
|
||||
292. io2.STM.retry : '{STM} a
|
||||
293. unique type io2.SeekMode
|
||||
294. io2.SeekMode.AbsoluteSeek : SeekMode
|
||||
295. io2.SeekMode.RelativeSeek : SeekMode
|
||||
296. io2.SeekMode.SeekFromEnd : SeekMode
|
||||
297. builtin type io2.Socket
|
||||
298. unique type io2.StdHandle
|
||||
299. io2.StdHandle.StdErr : StdHandle
|
||||
300. io2.StdHandle.StdIn : StdHandle
|
||||
301. io2.StdHandle.StdOut : StdHandle
|
||||
302. io2.TLS.ClientConfig.ciphers.set : [##Tls.Cipher]
|
||||
-> ClientConfig
|
||||
-> ClientConfig
|
||||
303. builtin type io2.TVar
|
||||
304. io2.TVar.new : a ->{STM} TVar a
|
||||
305. io2.TVar.newIO : a ->{IO} TVar a
|
||||
306. io2.TVar.read : TVar a ->{STM} a
|
||||
307. io2.TVar.readIO : TVar a ->{IO} a
|
||||
308. io2.TVar.swap : TVar a -> a ->{STM} a
|
||||
309. io2.TVar.write : TVar a -> a ->{STM} ()
|
||||
310. builtin type io2.ThreadId
|
||||
311. builtin type io2.Tls
|
||||
312. builtin type io2.Tls.ClientConfig
|
||||
313. io2.Tls.ClientConfig.certificates.set : [SignedCert]
|
||||
-> ClientConfig
|
||||
-> ClientConfig
|
||||
307. io2.Tls.ClientConfig.default : Text
|
||||
314. io2.Tls.ClientConfig.default : Text
|
||||
-> Bytes
|
||||
-> ClientConfig
|
||||
308. builtin type io2.Tls.PrivateKey
|
||||
309. builtin type io2.Tls.ServerConfig
|
||||
310. io2.Tls.ServerConfig.certificates.set : [SignedCert]
|
||||
315. io2.Tls.ClientConfig.versions.set : [##Tls.Version]
|
||||
-> ClientConfig
|
||||
-> ClientConfig
|
||||
316. builtin type io2.Tls.PrivateKey
|
||||
317. builtin type io2.Tls.ServerConfig
|
||||
318. io2.Tls.ServerConfig.certificates.set : [SignedCert]
|
||||
-> ServerConfig
|
||||
-> ServerConfig
|
||||
311. io2.Tls.ServerConfig.default : [SignedCert]
|
||||
319. io2.Tls.ServerConfig.ciphers.set : [##Tls.Cipher]
|
||||
-> ServerConfig
|
||||
-> ServerConfig
|
||||
320. io2.Tls.ServerConfig.default : [SignedCert]
|
||||
-> PrivateKey
|
||||
-> ServerConfig
|
||||
312. builtin type io2.Tls.SignedCert
|
||||
313. io2.Tls.decodeCert : Bytes -> Either Failure SignedCert
|
||||
314. io2.Tls.decodePrivateKey : Bytes -> [PrivateKey]
|
||||
315. io2.Tls.encodeCert : SignedCert -> Bytes
|
||||
316. io2.Tls.encodePrivateKey : PrivateKey -> Bytes
|
||||
317. io2.Tls.handshake : Tls ->{IO} Either Failure ()
|
||||
318. io2.Tls.newClient : ClientConfig
|
||||
-> Socket
|
||||
->{IO} Either Failure Tls
|
||||
319. io2.Tls.newServer : ServerConfig
|
||||
-> Socket
|
||||
->{IO} Either Failure Tls
|
||||
320. io2.Tls.receive : Tls ->{IO} Either Failure Bytes
|
||||
321. io2.Tls.send : Tls -> Bytes ->{IO} Either Failure ()
|
||||
322. io2.Tls.terminate : Tls ->{IO} Either Failure ()
|
||||
323. unique type io2.TlsFailure
|
||||
324. io2.tls.ClientConfig.ciphers.set : [##Tls.Cipher]
|
||||
-> ClientConfig
|
||||
-> ClientConfig
|
||||
325. io2.tls.ClientConfig.versions.set : [##Tls.Version]
|
||||
-> ClientConfig
|
||||
-> ClientConfig
|
||||
326. io2.tls.ServerConfig.ciphers.set : [##Tls.Cipher]
|
||||
-> ServerConfig
|
||||
-> ServerConfig
|
||||
327. io2.tls.ServerConfig.versions.set : [##Tls.Version]
|
||||
321. io2.Tls.ServerConfig.versions.set : [##Tls.Version]
|
||||
-> ServerConfig
|
||||
-> ServerConfig
|
||||
328. todo : a -> b
|
||||
322. builtin type io2.Tls.SignedCert
|
||||
323. io2.Tls.decodeCert : 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 : Tls ->{IO} Either Failure ()
|
||||
328. io2.Tls.newClient : ClientConfig
|
||||
-> Socket
|
||||
->{IO} Either Failure Tls
|
||||
329. io2.Tls.newServer : ServerConfig
|
||||
-> Socket
|
||||
->{IO} Either Failure Tls
|
||||
330. io2.Tls.receive : Tls ->{IO} Either Failure Bytes
|
||||
331. io2.Tls.send : Tls -> Bytes ->{IO} Either Failure ()
|
||||
332. io2.Tls.terminate : Tls ->{IO} Either Failure ()
|
||||
333. builtin type io2.TlsFailure##TlsFailure
|
||||
334. unique type io2.TlsFailure#o6b
|
||||
335. metadata.isPropagated : IsPropagated
|
||||
336. metadata.isTest : IsTest
|
||||
337. todo : a -> b
|
||||
|
||||
|
||||
.builtin> alias.many 94-104 .mylib
|
||||
|
@ -9,49 +9,54 @@ The `builtins.merge` command adds the known builtins to a `builtin` subnamespace
|
||||
|
||||
.tmp> ls builtin
|
||||
|
||||
1. Any (builtin type)
|
||||
2. Any/ (1 definition)
|
||||
3. Boolean (builtin type)
|
||||
4. Boolean/ (1 definition)
|
||||
5. Bytes (builtin type)
|
||||
6. Bytes/ (17 definitions)
|
||||
7. Char (builtin type)
|
||||
8. Char/ (2 definitions)
|
||||
9. Code (builtin type)
|
||||
10. Code/ (6 definitions)
|
||||
11. Debug/ (1 definition)
|
||||
12. Doc (type)
|
||||
13. Doc/ (6 definitions)
|
||||
14. Either (type)
|
||||
15. Either/ (2 definitions)
|
||||
16. Float (builtin type)
|
||||
17. Float/ (36 definitions)
|
||||
18. Int (builtin type)
|
||||
19. Int/ (29 definitions)
|
||||
20. Link (type)
|
||||
21. Link/ (4 definitions)
|
||||
22. List (builtin type)
|
||||
23. List/ (10 definitions)
|
||||
24. Nat (builtin type)
|
||||
25. Nat/ (28 definitions)
|
||||
26. Optional (type)
|
||||
27. Optional/ (2 definitions)
|
||||
28. Request (builtin type)
|
||||
29. SeqView (type)
|
||||
30. SeqView/ (2 definitions)
|
||||
31. Test/ (3 definitions)
|
||||
32. Text (builtin type)
|
||||
33. Text/ (17 definitions)
|
||||
34. Tuple (type)
|
||||
35. Tuple/ (1 definition)
|
||||
36. Unit (type)
|
||||
37. Unit/ (1 definition)
|
||||
38. Universal/ (6 definitions)
|
||||
39. Value (builtin type)
|
||||
40. Value/ (5 definitions)
|
||||
41. bug (a -> b)
|
||||
42. crypto/ (12 definitions)
|
||||
43. io2/ (115 definitions)
|
||||
44. todo (a -> b)
|
||||
1. Any (builtin type)
|
||||
2. Any/ (1 definition)
|
||||
3. Boolean (builtin type)
|
||||
4. Boolean/ (1 definition)
|
||||
5. Bytes (builtin type)
|
||||
6. Bytes/ (17 definitions)
|
||||
7. Char (builtin type)
|
||||
8. Char/ (2 definitions)
|
||||
9. Code (builtin type)
|
||||
10. Code/ (6 definitions)
|
||||
11. Debug/ (1 definition)
|
||||
12. Doc (type)
|
||||
13. Doc/ (6 definitions)
|
||||
14. Either (type)
|
||||
15. Either/ (2 definitions)
|
||||
16. Float (builtin type)
|
||||
17. Float/ (36 definitions)
|
||||
18. Int (builtin type)
|
||||
19. Int/ (29 definitions)
|
||||
20. IsPropagated (type)
|
||||
21. IsPropagated/ (1 definition)
|
||||
22. IsTest (type)
|
||||
23. IsTest/ (1 definition)
|
||||
24. Link (type)
|
||||
25. Link/ (4 definitions)
|
||||
26. List (builtin type)
|
||||
27. List/ (10 definitions)
|
||||
28. Nat (builtin type)
|
||||
29. Nat/ (28 definitions)
|
||||
30. Optional (type)
|
||||
31. Optional/ (2 definitions)
|
||||
32. Request (builtin type)
|
||||
33. SeqView (type)
|
||||
34. SeqView/ (2 definitions)
|
||||
35. Test/ (3 definitions)
|
||||
36. Text (builtin type)
|
||||
37. Text/ (17 definitions)
|
||||
38. Tuple (type)
|
||||
39. Tuple/ (1 definition)
|
||||
40. Unit (type)
|
||||
41. Unit/ (1 definition)
|
||||
42. Universal/ (6 definitions)
|
||||
43. Value (builtin type)
|
||||
44. Value/ (5 definitions)
|
||||
45. bug (a -> b)
|
||||
46. crypto/ (12 definitions)
|
||||
47. io2/ (118 definitions)
|
||||
48. metadata/ (2 definitions)
|
||||
49. todo (a -> b)
|
||||
|
||||
```
|
||||
|
@ -44,3 +44,22 @@ type Foo = Foo | Bar
|
||||
.> view.patch
|
||||
```
|
||||
|
||||
```unison
|
||||
bar = 3
|
||||
type bar = Foo
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
|
||||
```unison
|
||||
type bar = Foo | Bar
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
.> view.patch
|
||||
.> delete.type-replacement bar
|
||||
.> view.patch
|
||||
```
|
||||
|
@ -130,3 +130,75 @@ type Foo = Foo | Bar
|
||||
This patch is empty.
|
||||
|
||||
```
|
||||
```unison
|
||||
bar = 3
|
||||
type bar = Foo
|
||||
```
|
||||
|
||||
```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`:
|
||||
|
||||
type bar
|
||||
bar : ##Nat
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
type bar
|
||||
bar : ##Nat
|
||||
|
||||
```
|
||||
```unison
|
||||
type bar = Foo | Bar
|
||||
```
|
||||
|
||||
```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 names already exist. You can `update` them to your
|
||||
new definition:
|
||||
|
||||
type bar
|
||||
(also named Foo)
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> update
|
||||
|
||||
⍟ I've updated these names to your new definition:
|
||||
|
||||
type bar
|
||||
(also named Foo)
|
||||
|
||||
.> view.patch
|
||||
|
||||
Edited Types: bar#568rsi7o3g -> Foo
|
||||
|
||||
Tip: To remove entries from a patch, use
|
||||
delete.term-replacement or delete.type-replacement, as
|
||||
appropriate.
|
||||
|
||||
.> delete.type-replacement bar
|
||||
|
||||
Done.
|
||||
|
||||
.> view.patch
|
||||
|
||||
Edited Types: bar#568rsi7o3g -> Foo
|
||||
|
||||
Tip: To remove entries from a patch, use
|
||||
delete.term-replacement or delete.type-replacement, as
|
||||
appropriate.
|
||||
|
||||
```
|
||||
|
@ -23,7 +23,7 @@ Technically, the definitions all exist, but they have no names. `builtins.merge`
|
||||
|
||||
.foo> ls
|
||||
|
||||
1. builtin/ (328 definitions)
|
||||
1. builtin/ (337 definitions)
|
||||
|
||||
```
|
||||
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/ (491 definitions)
|
||||
1. builtin/ (494 definitions)
|
||||
|
||||
```
|
||||
More typically, you'd start out by pulling `base.
|
||||
|
39
unison-src/transcripts/isPropagated-exists.md
Normal file
39
unison-src/transcripts/isPropagated-exists.md
Normal file
@ -0,0 +1,39 @@
|
||||
This transcript tests that UCM can always access the definition of
|
||||
`IsPropagated`/`isPropagated`, which is used internally.
|
||||
|
||||
```ucm:hide
|
||||
.> alias.term ##Nat.+ +
|
||||
.> alias.type ##Nat Nat
|
||||
```
|
||||
|
||||
`y` depends on `x`,
|
||||
```unison:hide
|
||||
x = 3
|
||||
y = x + 1
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
|
||||
so the `update` of `x` causes a propagated update of `y`, and UCM links the
|
||||
`isPropagated` metadata to such resulting terms:
|
||||
|
||||
```unison:hide
|
||||
x = 4
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
.> links y
|
||||
.> view 1
|
||||
```
|
||||
|
||||
Well, it's hard to tell from those hashes, but those are right. We can confirm
|
||||
by running `builtins.merge` to have UCM add names for them.
|
||||
|
||||
```ucm
|
||||
.> builtins.merge
|
||||
.> links y
|
||||
.> view 1
|
||||
```
|
66
unison-src/transcripts/isPropagated-exists.output.md
Normal file
66
unison-src/transcripts/isPropagated-exists.output.md
Normal file
@ -0,0 +1,66 @@
|
||||
This transcript tests that UCM can always access the definition of
|
||||
`IsPropagated`/`isPropagated`, which is used internally.
|
||||
|
||||
`y` depends on `x`,
|
||||
```unison
|
||||
x = 3
|
||||
y = x + 1
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
x : Nat
|
||||
y : Nat
|
||||
|
||||
```
|
||||
so the `update` of `x` causes a propagated update of `y`, and UCM links the
|
||||
`isPropagated` metadata to such resulting terms:
|
||||
|
||||
```unison
|
||||
x = 4
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
|
||||
⍟ I've updated these names to your new definition:
|
||||
|
||||
x : Nat
|
||||
|
||||
.> links y
|
||||
|
||||
1. #uqdd5t2fgn : #ffb7g9cull
|
||||
|
||||
Tip: Try using `display 1` to display the first result or
|
||||
`view 1` to view its source.
|
||||
|
||||
.> view 1
|
||||
|
||||
#uqdd5t2fgn : #ffb7g9cull
|
||||
#uqdd5t2fgn = #ffb7g9cull#0
|
||||
|
||||
```
|
||||
Well, it's hard to tell from those hashes, but those are right. We can confirm
|
||||
by running `builtins.merge` to have UCM add names for them.
|
||||
|
||||
```ucm
|
||||
.> builtins.merge
|
||||
|
||||
Done.
|
||||
|
||||
.> links y
|
||||
|
||||
1. builtin.metadata.isPropagated : IsPropagated
|
||||
|
||||
Tip: Try using `display 1` to display the first result or
|
||||
`view 1` to view its source.
|
||||
|
||||
.> view 1
|
||||
|
||||
builtin.metadata.isPropagated : IsPropagated
|
||||
builtin.metadata.isPropagated = IsPropagated
|
||||
|
||||
```
|
18
unison-src/transcripts/isTest-exists.md
Normal file
18
unison-src/transcripts/isTest-exists.md
Normal file
@ -0,0 +1,18 @@
|
||||
This transcript tests that UCM can always access the definition of
|
||||
`IsTest`/`isTest`, which is used internally.
|
||||
|
||||
```ucm
|
||||
.> builtins.merge
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
test> pass = [Ok "Passed"]
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
.> links pass
|
||||
.> display 1
|
||||
```
|
||||
|
||||
The definition and type of `isTest` should exist.
|
33
unison-src/transcripts/isTest-exists.output.md
Normal file
33
unison-src/transcripts/isTest-exists.output.md
Normal file
@ -0,0 +1,33 @@
|
||||
This transcript tests that UCM can always access the definition of
|
||||
`IsTest`/`isTest`, which is used internally.
|
||||
|
||||
```ucm
|
||||
.> builtins.merge
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
```unison
|
||||
test> pass = [Ok "Passed"]
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
pass : [Result]
|
||||
|
||||
.> links pass
|
||||
|
||||
1. builtin.metadata.isTest : IsTest
|
||||
|
||||
Tip: Try using `display 1` to display the first result or
|
||||
`view 1` to view its source.
|
||||
|
||||
.> display 1
|
||||
|
||||
IsTest
|
||||
|
||||
```
|
||||
The definition and type of `isTest should exist.
|
@ -112,13 +112,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.
|
||||
|
||||
⊙ #hdb2qmoob9
|
||||
⊙ #rq3jrbg57r
|
||||
|
||||
- Deletes:
|
||||
|
||||
feature1.y
|
||||
|
||||
⊙ #bg9tk5ai3i
|
||||
⊙ #64jmhloeht
|
||||
|
||||
+ Adds / updates:
|
||||
|
||||
@ -129,26 +129,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
|
||||
|
||||
⊙ #ak1kamiv9o
|
||||
⊙ #ncr9hv1q57
|
||||
|
||||
+ Adds / updates:
|
||||
|
||||
feature1.y
|
||||
|
||||
⊙ #o7jv334moc
|
||||
⊙ #bbcrond13i
|
||||
|
||||
> Moves:
|
||||
|
||||
Original name New name
|
||||
x master.x
|
||||
|
||||
⊙ #tab428em20
|
||||
⊙ #311k7aet5l
|
||||
|
||||
+ Adds / updates:
|
||||
|
||||
x
|
||||
|
||||
⊙ #s8vqfp4ot8
|
||||
⊙ #e3bhlpkn5h
|
||||
|
||||
+ Adds / updates:
|
||||
|
||||
@ -193,19 +193,22 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t
|
||||
builtin.Int.shiftRight builtin.Int.signum
|
||||
builtin.Int.toFloat builtin.Int.toText
|
||||
builtin.Int.trailingZeros builtin.Int.truncate0
|
||||
builtin.Int.xor builtin.Link builtin.Link.Term##Link.Term
|
||||
builtin.Link.Term#quh#0 builtin.Link.Type##Link.Type
|
||||
builtin.Link.Type#quh#1 builtin.List builtin.List.++
|
||||
builtin.List.+: builtin.List.:+ builtin.List.at
|
||||
builtin.List.cons builtin.List.drop builtin.List.empty
|
||||
builtin.List.size builtin.List.snoc builtin.List.take
|
||||
builtin.Nat builtin.Nat.* builtin.Nat.+ builtin.Nat./
|
||||
builtin.Nat.and builtin.Nat.complement builtin.Nat.drop
|
||||
builtin.Nat.eq builtin.Nat.fromText builtin.Nat.gt
|
||||
builtin.Nat.gteq builtin.Nat.increment builtin.Nat.isEven
|
||||
builtin.Nat.isOdd builtin.Nat.leadingZeros builtin.Nat.lt
|
||||
builtin.Nat.lteq builtin.Nat.mod builtin.Nat.or
|
||||
builtin.Nat.popCount builtin.Nat.pow builtin.Nat.shiftLeft
|
||||
builtin.Int.xor builtin.IsPropagated
|
||||
builtin.IsPropagated.IsPropagated builtin.IsTest
|
||||
builtin.IsTest.IsTest builtin.Link
|
||||
builtin.Link.Term##Link.Term builtin.Link.Term#quh#0
|
||||
builtin.Link.Type##Link.Type builtin.Link.Type#quh#1
|
||||
builtin.List builtin.List.++ builtin.List.+:
|
||||
builtin.List.:+ builtin.List.at builtin.List.cons
|
||||
builtin.List.drop builtin.List.empty builtin.List.size
|
||||
builtin.List.snoc builtin.List.take builtin.Nat
|
||||
builtin.Nat.* builtin.Nat.+ builtin.Nat./ builtin.Nat.and
|
||||
builtin.Nat.complement builtin.Nat.drop builtin.Nat.eq
|
||||
builtin.Nat.fromText builtin.Nat.gt builtin.Nat.gteq
|
||||
builtin.Nat.increment builtin.Nat.isEven builtin.Nat.isOdd
|
||||
builtin.Nat.leadingZeros builtin.Nat.lt builtin.Nat.lteq
|
||||
builtin.Nat.mod builtin.Nat.or builtin.Nat.popCount
|
||||
builtin.Nat.pow builtin.Nat.shiftLeft
|
||||
builtin.Nat.shiftRight builtin.Nat.sub builtin.Nat.toFloat
|
||||
builtin.Nat.toInt builtin.Nat.toText
|
||||
builtin.Nat.trailingZeros builtin.Nat.xor builtin.Optional
|
||||
@ -273,40 +276,44 @@ We can also delete the fork if we're done with it. (Don't worry, it's still in t
|
||||
builtin.io2.IOError.PermissionDenied
|
||||
builtin.io2.IOError.ResourceBusy
|
||||
builtin.io2.IOError.ResourceExhausted
|
||||
builtin.io2.IOError.UserError builtin.io2.MVar
|
||||
builtin.io2.MVar.isEmpty builtin.io2.MVar.new
|
||||
builtin.io2.MVar.newEmpty builtin.io2.MVar.put
|
||||
builtin.io2.MVar.read builtin.io2.MVar.swap
|
||||
builtin.io2.MVar.take builtin.io2.MVar.tryPut
|
||||
builtin.io2.MVar.tryRead builtin.io2.MVar.tryTake
|
||||
builtin.io2.STM builtin.io2.STM.atomically
|
||||
builtin.io2.STM.retry builtin.io2.SeekMode
|
||||
builtin.io2.SeekMode.AbsoluteSeek
|
||||
builtin.io2.IOError.UserError
|
||||
builtin.io2.IOFailure##IOFailure builtin.io2.IOFailure#gro
|
||||
builtin.io2.MVar builtin.io2.MVar.isEmpty
|
||||
builtin.io2.MVar.new builtin.io2.MVar.newEmpty
|
||||
builtin.io2.MVar.put builtin.io2.MVar.read
|
||||
builtin.io2.MVar.swap builtin.io2.MVar.take
|
||||
builtin.io2.MVar.tryPut builtin.io2.MVar.tryRead
|
||||
builtin.io2.MVar.tryTake builtin.io2.STM
|
||||
builtin.io2.STM.atomically builtin.io2.STM.retry
|
||||
builtin.io2.SeekMode builtin.io2.SeekMode.AbsoluteSeek
|
||||
builtin.io2.SeekMode.RelativeSeek
|
||||
builtin.io2.SeekMode.SeekFromEnd builtin.io2.Socket
|
||||
builtin.io2.StdHandle builtin.io2.StdHandle.StdErr
|
||||
builtin.io2.StdHandle.StdIn builtin.io2.StdHandle.StdOut
|
||||
builtin.io2.TVar builtin.io2.TVar.new
|
||||
builtin.io2.TVar.newIO builtin.io2.TVar.read
|
||||
builtin.io2.TVar.readIO builtin.io2.TVar.swap
|
||||
builtin.io2.TVar.write builtin.io2.ThreadId
|
||||
builtin.io2.Tls builtin.io2.Tls.ClientConfig
|
||||
builtin.io2.TLS.ClientConfig.ciphers.set builtin.io2.TVar
|
||||
builtin.io2.TVar.new builtin.io2.TVar.newIO
|
||||
builtin.io2.TVar.read builtin.io2.TVar.readIO
|
||||
builtin.io2.TVar.swap builtin.io2.TVar.write
|
||||
builtin.io2.ThreadId builtin.io2.Tls
|
||||
builtin.io2.Tls.ClientConfig
|
||||
builtin.io2.Tls.ClientConfig.certificates.set
|
||||
builtin.io2.Tls.ClientConfig.default
|
||||
builtin.io2.Tls.ClientConfig.versions.set
|
||||
builtin.io2.Tls.PrivateKey builtin.io2.Tls.ServerConfig
|
||||
builtin.io2.Tls.ServerConfig.certificates.set
|
||||
builtin.io2.Tls.ServerConfig.ciphers.set
|
||||
builtin.io2.Tls.ServerConfig.default
|
||||
builtin.io2.Tls.ServerConfig.versions.set
|
||||
builtin.io2.Tls.SignedCert builtin.io2.Tls.decodeCert
|
||||
builtin.io2.Tls.decodePrivateKey
|
||||
builtin.io2.Tls.encodeCert
|
||||
builtin.io2.Tls.encodePrivateKey builtin.io2.Tls.handshake
|
||||
builtin.io2.Tls.newClient builtin.io2.Tls.newServer
|
||||
builtin.io2.Tls.receive builtin.io2.Tls.send
|
||||
builtin.io2.Tls.terminate builtin.io2.TlsFailure
|
||||
builtin.io2.tls.ClientConfig.ciphers.set
|
||||
builtin.io2.tls.ClientConfig.versions.set
|
||||
builtin.io2.tls.ServerConfig.ciphers.set
|
||||
builtin.io2.tls.ServerConfig.versions.set builtin.todo
|
||||
builtin.io2.Tls.terminate
|
||||
builtin.io2.TlsFailure##TlsFailure
|
||||
builtin.io2.TlsFailure#o6b builtin.metadata.isPropagated
|
||||
builtin.metadata.isTest builtin.todo
|
||||
|
||||
□ #7asfbtqmoj (start of history)
|
||||
|
||||
|
@ -37,13 +37,13 @@ And then we add it.
|
||||
|
||||
.subpath> find.verbose
|
||||
|
||||
1. -- #qae64o6am81hoadf7eabd909gojboi5iu3g9deip79ro18f11bbhir2vg51grg4m72kr5ikdovi6aupttet0nsqil7f0df9nqr10hqg
|
||||
1. -- #v4a90flt15t54qnjbvbdtj42ouqo8dktu5da8g6q30l4frc6l81ttjtov42r1nbj5jq3hh98snlb64tkbb1mc5dk8les96v71b4qr6g
|
||||
unique type Foo
|
||||
|
||||
2. -- #qae64o6am81hoadf7eabd909gojboi5iu3g9deip79ro18f11bbhir2vg51grg4m72kr5ikdovi6aupttet0nsqil7f0df9nqr10hqg#0
|
||||
2. -- #v4a90flt15t54qnjbvbdtj42ouqo8dktu5da8g6q30l4frc6l81ttjtov42r1nbj5jq3hh98snlb64tkbb1mc5dk8les96v71b4qr6g#0
|
||||
Foo.Foo : Foo
|
||||
|
||||
3. -- #hvtmbg1bd8of81n2os4ginnnen13njh47294uandlohooq0ej971u6tl5cdsfq237lec1tc007oajc4dee1fmnflqi6ogom3ecemu5g
|
||||
3. -- #31g7t8qcmqqdtpe4bdo1591egqh1q0ltnt69u345gdrdur0n8flfu1ohpjasauc9k81msvi2a4q4b03tp1018sac9esd8d3qmbq4b2g
|
||||
fooToInt : Foo -> Int
|
||||
|
||||
|
||||
@ -187,9 +187,9 @@ Cleaning up a bit...
|
||||
Removed definitions:
|
||||
|
||||
1. unique type Foo
|
||||
2. Foo.Bar : #16d2id848g
|
||||
3. Foo.Foo : #16d2id848g
|
||||
4. fooToInt : #16d2id848g -> Int
|
||||
2. Foo.Bar : #i2nv821v0u
|
||||
3. Foo.Foo : #i2nv821v0u
|
||||
4. fooToInt : #i2nv821v0u -> Int
|
||||
5. preserve.otherTerm : Optional baz -> Optional baz
|
||||
6. preserve.someTerm : Optional x -> Optional x
|
||||
7. patch patch
|
||||
|
@ -59,16 +59,16 @@ y = 2
|
||||
most recent, along with the command that got us there. Try:
|
||||
|
||||
`fork 2 .old`
|
||||
`fork #c2isrgss72 .old` to make an old namespace
|
||||
`fork #90u1kgvkts .old` to make an old namespace
|
||||
accessible again,
|
||||
|
||||
`reset-root #c2isrgss72` to reset the root namespace and
|
||||
`reset-root #90u1kgvkts` to reset the root namespace and
|
||||
its history to that of the
|
||||
specified namespace.
|
||||
|
||||
1. #2a6716f77m : add
|
||||
2. #c2isrgss72 : add
|
||||
3. #s8vqfp4ot8 : builtins.merge
|
||||
1. #q752mbqfhn : add
|
||||
2. #90u1kgvkts : add
|
||||
3. #e3bhlpkn5h : builtins.merge
|
||||
4. #7asfbtqmoj : (initial reflogged namespace)
|
||||
|
||||
```
|
||||
|
@ -13,7 +13,7 @@ Let's look at some examples. We'll start with a namespace with just the builtins
|
||||
|
||||
|
||||
|
||||
□ #dkeu9bg399 (start of history)
|
||||
□ #1jd6dhvs8p (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.
|
||||
|
||||
⊙ #gieeiaclmr
|
||||
⊙ #878lsss0qo
|
||||
|
||||
> Moves:
|
||||
|
||||
Original name New name
|
||||
Nat.frobnicate Nat.+
|
||||
|
||||
⊙ #8oolo648l6
|
||||
⊙ #brr50llg52
|
||||
|
||||
> Moves:
|
||||
|
||||
Original name New name
|
||||
Nat.+ Nat.frobnicate
|
||||
|
||||
□ #dkeu9bg399 (start of history)
|
||||
□ #1jd6dhvs8p (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.
|
||||
|
||||
⊙ #gieeiaclmr
|
||||
⊙ #878lsss0qo
|
||||
|
||||
> Moves:
|
||||
|
||||
Original name New name
|
||||
Nat.frobnicate Nat.+
|
||||
|
||||
⊙ #8oolo648l6
|
||||
⊙ #brr50llg52
|
||||
|
||||
> Moves:
|
||||
|
||||
Original name New name
|
||||
Nat.+ Nat.frobnicate
|
||||
|
||||
□ #dkeu9bg399 (start of history)
|
||||
□ #1jd6dhvs8p (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
|
||||
|
||||
|
||||
|
||||
□ #dkeu9bg399 (start of history)
|
||||
□ #1jd6dhvs8p (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.
|
||||
|
Loading…
Reference in New Issue
Block a user