
Do you need to be able to extract the intermediate types?
If not, then the only observable value for your function list is the
composition (forward/backward), and you can easily represent it like
this:
data Inv a b = Inv { forward :: (a -> b), backward :: (b -> a) }
nil :: Inv a a
nll = Inv id id
cat :: Inv a b -> Inv b c -> Inv a c
cat ab bc = Inv (forward bc . forward ab) (backward ab . backward bc)
reverse :: Inv a b -> Inv b a
reverse ab = Inv (backward ab) (forward ab)
-- ryan
On Mon, Dec 28, 2009 at 8:32 PM, Jonathan Fischoff
Hi, I would to create a list of tuples (or something similar) of invertible functions [((a -> b), (b -> a)), ((b -> c), (c -> b)), .... Such that I could call forward invertibleFuctionList domainValue = ? -- composite all the functions backward invertibleFuctionList rangeValue = forward (reverse invertibleFuctionList) rangeValue -- or something similar
I would also like to concat them. This sounds like a job for GADT that someone might have already tackled. Any ideas? -Jonathan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe