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
I'm trying to write a small library to make it easier to create types that are existentially quantified. I'm using the idea of a type interface F<A> { foo : a, ext : exists E. E } (pseudocode) can be implemented as interface Fe<A,E> { foo : a, ext : E } and type F<A> = <R>(cont : <E>(x : Fe<A,E>) => R) => R. My current implementation can be found here: https://github.com/theNerd247/tsfreeapp/blob/master/existential.ts
liftExt compiles just fine. However mapExt which is supposed to make lifting functions that modify the underlying containers of existentially quantified types easier. However I get the following compiler error and I'm not sure where to start on fixing this any ideas?
existential.ts:34:3 - error TS2322: Type 'Existential2<"Either", unknown>' is not assignable to type 'Existential<F>'.
Types of property 'runExt' are incompatible.
Type '<R>(cont: <E>(t: Either<unknown, E>) => R) => R' is not assignable to type '<R>(cont: <E>(t: Kind<F, E>) => R) => R'.
Types of parameters 'cont' and 'cont' are incompatible.
Types of parameters 't' and 't' are incompatible.
Type 'Either<unknown, E>' is not assignable to type 'Kind<F, unknown>'.
Type 'Left<unknown>' is not assignable to type 'Kind<F, unknown>'.
34 return liftExt(x.runExt(f))
~~~~~~~~~~~~~~~~~~~~~~~~~~~
existential.ts:34:27 - error TS2345: Argument of type '<E>(a: Kind<F, E>) => Kind<F, E>' is not assignable to parameter of type '<E>(t: Kind<F, E>) => Kind<F, unknown>'.
Type 'Kind<F, E>' is not assignable to type 'Kind<F, unknown>'.
Type 'URItoKind<E>[F]' is not assignable to type 'URItoKind<unknown>[F]'.
Type 'URItoKind<E>' is not assignable to type 'URItoKind<unknown>'.
Types of property 'Eq' are incompatible.
Type 'Eq<E>' is not assignable to type 'Eq<unknown>'.
Type 'unknown' is not assignable to type 'E'.
Type 'URItoKind<E>[F]' is not assignable to type '(Eq<unknown> & Ord<unknown> & None) | (Eq<unknown> & Ord<unknown> & Some<unknown>)'.
Type 'None | Eq<E> | Ord<E> | Some<E>' is not assignable to type '(Eq<unknown> & Ord<unknown> & None) | (Eq<unknown> & Ord<unknown> & Some<unknown>)'.
Type 'None' is not assignable to type '(Eq<unknown> & Ord<unknown> & None) | (Eq<unknown> & Ord<unknown> & Some<unknown>)'.
Type 'None' is not assignable to type 'Eq<unknown> & Ord<unknown> & None'.
Type 'None' is not assignable to type 'Eq<unknown>'.
Type 'URItoKind<E>[F]' is not assignable to type 'Eq<unknown> & Ord<unknown> & Some<unknown>'.
Type 'None | Eq<E> | Ord<E> | Some<E>' is not assignable to type 'Eq<unknown> & Ord<unknown> & Some<unknown>'.
Type 'None' is not assignable to type 'Eq<unknown> & Ord<unknown> & Some<unknown>'.
Property 'equals' is missing in type 'None' but required in type 'Eq<unknown>'.
Type 'URItoKind<E>[F]' is not assignable to type 'Eq<unknown>'.
Type 'None | Eq<E> | Ord<E> | Some<E>' is not assignable to type 'Eq<unknown>'.
Property 'equals' is missing in type 'None' but required in type 'Eq<unknown>'.
34 return liftExt(x.runExt(f))
The text was updated successfully, but these errors were encountered:
I'm trying to write a small library to make it easier to create types that are existentially quantified. I'm using the idea of a type
interface F<A> { foo : a, ext : exists E. E }
(pseudocode) can be implemented asinterface Fe<A,E> { foo : a, ext : E }
andtype F<A> = <R>(cont : <E>(x : Fe<A,E>) => R) => R
. My current implementation can be found here: https://github.com/theNerd247/tsfreeapp/blob/master/existential.tsliftExt
compiles just fine. HowevermapExt
which is supposed to make lifting functions that modify the underlying containers of existentially quantified types easier. However I get the following compiler error and I'm not sure where to start on fixing this any ideas?The text was updated successfully, but these errors were encountered: