diff --git a/src/core/ambience-core.scala b/src/core/ambience-core.scala index 9423948..66bcbde 100644 --- a/src/core/ambience-core.scala +++ b/src/core/ambience-core.scala @@ -23,9 +23,9 @@ import contingency.* //import language.experimental.captureChecking package workingDirectories: - given virtualMachine(using Errant[SystemPropertyError], SystemProperties): WorkingDirectory = () => + given virtualMachine(using Tactic[SystemPropertyError], SystemProperties): WorkingDirectory = () => Properties.user.dir[Text]() package homeDirectories: - given virtualMachine(using Errant[SystemPropertyError], SystemProperties): HomeDirectory = () => + given virtualMachine(using Tactic[SystemPropertyError], SystemProperties): HomeDirectory = () => Properties.user.home[Text]() diff --git a/src/core/envvars.scala b/src/core/envvars.scala index 5f90d70..d8c5c80 100644 --- a/src/core/envvars.scala +++ b/src/core/envvars.scala @@ -38,19 +38,19 @@ object Environment extends Dynamic: def apply[VariableType](variable: Text) (using environment: Environment, reader: EnvironmentVariable[Label, VariableType], - environmentError: Errant[EnvironmentError]) + environmentError: Tactic[EnvironmentError]) : VariableType^{environment, reader, environmentError} = - environment.variable(variable).let(reader.read).or(raise(EnvironmentError(variable))(reader.read(Text("")))) + environment.variable(variable).let(reader.read).or(raise(EnvironmentError(variable), reader.read(Text("")))) inline def selectDynamic[VariableType](key: String) (using environment: Environment, reader: EnvironmentVariable[key.type, VariableType], - environmentError: Errant[EnvironmentError]) + environmentError: Tactic[EnvironmentError]) : VariableType^{environment, reader, environmentError} = environment.variable(reader.defaultName).let(reader.read(_)).or: - raise(EnvironmentError(reader.defaultName))(reader.read(Text(""))) + raise(EnvironmentError(reader.defaultName), reader.read(Text(""))) @capability trait EnvironmentVariable[AliasType <: Label, +VariableType] extends Pure: @@ -113,7 +113,7 @@ object EnvironmentVariable extends EnvironmentVariable2: given [PathType: SpecificPath] => EnvironmentVariable["editor", PathType] as editor = SpecificPath(_) given [PathType: SpecificPath] => EnvironmentVariable["pager", PathType] as pager = SpecificPath(_) - given (using Errant[NumberError]) => EnvironmentVariable["sshAgentPid", Pid] as sshAgentPid = + given (using Tactic[NumberError]) => EnvironmentVariable["sshAgentPid", Pid] as sshAgentPid = text => Pid(text.decodeAs[Int]) given sshAuthSock[PathType: SpecificPath]: EnvironmentVariable["sshAuthSock", PathType] = SpecificPath(_) diff --git a/src/core/properties.scala b/src/core/properties.scala index 010c0dc..0488f61 100644 --- a/src/core/properties.scala +++ b/src/core/properties.scala @@ -39,7 +39,7 @@ object Properties extends Dynamic: def apply[PropertyType](property: Text) (using properties: SystemProperties, reader: SystemProperty[String, PropertyType], - systemProperty: Errant[SystemPropertyError]) + systemProperty: Tactic[SystemPropertyError]) : PropertyType^{properties, reader, systemProperty} = properties(property).let(reader.read).or(abort(SystemPropertyError(property))) @@ -57,13 +57,13 @@ object SystemProperty: given javaHome[PathType: SpecificPath]: SystemProperty["java.home", PathType] = SpecificPath(_) given javaLibraryPath[PathType: SpecificPath] - (using systemProperties: SystemProperties, systemProperty: Errant[SystemPropertyError]) + (using systemProperties: SystemProperties, systemProperty: Tactic[SystemPropertyError]) : SystemProperty["java.library.path", List[PathType]] = _.cut(systemProperties(t"path.separator").or(t":")).to(List).map(SpecificPath(_)) given javaClassPath[PathType: SpecificPath] - (using systemProperties: SystemProperties, systemProperty: Errant[SystemPropertyError]) + (using systemProperties: SystemProperties, systemProperty: Tactic[SystemPropertyError]) : SystemProperty["java.class.path", List[PathType]] = _.cut(systemProperties(t"path.separator").or(t":")).to(List).map(SpecificPath(_)) @@ -72,7 +72,7 @@ object SystemProperty: given javaRuntimeVersion: SystemProperty["java.runtime.version", Text] = identity(_) given javaExtDirs[PathType: SpecificPath] - (using systemProperties: SystemProperties, systemProperty: Errant[SystemPropertyError]) + (using systemProperties: SystemProperties, systemProperty: Tactic[SystemPropertyError]) : SystemProperty["java.ext.dirs", List[PathType]] = _.cut(systemProperties(t"path.separator").or(t":")).to(List).map(SpecificPath(_)) @@ -101,7 +101,7 @@ case class PropertyAccess[NameType <: String](property: String) extends Dynamic: def applyDynamic[PropertyType](key: String)() (using properties: SystemProperties, reader: SystemProperty[NameType+"."+key.type, PropertyType], - systemProperty: Errant[SystemPropertyError]) + systemProperty: Tactic[SystemPropertyError]) : PropertyType^{properties, reader, systemProperty} = properties((property+"."+key).tt).let(reader.read(_)).or: @@ -110,7 +110,7 @@ case class PropertyAccess[NameType <: String](property: String) extends Dynamic: inline def apply[PropertyType]() (using properties: SystemProperties, reader: SystemProperty[NameType, PropertyType], - systemProperty: Errant[SystemPropertyError]) + systemProperty: Tactic[SystemPropertyError]) : PropertyType^{properties, reader, systemProperty} = properties(valueOf[NameType].tt).let(reader.read(_)).or: