Question. Is there any way to make this code without an explicit type signature?
the code. First, I have a class of more practical alternatives MonadTrans, inspired by Data.Newtype. It looks like this:
{-# LANGUAGE FlexibleContexts, TypeFamilies #-}
module Alt.Control.Monad.Trans where
import Control.Monad
class (Monad 𝔪, Monad (BaseMonad 𝔪)) => MonadTrans (𝔪 :: * -> *) where
type BaseMonad 𝔪 :: * -> *
lift :: (BaseMonad 𝔪) α -> 𝔪 α
Then I have a class Awith a method foo, and if some kind of base monad Mis A, then any converted monad is T Malso A. In code
class A 𝔪 where
foo :: String -> 𝔪 ()
instance (A (BaseMonad 𝔪), MonadTrans 𝔪) => A 𝔪 where
foo n = lift $ foo n
However, if now I want to create a shortcut for foowith the first argument replaced, I need an explicit type signature or an overflow of the compiler context stack.
minimize_call :: A 𝔪 => 𝔪 ()
minimize_call = foo "minimize"
, . , B :: * -> *. , , B B t /= t, B (B t) /= B t .., . . B - "" - newtype, newtype , A .