Given a functor (or any type constructor) f, we can get a "version" of that functor that does not contain a value of its argument. We just define newtype NoArg f = NoArg (f Void). For example:
NoArg []is just the empty list.NoArg Maybeis just Nothing.NoArg (Either e)is juste.NoArg (Identity)isVoid.NoArg IOis an IO action that produces effects forever (like a server).Functor f => NoArg (Free f)isFix f.- etc...
My question is if we can do the opposite, and create a type of the constructors of a Functor that does use its argument. Formally, Arg :: (* -> *) -> (* -> *) should be such that there is a term forall a. Arg f a -> a or equivalently Arg f Void -> Void. For example:
Arg [] ais the type of non empty lists of typea.Arg Maybe ais justa.Arg (Either e) ais justa.Arg Identity ais justa.Arg IO ayou would think is IO actions that produce a result. This probably will not be the case though since you there is no function fromIO atoa, or evenMaybe athat isn'tconst Nothing.Functor f => Arg (Free f) aisFree (Arg f) a.- etc...
I'm thinking Arg f would be some sort of "supremum" of the functors g that embed in f such that there exists a term Argful g :: g Void -> Void.
EDIT: I guess the true test would be for Arg [] a to be isomorphic to NomEmpty a, where
data NonEmpty a = One a | Cons a (NonEmpty a)