Is there any binder in haskell to introduce a type variable (and constraints) quantified in a type ?
I can add an extra argument, but it defeats the purpose.
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
data Exists x = forall m. Monad m => Exists (m x)
convBad :: x -> Exists x
convBad x = Exists @m (return @m x, undefined) --Not in scope: type variable ‘m’typecheck
data Proxy (m:: * -> *) where Proxy :: Proxy m
convOk :: Monad m => x -> Proxy m -> Exists x
convOk x (_ :: Proxy m) = Exists (return @m x)