[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Invertible functions list

Subject: Re: [Haskell-cafe] Invertible functions list
From: Antoine Latter
Date: Mon, 28 Dec 2009 22:43:08 -0500
On Mon, Dec 28, 2009 at 10:32 PM, Jonathan Fischoff
<[email protected]> wrote:
> 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?

It looks like the thrist package should help you out:

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/thrist

You could define some sort of type Iso:

data Iso a b = Iso (a -> b) (b -> a)

And then build a Thrist and fold over it, the functions forward and
backwards can both be implemented with right-folds.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>