Arrows that are also Functors
twhitehead at gmail.com
Wed Apr 20 05:48:54 CEST 2011
On April 19, 2011 23:22:12 Tyson Whitehead wrote:
> ArrowLoop from MonadFix
> loop' f = fst' .' loop'' (f .' arr' (second snd))
> where loop'' f = mfix (\y -> f .' arr' (,y))
BTW haskellers, I've been wondering if mfix would better be defined as
mfix' :: (m a -> m a) -> m a
where "mfix' f = mfix (f . pure)" for the computational monads. The advantage
being you can give a useful definition for structural monads as well.
I was also wondering if there is a way to specify something like
... => (forall a. Applicative f a) => ...
where I'm trying to express that the dictionary must be valid for all a.
In the GHC documentation under point (1) of section 7.8.2
it seems to suggest the answer is no. The reason gives is because we never
get to know what a is.
That is the whole point though. I want to be limited to only instances like
instance Applicative (a ->) where
f <*> x = \u -> f u (x u)
(the reader Monad and the Hask Arrow) that are valid for all a.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 490 bytes
Desc: This is a digitally signed message part.
More information about the Libraries