[Haskell-cafe] Vague: Assembly line process

Bas van Dijk v.dijk.bas at gmail.com
Tue Jun 15 15:26:48 EDT 2010

On Tue, Jun 15, 2010 at 7:23 PM, Martin Drautzburg
<Martin.Drautzburg at web.de> wrote:
> When I know my supplies I want to know what I can produce. When I know what I
> want to produce I want to know what supplies I need for that. Both kinds of
> questions should be answered by a singe Process thingy.

Your Process thingy reminds me of a natural isomorphism:

data Iso a b = Iso { ab :: a -> b
                   , ba :: b -> a

> I want to be able to chain processes and the whole thing should still act like
> a Process.

These isomorphisms can be chained together using the standard Category
method '.':

import qualified Control.Category as C

instance C.Category Iso where
   id = Iso id id
   Iso bc cb . Iso ab ba = Iso (bc . ab) (ba . cb)

More information about the Haskell-Cafe mailing list