purescript / purescript-profunctor

Profunctor type classes and data structures
BSD 3-Clause "New" or "Revised" License
33 stars 13 forks source link

Add Loop #2

Closed paf31 closed 4 years ago

paf31 commented 9 years ago

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).

DavidHarrison commented 9 years ago

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

garyb commented 8 years ago

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

paf31 commented 8 years ago

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