Questa non è una risposta, ma non si adatta ad un commento.
Anche io volevo una funzionalità simile. Ho il sospetto che il tipo interno sarà simile a questa:
-- The same `FreeF` type from the `free` package in `Control.Monad.Trans.Free`
data FreeF f a x = Pure a | Free (f x)
newtype FreeP f p a' a b' b m r
= FreeP { unFreeP ::
p a'
(FreeF f a (FreeP f p a' a b' b m r))
b'
(FreeF f b (FreeP f p a' a b' b m r))
m
(FreeF f r (FreeP f p a' a b' b m r)) }
Inoltre, potrebbe non essere possibile con le macchine attualmente esistente, ma che va bene. Ad esempio, consultare il trasformatore proxy StateP
, che si basa su thread_P
da ProxyInternal
. Un analogo simile a thread_P
potrebbe essere necessario per implementare FreeP
.
fonte
2013-05-16 18:05:56