Bluefin naming: "handle" or "capability"?

Bluefin represents effects at the value level. Should I call these value level parameters “handles” (their current name) or “capabilities” (a name for a similar concept used elsewhere in programming laguage design)?


My effect system Bluefin works by passing the ability to perform effects at the value level rather than at the type level (via constraints) which is the more common pattern. For example, to run IO actions in a Bluefin operation you use IOE and pass it into your operation like this

-- Bluefin
fooBf :: e <: es => IOE e -> Eff es r

This contrasts with effectful and mtl style, where you would use a constraint:

-- effectful
fooEf :: IOE :> es => Eff es r

-- mtl
fooMt :: MonadIO m => m r

On the other hand, passing state at the value level already has prior art in Haskell: ST:

-- ST
stateSt :: STRef Int s -> ST s r

-- Bluefin
stateBf :: e <: es => State Int e -> Eff es r


-- effectful
stateEf :: State Int :> es => Eff es r

-- mtl
stateMt :: MonadState Int m => m r

Since the concept of passing these things at value level is essential to Bluefin I’d like to use the clearest name. Currently I call them handles because that is the name used for “file handles” and in “the handle pattern”. But that name is pretty generic and perhaps it doesn’t communicate precisely enough. There is another name for this concept, “capability”. I believe it is generally used in a security context, as in “capability-based security”, but the concept itself is broader.


Does anyone have any opinions on whether “handle” or “capability” communicates this concept more clearly? If “capability” has strong support then I’ll change the nomenclature in Bluefin.

2 Likes

I quite like capability when referring to the effect system members and handles when talking about the what the function requires to provide the effect.

Reading the type signature for fooBf, I read it as:

"fooBf is a computation in which capability e is a member of the capabilities es and it takes a handle to an IOE effects over capability e which it will use to produce an Effect and a return value from the es effect sytem of type r.”

EDIT: IOE e and fooBF does not use other effects in es. The effect is locked to whatever IOE effects e can effect in es.

3 Likes

“capability” conveys the right idea to me. It’s less generic.

Simon

3 Likes

I like “capabilities”. But I come from infosec and may be biased :smile:

2 Likes

To me “capability” somehow suggests singleton-ness. Whereas “handle” suggests that I could have several similar handles to different things. It seems more natural to me to say “I have two State handles in scope” versus “I have two State capabilities in scope”.

5 Likes