We can define the continuation monad transformer as
data Cont r m a = Cont {run :: (a -> m r) -> m r}
We can give Cont r m an Alternative instance if m is a member of Alternative via
empty = Cont $ \f -> empty
ca <|> cb = Cont $ \f -> run ca f <|> run cb f
And then allow some and many to take on their default methods. My question is, can we define some and many in terms of m's some and many, instead of the default definitions? The apparently obvious options
some ca = Cont $ \f -> some $ run ca f
many ca = Cont $ \f -> many $ run ca f
obviously do not work (they do not even type check). Is there some other way to use them (if we need m to also be a monad, that's fine)?
For reference, some and many must be the least solution to the equations:
some v = (:) <$> v <*> many vmany v = some v <|> pure []
Assuming that some :: m a -> m [a] and many :: m a -> [a] satisfy this law, so should some :: Cont r m a -> Cont r m [a] and many :: Cont r m a -> Cont r m [a].