I have a type T (which, if you're interested, is a wrapper for static pointers that I studied here ), where I can happily write the following operations for:
unpointT :: T a -> a apT :: T (a -> b) -> T a -> T b bindT :: T a -> (a -> T b) -> T b
The problem is that I do not have an unlimited pure function. pure should be limited in my case to some restriction that says the type is serializable, like Binary .
pureT :: C a => a -> T a
Please note that both apT and bindT are unlimited.
It all looks like a monad, but with the only problem, which is limited purity. Is there anyway, possibly with some GADT wrapping / unwrapping, that I can get this to work with the standard Monad hierarchy?
If not, is there an alternative hierarchy that restricts pure but preserves <*> and >>= unlimited?
Note also that T a may be valid for some a , although pure (x :: a) not, for example, by combining T (b -> a) and T b with ap .
source share