purescript/purescript-profunctor

Add Loop

paf31 opened this issue · 3 comments

Suggested:

class (Category a, Strong a) <= Loop a where
  loop :: forall b c d. a (Tuple b d) (Tuple c d) -> a b c

with laws (cribbed from https://hackage.haskell.org/package/base-4.7.0.2/docs/Control-Arrow.html#t:ArrowLoop):

loop (f <<< first h) = loop f <<< h
loop (f >>> first h) = loop f >>> h

.. and the rest which I haven't figured out yet (TODO).

Does ArrowLoop depend on Haskell's lazy evaluation? It seems that Halogen's loop relies on an initial state.

Does Costrong cover this? unfirst is loop anyway, but there's also unsecond.

I think it possibly does. I don't fully understand the intent of Costrong yet, so I'm not sure.