Arrows that are also Functors

Tyson Whitehead 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

http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/other-type-
extensions.html

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.

Cheers!  -Tyson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110419/8f19c243/attachment.pgp>


More information about the Libraries mailing list