propensive / guillotine

Making the execution of system processes easier in Scala

Home Page:https://propensive.com/guillotine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Associate default return types for different shell commands

propensive opened this issue · comments

A shell process may be defined as, for example, sh"echo foo" and is currently typed as Command,
but could be given a singleton type parameter as Command["echo"] since the command is known
statically.

A contextual typeclass instance could then associate the result of any "echo" command with the
return type, String (or a different type for other commands), such that the String in
exec[String]() could be inferred.

I think this requires changes to Contextual to allow the return type to be more specific.

This should be achievable by calling the Contextual macro from another macro, which refines the return type.