Closed ivenmarquardt closed 3 years ago
Unfortunately, existentials have an impact on unification. I not gonna open Pandora's Box again. With scriptum we'll have to resort to higher-rank types to overcome this shortcomming:
const Coyoneda = type1("(^b, r. ((b => a) => f<b> => r) => r) => Coyoneda<f, a>")
Existentials are incredible useful. For instance, they allow the composition of a non-deterministic list of functions. I reckon there is no other way than to open Pandora's Box and extend the unification algorithm. This will take at least a week. Here we go.
Subsumed under #346
This will allow the following type:
const Coyoneda = type1("^b. (b => a) => f<b> => Coyoneda<f, a>")
.Prerequisit for this feature is that it only affects the
type1
newtype constructor. Since there is no pattern matching for newtypes in scriptum there shouldn't be a problem. For more information read existentials in GHC.Record types are another context where existential types make a lot of sense but scriptum won't support existential record types for the time being.