You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Imported from JIRA. Reported by Tim Watson [Administrator] @hyperthunk) as DPP-55 on 2013-01-12 18:03:03]
Trying to unify the APIs for AsyncChan and AsyncSTM in d-p-platform. I've thought about doing this with type (or data) families but ... we need to handle AsyncChan a or AsyncSTM a so...
this isn't quite what I want, as the types cannot be inferred properly. And I couldn't quite figure out whether declaring data AsyncHandle a in the type class and having the instance as data AsyncHandle (STM.AsyncSTM a) = HStm (STM.AsyncSTM a) was the right approach either, but of course you can't leave a gap in the type signature without telling the compiler what the relation is between the two:
instanceAsync (STM.AsyncSTMa) wheredataAsyncHandle (STM.AsyncSTMa) =HStm (STM.AsyncSTMa)
poll (HStmh) =STM.pollh-- illegal because we don't know that the `a` in the associated type is related to the `a` in the instance declaration.
I wondered about functional dependencies here, but couldn't see how to apply them. Anyhow, I realise this is probably a pretty basic question, but I don't see a neat way to handle it. Should I just live with having the two APIs without a common method of interchanging between them? At the moment, for the most part all you need to do to switch from AsyncChan to AsyncSTM is change your imports.
The text was updated successfully, but these errors were encountered:
[Imported from JIRA. Reported by Tim Watson [Administrator] @hyperthunk) as DPP-55 on 2013-01-12 18:03:03]
Trying to unify the APIs for AsyncChan and AsyncSTM in d-p-platform. I've thought about doing this with type (or data) families but ... we need to handle
AsyncChan a
orAsyncSTM a
so...but ...
this isn't quite what I want, as the types cannot be inferred properly. And I couldn't quite figure out whether declaring
data AsyncHandle a
in the type class and having the instance asdata AsyncHandle (STM.AsyncSTM a) = HStm (STM.AsyncSTM a)
was the right approach either, but of course you can't leave a gap in the type signature without telling the compiler what the relation is between the two:I wondered about functional dependencies here, but couldn't see how to apply them. Anyhow, I realise this is probably a pretty basic question, but I don't see a neat way to handle it. Should I just live with having the two APIs without a common method of interchanging between them? At the moment, for the most part all you need to do to switch from
AsyncChan
toAsyncSTM
is change your imports.The text was updated successfully, but these errors were encountered: